Passed
Pull Request — master (#228)
by Viruthagiri
10:20
created
geodirectory-functions/ajax_handler_functions.php 3 patches
Braces   +34 added lines, -25 removed lines patch added patch discarded remove patch
@@ -126,10 +126,11 @@  discard block
 block discarded – undo
126 126
     }
127 127
 
128 128
     if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
129
+        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) {
130
+                    geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
+        } else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) {
132
+                    geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
+        }
133 134
     }
134 135
 
135 136
     if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
@@ -151,22 +152,25 @@  discard block
 block discarded – undo
151 152
         if (current_user_can('manage_options')) {
152 153
             switch ($_REQUEST['geodir_autofill']):
153 154
                 case "geodir_dummy_delete" :
154
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
-                        return;
155
+                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) {
156
+                                            return;
157
+                    }
156 158
 
157
-                    if (isset($_REQUEST['posttype']))
158
-                        /**
159
+                    if (isset($_REQUEST['posttype'])) {
160
+                                            /**
159 161
                          * Used to delete the dummy post data per post type.
160 162
                          *
161 163
                          * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162 164
                          *
163 165
                          * @since 1.0.0
164 166
                          */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
167
+                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
168
+                    }
166 169
                     break;
167 170
                 case "geodir_dummy_insert" :
168
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
-                        return;
171
+                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) {
172
+                                            return;
173
+                    }
170 174
 
171 175
                     global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172 176
                     $dummy_post_index = $_REQUEST['insert_dummy_post_index'];
@@ -175,15 +179,16 @@  discard block
 block discarded – undo
175 179
                     $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176 180
                     $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177 181
 
178
-                    if (isset($_REQUEST['posttype']))
179
-                        /**
182
+                    if (isset($_REQUEST['posttype'])) {
183
+                                            /**
180 184
                          * Used to insert the dummy post data per post type.
181 185
                          *
182 186
                          * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183 187
                          *
184 188
                          * @since 1.0.0
185 189
                          */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
190
+                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
191
+                    }
187 192
 
188 193
                     break;
189 194
             endswitch;
@@ -204,8 +209,9 @@  discard block
 block discarded – undo
204 209
 
205 210
     if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
206 211
 
207
-        if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend')
208
-            require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php');
212
+        if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
213
+                    require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php');
214
+        }
209 215
 
210 216
         exit;
211 217
     }
@@ -266,8 +272,9 @@  discard block
 block discarded – undo
266 272
                         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
267 273
                             $redirect_to = get_permalink(geodir_add_listing_page_id());
268 274
                             $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
269
-                        } else
270
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
275
+                        } else {
276
+                                                    $redirect_to = get_permalink(geodir_add_listing_page_id());
277
+                        }
271 278
 
272 279
                         wp_redirect($redirect_to);
273 280
                     } else {
@@ -280,9 +287,9 @@  discard block
 block discarded – undo
280 287
 
281 288
                     $gd_session->un_set('listing');
282 289
 
283
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
284
-                        wp_redirect(get_permalink($_REQUEST['pid']));
285
-                    else {
290
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) {
291
+                                            wp_redirect(get_permalink($_REQUEST['pid']));
292
+                    } else {
286 293
                         geodir_remove_temp_images();
287 294
                         wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
288 295
                     }
@@ -310,8 +317,9 @@  discard block
 block discarded – undo
310 317
                             } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
311 318
                                 $redirect_to = get_permalink(geodir_add_listing_page_id());
312 319
                                 $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
313
-                            } else
314
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
320
+                            } else {
321
+                                                            $redirect_to = get_permalink(geodir_add_listing_page_id());
322
+                            }
315 323
 
316 324
                             $gd_session->un_set('listing');
317 325
                             wp_redirect($redirect_to);
@@ -333,8 +341,9 @@  discard block
 block discarded – undo
333 341
                             $lastid = wp_delete_post($_REQUEST['pid']);
334 342
                         }
335 343
 
336
-                        if ($lastid && !is_wp_error($lastid))
337
-                            wp_redirect($_SERVER['HTTP_REFERER']);
344
+                        if ($lastid && !is_wp_error($lastid)) {
345
+                                                    wp_redirect($_SERVER['HTTP_REFERER']);
346
+                        }
338 347
 
339 348
                         //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
340 349
                     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
47
+    if (geodir_is_page('login')) {
48 48
         geodir_user_signup();
49 49
     }
50 50
 
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
         if (is_user_logged_in()) {
229 229
             switch ($_REQUEST['ajax_action']):
230 230
                 case "add" :
231
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
231
+                    geodir_add_to_favorite((int) $_REQUEST['pid']);
232 232
                     break;
233 233
                 case "remove" :
234
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
234
+                    geodir_remove_from_favorite((int) $_REQUEST['pid']);
235 235
                     break;
236 236
             endswitch;
237 237
         } else {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
         $is_current_user_owner = true;
246 246
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
247
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
247
+            $is_current_user_owner = geodir_listing_belong_to_current_user((int) $_REQUEST['pid']);
248 248
         }
249 249
 
250 250
         $request = $gd_session->get('listing');
Please login to merge, or discard this patch.
Indentation   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Functions that are called via ajax.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Functions that are called via ajax.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 
10 10
 /**
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_on_wp_loaded()
18 18
 {
19
-    /**
20
-     * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
-     *
22
-     * @since 1.0.0
23
-     */
24
-    do_action('giodir_handle_request_plugins_loaded');
25
-    global $wpdb;
19
+	/**
20
+	 * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
+	 *
22
+	 * @since 1.0.0
23
+	 */
24
+	do_action('giodir_handle_request_plugins_loaded');
25
+	global $wpdb;
26 26
 
27 27
 
28
-    if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
-        geodir_send_inquiry($_REQUEST); // function in custom_functions.php
28
+	if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
+		geodir_send_inquiry($_REQUEST); // function in custom_functions.php
30 30
 
31
-    } elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
-        geodir_send_friend($_REQUEST); // function in custom_functions.php
31
+	} elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
+		geodir_send_friend($_REQUEST); // function in custom_functions.php
33 33
 
34
-    }
34
+	}
35 35
 
36 36
 }
37 37
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
48
-        geodir_user_signup();
49
-    }
47
+	if(geodir_is_page('login')) {
48
+		geodir_user_signup();
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,47 +59,47 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function geodir_on_init()
61 61
 {
62
-    /**
63
-     * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
-     *
65
-     * @since 1.0.0
66
-     */
67
-    do_action('giodir_handle_request');
68
-    global $wpdb;
69
-
70
-
71
-
72
-
73
-    if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options')) {
74
-        show_admin_bar(false);
75
-    }
76
-
77
-
78
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
-        /**
80
-         * Contains map marker functions.
81
-         *
82
-         * @since 1.0.0
83
-         * @package GeoDirectory
84
-         */
85
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
-        die;
87
-    }
88
-
89
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') {
90
-        if (isset($_REQUEST['ga_start'])) {
91
-            $ga_start = $_REQUEST['ga_start'];
92
-        } else {
93
-            $ga_start = '';
94
-        }
95
-        if (isset($_REQUEST['ga_end'])) {
96
-            $ga_end = $_REQUEST['ga_end'];
97
-        } else {
98
-            $ga_end = '';
99
-        }
100
-        geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
101
-        die;
102
-    }
62
+	/**
63
+	 * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
+	 *
65
+	 * @since 1.0.0
66
+	 */
67
+	do_action('giodir_handle_request');
68
+	global $wpdb;
69
+
70
+
71
+
72
+
73
+	if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options')) {
74
+		show_admin_bar(false);
75
+	}
76
+
77
+
78
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
+		/**
80
+		 * Contains map marker functions.
81
+		 *
82
+		 * @since 1.0.0
83
+		 * @package GeoDirectory
84
+		 */
85
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
+		die;
87
+	}
88
+
89
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') {
90
+		if (isset($_REQUEST['ga_start'])) {
91
+			$ga_start = $_REQUEST['ga_start'];
92
+		} else {
93
+			$ga_start = '';
94
+		}
95
+		if (isset($_REQUEST['ga_end'])) {
96
+			$ga_end = $_REQUEST['ga_end'];
97
+		} else {
98
+			$ga_end = '';
99
+		}
100
+		geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
101
+		die;
102
+	}
103 103
 
104 104
 
105 105
 }
@@ -118,241 +118,241 @@  discard block
 block discarded – undo
118 118
  * @todo check if nonce is required here and if so add one.
119 119
  */
120 120
 function geodir_ajax_handler() {
121
-    global $wpdb, $gd_session;
121
+	global $wpdb, $gd_session;
122 122
 
123
-    if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
123
+	if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
124 124
 		$gd_session->set('gd_listing_view', $_REQUEST['gd_listing_view']);
125
-        echo '1';
126
-    }
127
-
128
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
-    }
134
-
135
-    if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
136
-        if (current_user_can('manage_options')) {
137
-            /**
138
-             * Contains admin ajax handling functions.
139
-             *
140
-             * @since 1.0.0
141
-             * @package GeoDirectory
142
-             */
143
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
144
-        } else {
145
-            wp_redirect(geodir_login_url());
146
-            exit();
147
-        }
148
-    }
149
-
150
-    if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
151
-        if (current_user_can('manage_options')) {
152
-            switch ($_REQUEST['geodir_autofill']):
153
-                case "geodir_dummy_delete" :
154
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
-                        return;
156
-
157
-                    if (isset($_REQUEST['posttype']))
158
-                        /**
159
-                         * Used to delete the dummy post data per post type.
160
-                         *
161
-                         * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162
-                         *
163
-                         * @since 1.0.0
164
-                         */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
166
-                    break;
167
-                case "geodir_dummy_insert" :
168
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
-                        return;
170
-
171
-                    global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172
-                    $dummy_post_index = $_REQUEST['insert_dummy_post_index'];
173
-                    $city_bound_lat1 = $_REQUEST['city_bound_lat1'];
174
-                    $city_bound_lng1 = $_REQUEST['city_bound_lng1'];
175
-                    $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176
-                    $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177
-
178
-                    if (isset($_REQUEST['posttype']))
179
-                        /**
180
-                         * Used to insert the dummy post data per post type.
181
-                         *
182
-                         * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183
-                         *
184
-                         * @since 1.0.0
185
-                         */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
187
-
188
-                    break;
189
-            endswitch;
190
-        } else {
191
-            wp_redirect(geodir_login_url());
192
-            exit();
193
-        }
194
-    }
195
-
196
-    if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
197
-
198
-        if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend')
199
-            require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php');
200
-
201
-        exit;
202
-    }
203
-
204
-    /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
125
+		echo '1';
126
+	}
127
+
128
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
+		if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
+			geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
+		else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
+			geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
+	}
134
+
135
+	if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
136
+		if (current_user_can('manage_options')) {
137
+			/**
138
+			 * Contains admin ajax handling functions.
139
+			 *
140
+			 * @since 1.0.0
141
+			 * @package GeoDirectory
142
+			 */
143
+			include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
144
+		} else {
145
+			wp_redirect(geodir_login_url());
146
+			exit();
147
+		}
148
+	}
149
+
150
+	if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
151
+		if (current_user_can('manage_options')) {
152
+			switch ($_REQUEST['geodir_autofill']):
153
+				case "geodir_dummy_delete" :
154
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
+						return;
156
+
157
+					if (isset($_REQUEST['posttype']))
158
+						/**
159
+						 * Used to delete the dummy post data per post type.
160
+						 *
161
+						 * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162
+						 *
163
+						 * @since 1.0.0
164
+						 */
165
+						do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
166
+					break;
167
+				case "geodir_dummy_insert" :
168
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
+						return;
170
+
171
+					global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172
+					$dummy_post_index = $_REQUEST['insert_dummy_post_index'];
173
+					$city_bound_lat1 = $_REQUEST['city_bound_lat1'];
174
+					$city_bound_lng1 = $_REQUEST['city_bound_lng1'];
175
+					$city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176
+					$city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177
+
178
+					if (isset($_REQUEST['posttype']))
179
+						/**
180
+						 * Used to insert the dummy post data per post type.
181
+						 *
182
+						 * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183
+						 *
184
+						 * @since 1.0.0
185
+						 */
186
+						do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
187
+
188
+					break;
189
+			endswitch;
190
+		} else {
191
+			wp_redirect(geodir_login_url());
192
+			exit();
193
+		}
194
+	}
195
+
196
+	if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
197
+
198
+		if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend')
199
+			require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php');
200
+
201
+		exit;
202
+	}
203
+
204
+	/*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
205 205
         include_once ( geodir_plugin_path() . '/geodirectory-templates/advance-search-form.php');
206 206
     }*/
207 207
 
208
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
209
-        /**
210
-         * Contains map marker functions.
211
-         *
212
-         * @since 1.0.0
213
-         * @package GeoDirectory
214
-         */
215
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
216
-    }
217
-
218
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
219
-        if (is_user_logged_in()) {
220
-            switch ($_REQUEST['ajax_action']):
221
-                case "add" :
222
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
223
-                    break;
224
-                case "remove" :
225
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
226
-                    break;
227
-            endswitch;
228
-        } else {
229
-            wp_redirect(geodir_login_url());
230
-            exit();
231
-        }
232
-    }
233
-
234
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
235
-
236
-        $is_current_user_owner = true;
237
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
238
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
239
-        }
240
-
241
-        $request = $gd_session->get('listing');
242
-
243
-        if (is_user_logged_in() && $is_current_user_owner) {
244
-
245
-            switch ($_REQUEST['ajax_action']):
246
-                case "add":
247
-                case "update":
248
-
249
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
250
-                        $last_id = geodir_save_listing();
251
-
252
-                        if ($last_id) {
253
-                            //$redirect_to = get_permalink( $last_id );
254
-                            $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
255
-
256
-                        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
257
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
258
-                            $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
259
-                        } else
260
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
261
-
262
-                        wp_redirect($redirect_to);
263
-                    } else {
264
-                        $gd_session->un_set('listing');
265
-                        wp_redirect(home_url());
266
-                    }
267
-
268
-                    break;
269
-                case "cancel" :
270
-
271
-                    $gd_session->un_set('listing');
272
-
273
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
274
-                        wp_redirect(get_permalink($_REQUEST['pid']));
275
-                    else {
276
-                        geodir_remove_temp_images();
277
-                        wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
278
-                    }
279
-
280
-                    break;
281
-
282
-                case "publish" :
283
-
284
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
285
-
286
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
287
-                            $new_post = array();
288
-                            $new_post['ID'] = $_REQUEST['pid'];
289
-
290
-                            $lastid = wp_update_post($new_post);
291
-
292
-                            $gd_session->un_set('listing');
293
-                            wp_redirect(get_permalink($lastid));
294
-                        } else {
295
-                            $last_id = geodir_save_listing();
296
-
297
-                            if ($last_id) {
298
-                                //$redirect_to = get_permalink( $last_id );
299
-                                $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
300
-                            } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
301
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
302
-                                $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
303
-                            } else
304
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
305
-
306
-                            $gd_session->un_set('listing');
307
-                            wp_redirect($redirect_to);
308
-                        }
309
-                    } else {
310
-                        $gd_session->un_set('listing');
311
-                        wp_redirect(home_url());
312
-                    }
313
-
314
-                    break;
315
-                case "delete" :
316
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
317
-                        global $current_user;
318
-                        get_currentuserinfo();
319
-
320
-                        if (get_option('geodir_disable_perm_delete')) {
321
-                            $lastid = wp_trash_post($_REQUEST['pid']);
322
-                        } else {
323
-                            $lastid = wp_delete_post($_REQUEST['pid']);
324
-                        }
325
-
326
-                        if ($lastid && !is_wp_error($lastid))
327
-                            wp_redirect($_SERVER['HTTP_REFERER']);
328
-
329
-                        //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
330
-                    }
331
-                    break;
332
-            endswitch;
333
-
334
-            $gd_session->un_set('listing');
335
-        } else {
336
-            $gd_session->un_set('listing');
337
-            wp_redirect(geodir_login_url());
338
-            exit();
339
-        }
340
-    }
341
-
342
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
343
-        /**
344
-         * Contains registration and login functions.
345
-         * @todo Fix the file path.
346
-         *
347
-         * @since 1.0.0
348
-         * @package GeoDirectory
349
-         */
350
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
351
-    }
352
-
353
-
354
-    if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
355
-        $terms_o = get_terms(sanitize_text_field($_REQUEST['term']));
208
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
209
+		/**
210
+		 * Contains map marker functions.
211
+		 *
212
+		 * @since 1.0.0
213
+		 * @package GeoDirectory
214
+		 */
215
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
216
+	}
217
+
218
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
219
+		if (is_user_logged_in()) {
220
+			switch ($_REQUEST['ajax_action']):
221
+				case "add" :
222
+					geodir_add_to_favorite((int)$_REQUEST['pid']);
223
+					break;
224
+				case "remove" :
225
+					geodir_remove_from_favorite((int)$_REQUEST['pid']);
226
+					break;
227
+			endswitch;
228
+		} else {
229
+			wp_redirect(geodir_login_url());
230
+			exit();
231
+		}
232
+	}
233
+
234
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
235
+
236
+		$is_current_user_owner = true;
237
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
238
+			$is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
239
+		}
240
+
241
+		$request = $gd_session->get('listing');
242
+
243
+		if (is_user_logged_in() && $is_current_user_owner) {
244
+
245
+			switch ($_REQUEST['ajax_action']):
246
+				case "add":
247
+				case "update":
248
+
249
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
250
+						$last_id = geodir_save_listing();
251
+
252
+						if ($last_id) {
253
+							//$redirect_to = get_permalink( $last_id );
254
+							$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
255
+
256
+						} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
257
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
258
+							$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
259
+						} else
260
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
261
+
262
+						wp_redirect($redirect_to);
263
+					} else {
264
+						$gd_session->un_set('listing');
265
+						wp_redirect(home_url());
266
+					}
267
+
268
+					break;
269
+				case "cancel" :
270
+
271
+					$gd_session->un_set('listing');
272
+
273
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
274
+						wp_redirect(get_permalink($_REQUEST['pid']));
275
+					else {
276
+						geodir_remove_temp_images();
277
+						wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
278
+					}
279
+
280
+					break;
281
+
282
+				case "publish" :
283
+
284
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
285
+
286
+						if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
287
+							$new_post = array();
288
+							$new_post['ID'] = $_REQUEST['pid'];
289
+
290
+							$lastid = wp_update_post($new_post);
291
+
292
+							$gd_session->un_set('listing');
293
+							wp_redirect(get_permalink($lastid));
294
+						} else {
295
+							$last_id = geodir_save_listing();
296
+
297
+							if ($last_id) {
298
+								//$redirect_to = get_permalink( $last_id );
299
+								$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
300
+							} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
301
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
302
+								$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
303
+							} else
304
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
305
+
306
+							$gd_session->un_set('listing');
307
+							wp_redirect($redirect_to);
308
+						}
309
+					} else {
310
+						$gd_session->un_set('listing');
311
+						wp_redirect(home_url());
312
+					}
313
+
314
+					break;
315
+				case "delete" :
316
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
317
+						global $current_user;
318
+						get_currentuserinfo();
319
+
320
+						if (get_option('geodir_disable_perm_delete')) {
321
+							$lastid = wp_trash_post($_REQUEST['pid']);
322
+						} else {
323
+							$lastid = wp_delete_post($_REQUEST['pid']);
324
+						}
325
+
326
+						if ($lastid && !is_wp_error($lastid))
327
+							wp_redirect($_SERVER['HTTP_REFERER']);
328
+
329
+						//wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
330
+					}
331
+					break;
332
+			endswitch;
333
+
334
+			$gd_session->un_set('listing');
335
+		} else {
336
+			$gd_session->un_set('listing');
337
+			wp_redirect(geodir_login_url());
338
+			exit();
339
+		}
340
+	}
341
+
342
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
343
+		/**
344
+		 * Contains registration and login functions.
345
+		 * @todo Fix the file path.
346
+		 *
347
+		 * @since 1.0.0
348
+		 * @package GeoDirectory
349
+		 */
350
+		include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
351
+	}
352
+
353
+
354
+	if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
355
+		$terms_o = get_terms(sanitize_text_field($_REQUEST['term']));
356 356
 		
357 357
 		// Skip terms which has no listing
358 358
 		if (!empty($terms_o)) {
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
 			$terms_o = $filter_terms;
367 367
 		}
368 368
 		
369
-        $terms = geodir_sort_terms($terms_o, 'count');
370
-        geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
371
-        exit();
369
+		$terms = geodir_sort_terms($terms_o, 'count');
370
+		geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
371
+		exit();
372 372
 
373
-    }
373
+	}
374 374
 
375
-    gd_die();
375
+	gd_die();
376 376
 }
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/cat_meta.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
      */
25 25
 
26 26
     $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
27
+        'id' => 'demo_meta_box', // meta box id, unique per meta box
28
+        'title' => __('Demo Meta Box', 'geodirectory'), // meta box title
29
+        'pages' => geodir_get_taxonomies(), // taxonomy name, accept categories, post_tag and custom taxonomies
30
+        'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
31
+        'fields' => array(), // list of meta fields (can be added by field arrays)
32
+        'local_images' => false, // Use local or hosted images (meta box images for add/remove)
33 33
         'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34 34
     );
35 35
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-        apply_filters('geodir_cat_schemas',array(
52
+        apply_filters('geodir_cat_schemas', array(
53 53
             '' => __('Default (LocalBusiness)', 'geodirectory'),
54 54
             'AccountingService' => 'AccountingService',
55 55
             'Attorney' => 'Attorney',
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 
215 215
             $file_info = pathinfo($term_icon_url['src']);
216 216
 
217
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..')
217
+            if (isset($file_info['dirname']) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..')
218 218
                 $sub_dir = $file_info['dirname'];
219
-            else{$sub_dir = '';}
219
+            else {$sub_dir = ''; }
220 220
 
221 221
             $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
222 222
             $uploads_baseurl = $uploads['baseurl'];
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
                             jQuery("#addtag iframe").contents().find("body").html('');
269 269
                             jQuery('#addtag [rel="ct_cat_default_img"]').removeClass('at-delete_image_button').addClass('at-upload_image_button');
270 270
                             jQuery('#addtag [rel="ct_cat_icon"]').removeClass('at-delete_image_button').addClass('at-upload_image_button');
271
-                            jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image','geodirectory');?>');
272
-                            jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image','geodirectory');?>');
271
+                            jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image', 'geodirectory'); ?>');
272
+                            jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image', 'geodirectory'); ?>');
273 273
                         }
274 274
                     }, 1000);
275 275
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -12 removed lines patch added patch discarded remove patch
@@ -204,8 +204,9 @@  discard block
 block discarded – undo
204 204
 #############################################################
205 205
 function manage_category_custom_fields($deprecated, $column_name, $term_id)
206 206
 {
207
-    if ($column_name == 'cat_ID_num')
208
-        echo $term_id;
207
+    if ($column_name == 'cat_ID_num') {
208
+            echo $term_id;
209
+    }
209 210
 
210 211
     if ($column_name == 'cat_icon') {
211 212
         $term_icon_url = get_tax_meta($term_id, 'ct_cat_icon');
@@ -214,9 +215,9 @@  discard block
 block discarded – undo
214 215
 
215 216
             $file_info = pathinfo($term_icon_url['src']);
216 217
 
217
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..')
218
-                $sub_dir = $file_info['dirname'];
219
-            else{$sub_dir = '';}
218
+            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
219
+                            $sub_dir = $file_info['dirname'];
220
+            } else{$sub_dir = '';}
220 221
 
221 222
             $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
222 223
             $uploads_baseurl = $uploads['baseurl'];
@@ -236,8 +237,9 @@  discard block
 block discarded – undo
236 237
 
237 238
     if ($column_name == 'cat_default_img') {
238 239
         $cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img');
239
-        if ($cat_default_img != '')
240
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
240
+        if ($cat_default_img != '') {
241
+                    echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
242
+        }
241 243
 
242 244
     }
243 245
 }
@@ -245,11 +247,12 @@  discard block
 block discarded – undo
245 247
 function geodir_get_default_catimage($term_id, $post_type = 'gd_place')
246 248
 {
247 249
 
248
-    if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
249
-        return $cat_default_img;
250
-    else
251
-        return false;
252
-}
250
+    if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) {
251
+            return $cat_default_img;
252
+    } else {
253
+            return false;
254
+    }
255
+    }
253 256
 
254 257
 //Clear custom fields
255 258
 add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field');
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -11,139 +11,139 @@  discard block
 block discarded – undo
11 11
 //include the main class file
12 12
 require_once("Tax-meta-class.php");
13 13
 if (is_admin()) {
14
-    /*
14
+	/*
15 15
      * prefix of meta keys, optional
16 16
      * use underscore (_) at the beginning to make keys hidden, for example $prefix = '_ba_';
17 17
      *  you also can make prefix empty to disable it
18 18
      *
19 19
      */
20 20
 
21
-    $prefix = 'ct_';
22
-    /*
21
+	$prefix = 'ct_';
22
+	/*
23 23
      * configure your meta box
24 24
      */
25 25
 
26
-    $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
-        'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
-    );
26
+	$config = array(
27
+		'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
+		'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
+		'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
+		'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
+		'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
+		'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
+		'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
+	);
35 35
 
36 36
 
37
-    /*
37
+	/*
38 38
      * Initiate your meta box
39 39
      */
40
-    $my_meta = new Tax_Meta_Class($config);
41
-    $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
-    $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
-    $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
-    /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45
-
46
-    $my_meta->addSelect($prefix . 'cat_schema',
47
-    /*
40
+	$my_meta = new Tax_Meta_Class($config);
41
+	$my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
+	$my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
+	$my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
+	/*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45
+
46
+	$my_meta->addSelect($prefix . 'cat_schema',
47
+	/*
48 48
      * Allows you to add/filter the cat schema types.
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-        apply_filters('geodir_cat_schemas',array(
53
-            '' => __('Default (LocalBusiness)', 'geodirectory'),
54
-            'AccountingService' => 'AccountingService',
55
-            'Attorney' => 'Attorney',
56
-            'AutoBodyShop' => 'AutoBodyShop',
57
-            'AutoDealer' => 'AutoDealer',
58
-            'AutoPartsStore' => 'AutoPartsStore',
59
-            'AutoRental' => 'AutoRental',
60
-            'AutoRepair' => 'AutoRepair',
61
-            'AutoWash' => 'AutoWash',
62
-            'Bakery' => 'Bakery',
63
-            'BarOrPub' => 'BarOrPub',
64
-            'BeautySalon' => 'BeautySalon',
65
-            'BedAndBreakfast' => 'BedAndBreakfast',
66
-            'BikeStore' => 'BikeStore',
67
-            'BookStore' => 'BookStore',
68
-            'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
-            'ChildCare' => 'ChildCare',
70
-            'ClothingStore' => 'ClothingStore',
71
-            'ComputerStore' => 'ComputerStore',
72
-            'DaySpa' => 'DaySpa',
73
-            'Dentist' => 'Dentist',
74
-            'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
75
-            'Electrician' => 'Electrician',
76
-            'ElectronicsStore' => 'ElectronicsStore',
77
-            'EmergencyService' => 'EmergencyService',
78
-            'EntertainmentBusiness' => 'EntertainmentBusiness',
79
-            'Event' => 'Event',
80
-            'EventVenue' => 'EventVenue',
81
-            'ExerciseGym' => 'ExerciseGym',
82
-            'FinancialService' => 'FinancialService',
83
-            'Florist' => 'Florist',
84
-            'FoodEstablishment' => 'FoodEstablishment',
85
-            'FurnitureStore' => 'FurnitureStore',
86
-            'GardenStore' => 'GardenStore',
87
-            'GeneralContractor' => 'GeneralContractor',
88
-            'GolfCourse' => 'GolfCourse',
89
-            'HairSalon' => 'HairSalon',
90
-            'HardwareStore' => 'HardwareStore',
91
-            'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
92
-            'HobbyShop' => 'HobbyShop',
93
-            'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
94
-            'HomeGoodsStore' => 'HomeGoodsStore',
95
-            'Hospital' => 'Hospital',
96
-            'Hotel' => 'Hotel',
97
-            'HousePainter' => 'HousePainter',
98
-            'HVACBusiness' => 'HVACBusiness',
99
-            'InsuranceAgency' => 'InsuranceAgency',
100
-            'JewelryStore' => 'JewelryStore',
101
-            'LiquorStore' => 'LiquorStore',
102
-            'Locksmith' => 'Locksmith',
103
-            'LodgingBusiness' => 'LodgingBusiness',
104
-            'MedicalClinic' => 'MedicalClinic',
105
-            'MensClothingStore' => 'MensClothingStore',
106
-            'MobilePhoneStore' => 'MobilePhoneStore',
107
-            'Motel' => 'Motel',
108
-            'MotorcycleDealer' => 'MotorcycleDealer',
109
-            'MotorcycleRepair' => 'MotorcycleRepair',
110
-            'MovingCompany' => 'MovingCompany',
111
-            'MusicStore' => 'MusicStore',
112
-            'NailSalon' => 'NailSalon',
113
-            'NightClub' => 'NightClub',
114
-            'Notary' => 'Notary',
115
-            'OfficeEquipmentStore' => 'OfficeEquipmentStore',
116
-            'Optician' => 'Optician',
117
-            'PetStore' => 'PetStore',
118
-            'Physician' => 'Physician',
119
-            'Plumber' => 'Plumber',
120
-            'ProfessionalService' => 'ProfessionalService',
121
-            'RealEstateAgent' => 'RealEstateAgent',
122
-            'Residence' => 'Residence',
123
-            'Restaurant' => 'Restaurant',
124
-            'RoofingContractor' => 'RoofingContractor',
125
-            'RVPark' => 'RVPark',
126
-            'School' => 'School',
127
-            'SelfStorage' => 'SelfStorage',
128
-            'ShoeStore' => 'ShoeStore',
129
-            'SkiResort' => 'SkiResort',
130
-            'SportingGoodsStore' => 'SportingGoodsStore',
131
-            'SportsClub' => 'SportsClub',
132
-            'Store' => 'Store',
133
-            'TattooParlor' => 'TattooParlor',
134
-            'Taxi' => 'Taxi',
135
-            'TennisComplex' => 'TennisComplex',
136
-            'TireShop' => 'TireShop',
137
-            'TouristAttraction' => 'TouristAttraction',
138
-            'ToyStore' => 'ToyStore',
139
-            'TravelAgency' => 'TravelAgency',
140
-            'VeterinaryCare' => 'VeterinaryCare',
141
-            'WholesaleStore' => 'WholesaleStore',
142
-            'Winery' => 'Winery'
143
-        )),
144
-        array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
145
-
146
-    /*$my_meta->addSelect($prefix.'cat_sort',array(''=>__('Default' , 'geodirectory'),
52
+		apply_filters('geodir_cat_schemas',array(
53
+			'' => __('Default (LocalBusiness)', 'geodirectory'),
54
+			'AccountingService' => 'AccountingService',
55
+			'Attorney' => 'Attorney',
56
+			'AutoBodyShop' => 'AutoBodyShop',
57
+			'AutoDealer' => 'AutoDealer',
58
+			'AutoPartsStore' => 'AutoPartsStore',
59
+			'AutoRental' => 'AutoRental',
60
+			'AutoRepair' => 'AutoRepair',
61
+			'AutoWash' => 'AutoWash',
62
+			'Bakery' => 'Bakery',
63
+			'BarOrPub' => 'BarOrPub',
64
+			'BeautySalon' => 'BeautySalon',
65
+			'BedAndBreakfast' => 'BedAndBreakfast',
66
+			'BikeStore' => 'BikeStore',
67
+			'BookStore' => 'BookStore',
68
+			'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
+			'ChildCare' => 'ChildCare',
70
+			'ClothingStore' => 'ClothingStore',
71
+			'ComputerStore' => 'ComputerStore',
72
+			'DaySpa' => 'DaySpa',
73
+			'Dentist' => 'Dentist',
74
+			'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
75
+			'Electrician' => 'Electrician',
76
+			'ElectronicsStore' => 'ElectronicsStore',
77
+			'EmergencyService' => 'EmergencyService',
78
+			'EntertainmentBusiness' => 'EntertainmentBusiness',
79
+			'Event' => 'Event',
80
+			'EventVenue' => 'EventVenue',
81
+			'ExerciseGym' => 'ExerciseGym',
82
+			'FinancialService' => 'FinancialService',
83
+			'Florist' => 'Florist',
84
+			'FoodEstablishment' => 'FoodEstablishment',
85
+			'FurnitureStore' => 'FurnitureStore',
86
+			'GardenStore' => 'GardenStore',
87
+			'GeneralContractor' => 'GeneralContractor',
88
+			'GolfCourse' => 'GolfCourse',
89
+			'HairSalon' => 'HairSalon',
90
+			'HardwareStore' => 'HardwareStore',
91
+			'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
92
+			'HobbyShop' => 'HobbyShop',
93
+			'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
94
+			'HomeGoodsStore' => 'HomeGoodsStore',
95
+			'Hospital' => 'Hospital',
96
+			'Hotel' => 'Hotel',
97
+			'HousePainter' => 'HousePainter',
98
+			'HVACBusiness' => 'HVACBusiness',
99
+			'InsuranceAgency' => 'InsuranceAgency',
100
+			'JewelryStore' => 'JewelryStore',
101
+			'LiquorStore' => 'LiquorStore',
102
+			'Locksmith' => 'Locksmith',
103
+			'LodgingBusiness' => 'LodgingBusiness',
104
+			'MedicalClinic' => 'MedicalClinic',
105
+			'MensClothingStore' => 'MensClothingStore',
106
+			'MobilePhoneStore' => 'MobilePhoneStore',
107
+			'Motel' => 'Motel',
108
+			'MotorcycleDealer' => 'MotorcycleDealer',
109
+			'MotorcycleRepair' => 'MotorcycleRepair',
110
+			'MovingCompany' => 'MovingCompany',
111
+			'MusicStore' => 'MusicStore',
112
+			'NailSalon' => 'NailSalon',
113
+			'NightClub' => 'NightClub',
114
+			'Notary' => 'Notary',
115
+			'OfficeEquipmentStore' => 'OfficeEquipmentStore',
116
+			'Optician' => 'Optician',
117
+			'PetStore' => 'PetStore',
118
+			'Physician' => 'Physician',
119
+			'Plumber' => 'Plumber',
120
+			'ProfessionalService' => 'ProfessionalService',
121
+			'RealEstateAgent' => 'RealEstateAgent',
122
+			'Residence' => 'Residence',
123
+			'Restaurant' => 'Restaurant',
124
+			'RoofingContractor' => 'RoofingContractor',
125
+			'RVPark' => 'RVPark',
126
+			'School' => 'School',
127
+			'SelfStorage' => 'SelfStorage',
128
+			'ShoeStore' => 'ShoeStore',
129
+			'SkiResort' => 'SkiResort',
130
+			'SportingGoodsStore' => 'SportingGoodsStore',
131
+			'SportsClub' => 'SportsClub',
132
+			'Store' => 'Store',
133
+			'TattooParlor' => 'TattooParlor',
134
+			'Taxi' => 'Taxi',
135
+			'TennisComplex' => 'TennisComplex',
136
+			'TireShop' => 'TireShop',
137
+			'TouristAttraction' => 'TouristAttraction',
138
+			'ToyStore' => 'ToyStore',
139
+			'TravelAgency' => 'TravelAgency',
140
+			'VeterinaryCare' => 'VeterinaryCare',
141
+			'WholesaleStore' => 'WholesaleStore',
142
+			'Winery' => 'Winery'
143
+		)),
144
+		array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
145
+
146
+	/*$my_meta->addSelect($prefix.'cat_sort',array(''=>__('Default' , 'geodirectory'),
147 147
     'random'=>__('Random','geodirectory'),
148 148
     'az'=>__('Alphabetical' , 'geodirectory'),
149 149
     'newest'=>__('Newest','geodirectory'),
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
     'low_review'=>__('Lowest Reviews','geodirectory')),
155 155
     array('name'=> __('Sort By','geodirectory'),'desc' => __('Select the default sort option.' ,'geodirectory'), 'std'=> array('selectkey2')));*/
156 156
 
157
-    // Show options for placecategories only
158
-    /*	if(isset($_REQUEST['taxonomy']) && in_array($_REQUEST['taxonomy'],$config['pages']) ){
157
+	// Show options for placecategories only
158
+	/*	if(isset($_REQUEST['taxonomy']) && in_array($_REQUEST['taxonomy'],$config['pages']) ){
159 159
         // Exclude sort options
160 160
         $my_meta->addCheckbox($prefix.'cat_exclude_rating',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory')));
161 161
         $my_meta->addCheckbox($prefix.'cat_exclude_reviews',array('name'=> __('<b>Exclude</b> Reviews sort option','geodirectory')));
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 
168 168
         }*/
169 169
 
170
-    //Finish Meta Box Decleration
171
-    $my_meta->Finish();
170
+	//Finish Meta Box Decleration
171
+	$my_meta->Finish();
172 172
 }
173 173
 
174 174
 
@@ -177,86 +177,86 @@  discard block
 block discarded – undo
177 177
 ##############################################################
178 178
 $gd_taxonomies = geodir_get_taxonomies();
179 179
 if (!empty($gd_taxonomies)) {
180
-    foreach ($gd_taxonomies as $gd_taxonomy) {
180
+	foreach ($gd_taxonomies as $gd_taxonomy) {
181 181
 
182
-        add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
183
-        add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
182
+		add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
183
+		add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
184 184
 
185
-    }
185
+	}
186 186
 }
187 187
 
188 188
 function addCat_column($columns)
189 189
 {
190
-    // only edit the columns on the current taxonomy
191
-    /*if ( !isset($_GET['taxonomy']) && !in_array($_GET['taxonomy'],geodir_get_taxonomies()) )
190
+	// only edit the columns on the current taxonomy
191
+	/*if ( !isset($_GET['taxonomy']) && !in_array($_GET['taxonomy'],geodir_get_taxonomies()) )
192 192
     return $columns;
193 193
     */
194
-    if ($posts = $columns['description']) {
195
-        unset($columns['description']);
196
-    }
197
-
198
-    $columns['cat_icon'] = 'Icon';
199
-    $columns['cat_default_img'] = __('Default Image', 'geodirectory');
200
-    $columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
201
-    return $columns;
194
+	if ($posts = $columns['description']) {
195
+		unset($columns['description']);
196
+	}
197
+
198
+	$columns['cat_icon'] = 'Icon';
199
+	$columns['cat_default_img'] = __('Default Image', 'geodirectory');
200
+	$columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
201
+	return $columns;
202 202
 }
203 203
 
204 204
 #############################################################
205 205
 function manage_category_custom_fields($deprecated, $column_name, $term_id)
206 206
 {
207
-    if ($column_name == 'cat_ID_num')
208
-        echo $term_id;
207
+	if ($column_name == 'cat_ID_num')
208
+		echo $term_id;
209 209
 
210
-    if ($column_name == 'cat_icon') {
211
-        $term_icon_url = get_tax_meta($term_id, 'ct_cat_icon');
210
+	if ($column_name == 'cat_icon') {
211
+		$term_icon_url = get_tax_meta($term_id, 'ct_cat_icon');
212 212
 
213
-        if ($term_icon_url != '') {
213
+		if ($term_icon_url != '') {
214 214
 
215
-            $file_info = pathinfo($term_icon_url['src']);
215
+			$file_info = pathinfo($term_icon_url['src']);
216 216
 
217
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..')
218
-                $sub_dir = $file_info['dirname'];
219
-            else{$sub_dir = '';}
217
+			if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..')
218
+				$sub_dir = $file_info['dirname'];
219
+			else{$sub_dir = '';}
220 220
 
221
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
222
-            $uploads_baseurl = $uploads['baseurl'];
223
-            $uploads_path = $uploads['path'];
221
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
222
+			$uploads_baseurl = $uploads['baseurl'];
223
+			$uploads_path = $uploads['path'];
224 224
 
225
-            $file_name = $file_info['basename'];
225
+			$file_name = $file_info['basename'];
226 226
 
227
-            $sub_dir = str_replace($uploads_baseurl, '', $sub_dir);
227
+			$sub_dir = str_replace($uploads_baseurl, '', $sub_dir);
228 228
 
229
-            $uploads_url = $uploads_baseurl . $sub_dir;
229
+			$uploads_url = $uploads_baseurl . $sub_dir;
230 230
 
231
-            $term_icon_url['src'] = $uploads_url . '/' . $file_name;
232
-            echo '<img src="' . $term_icon_url['src'] . '" />';
231
+			$term_icon_url['src'] = $uploads_url . '/' . $file_name;
232
+			echo '<img src="' . $term_icon_url['src'] . '" />';
233 233
 
234
-        }
235
-    }
234
+		}
235
+	}
236 236
 
237
-    if ($column_name == 'cat_default_img') {
238
-        $cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img');
239
-        if ($cat_default_img != '')
240
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
237
+	if ($column_name == 'cat_default_img') {
238
+		$cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img');
239
+		if ($cat_default_img != '')
240
+			echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
241 241
 
242
-    }
242
+	}
243 243
 }
244 244
 
245 245
 function geodir_get_default_catimage($term_id, $post_type = 'gd_place')
246 246
 {
247 247
 
248
-    if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
249
-        return $cat_default_img;
250
-    else
251
-        return false;
248
+	if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
249
+		return $cat_default_img;
250
+	else
251
+		return false;
252 252
 }
253 253
 
254 254
 //Clear custom fields
255 255
 add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field');
256 256
 function geodir_tax_meta_clear_custom_field()
257 257
 {
258
-    if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
259
-        ?>
258
+	if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
259
+		?>
260 260
         <script type="text/javascript">
261 261
             jQuery(document).ready(function () {
262 262
                 jQuery('#addtag #submit').click(function () {
@@ -277,5 +277,5 @@  discard block
 block discarded – undo
277 277
             });
278 278
         </script>
279 279
     <?php
280
-    endif;
280
+	endif;
281 281
 }
Please login to merge, or discard this patch.
geodirectory-functions/comments_functions.php 3 patches
Braces   +60 added lines, -48 removed lines patch added patch discarded remove patch
@@ -248,8 +248,9 @@  discard block
 block discarded – undo
248 248
 
249 249
     $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
250 250
 
251
-    if (!empty($comment_info))
252
-        $status = $comment_info->comment_approved;
251
+    if (!empty($comment_info)) {
252
+            $status = $comment_info->comment_approved;
253
+    }
253 254
 
254 255
     if ($status == 'approve' || $status == 1) {
255 256
         $status = 1;
@@ -381,12 +382,14 @@  discard block
 block discarded – undo
381 382
 function geodir_wrap_comment_text($content, $comment = '')
382 383
 {
383 384
     $rating = 0;
384
-    if (!empty($comment))
385
-        $rating = geodir_get_commentoverall($comment->comment_ID);
385
+    if (!empty($comment)) {
386
+            $rating = geodir_get_commentoverall($comment->comment_ID);
387
+    }
386 388
     if ($rating != 0 && !is_admin()) {
387 389
         return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
388
-    } else
389
-        return $content;
390
+    } else {
391
+            return $content;
392
+    }
390 393
 
391 394
 }
392 395
 
@@ -475,11 +478,12 @@  discard block
 block discarded – undo
475 478
         $post_ratings = get_post_meta($post_id, 'overall_rating');
476 479
     }
477 480
 
478
-    if ($post_ratings)
479
-        return $post_ratings;
480
-    else
481
-        return false;
482
-}
481
+    if ($post_ratings) {
482
+            return $post_ratings;
483
+    } else {
484
+            return false;
485
+    }
486
+    }
483 487
 
484 488
 
485 489
 /**
@@ -504,11 +508,12 @@  discard block
 block discarded – undo
504 508
         )
505 509
     );
506 510
 
507
-    if (!empty($reatings))
508
-        return $reatings;
509
-    else
510
-        return false;
511
-}
511
+    if (!empty($reatings)) {
512
+            return $reatings;
513
+    } else {
514
+            return false;
515
+    }
516
+    }
512 517
 
513 518
 /**
514 519
  * Get review total of a Post.
@@ -532,11 +537,12 @@  discard block
 block discarded – undo
532 537
         )
533 538
     );
534 539
 
535
-    if (!empty($results))
536
-        return $results;
537
-    else
538
-        return false;
539
-}
540
+    if (!empty($results)) {
541
+            return $results;
542
+    } else {
543
+            return false;
544
+    }
545
+    }
540 546
 
541 547
 /**
542 548
  * Get review count by user ID.
@@ -559,11 +565,12 @@  discard block
 block discarded – undo
559 565
         )
560 566
     );
561 567
 
562
-    if (!empty($results))
563
-        return $results;
564
-    else
565
-        return false;
566
-}
568
+    if (!empty($results)) {
569
+            return $results;
570
+    } else {
571
+            return false;
572
+    }
573
+    }
567 574
 
568 575
 /**
569 576
  * Get average overall rating of a Post.
@@ -597,11 +604,12 @@  discard block
 block discarded – undo
597 604
         )
598 605
     );
599 606
 
600
-    if (!empty($results))
601
-        return $results;
602
-    else
603
-        return false;
604
-}
607
+    if (!empty($results)) {
608
+            return $results;
609
+    } else {
610
+            return false;
611
+    }
612
+    }
605 613
 
606 614
 /**
607 615
  * Get review count of a Post.
@@ -625,11 +633,12 @@  discard block
 block discarded – undo
625 633
         )
626 634
     );
627 635
 
628
-    if (!empty($results))
629
-        return $results;
630
-    else
631
-        return false;
632
-}
636
+    if (!empty($results)) {
637
+            return $results;
638
+    } else {
639
+            return false;
640
+    }
641
+    }
633 642
 
634 643
 /**
635 644
  * Get comments count of a Post.
@@ -655,11 +664,12 @@  discard block
 block discarded – undo
655 664
     );
656 665
 
657 666
 
658
-    if (!empty($results))
659
-        return $results;
660
-    else
661
-        return false;
662
-}
667
+    if (!empty($results)) {
668
+            return $results;
669
+    } else {
670
+            return false;
671
+    }
672
+    }
663 673
 
664 674
 /**
665 675
  * Get overall rating of a comment.
@@ -683,11 +693,12 @@  discard block
 block discarded – undo
683 693
         )
684 694
     );
685 695
 
686
-    if ($reatings)
687
-        return $reatings;
688
-    else
689
-        return false;
690
-}
696
+    if ($reatings) {
697
+            return $reatings;
698
+    } else {
699
+            return false;
700
+    }
701
+    }
691 702
 
692 703
 /**
693 704
  * Returns average overall rating of a Post. Depreciated since ver 1.3.6.
@@ -930,8 +941,9 @@  discard block
 block discarded – undo
930 941
     $active_tabs = get_option('geodir_detail_page_tabs_excluded');
931 942
 
932 943
     $is_display = true;
933
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
934
-        $is_display = false;
944
+    if (!empty($active_tabs) && in_array('reviews', $active_tabs)) {
945
+            $is_display = false;
946
+    }
935 947
 
936 948
     /**
937 949
      * Filter to change display value.
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 function geodir_comment_rating_meta($comment)
69 69
 {
70 70
     $post_type = get_post_type($comment->comment_post_ID);
71
-	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0) {
71
+	if (in_array($post_type, (array) geodir_get_posttypes()) && (int) $comment->comment_parent == 0) {
72 72
 		$rating = geodir_get_commentoverall($comment->comment_ID);
73 73
 		
74
-		if ((int)get_option('geodir_reviewrating_enable_font_awesome') == 1) {
74
+		if ((int) get_option('geodir_reviewrating_enable_font_awesome') == 1) {
75 75
 			$star_texts = array();
76 76
 			$star_texts[] = __('Terrible', 'geodirectory');
77 77
 			$star_texts[] = __('Poor', 'geodirectory');
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     if (isset($_REQUEST['geodir_overallrating'])) {
194 194
         $overall_rating = $_REQUEST['geodir_overallrating'];
195 195
         
196
-		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
196
+		if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
197 197
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
198 198
 
199 199
             $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
         $overall_rating = $_REQUEST['geodir_overallrating'];
339 339
 
340
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
340
+        if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
341 341
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
342 342
 
343 343
             if (isset($old_rating)) {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
      * @package GeoDirectory
458 458
      * @param int $post_id The post ID.
459 459
      */
460
-    do_action('geodir_update_postrating',$post_id);
460
+    do_action('geodir_update_postrating', $post_id);
461 461
 
462 462
 }
463 463
 
@@ -969,10 +969,10 @@  discard block
 block discarded – undo
969 969
 /*
970 970
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
971 971
  */
972
-if(function_exists('dsq_can_replace')) {
972
+if (function_exists('dsq_can_replace')) {
973 973
     remove_filter('comments_template', 'dsq_comments_template');
974 974
     add_filter('comments_template', 'dsq_comments_template', 100);
975
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
975
+    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active', 10, 1);
976 976
 }
977 977
 
978 978
 
@@ -985,11 +985,11 @@  discard block
 block discarded – undo
985 985
  * @param string $disqus_active Hook called before DB call for option so this is empty.
986 986
  * @return string `1` if active `0` if disabled.
987 987
  */
988
-function geodir_option_disqus_active($disqus_active){
988
+function geodir_option_disqus_active($disqus_active) {
989 989
     global $post;
990 990
     $all_postypes = geodir_get_posttypes();
991 991
 
992
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
992
+    if (isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
993 993
         $disqus_active = '0';
994 994
     }
995 995
 
Please login to merge, or discard this patch.
Indentation   +422 added lines, -422 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Comment related functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Comment related functions.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 add_filter('comment_row_actions', 'geodir_comment_meta_row_action', 11, 1);
10 10
 /**
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function geodir_comment_meta_row_action($a)
33 33
 {
34
-    global $comment;
35
-
36
-    $rating = geodir_get_commentoverall($comment->comment_ID);
37
-    if ($rating != 0) {
38
-        //echo '<div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$comment->comment_ID.'"></div>';
39
-        echo geodir_get_rating_stars($rating, $comment->comment_ID);
40
-    }
41
-    return $a;
34
+	global $comment;
35
+
36
+	$rating = geodir_get_commentoverall($comment->comment_ID);
37
+	if ($rating != 0) {
38
+		//echo '<div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$comment->comment_ID.'"></div>';
39
+		echo geodir_get_rating_stars($rating, $comment->comment_ID);
40
+	}
41
+	return $a;
42 42
 }
43 43
 
44 44
 add_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function geodir_comment_add_meta_box($comment)
55 55
 {
56
-    add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
56
+	add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
57 57
 }
58 58
 
59 59
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_comment_rating_meta($comment)
69 69
 {
70
-    $post_type = get_post_type($comment->comment_post_ID);
70
+	$post_type = get_post_type($comment->comment_post_ID);
71 71
 	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0) {
72 72
 		$rating = geodir_get_commentoverall($comment->comment_ID);
73 73
 		
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function geodir_comment_rating_fields()
109 109
 {
110
-    global $post;
110
+	global $post;
111 111
 
112
-    $post_types = geodir_get_posttypes();
112
+	$post_types = geodir_get_posttypes();
113 113
 
114
-    if (in_array($post->post_type, $post_types)) {
115
-        $star_texts = array();
114
+	if (in_array($post->post_type, $post_types)) {
115
+		$star_texts = array();
116 116
 		$star_texts[] = __('Terrible', 'geodirectory');
117 117
 		$star_texts[] = __('Poor', 'geodirectory');
118 118
 		$star_texts[] = __('Average', 'geodirectory');
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 		$star_texts[] = __('Excellent', 'geodirectory');
121 121
 		
122 122
 		$gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
123
-        echo $gd_rating_html;
124
-        ?>
123
+		echo $gd_rating_html;
124
+		?>
125 125
         <input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="0"/><?php
126
-    }
126
+	}
127 127
 }
128 128
 
129 129
 
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 function geodir_comment_replaylink($link)
140 140
 {
141 141
 
142
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
142
+	$link = '<div class="gd_comment_replaylink">' . $link . '</div>';
143 143
 
144
-    return $link;
144
+	return $link;
145 145
 }
146 146
 
147 147
 add_filter('cancel_comment_reply_link', 'geodir_cancle_replaylink');
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 function geodir_cancle_replaylink($link)
157 157
 {
158 158
 
159
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
159
+	$link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
160 160
 
161
-    return $link;
161
+	return $link;
162 162
 }
163 163
 
164 164
 add_action('comment_post', 'geodir_save_rating');
@@ -174,29 +174,29 @@  discard block
 block discarded – undo
174 174
  */
175 175
 function geodir_save_rating($comment = 0)
176 176
 {
177
-    global $wpdb, $user_ID, $plugin_prefix;
177
+	global $wpdb, $user_ID, $plugin_prefix;
178 178
 
179
-    $comment_info = get_comment($comment);
179
+	$comment_info = get_comment($comment);
180 180
 
181
-    $post_id = $comment_info->comment_post_ID;
182
-    $status = $comment_info->comment_approved;
183
-    $rating_ip = getenv("REMOTE_ADDR");
181
+	$post_id = $comment_info->comment_post_ID;
182
+	$status = $comment_info->comment_approved;
183
+	$rating_ip = getenv("REMOTE_ADDR");
184 184
 	
185
-    $post = geodir_get_post_info($post_id);
185
+	$post = geodir_get_post_info($post_id);
186 186
 
187
-    if ($post->post_status == 'publish') {
188
-        $post_status = '1';
189
-    } else {
190
-        $post_status = '0';
191
-    }
187
+	if ($post->post_status == 'publish') {
188
+		$post_status = '1';
189
+	} else {
190
+		$post_status = '0';
191
+	}
192 192
 	
193
-    if (isset($_REQUEST['geodir_overallrating'])) {
194
-        $overall_rating = $_REQUEST['geodir_overallrating'];
193
+	if (isset($_REQUEST['geodir_overallrating'])) {
194
+		$overall_rating = $_REQUEST['geodir_overallrating'];
195 195
         
196 196
 		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
197
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
197
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
198 198
 
199
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
199
+			$sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
200 200
 					post_id		= %d,
201 201
 					post_type = %s,
202 202
 					post_title	= %s,
@@ -214,35 +214,35 @@  discard block
 block discarded – undo
214 214
 					post_latitude	= %s,
215 215
 					comment_content	= %s 
216 216
 					",
217
-                array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
218
-            );
219
-
220
-            $wpdb->query($sqlqry);
221
-
222
-            /**
223
-             * Called after saving the comment.
224
-             *
225
-             * @since 1.0.0
226
-             * @package GeoDirectory
227
-             * @param array $_REQUEST {
228
-             *    Attributes of the $_REQUEST variable.
229
-             *
230
-             *    @type string $geodir_overallrating Overall rating.
231
-             *    @type string $comment Comment text.
232
-             *    @type string $submit Submit button text.
233
-             *    @type string $comment_post_ID Comment post ID.
234
-             *    @type string $comment_parent Comment Parent ID.
235
-             *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
236
-             *
237
-             * }
238
-             */
239
-            do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
240
-
241
-            if ($status) {
242
-                geodir_update_postrating($post_id);
243
-            }
244
-        }
245
-    }
217
+				array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
218
+			);
219
+
220
+			$wpdb->query($sqlqry);
221
+
222
+			/**
223
+			 * Called after saving the comment.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @package GeoDirectory
227
+			 * @param array $_REQUEST {
228
+			 *    Attributes of the $_REQUEST variable.
229
+			 *
230
+			 *    @type string $geodir_overallrating Overall rating.
231
+			 *    @type string $comment Comment text.
232
+			 *    @type string $submit Submit button text.
233
+			 *    @type string $comment_post_ID Comment post ID.
234
+			 *    @type string $comment_parent Comment Parent ID.
235
+			 *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
236
+			 *
237
+			 * }
238
+			 */
239
+			do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
240
+
241
+			if ($status) {
242
+				geodir_update_postrating($post_id);
243
+			}
244
+		}
245
+	}
246 246
 }
247 247
 
248 248
 
@@ -260,51 +260,51 @@  discard block
 block discarded – undo
260 260
  */
261 261
 function geodir_update_rating_status_change($comment_id, $status)
262 262
 {
263
-    if ($status == 'delete') {
264
-        return;
265
-    }
266
-    global $wpdb, $plugin_prefix, $user_ID;
263
+	if ($status == 'delete') {
264
+		return;
265
+	}
266
+	global $wpdb, $plugin_prefix, $user_ID;
267 267
 
268
-    $comment_info = get_comment($comment_id);
268
+	$comment_info = get_comment($comment_id);
269 269
 
270
-    $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
270
+	$post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
271 271
 
272
-    if (!empty($comment_info))
273
-        $status = $comment_info->comment_approved;
272
+	if (!empty($comment_info))
273
+		$status = $comment_info->comment_approved;
274 274
 
275
-    if ($status == 'approve' || $status == 1) {
276
-        $status = 1;
277
-    } else {
278
-        $status = 0;
279
-    }
275
+	if ($status == 'approve' || $status == 1) {
276
+		$status = 1;
277
+	} else {
278
+		$status = 0;
279
+	}
280 280
 
281
-    $comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
282
-    $old_rating = geodir_get_commentoverall($comment_info_ID);
281
+	$comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
282
+	$old_rating = geodir_get_commentoverall($comment_info_ID);
283 283
 
284
-    $post_type = get_post_type($post_id);
284
+	$post_type = get_post_type($post_id);
285 285
 
286
-    $detail_table = $plugin_prefix . $post_type . '_detail';
286
+	$detail_table = $plugin_prefix . $post_type . '_detail';
287 287
 
288
-    if ($comment_id) {
288
+	if ($comment_id) {
289 289
 
290
-        $overall_rating = $old_rating;
290
+		$overall_rating = $old_rating;
291 291
 
292
-        if (isset($old_rating)) {
292
+		if (isset($old_rating)) {
293 293
 
294
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
294
+			$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
295 295
 						overall_rating = %f,
296 296
 						status		= %s,
297 297
 						comment_content = %s 
298 298
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
299 299
 
300
-            $wpdb->query($sqlqry);
300
+			$wpdb->query($sqlqry);
301 301
 
302
-            //update rating
303
-            geodir_update_postrating($post_id, $post_type);
302
+			//update rating
303
+			geodir_update_postrating($post_id, $post_type);
304 304
 
305
-        }
305
+		}
306 306
 
307
-    }
307
+	}
308 308
 
309 309
 }
310 310
 
@@ -323,41 +323,41 @@  discard block
 block discarded – undo
323 323
 function geodir_update_rating($comment_id = 0)
324 324
 {
325 325
 
326
-    global $wpdb, $plugin_prefix, $user_ID;
326
+	global $wpdb, $plugin_prefix, $user_ID;
327 327
 
328
-    $comment_info = get_comment($comment_id);
328
+	$comment_info = get_comment($comment_id);
329 329
 
330
-    $post_id = $comment_info->comment_post_ID;
331
-    $status = $comment_info->comment_approved;
332
-    $old_rating = geodir_get_commentoverall($comment_info->comment_ID);
330
+	$post_id = $comment_info->comment_post_ID;
331
+	$status = $comment_info->comment_approved;
332
+	$old_rating = geodir_get_commentoverall($comment_info->comment_ID);
333 333
 
334
-    $post_type = get_post_type($post_id);
334
+	$post_type = get_post_type($post_id);
335 335
 
336
-    $detail_table = $plugin_prefix . $post_type . '_detail';
336
+	$detail_table = $plugin_prefix . $post_type . '_detail';
337 337
 
338
-    if (isset($_REQUEST['geodir_overallrating'])) {
338
+	if (isset($_REQUEST['geodir_overallrating'])) {
339 339
 
340
-        $overall_rating = $_REQUEST['geodir_overallrating'];
340
+		$overall_rating = $_REQUEST['geodir_overallrating'];
341 341
 
342
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
343
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
342
+		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
343
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
344 344
 
345
-            if (isset($old_rating)) {
345
+			if (isset($old_rating)) {
346 346
 
347
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
347
+				$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
348 348
 						overall_rating = %f,
349 349
 						status		= %s,
350 350
 						comment_content	= %s 
351 351
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
352 352
 
353
-                $wpdb->query($sqlqry);
353
+				$wpdb->query($sqlqry);
354 354
 
355
-                //update rating
356
-                geodir_update_postrating($post_id, $post_type);
355
+				//update rating
356
+				geodir_update_postrating($post_id, $post_type);
357 357
 
358
-            }
359
-        }
360
-    }
358
+			}
359
+		}
360
+	}
361 361
 
362 362
 
363 363
 }
@@ -373,19 +373,19 @@  discard block
 block discarded – undo
373 373
  */
374 374
 function geodir_comment_delete_comment($comment_id)
375 375
 {
376
-    global $wpdb;
376
+	global $wpdb;
377 377
 
378
-    $review_info = geodir_get_review($comment_id);
379
-    if ($review_info) {
380
-        geodir_update_postrating($review_info->post_id);
381
-    }
378
+	$review_info = geodir_get_review($comment_id);
379
+	if ($review_info) {
380
+		geodir_update_postrating($review_info->post_id);
381
+	}
382 382
 
383
-    $wpdb->query(
384
-        $wpdb->prepare(
385
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
386
-            array($comment_id)
387
-        )
388
-    );
383
+	$wpdb->query(
384
+		$wpdb->prepare(
385
+			"DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
386
+			array($comment_id)
387
+		)
388
+	);
389 389
 
390 390
 }
391 391
 
@@ -401,13 +401,13 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_wrap_comment_text($content, $comment = '')
403 403
 {
404
-    $rating = 0;
405
-    if (!empty($comment))
406
-        $rating = geodir_get_commentoverall($comment->comment_ID);
407
-    if ($rating != 0 && !is_admin()) {
408
-        return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
409
-    } else
410
-        return $content;
404
+	$rating = 0;
405
+	if (!empty($comment))
406
+		$rating = geodir_get_commentoverall($comment->comment_ID);
407
+	if ($rating != 0 && !is_admin()) {
408
+		return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
409
+	} else
410
+		return $content;
411 411
 
412 412
 }
413 413
 
@@ -425,41 +425,41 @@  discard block
 block discarded – undo
425 425
  */
426 426
 function geodir_update_postrating($post_id = 0, $post_type = '', $delete = false)
427 427
 {
428
-    global $wpdb, $plugin_prefix, $comment;
429
-    if (!$post_type) {
430
-        $post_type = get_post_type($post_id);
431
-    }
432
-    $detail_table = $plugin_prefix . $post_type . '_detail';
433
-    $post_newrating = geodir_get_post_rating($post_id, 1);
434
-    $post_newrating_count = geodir_get_review_count_total($post_id);
428
+	global $wpdb, $plugin_prefix, $comment;
429
+	if (!$post_type) {
430
+		$post_type = get_post_type($post_id);
431
+	}
432
+	$detail_table = $plugin_prefix . $post_type . '_detail';
433
+	$post_newrating = geodir_get_post_rating($post_id, 1);
434
+	$post_newrating_count = geodir_get_review_count_total($post_id);
435 435
 
436 436
 
437
-    //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
437
+	//$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
438 438
 
439
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
439
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
440 440
 
441
-        $wpdb->query(
442
-            $wpdb->prepare(
443
-                "UPDATE " . $detail_table . " SET
441
+		$wpdb->query(
442
+			$wpdb->prepare(
443
+				"UPDATE " . $detail_table . " SET
444 444
 						overall_rating = %f,
445 445
 						rating_count = %f
446 446
 						where post_id = %d",
447
-                array($post_newrating, $post_newrating_count, $post_id)
448
-            )
449
-        );
450
-
451
-        update_post_meta($post_id, 'overall_rating', $post_newrating);
452
-        update_post_meta($post_id, 'rating_count', $post_newrating_count);
453
-    }
454
-    /**
455
-     * Called after Updating post overall rating and rating count.
456
-     *
457
-     * @since 1.0.0
458
-     * @since 1.4.3 Added `$post_id` param.
459
-     * @package GeoDirectory
460
-     * @param int $post_id The post ID.
461
-     */
462
-    do_action('geodir_update_postrating',$post_id);
447
+				array($post_newrating, $post_newrating_count, $post_id)
448
+			)
449
+		);
450
+
451
+		update_post_meta($post_id, 'overall_rating', $post_newrating);
452
+		update_post_meta($post_id, 'rating_count', $post_newrating_count);
453
+	}
454
+	/**
455
+	 * Called after Updating post overall rating and rating count.
456
+	 *
457
+	 * @since 1.0.0
458
+	 * @since 1.4.3 Added `$post_id` param.
459
+	 * @package GeoDirectory
460
+	 * @param int $post_id The post ID.
461
+	 */
462
+	do_action('geodir_update_postrating',$post_id);
463 463
 
464 464
 }
465 465
 
@@ -477,29 +477,29 @@  discard block
 block discarded – undo
477 477
  */
478 478
 function geodir_get_postoverall($post_id = 0)
479 479
 {
480
-    global $wpdb, $plugin_prefix;
480
+	global $wpdb, $plugin_prefix;
481 481
 
482
-    $post_type = get_post_type($post_id);
483
-    $detail_table = $plugin_prefix . $post_type . '_detail';
482
+	$post_type = get_post_type($post_id);
483
+	$detail_table = $plugin_prefix . $post_type . '_detail';
484 484
 
485
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
485
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
486 486
 
487
-        $post_ratings = $wpdb->get_var(
488
-            $wpdb->prepare(
489
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
490
-                array($post_id)
491
-            )
492
-        );
487
+		$post_ratings = $wpdb->get_var(
488
+			$wpdb->prepare(
489
+				"SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
490
+				array($post_id)
491
+			)
492
+		);
493 493
 
494 494
 
495
-    } else {
496
-        $post_ratings = get_post_meta($post_id, 'overall_rating');
497
-    }
495
+	} else {
496
+		$post_ratings = get_post_meta($post_id, 'overall_rating');
497
+	}
498 498
 
499
-    if ($post_ratings)
500
-        return $post_ratings;
501
-    else
502
-        return false;
499
+	if ($post_ratings)
500
+		return $post_ratings;
501
+	else
502
+		return false;
503 503
 }
504 504
 
505 505
 
@@ -516,19 +516,19 @@  discard block
 block discarded – undo
516 516
  */
517 517
 function geodir_get_review($comment_id = 0)
518 518
 {
519
-    global $wpdb;
520
-
521
-    $reatings = $wpdb->get_row(
522
-        $wpdb->prepare(
523
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
524
-            array($comment_id)
525
-        )
526
-    );
527
-
528
-    if (!empty($reatings))
529
-        return $reatings;
530
-    else
531
-        return false;
519
+	global $wpdb;
520
+
521
+	$reatings = $wpdb->get_row(
522
+		$wpdb->prepare(
523
+			"SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
524
+			array($comment_id)
525
+		)
526
+	);
527
+
528
+	if (!empty($reatings))
529
+		return $reatings;
530
+	else
531
+		return false;
532 532
 }
533 533
 
534 534
 /**
@@ -544,19 +544,19 @@  discard block
 block discarded – undo
544 544
  */
545 545
 function geodir_get_review_total($post_id = 0)
546 546
 {
547
-    global $wpdb;
548
-
549
-    $results = $wpdb->get_var(
550
-        $wpdb->prepare(
551
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
552
-            array($post_id)
553
-        )
554
-    );
555
-
556
-    if (!empty($results))
557
-        return $results;
558
-    else
559
-        return false;
547
+	global $wpdb;
548
+
549
+	$results = $wpdb->get_var(
550
+		$wpdb->prepare(
551
+			"SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
552
+			array($post_id)
553
+		)
554
+	);
555
+
556
+	if (!empty($results))
557
+		return $results;
558
+	else
559
+		return false;
560 560
 }
561 561
 
562 562
 /**
@@ -572,18 +572,18 @@  discard block
 block discarded – undo
572 572
  */
573 573
 function geodir_get_review_count_by_user_id($user_id = 0)
574 574
 {
575
-    global $wpdb;
576
-    $results = $wpdb->get_var(
577
-        $wpdb->prepare(
578
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
579
-            array($user_id)
580
-        )
581
-    );
582
-
583
-    if (!empty($results))
584
-        return $results;
585
-    else
586
-        return false;
575
+	global $wpdb;
576
+	$results = $wpdb->get_var(
577
+		$wpdb->prepare(
578
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
579
+			array($user_id)
580
+		)
581
+	);
582
+
583
+	if (!empty($results))
584
+		return $results;
585
+	else
586
+		return false;
587 587
 }
588 588
 
589 589
 /**
@@ -601,27 +601,27 @@  discard block
 block discarded – undo
601 601
  */
602 602
 function geodir_get_post_rating($post_id = 0, $force_query = 0)
603 603
 {
604
-    global $wpdb, $post;
605
-
606
-    if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
607
-        if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
608
-            return $post->overall_rating;
609
-        } else {
610
-            return 0;
611
-        }
612
-    }
613
-
614
-    $results = $wpdb->get_var(
615
-        $wpdb->prepare(
616
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
617
-            array($post_id)
618
-        )
619
-    );
620
-
621
-    if (!empty($results))
622
-        return $results;
623
-    else
624
-        return false;
604
+	global $wpdb, $post;
605
+
606
+	if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
607
+		if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
608
+			return $post->overall_rating;
609
+		} else {
610
+			return 0;
611
+		}
612
+	}
613
+
614
+	$results = $wpdb->get_var(
615
+		$wpdb->prepare(
616
+			"SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
617
+			array($post_id)
618
+		)
619
+	);
620
+
621
+	if (!empty($results))
622
+		return $results;
623
+	else
624
+		return false;
625 625
 }
626 626
 
627 627
 /**
@@ -637,19 +637,19 @@  discard block
 block discarded – undo
637 637
  */
638 638
 function geodir_get_review_count_total($post_id = 0)
639 639
 {
640
-    global $wpdb;
641
-
642
-    $results = $wpdb->get_var(
643
-        $wpdb->prepare(
644
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
645
-            array($post_id)
646
-        )
647
-    );
648
-
649
-    if (!empty($results))
650
-        return $results;
651
-    else
652
-        return false;
640
+	global $wpdb;
641
+
642
+	$results = $wpdb->get_var(
643
+		$wpdb->prepare(
644
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
645
+			array($post_id)
646
+		)
647
+	);
648
+
649
+	if (!empty($results))
650
+		return $results;
651
+	else
652
+		return false;
653 653
 }
654 654
 
655 655
 /**
@@ -666,20 +666,20 @@  discard block
 block discarded – undo
666 666
  */
667 667
 function geodir_get_comments_number($post_id = 0)
668 668
 {
669
-    global $wpdb;
669
+	global $wpdb;
670 670
 
671
-    $results = $wpdb->get_var(
672
-        $wpdb->prepare(
673
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
674
-            array($post_id)
675
-        )
676
-    );
671
+	$results = $wpdb->get_var(
672
+		$wpdb->prepare(
673
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
674
+			array($post_id)
675
+		)
676
+	);
677 677
 
678 678
 
679
-    if (!empty($results))
680
-        return $results;
681
-    else
682
-        return false;
679
+	if (!empty($results))
680
+		return $results;
681
+	else
682
+		return false;
683 683
 }
684 684
 
685 685
 /**
@@ -695,19 +695,19 @@  discard block
 block discarded – undo
695 695
  */
696 696
 function geodir_get_commentoverall($comment_id = 0)
697 697
 {
698
-    global $wpdb;
699
-
700
-    $reatings = $wpdb->get_var(
701
-        $wpdb->prepare(
702
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
703
-            array($comment_id)
704
-        )
705
-    );
706
-
707
-    if ($reatings)
708
-        return $reatings;
709
-    else
710
-        return false;
698
+	global $wpdb;
699
+
700
+	$reatings = $wpdb->get_var(
701
+		$wpdb->prepare(
702
+			"SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
703
+			array($comment_id)
704
+		)
705
+	);
706
+
707
+	if ($reatings)
708
+		return $reatings;
709
+	else
710
+		return false;
711 711
 }
712 712
 
713 713
 /**
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
  */
722 722
 function geodir_get_commentoverall_number($post_id = 0)
723 723
 {
724
-    return geodir_get_post_rating($post_id);
724
+	return geodir_get_post_rating($post_id);
725 725
 }
726 726
 
727 727
 
@@ -739,98 +739,98 @@  discard block
 block discarded – undo
739 739
  */
740 740
 function geodir_comment_template($comment_template)
741 741
 {
742
-    global $post;
743
-
744
-    $post_types = geodir_get_posttypes();
745
-
746
-    if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
747
-        return;
748
-    }
749
-    if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
750
-        $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
751
-        if (!$template) {
752
-            $template = dirname(__FILE__) . '/reviews.php';
753
-        }
754
-        return $template;
755
-    }
742
+	global $post;
743
+
744
+	$post_types = geodir_get_posttypes();
745
+
746
+	if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
747
+		return;
748
+	}
749
+	if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
750
+		$template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
751
+		if (!$template) {
752
+			$template = dirname(__FILE__) . '/reviews.php';
753
+		}
754
+		return $template;
755
+	}
756 756
 }
757 757
 
758 758
 add_filter("comments_template", "geodir_comment_template");
759 759
 
760 760
 
761 761
 if (!function_exists('geodir_comment')) {
762
-    /**
763
-     * Comment HTML markup.
764
-     *
765
-     * @since 1.0.0
766
-     * @package GeoDirectory
767
-     * @global object $post The current post object.
768
-     * @param object $comment The comment object.
769
-     * @param string|array $args {
770
-     *     Optional. Formatting options.
771
-     *
772
-     *     @type object $walker            Instance of a Walker class to list comments. Default null.
773
-     *     @type int    $max_depth         The maximum comments depth. Default empty.
774
-     *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
775
-     *     @type string $callback          Callback function to use. Default null.
776
-     *     @type string $end-callback      Callback function to use at the end. Default null.
777
-     *     @type string $type              Type of comments to list.
778
-     *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
779
-     *     @type int    $page              Page ID to list comments for. Default empty.
780
-     *     @type int    $per_page          Number of comments to list per page. Default empty.
781
-     *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
782
-     *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
783
-     *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
784
-     *     @type string $format            How to format the comments list.
785
-     *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
786
-     *     @type bool   $short_ping        Whether to output short pings. Default false.
787
-     *     @type bool   $echo              Whether to echo the output or return it. Default true.
788
-     * }
789
-     * @param int $depth Depth of comment.
790
-     */
791
-    function geodir_comment($comment, $args, $depth)
792
-    {
793
-        $GLOBALS['comment'] = $comment;
794
-        switch ($comment->comment_type) :
795
-            case 'pingback' :
796
-            case 'trackback' :
797
-                // Display trackbacks differently than normal comments.
798
-                ?>
762
+	/**
763
+	 * Comment HTML markup.
764
+	 *
765
+	 * @since 1.0.0
766
+	 * @package GeoDirectory
767
+	 * @global object $post The current post object.
768
+	 * @param object $comment The comment object.
769
+	 * @param string|array $args {
770
+	 *     Optional. Formatting options.
771
+	 *
772
+	 *     @type object $walker            Instance of a Walker class to list comments. Default null.
773
+	 *     @type int    $max_depth         The maximum comments depth. Default empty.
774
+	 *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
775
+	 *     @type string $callback          Callback function to use. Default null.
776
+	 *     @type string $end-callback      Callback function to use at the end. Default null.
777
+	 *     @type string $type              Type of comments to list.
778
+	 *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
779
+	 *     @type int    $page              Page ID to list comments for. Default empty.
780
+	 *     @type int    $per_page          Number of comments to list per page. Default empty.
781
+	 *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
782
+	 *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
783
+	 *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
784
+	 *     @type string $format            How to format the comments list.
785
+	 *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
786
+	 *     @type bool   $short_ping        Whether to output short pings. Default false.
787
+	 *     @type bool   $echo              Whether to echo the output or return it. Default true.
788
+	 * }
789
+	 * @param int $depth Depth of comment.
790
+	 */
791
+	function geodir_comment($comment, $args, $depth)
792
+	{
793
+		$GLOBALS['comment'] = $comment;
794
+		switch ($comment->comment_type) :
795
+			case 'pingback' :
796
+			case 'trackback' :
797
+				// Display trackbacks differently than normal comments.
798
+				?>
799 799
                 <li <?php comment_class('geodir-comment'); ?> id="comment-<?php comment_ID(); ?>">
800 800
                 <p><?php _e('Pingback:', 'geodirectory'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'geodirectory'), '<span class="edit-link">', '</span>'); ?></p>
801 801
                 <?php
802
-                break;
803
-            default :
804
-                // Proceed with normal comments.
805
-                global $post;
806
-                ?>
802
+				break;
803
+			default :
804
+				// Proceed with normal comments.
805
+				global $post;
806
+				?>
807 807
             <li <?php comment_class('geodir-comment'); ?> id="li-comment-<?php comment_ID(); ?>">
808 808
                 <article id="comment-<?php comment_ID(); ?>" class="comment hreview">
809 809
                     <header class="comment-meta comment-author vcard">
810 810
                         <?php
811
-                        /**
812
-                         * Filter to modify comment avatar size
813
-                         *
814
-                         * You can use this filter to change comment avatar size.
815
-                         *
816
-                         * @since 1.0.0
817
-                         * @package GeoDirectory
818
-                         */
819
-                        $avatar_size = apply_filters('geodir_comment_avatar_size', 44);
820
-                        echo get_avatar($comment, $avatar_size);
821
-                        printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
822
-                            get_comment_author_link(),
823
-                            // If current post author is also comment author, make it known visually.
824
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
825
-                        );
826
-                        echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
827
-                        printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
828
-                            esc_url(get_comment_link($comment->comment_ID)),
829
-                            get_comment_time('c'),
830
-                            /* translators: 1: date, 2: time */
831
-                            sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
832
-                        );
833
-                        ?>
811
+						/**
812
+						 * Filter to modify comment avatar size
813
+						 *
814
+						 * You can use this filter to change comment avatar size.
815
+						 *
816
+						 * @since 1.0.0
817
+						 * @package GeoDirectory
818
+						 */
819
+						$avatar_size = apply_filters('geodir_comment_avatar_size', 44);
820
+						echo get_avatar($comment, $avatar_size);
821
+						printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
822
+							get_comment_author_link(),
823
+							// If current post author is also comment author, make it known visually.
824
+							($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
825
+						);
826
+						echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
827
+						printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
828
+							esc_url(get_comment_link($comment->comment_ID)),
829
+							get_comment_time('c'),
830
+							/* translators: 1: date, 2: time */
831
+							sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
832
+						);
833
+						?>
834 834
                     </header>
835 835
                     <!-- .comment-meta -->
836 836
 
@@ -854,47 +854,47 @@  discard block
 block discarded – undo
854 854
                 </article>
855 855
                 <!-- #comment-## -->
856 856
                 <?php
857
-                break;
858
-        endswitch; // end comment_type check
859
-    }
857
+				break;
858
+		endswitch; // end comment_type check
859
+	}
860 860
 }
861 861
 
862 862
 
863 863
 add_filter('get_comments_number', 'geodir_fix_comment_count', 10, 2);
864 864
 if (!function_exists('geodir_fix_comment_count')) {
865
-    /**
866
-     * Fix comment count by not listing replies as reviews
867
-     *
868
-     * @since 1.0.0
869
-     * @package GeoDirectory
870
-     * @global object $post The current post object.
871
-     * @param int $count The comment count.
872
-     * @param int $post_id The post ID.
873
-     * @todo $post is unreachable since the function return the count before that variable.
874
-     * @return bool|null|string The comment count.
875
-     */
876
-    function geodir_fix_comment_count($count, $post_id)
877
-    {
878
-        if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
879
-            global $post;
880
-            $post_types = geodir_get_posttypes();
881
-
882
-            if (in_array(get_post_type($post_id), $post_types)) {
883
-                $review_count = geodir_get_review_count_total($post_id);
884
-                return $review_count;
885
-
886
-                if ($post && isset($post->rating_count)) {
887
-                    return $post->rating_count;
888
-                } else {
889
-                    return geodir_get_comments_number($post_id);
890
-                }
891
-            } else {
892
-                return $count;
893
-            }
894
-        } else {
895
-            return $count;
896
-        }
897
-    }
865
+	/**
866
+	 * Fix comment count by not listing replies as reviews
867
+	 *
868
+	 * @since 1.0.0
869
+	 * @package GeoDirectory
870
+	 * @global object $post The current post object.
871
+	 * @param int $count The comment count.
872
+	 * @param int $post_id The post ID.
873
+	 * @todo $post is unreachable since the function return the count before that variable.
874
+	 * @return bool|null|string The comment count.
875
+	 */
876
+	function geodir_fix_comment_count($count, $post_id)
877
+	{
878
+		if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
879
+			global $post;
880
+			$post_types = geodir_get_posttypes();
881
+
882
+			if (in_array(get_post_type($post_id), $post_types)) {
883
+				$review_count = geodir_get_review_count_total($post_id);
884
+				return $review_count;
885
+
886
+				if ($post && isset($post->rating_count)) {
887
+					return $post->rating_count;
888
+				} else {
889
+					return geodir_get_comments_number($post_id);
890
+				}
891
+			} else {
892
+				return $count;
893
+			}
894
+		} else {
895
+			return $count;
896
+		}
897
+	}
898 898
 }
899 899
 
900 900
 /**
@@ -911,11 +911,11 @@  discard block
 block discarded – undo
911 911
  */
912 912
 function geodir_get_rating_stars($rating, $post_id, $small = false)
913 913
 {
914
-    $a_rating = $rating / 5 * 100;
914
+	$a_rating = $rating / 5 * 100;
915 915
 
916
-    if ($small) {
917
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
918
-    } else {
916
+	if ($small) {
917
+		$r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
918
+	} else {
919 919
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
920 920
 			// Show rating stars from review rating manager
921 921
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
933 933
 			}
934 934
 			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
935 935
 		}
936
-    }
937
-    return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
936
+	}
937
+	return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
938 938
 }
939 939
 
940 940
 /**
@@ -948,23 +948,23 @@  discard block
 block discarded – undo
948 948
 function geodir_is_reviews_show($pageview = '')
949 949
 {
950 950
 
951
-    $active_tabs = get_option('geodir_detail_page_tabs_excluded');
952
-
953
-    $is_display = true;
954
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
955
-        $is_display = false;
956
-
957
-    /**
958
-     * Filter to change display value.
959
-     *
960
-     * You can use this filter to change the is_display value.
961
-     *
962
-     * @since 1.0.0
963
-     * @package GeoDirectory
964
-     * @param bool $is_display Display ratings when set to true.
965
-     * @param string $pageview The view template. Ex: listview, gridview etc.
966
-     */
967
-    return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
951
+	$active_tabs = get_option('geodir_detail_page_tabs_excluded');
952
+
953
+	$is_display = true;
954
+	if (!empty($active_tabs) && in_array('reviews', $active_tabs))
955
+		$is_display = false;
956
+
957
+	/**
958
+	 * Filter to change display value.
959
+	 *
960
+	 * You can use this filter to change the is_display value.
961
+	 *
962
+	 * @since 1.0.0
963
+	 * @package GeoDirectory
964
+	 * @param bool $is_display Display ratings when set to true.
965
+	 * @param string $pageview The view template. Ex: listview, gridview etc.
966
+	 */
967
+	return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
968 968
 }
969 969
 
970 970
 
@@ -972,9 +972,9 @@  discard block
 block discarded – undo
972 972
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
973 973
  */
974 974
 if(function_exists('dsq_can_replace')) {
975
-    remove_filter('comments_template', 'dsq_comments_template');
976
-    add_filter('comments_template', 'dsq_comments_template', 100);
977
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
975
+	remove_filter('comments_template', 'dsq_comments_template');
976
+	add_filter('comments_template', 'dsq_comments_template', 100);
977
+	add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
978 978
 }
979 979
 
980 980
 
@@ -988,13 +988,13 @@  discard block
 block discarded – undo
988 988
  * @return string `1` if active `0` if disabled.
989 989
  */
990 990
 function geodir_option_disqus_active($disqus_active){
991
-    global $post;
992
-    $all_postypes = geodir_get_posttypes();
991
+	global $post;
992
+	$all_postypes = geodir_get_posttypes();
993 993
 
994
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
995
-        $disqus_active = '0';
996
-    }
994
+	if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
995
+		$disqus_active = '0';
996
+	}
997 997
 
998
-    return $disqus_active;
998
+	return $disqus_active;
999 999
 }
1000 1000
 
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Avada.php 4 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function gd_strip_breadcrumb_wrappers($breadcrumb)
20 20
 {
21
-    $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb);
21
+    $breadcrumb = str_replace(array("<li>", "</li>"), "", $breadcrumb);
22 22
     $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb);
23 23
     $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb);
24 24
     return $breadcrumb;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     return $separator;
40 40
 }
41 41
 
42
-add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change');
42
+add_action('avada_override_current_page_title_bar', 'gd_avada_current_page_title_bar_change');
43 43
 /**
44 44
  * new title bar functions for gd pages.
45 45
  *
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 {
52 52
     if (geodir_is_geodir_page()) {
53 53
         gd_avada_current_page_title_bar();
54
-    }else{
55
-        avada_current_page_title_bar( $c_pageID );
54
+    } else {
55
+        avada_current_page_title_bar($c_pageID);
56 56
     }
57 57
 
58 58
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
  * @since 1.0.0
114 114
  * @package GeoDirectory
115 115
  * @param array $classes Class array.
116
- * @return array Modified class array.
116
+ * @return string[] Modified class array.
117 117
  */
118 118
 function geodir_x_body_class($classes)
119 119
 {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -353,7 +353,7 @@
 block discarded – undo
353 353
 
354 354
     if(!$cpt_left){
355 355
         $cpt_left = "gd-cpt-flat";
356
-    }else{
356
+    } else{
357 357
         $cpt_left = '';
358 358
     }
359 359
 
Please login to merge, or discard this patch.
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Avada theme compatibility functions.
4
- *
5
- * This file lets the GeoDirectory Plugin use the Avada theme HTML wrappers to fit and work perfectly.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+	 * Avada theme compatibility functions.
4
+	 *
5
+	 * This file lets the GeoDirectory Plugin use the Avada theme HTML wrappers to fit and work perfectly.
6
+	 *
7
+	 * @since 1.0.0
8
+	 * @package GeoDirectory
9
+	 */
10 10
 add_filter('geodir_breadcrumb', 'gd_strip_breadcrumb_wrappers');
11 11
 /**
12
- * strips the gd breadcrumb wrappers.
13
- *
14
- * @since 1.0.0
15
- * @package GeoDirectory
16
- * @param string $breadcrumb Old breadcrumb HTML.
17
- * @return string Modified breadcrumb HTML.
18
- */
12
+	 * strips the gd breadcrumb wrappers.
13
+	 *
14
+	 * @since 1.0.0
15
+	 * @package GeoDirectory
16
+	 * @param string $breadcrumb Old breadcrumb HTML.
17
+	 * @return string Modified breadcrumb HTML.
18
+	 */
19 19
 function gd_strip_breadcrumb_wrappers($breadcrumb)
20 20
 {
21
-    $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb);
22
-    $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb);
23
-    $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb);
24
-    return $breadcrumb;
21
+	$breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb);
22
+	$breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb);
23
+	$breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb);
24
+	return $breadcrumb;
25 25
 }
26 26
 
27 27
 add_filter('geodir_breadcrumb_separator', 'gd_change_breadcrumb_separator');
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function gd_change_breadcrumb_separator($separator)
37 37
 {
38
-    $separator = ' / ';
39
-    return $separator;
38
+	$separator = ' / ';
39
+	return $separator;
40 40
 }
41 41
 
42 42
 add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change');
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function gd_avada_current_page_title_bar_change($c_pageID)
51 51
 {
52
-    if (geodir_is_geodir_page()) {
53
-        gd_avada_current_page_title_bar();
54
-    }else{
55
-        avada_current_page_title_bar( $c_pageID );
56
-    }
52
+	if (geodir_is_geodir_page()) {
53
+		gd_avada_current_page_title_bar();
54
+	}else{
55
+		avada_current_page_title_bar( $c_pageID );
56
+	}
57 57
 
58 58
 }
59 59
 
@@ -65,46 +65,46 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function gd_avada_current_page_title_bar()
67 67
 {
68
-    ob_start();
69
-    geodir_breadcrumb();
70
-    $secondary_content = ob_get_contents();
71
-    ob_get_clean();
72
-
73
-    $title = '';
74
-    $subtitle = '';
75
-
76
-    if (geodir_is_page('listing')) {
77
-        ob_start(); // Start buffering;
78
-        geodir_action_listings_title();
79
-        $title = ob_get_clean();
80
-        avada_page_title_bar($title, $subtitle, $secondary_content);
81
-    }
82
-
83
-    if (geodir_is_page('add-listing')) {
84
-        ob_start(); // Start buffering;
85
-        geodir_action_add_listing_page_title();
86
-        $title = ob_get_clean();
87
-        avada_page_title_bar($title, $subtitle, $secondary_content);
88
-    }
89
-
90
-    if (geodir_is_page('author')) {
91
-        ob_start(); // Start buffering;
92
-        geodir_action_author_page_title();
93
-        $title = ob_get_clean();
94
-        avada_page_title_bar($title, $subtitle, $secondary_content);
95
-    }
96
-
97
-    if (geodir_is_page('detail') || geodir_is_page('preview')) {
98
-        $title = get_the_title();
99
-        avada_page_title_bar($title, $subtitle, $secondary_content);
100
-    }
101
-
102
-    if (geodir_is_page('search')) {
103
-        ob_start(); // Start buffering;
104
-        geodir_action_search_page_title();
105
-        $title = ob_get_clean();
106
-        avada_page_title_bar($title, $subtitle, $secondary_content);
107
-    }
68
+	ob_start();
69
+	geodir_breadcrumb();
70
+	$secondary_content = ob_get_contents();
71
+	ob_get_clean();
72
+
73
+	$title = '';
74
+	$subtitle = '';
75
+
76
+	if (geodir_is_page('listing')) {
77
+		ob_start(); // Start buffering;
78
+		geodir_action_listings_title();
79
+		$title = ob_get_clean();
80
+		avada_page_title_bar($title, $subtitle, $secondary_content);
81
+	}
82
+
83
+	if (geodir_is_page('add-listing')) {
84
+		ob_start(); // Start buffering;
85
+		geodir_action_add_listing_page_title();
86
+		$title = ob_get_clean();
87
+		avada_page_title_bar($title, $subtitle, $secondary_content);
88
+	}
89
+
90
+	if (geodir_is_page('author')) {
91
+		ob_start(); // Start buffering;
92
+		geodir_action_author_page_title();
93
+		$title = ob_get_clean();
94
+		avada_page_title_bar($title, $subtitle, $secondary_content);
95
+	}
96
+
97
+	if (geodir_is_page('detail') || geodir_is_page('preview')) {
98
+		$title = get_the_title();
99
+		avada_page_title_bar($title, $subtitle, $secondary_content);
100
+	}
101
+
102
+	if (geodir_is_page('search')) {
103
+		ob_start(); // Start buffering;
104
+		geodir_action_search_page_title();
105
+		$title = ob_get_clean();
106
+		avada_page_title_bar($title, $subtitle, $secondary_content);
107
+	}
108 108
 }
109 109
 
110 110
 /**
@@ -115,34 +115,34 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function gd_compat_php_avada()
117 117
 {
118
-    // change widget wrappers
119
-    //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 );
120
-    //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 );
121
-
122
-    // REMOVE BREADCRUMB
123
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
124
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
125
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
126
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
127
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
128
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
129
-
130
-    // REMOVE PAGE TITLES
131
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
132
-    remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10);
133
-    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
134
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
135
-    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
136
-
137
-    // make top section wide
138
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
139
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
140
-    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
141
-    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
142
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
143
-    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
144
-
145
-    //gd_compat_add_top_section_back();
118
+	// change widget wrappers
119
+	//add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 );
120
+	//add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 );
121
+
122
+	// REMOVE BREADCRUMB
123
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
124
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
125
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
126
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
127
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
128
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
129
+
130
+	// REMOVE PAGE TITLES
131
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
132
+	remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10);
133
+	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
134
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
135
+	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
136
+
137
+	// make top section wide
138
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
139
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
140
+	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
141
+	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
142
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
143
+	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
144
+
145
+	//gd_compat_add_top_section_back();
146 146
 
147 147
 }
148 148
 
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 function gd_compat_add_top_section_back()
157 157
 {
158 158
 
159
-    if (is_page_geodir_home() || geodir_is_page('location')) {
160
-        geodir_action_geodir_sidebar_home_top();
161
-    } elseif (geodir_is_page('listing')) {
162
-        geodir_action_geodir_sidebar_listings_top();
163
-    } elseif (geodir_is_page('detail')) {
164
-        geodir_action_geodir_sidebar_detail_top();
165
-    } elseif (geodir_is_page('search')) {
166
-        geodir_action_geodir_sidebar_search_top();
167
-    } elseif (geodir_is_page('author')) {
168
-        geodir_action_geodir_sidebar_author_top();
169
-    }
159
+	if (is_page_geodir_home() || geodir_is_page('location')) {
160
+		geodir_action_geodir_sidebar_home_top();
161
+	} elseif (geodir_is_page('listing')) {
162
+		geodir_action_geodir_sidebar_listings_top();
163
+	} elseif (geodir_is_page('detail')) {
164
+		geodir_action_geodir_sidebar_detail_top();
165
+	} elseif (geodir_is_page('search')) {
166
+		geodir_action_geodir_sidebar_search_top();
167
+	} elseif (geodir_is_page('author')) {
168
+		geodir_action_geodir_sidebar_author_top();
169
+	}
170 170
 
171 171
 
172 172
 }
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
  */
184 184
 function gd_compat_body_class($classes)
185 185
 {
186
-    if (geodir_is_geodir_page()) {
187
-        $classes[] = 'wpgeo-avada';
188
-    } else {
189
-        $classes[] = '';
190
-    }
191
-    return $classes;
186
+	if (geodir_is_geodir_page()) {
187
+		$classes[] = 'wpgeo-avada';
188
+	} else {
189
+		$classes[] = '';
190
+	}
191
+	return $classes;
192 192
 }
193 193
 
194 194
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
  */
203 203
 function geodir_before_widget_compat($var)
204 204
 {
205
-    return '<div id="%1$s" class="geodir-widget %2$s">';
205
+	return '<div id="%1$s" class="geodir-widget %2$s">';
206 206
 }
207 207
 
208 208
 /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_after_widget_compat($var)
217 217
 {
218
-    return '</div>';
218
+	return '</div>';
219 219
 }
220 220
 
221 221
 add_filter('geodir_search_form_class', 'geodir_search_form_class_avada');
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_search_form_class_avada($class)
231 231
 {
232
-    $class .= ' search';
233
-    return $class;
232
+	$class .= ' search';
233
+	return $class;
234 234
 }
235 235
 
236 236
 
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 3 patches
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
             ?>
62 62
 
63 63
             <b style="cursor:pointer;"
64
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
64
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title); ?></b>
65 65
         <?php
66 66
         } else {
67 67
             ?>
68 68
             <b style="cursor:pointer;"
69
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
69
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')'); ?></b>
70 70
         <?php
71 71
         }
72 72
         ?>
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                 ?>
173 173
 
174 174
                 <tr>
175
-                    <td><strong><?php _e('HTML variable name :', 'geodirectory');?></strong></td>
175
+                    <td><strong><?php _e('HTML variable name :', 'geodirectory'); ?></strong></td>
176 176
                     <td align="left">
177 177
                         <input type="text" name="htmlvar_name" id="htmlvar_name"
178 178
                                value="<?php if (isset($field_info->htmlvar_name)) {
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
                                }?>" <?php if ($default) {
181 181
                             echo 'readonly="readonly"';
182 182
                         }?> />
183
-                        <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory');?></span>
184
-                        <br/> <span><?php _e('This should be a unique name', 'geodirectory');?></span>
183
+                        <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory'); ?></span>
184
+                        <br/> <span><?php _e('This should be a unique name', 'geodirectory'); ?></span>
185 185
                         <br/>
186
-                        <span><?php _e('HTML variable name not use spaces, special characters', 'geodirectory');?></span>
186
+                        <span><?php _e('HTML variable name not use spaces, special characters', 'geodirectory'); ?></span>
187 187
                     </td>
188 188
                 </tr>
189 189
             <?php } ?>
@@ -202,19 +202,19 @@  discard block
 block discarded – undo
202 202
 				$default_value = isset($field_info->default_value) ? $field_info->default_value : '';
203 203
 			?>
204 204
 			<tr>
205
-				<td><strong><?php _e('Default value :', 'geodirectory');?></strong></td>
205
+				<td><strong><?php _e('Default value :', 'geodirectory'); ?></strong></td>
206 206
 				<td align="left">
207 207
 				<?php if ($field_type == 'checkbox') { ?>
208 208
 				<select name="default_value" id="default_value">
209 209
 					<option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
210
-					<option value="1" <?php selected(true, (int)$default_value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
210
+					<option value="1" <?php selected(true, (int) $default_value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
211 211
 				</select>
212 212
 				<?php } else if ($field_type == 'email') { ?>
213
-				<input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($default_value);?>" /><br/>
214
-				<span><?php _e('Enter the default value. Ex: [email protected]', 'geodirectory');?></span>
213
+				<input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($default_value); ?>" /><br/>
214
+				<span><?php _e('Enter the default value. Ex: [email protected]', 'geodirectory'); ?></span>
215 215
 				<?php } else { ?>
216
-				<input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($default_value);?>" /><br/>
217
-				<span><?php _e('Enter the default value (for "link" this will be used as the link text)', 'geodirectory');?></span>
216
+				<input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($default_value); ?>" /><br/>
217
+				<span><?php _e('Enter the default value (for "link" this will be used as the link text)', 'geodirectory'); ?></span>
218 218
 				<?php } ?>
219 219
 				</td>
220 220
 			</tr>
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                 </td>
380 380
             </tr>
381 381
 
382
-            <?php if ($field_type == 'text'){?>
382
+            <?php if ($field_type == 'text') {?>
383 383
             <tr>
384 384
                 <td><strong><?php _e('Validation Pattern:', 'geodirectory'); ?></strong></td>
385 385
                 <td align="left">
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
             </tr>
410 410
             <?php } ?>
411 411
 
412
-            <tr <?php echo (!$display_on_listing ? 'style="display:none"' : '') ;?>>
412
+            <tr <?php echo (!$display_on_listing ? 'style="display:none"' : ''); ?>>
413 413
                 <td><strong><?php _e('Show on listing page ? :', 'geodirectory'); ?></strong></td>
414 414
                 <td align="left">
415 415
                     <select name="show_on_listing" id="show_on_listing">
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
                 case 'taxonomy': {
469 469
                     ?>
470 470
                     <tr>
471
-                        <td><strong><?php _e('Select taxonomy:', 'geodirectory');?></strong></td>
471
+                        <td><strong><?php _e('Select taxonomy:', 'geodirectory'); ?></strong></td>
472 472
                         <td align="left">
473 473
                             <select name="htmlvar_name" id="htmlvar_name">
474 474
                                 <?php
@@ -478,40 +478,40 @@  discard block
 block discarded – undo
478 478
                                     ?>
479 479
                                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
480 480
                                         echo 'selected="selected"';
481
-                                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
481
+                                    }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php
482 482
                                 }
483 483
                                 ?>
484 484
                             </select>
485 485
 
486 486
                             <br/>
487
-                            <span><?php _e('Selected taxonomy name use as field name index. ex:-( post_category[gd_placecategory] )', 'geodirectory');?></span>
487
+                            <span><?php _e('Selected taxonomy name use as field name index. ex:-( post_category[gd_placecategory] )', 'geodirectory'); ?></span>
488 488
                         </td>
489 489
                     </tr>
490 490
 
491 491
                     <tr>
492
-                        <td><strong><?php _e('Category display type :', 'geodirectory');?></strong></td>
492
+                        <td><strong><?php _e('Category display type :', 'geodirectory'); ?></strong></td>
493 493
                         <td align="left">
494 494
 
495 495
                             <select name="cat_display_type" id="cat_display_type">
496 496
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
497 497
                                     echo 'selected="selected"';
498
-                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
498
+                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
499 499
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
500 500
                                     echo 'selected="selected"';
501
-                                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
501
+                                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
502 502
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
503 503
                                     echo 'selected="selected"';
504
-                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
504
+                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
505 505
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
506 506
                                     echo 'selected="selected"';
507
-                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
507
+                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
508 508
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
509 509
                                     echo 'selected="selected"';
510
-                                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
510
+                                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
511 511
                             </select>
512 512
 
513 513
                             <br/>
514
-                            <span><?php _e('Show categories list as select,multiselect,checkbox or radio', 'geodirectory');?></span>
514
+                            <span><?php _e('Show categories list as select,multiselect,checkbox or radio', 'geodirectory'); ?></span>
515 515
                         </td>
516 516
                     </tr>
517 517
                 <?php } // end of additional field for taxonomy field type
@@ -532,92 +532,92 @@  discard block
 block discarded – undo
532 532
                     do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
533 533
 
534 534
                     <tr>
535
-                        <td><strong><?php _e('Display zip/post code :', 'geodirectory');?></strong></td>
535
+                        <td><strong><?php _e('Display zip/post code :', 'geodirectory'); ?></strong></td>
536 536
                         <td align="left">
537 537
                             <input type="checkbox" name="extra[show_zip]" id="show_zip"
538 538
                                    value="1" <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
539 539
                                 echo 'checked="checked"';
540 540
                             }?>/>
541
-                            <span><?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?></span>
541
+                            <span><?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?></span>
542 542
                         </td>
543 543
                     </tr>
544 544
 
545 545
                     <tr>
546
-                        <td><strong><?php _e('Zip/Post code label :', 'geodirectory');?></strong></td>
546
+                        <td><strong><?php _e('Zip/Post code label :', 'geodirectory'); ?></strong></td>
547 547
                         <td align="left">
548 548
                             <input type="text" name="extra[zip_lable]" id="zip_lable"
549 549
                                    value="<?php if (isset($address['zip_lable'])) {
550 550
                                        echo esc_attr($address['zip_lable']);
551 551
                                    }?>"/>
552
-                            <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory');?></span>
552
+                            <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?></span>
553 553
                         </td>
554 554
                     </tr>
555 555
 
556 556
                     <tr style="display:none;">
557
-                        <td><strong><?php _e('Display map :', 'geodirectory');?></strong></td>
557
+                        <td><strong><?php _e('Display map :', 'geodirectory'); ?></strong></td>
558 558
                         <td align="left">
559 559
                             <input type="checkbox" name="extra[show_map]" id="show_map"
560 560
                                    value="1" <?php if (isset($address['show_map']) && $address['show_map'] == '1') {
561 561
                                 echo 'checked="checked"';
562 562
                             }?>/>
563
-                            <span><?php _e('Select if you want to `set address on map` field in address section.', 'geodirectory');?></span>
563
+                            <span><?php _e('Select if you want to `set address on map` field in address section.', 'geodirectory'); ?></span>
564 564
                         </td>
565 565
                     </tr>
566 566
 
567 567
                     <tr>
568
-                        <td><strong><?php _e('Map button label :', 'geodirectory');?></strong></td>
568
+                        <td><strong><?php _e('Map button label :', 'geodirectory'); ?></strong></td>
569 569
                         <td align="left">
570 570
                             <input type="text" name="extra[map_lable]" id="map_lable"
571 571
                                    value="<?php if (isset($address['map_lable'])) {
572 572
                                        echo esc_attr($address['map_lable']);
573 573
                                    }?>"/>
574
-                            <span><?php _e('Enter text for  `set address on map` button in address section.', 'geodirectory');?></span>
574
+                            <span><?php _e('Enter text for  `set address on map` button in address section.', 'geodirectory'); ?></span>
575 575
                         </td>
576 576
                     </tr>
577 577
 
578 578
                     <tr>
579
-                        <td><strong><?php _e('Use user zoom level:', 'geodirectory');?></strong></td>
579
+                        <td><strong><?php _e('Use user zoom level:', 'geodirectory'); ?></strong></td>
580 580
                         <td align="left">
581 581
                             <input type="checkbox" name="extra[show_mapzoom]" id="show_mapzoom"
582 582
                                    value="1" <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
583 583
                                 echo 'checked="checked"';
584 584
                             }?>/>
585
-                            <span><?php _e('Select if you want to use the user defined map zoom level.', 'geodirectory');?></span>
585
+                            <span><?php _e('Select if you want to use the user defined map zoom level.', 'geodirectory'); ?></span>
586 586
                         </td>
587 587
                     </tr>
588 588
 
589 589
                     <tr>
590
-                        <td><strong><?php _e('Display map view:', 'geodirectory');?></strong></td>
590
+                        <td><strong><?php _e('Display map view:', 'geodirectory'); ?></strong></td>
591 591
                         <td align="left">
592 592
                             <input type="checkbox" name="extra[show_mapview]" id="show_mapview"
593 593
                                    value="1" <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
594 594
                                 echo 'checked="checked"';
595 595
                             }?>/>
596
-                            <span><?php _e('Select if you want to `set default map` options in address section.', 'geodirectory');?></span>
596
+                            <span><?php _e('Select if you want to `set default map` options in address section.', 'geodirectory'); ?></span>
597 597
                         </td>
598 598
                     </tr>
599 599
 
600 600
 
601 601
                     <tr>
602
-                        <td><strong><?php _e('Map view label :', 'geodirectory');?></strong></td>
602
+                        <td><strong><?php _e('Map view label :', 'geodirectory'); ?></strong></td>
603 603
                         <td align="left">
604 604
                             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
605 605
                                    value="<?php if (isset($address['mapview_lable'])) {
606 606
                                        echo esc_attr($address['mapview_lable']);
607 607
                                    }?>"/>
608
-                            <span><?php _e('Enter mapview field label in address section.', 'geodirectory');?></span>
608
+                            <span><?php _e('Enter mapview field label in address section.', 'geodirectory'); ?></span>
609 609
                         </td>
610 610
                     </tr>
611 611
                     <tr>
612 612
                         <td>
613
-                            <strong><?php _e('Show latitude and longitude from front-end :', 'geodirectory');?></strong>
613
+                            <strong><?php _e('Show latitude and longitude from front-end :', 'geodirectory'); ?></strong>
614 614
                         </td>
615 615
                         <td align="left">
616 616
                             <input type="checkbox" name="extra[show_latlng]" id="show_latlng"
617 617
                                    value="1" <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
618 618
                                 echo 'checked="checked"';
619 619
                             }?>/>
620
-                            <span><?php _e('Select if you want to show latitude and logatude fields in address section from front-end.', 'geodirectory');?></span>
620
+                            <span><?php _e('Select if you want to show latitude and logatude fields in address section from front-end.', 'geodirectory'); ?></span>
621 621
                         </td>
622 622
                     </tr>
623 623
                 <?php } // end of extra fields for address field type
@@ -629,41 +629,41 @@  discard block
 block discarded – undo
629 629
 
630 630
                         ?>
631 631
                         <tr>
632
-                            <td><strong><?php _e('Multiselect display type :', 'geodirectory');?></strong></td>
632
+                            <td><strong><?php _e('Multiselect display type :', 'geodirectory'); ?></strong></td>
633 633
                             <td align="left">
634 634
 
635 635
                                 <select name="multi_display_type" id="multi_display_type">
636 636
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
637 637
                                         echo 'selected="selected"';
638
-                                    }?> value="select"><?php _e('Select', 'geodirectory');?></option>
638
+                                    }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
639 639
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
640 640
                                         echo 'selected="selected"';
641
-                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
641
+                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
642 642
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
643 643
                                         echo 'selected="selected"';
644
-                                    }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
644
+                                    }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
645 645
                                 </select>
646 646
 
647 647
                                 <br/>
648
-                                <span><?php _e('Show multiselect list as multiselect,checkbox or radio', 'geodirectory');?></span>
648
+                                <span><?php _e('Show multiselect list as multiselect,checkbox or radio', 'geodirectory'); ?></span>
649 649
                             </td>
650 650
                         </tr>
651 651
                     <?php
652 652
                     }
653 653
                     ?>
654 654
                     <tr>
655
-                        <td><strong><?php _e('Option Values :', 'geodirectory');?></strong></td>
655
+                        <td><strong><?php _e('Option Values :', 'geodirectory'); ?></strong></td>
656 656
                         <td align="left">
657 657
                             <input type="text" name="option_values" id="option_values"
658 658
                                    value="<?php if (isset($field_info->option_values)) {
659 659
                                        echo esc_attr($field_info->option_values);
660 660
                                    }?>"/>
661 661
                             <br/>
662
-                            <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
662
+                            <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
663 663
                             <br/>
664
-                            <span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
664
+                            <span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
665 665
                             <br/>
666
-                            <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
666
+                            <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
667 667
                             <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
668 668
                                 <br/>
669 669
                                 <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
@@ -681,12 +681,12 @@  discard block
 block discarded – undo
681 681
                     }
682 682
                     ?>
683 683
                     <tr>
684
-                        <td><strong><?php _e('Date Format :', 'geodirectory');?></strong></td>
684
+                        <td><strong><?php _e('Date Format :', 'geodirectory'); ?></strong></td>
685 685
                         <td align="left" style="overflow:inherit;">
686 686
                             <input type="text" name="extra[date_format]" id="date_format"
687 687
                                    value="<?php if (isset($extra['date_format'])) {
688 688
                                        echo esc_attr($extra['date_format']);
689
-                                   }else{echo "mm/dd/yy";}?>"/>
689
+                                   } else {echo "mm/dd/yy"; }?>"/>
690 690
 
691 691
                             <div style="position:relative; cursor:pointer;">
692 692
                         <span onclick="jQuery('#show_dateformat').toggle();">
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
                             </div>
766 766
                             <br/>
767
-                            <span><?php _e('Enter the date format.', 'geodirectory');?></span>
767
+                            <span><?php _e('Enter the date format.', 'geodirectory'); ?></span>
768 768
                         </td>
769 769
                     </tr>
770 770
                 <?php
@@ -777,20 +777,20 @@  discard block
 block discarded – undo
777 777
 					$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
778 778
 					?>
779 779
 					<tr>
780
-					  <td><strong><?php _e('Allowed file types:', 'geodirectory');?></strong></td>
780
+					  <td><strong><?php _e('Allowed file types:', 'geodirectory'); ?></strong></td>
781 781
 						<td align="left">
782 782
 							<select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">
783
-								<option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
784
-								<?php foreach ( $allowed_file_types as $format => $types ) { ?>
785
-								<optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
786
-									<?php foreach ( $types as $ext => $type ) { ?>
787
-									<option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>
783
+								<option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
784
+								<?php foreach ($allowed_file_types as $format => $types) { ?>
785
+								<optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
786
+									<?php foreach ($types as $ext => $type) { ?>
787
+									<option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.' . $ext; ?></option>
788 788
 									<?php } ?>
789 789
 								</optgroup>
790 790
 								<?php } ?>
791 791
 							</select>			
792 792
 							<br />
793
-							<span><?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', GEODIRPAYMENT_TEXTDOMAIN);?></span>				
793
+							<span><?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', GEODIRPAYMENT_TEXTDOMAIN); ?></span>				
794 794
 						</td>
795 795
 					</tr>
796 796
 					<?php 
@@ -805,28 +805,28 @@  discard block
 block discarded – undo
805 805
                 </tr>
806 806
 
807 807
                 <tr>
808
-                    <td><strong><?php _e('Upload icon:', 'geodirectory');?></strong></td>
808
+                    <td><strong><?php _e('Upload icon:', 'geodirectory'); ?></strong></td>
809 809
                     <td align="left">
810 810
                         <input type="text" name="field_icon" id="field_icon"
811 811
                                value="<?php if (isset($field_info->field_icon)) {
812 812
                                    echo $field_info->field_icon;
813 813
                                }?>"/>
814 814
                     <span>
815
-                        <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
815
+                        <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
816 816
                     </span>
817 817
                     </td>
818 818
                     </td>
819 819
                 </tr>
820 820
 
821 821
                 <tr>
822
-                    <td><strong><?php _e('Css class:', 'geodirectory');?></strong></td>
822
+                    <td><strong><?php _e('Css class:', 'geodirectory'); ?></strong></td>
823 823
                     <td align="left">
824 824
                         <input type="text" name="css_class" id="css_class"
825 825
                                value="<?php if (isset($field_info->css_class)) {
826 826
                                    echo esc_attr($field_info->css_class);
827 827
                                }?>"/>
828 828
                     <span>
829
-                        <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
829
+                        <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
830 830
                     </span>
831 831
                     </td>
832 832
                     </td>
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
                      * @since 1.0.0
889 889
                      * @param object $field_info The current fields info.
890 890
                      */
891
-                    do_action('geodir_advance_custom_fields', $field_info);?>
891
+                    do_action('geodir_advance_custom_fields', $field_info); ?>
892 892
 
893 893
                     <?php /*if(!in_array($field_type,array() )){?>
894 894
 				<tr>
@@ -907,10 +907,10 @@  discard block
 block discarded – undo
907 907
                 <td>&nbsp;</td>
908 908
                 <td align="left">
909 909
 
910
-                    <input type="button" class="button" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
910
+                    <input type="button" class="button" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
911 911
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
912 912
                     <?php if (!$default): ?>
913
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
913
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
914 914
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
915 915
                                                             class="button_n"/></a>
916 916
                     <?php endif; ?>
Please login to merge, or discard this patch.
Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin custom field form
4
- *
5
- * @since 1.0.0
6
- *
7
- * @package GeoDirectory
8
- */
3
+	 * Admin custom field form
4
+	 *
5
+	 * @since 1.0.0
6
+	 *
7
+	 * @package GeoDirectory
8
+	 */
9 9
  
10 10
 /**
11 11
  * Displays the custom field form content.
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 global $post_type;
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21
-    $post_type = sanitize_text_field($_REQUEST['listing_type']);
21
+	$post_type = sanitize_text_field($_REQUEST['listing_type']);
22 22
 } else
23
-    $post_type = $field_info->post_type;
23
+	$post_type = $field_info->post_type;
24 24
 
25 25
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
26 26
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 $field_admin_title = '';
30 30
 if (isset($field_info->admin_title))
31
-    $field_admin_title = $field_info->admin_title;
31
+	$field_admin_title = $field_info->admin_title;
32 32
 
33 33
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
34 34
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
48 48
         <?php
49 49
 
50
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
51
-        ?>
50
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
51
+		?>
52 52
 
53 53
         <?php if ($default): ?>
54 54
             <div title="<?php _e('Drag and drop to sort', 'geodirectory'); ?>" class="handlediv move"></div>
@@ -57,42 +57,42 @@  discard block
 block discarded – undo
57 57
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
58 58
                  class="handlediv close"></div>
59 59
         <?php endif;
60
-        if ($field_type == 'fieldset') {
61
-            ?>
60
+		if ($field_type == 'fieldset') {
61
+			?>
62 62
 
63 63
             <b style="cursor:pointer;"
64 64
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
65 65
         <?php
66
-        } else {
67
-            ?>
66
+		} else {
67
+			?>
68 68
             <b style="cursor:pointer;"
69 69
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
70 70
         <?php
71
-        }
72
-        ?>
71
+		}
72
+		?>
73 73
     </div>
74 74
 
75 75
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
76 76
          style="display:<?php if ($field_ins_upd == 'submit') {
77
-             echo 'block;';
78
-         } else {
79
-             echo 'none;';
80
-         } ?>">
77
+			 echo 'block;';
78
+		 } else {
79
+			 echo 'none;';
80
+		 } ?>">
81 81
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
82 82
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
83 83
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
84 84
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
85 85
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
86
-            echo $field_info->data_type;
87
-        } ?>"/>
86
+			echo $field_info->data_type;
87
+		} ?>"/>
88 88
         <input type="hidden" name="is_active" id="is_active" value="1"/>
89 89
 
90 90
         <table class="widefat post fixed" border="0" style="width:100%;">
91 91
             <?php if ($field_type != 'text' || $default) { ?>
92 92
 
93 93
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
94
-                    echo esc_attr($field_info->data_type);
95
-                } ?>"/>
94
+					echo esc_attr($field_info->data_type);
95
+				} ?>"/>
96 96
 
97 97
             <?php } else { ?>
98 98
 
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
                                 onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
105 105
                             <option
106 106
                                 value="VARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
107
-                                echo 'selected="selected"';
108
-                            } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
107
+								echo 'selected="selected"';
108
+							} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
109 109
                             <option
110 110
                                 value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
111
-                                echo 'selected="selected"';
112
-                            } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
111
+								echo 'selected="selected"';
112
+							} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
113 113
                             <option
114 114
                                 value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
115
-                                echo 'selected="selected"';
116
-                            } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
115
+								echo 'selected="selected"';
116
+							} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
117 117
                         </select>
118 118
                         <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
119 119
 
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
                         <select name="decimal_point" id="decimal_point">
128 128
                             <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
129 129
                             <?php for ($i = 1; $i <= 10; $i++) {
130
-                                $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
131
-                                $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
130
+								$decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
131
+								$selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
132 132
                                 <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
133 133
                             <?php } ?>
134 134
                         </select>
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
                 <td align="left">
144 144
                     <input type="text" name="admin_title" id="admin_title"
145 145
                            value="<?php if (isset($field_info->admin_title)) {
146
-                               echo esc_attr($field_info->admin_title);
147
-                           } ?>"/>
146
+							   echo esc_attr($field_info->admin_title);
147
+						   } ?>"/>
148 148
                     <br/><span><?php _e('Personal comment, it would not be displayed anywhere except in custom field settings', 'geodirectory'); ?></span>
149 149
                 </td>
150 150
             </tr>
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
                 <td align="left">
154 154
                     <input type="text" name="site_title" id="site_title"
155 155
                            value="<?php if (isset($field_info->site_title)) {
156
-                               echo esc_attr($field_info->site_title);
157
-                           } ?>"/>
156
+							   echo esc_attr($field_info->site_title);
157
+						   } ?>"/>
158 158
                     <br/><span><?php _e('Section title which you wish to display in frontend', 'geodirectory'); ?></span>
159 159
                 </td>
160 160
             </tr>
@@ -163,23 +163,23 @@  discard block
 block discarded – undo
163 163
                 <td align="left">
164 164
                     <input type="text" name="admin_desc" id="admin_desc"
165 165
                            value="<?php if (isset($field_info->admin_desc)) {
166
-                               echo esc_attr($field_info->admin_desc);
167
-                           } ?>"/>
166
+							   echo esc_attr($field_info->admin_desc);
167
+						   } ?>"/>
168 168
                     <br/><span><?php _e('Section description which will appear in frontend', 'geodirectory'); ?></span>
169 169
                 </td>
170 170
             </tr>
171 171
             <?php if ($field_type != 'fieldset' && $field_type != 'taxonomy') {
172
-                ?>
172
+				?>
173 173
 
174 174
                 <tr>
175 175
                     <td><strong><?php _e('HTML variable name :', 'geodirectory');?></strong></td>
176 176
                     <td align="left">
177 177
                         <input type="text" name="htmlvar_name" id="htmlvar_name"
178 178
                                value="<?php if (isset($field_info->htmlvar_name)) {
179
-                                   echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1);
180
-                               }?>" <?php if ($default) {
181
-                            echo 'readonly="readonly"';
182
-                        }?> />
179
+								   echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1);
180
+							   }?>" <?php if ($default) {
181
+							echo 'readonly="readonly"';
182
+						}?> />
183 183
                         <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory');?></span>
184 184
                         <br/> <span><?php _e('This should be a unique name', 'geodirectory');?></span>
185 185
                         <br/>
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
                 <td><strong><?php _e('Admin label :', 'geodirectory'); ?></strong></td>
192 192
                 <td align="left"><input type="text" name="clabels" id="clabels"
193 193
                                         value="<?php if (isset($field_info->clabels)) {
194
-                                            echo esc_attr($field_info->clabels);
195
-                                        } ?>"/>
194
+											echo esc_attr($field_info->clabels);
195
+										} ?>"/>
196 196
                     <br/>
197 197
                     <span><?php _e('Section Title which will appear in backend', 'geodirectory'); ?></span>
198 198
                 </td>
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
                 <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
224 224
                 <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
225 225
                                         value="<?php if (isset($field_info->sort_order)) {
226
-                                            echo esc_attr($field_info->sort_order);
227
-                                        } ?>"/>
226
+											echo esc_attr($field_info->sort_order);
227
+										} ?>"/>
228 228
                     <br/>
229 229
                     <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
230 230
                 </td>
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
                 <td align="left">
236 236
                     <select name="is_default" id="is_default">
237 237
                         <option value="0" <?php if (!isset($field_info->is_default) || $field_info->is_default == '0') {
238
-                            echo 'selected="selected"';
239
-                        } ?>><?php _e('No', 'geodirectory'); ?></option>
238
+							echo 'selected="selected"';
239
+						} ?>><?php _e('No', 'geodirectory'); ?></option>
240 240
                         <option value="1" <?php if (isset($field_info->is_default) && $field_info->is_default == '1') {
241
-                            echo 'selected="selected"';
242
-                        } ?>><?php _e('Yes', 'geodirectory'); ?></option>
241
+							echo 'selected="selected"';
242
+						} ?>><?php _e('Yes', 'geodirectory'); ?></option>
243 243
                     </select>
244 244
                     <br/>
245 245
                     <span><?php _e('Select yes or no. If no is selected then the field will be displayed as main form field or additional field', 'geodirectory'); ?></span>
@@ -254,13 +254,13 @@  discard block
 block discarded – undo
254 254
                 <td>
255 255
 
256 256
                     <?php
257
-                    $selected = '';
258
-                    if (isset($field_info->extra_fields))
259
-                        $advanced_editor = unserialize($field_info->extra_fields);
257
+					$selected = '';
258
+					if (isset($field_info->extra_fields))
259
+						$advanced_editor = unserialize($field_info->extra_fields);
260 260
 
261
-                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
262
-                        $selected = 'checked="checked"';
263
-                    ?>
261
+					if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
262
+						$selected = 'checked="checked"';
263
+					?>
264 264
 
265 265
                     <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
266 266
                            value="1" <?php echo $selected; ?>/>
@@ -268,42 +268,42 @@  discard block
 block discarded – undo
268 268
                 </td>
269 269
 
270 270
                 </tr><?php
271
-            } ?>
271
+			} ?>
272 272
 
273 273
             <?php
274 274
 
275
-            $pricearr = array();
276
-            if (isset($field_info->packages) && $field_info->packages != '') {
277
-                $pricearr = explode(',', trim($field_info->packages, ','));
278
-            } else {
279
-                $package_info = array();
275
+			$pricearr = array();
276
+			if (isset($field_info->packages) && $field_info->packages != '') {
277
+				$pricearr = explode(',', trim($field_info->packages, ','));
278
+			} else {
279
+				$package_info = array();
280 280
 
281
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
282
-                $pricearr[] = $package_info->pid;
283
-            }
281
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
282
+				$pricearr[] = $package_info->pid;
283
+			}
284 284
 
285
-            ob_start()
286
-            ?>
285
+			ob_start()
286
+			?>
287 287
 
288 288
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
289 289
                 <?php
290
-                if (!empty($pricearr)) {
291
-                    foreach ($pricearr as $val) {
292
-                        ?>
290
+				if (!empty($pricearr)) {
291
+					foreach ($pricearr as $val) {
292
+						?>
293 293
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
294
-                    }
295
-                }
296
-                ?>
294
+					}
295
+				}
296
+				?>
297 297
             </select>
298 298
 
299 299
             <?php
300
-            $html = ob_get_clean();
300
+			$html = ob_get_clean();
301 301
 
302 302
 			/**
303 303
 			 * Filter the price packages list.
304 304
 			 *
305 305
 			 * Filter the price packages list in custom field form in admin
306
-             * custom fields settings.
306
+			 * custom fields settings.
307 307
 			 *
308 308
 			 * @since 1.0.0
309 309
 			 *
@@ -312,26 +312,26 @@  discard block
 block discarded – undo
312 312
 			 */
313 313
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
314 314
 
315
-            ?>
315
+			?>
316 316
 
317 317
             <tr>
318 318
                 <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
319 319
                 <td align="left">
320 320
                     <select name="is_active" id="is_active">
321 321
                         <option value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
322
-                            echo 'selected="selected"';
323
-                        } ?>><?php _e('Yes', 'geodirectory'); ?></option>
322
+							echo 'selected="selected"';
323
+						} ?>><?php _e('Yes', 'geodirectory'); ?></option>
324 324
                         <option
325 325
                             value="0" <?php if ((isset($field_info->is_active) && $field_info->is_active == '0') || !isset($field_info->is_active)) {
326
-                            echo 'selected="selected"';
327
-                        } ?>><?php _e('No', 'geodirectory'); ?></option>
326
+							echo 'selected="selected"';
327
+						} ?>><?php _e('No', 'geodirectory'); ?></option>
328 328
                     </select>
329 329
                     <br/>
330 330
                     <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere', 'geodirectory'); ?></span>
331 331
                 </td>
332 332
             </tr>
333 333
             <?php if (!$default) { /* field for admin use only */
334
-                $for_admin_use = isset($field_info->for_admin_use) && $field_info->for_admin_use == '1' ? true : false; ?>
334
+				$for_admin_use = isset($field_info->for_admin_use) && $field_info->for_admin_use == '1' ? true : false; ?>
335 335
                 <tr>
336 336
                     <td><strong><?php _e('For admin use only? :', 'geodirectory'); ?></strong></td>
337 337
                     <td align="left">
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
                         <select name="is_required" id="is_required">
354 354
                             <option
355 355
                                 value="1" <?php if (isset($field_info->is_required) && $field_info->is_required == '1') {
356
-                                echo 'selected="selected"';
357
-                            } ?>><?php _e('Yes', 'geodirectory'); ?></option>
356
+								echo 'selected="selected"';
357
+							} ?>><?php _e('Yes', 'geodirectory'); ?></option>
358 358
                             <option
359 359
                                 value="0" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {
360
-                                echo 'selected="selected"';
361
-                            } ?>><?php _e('No', 'geodirectory'); ?></option>
360
+								echo 'selected="selected"';
361
+							} ?>><?php _e('No', 'geodirectory'); ?></option>
362 362
                         </select>
363 363
                         <br/> <span><?php _e('Select yes to set field as required', 'geodirectory'); ?></span>
364 364
                     </td>
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
                 <td align="left">
371 371
                     <input type="text" name="required_msg" id="required_msg"
372 372
                            value="<?php if (isset($field_info->required_msg)) {
373
-                               echo esc_attr($field_info->required_msg);
374
-                           } ?>"/>
373
+							   echo esc_attr($field_info->required_msg);
374
+						   } ?>"/>
375 375
                     <span>
376 376
                         <?php _e('Enter text for error message if field required and have not full fill requirement.', 'geodirectory'); ?>
377 377
                     </span>
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
                 <td align="left">
386 386
                     <input type="text" name="validation_pattern" id="validation_pattern"
387 387
                            value="<?php if (isset($field_info->validation_pattern)) {
388
-                               echo esc_attr($field_info->validation_pattern);
389
-                           } ?>"/>
388
+							   echo esc_attr($field_info->validation_pattern);
389
+						   } ?>"/>
390 390
                     <span>
391 391
                         <?php _e('Enter regex expression for HTML5 pattern validation.', 'geodirectory'); ?>
392 392
                     </span>
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
                 <td align="left">
400 400
                     <input type="text" name="validation_msg" id="validation_msg"
401 401
                            value="<?php if (isset($field_info->validation_msg)) {
402
-                               echo esc_attr($field_info->validation_msg);
403
-                           } ?>"/>
402
+							   echo esc_attr($field_info->validation_msg);
403
+						   } ?>"/>
404 404
                     <span>
405 405
                         <?php _e('Enter a extra validation message to show to the user if validation fails.', 'geodirectory'); ?>
406 406
                     </span>
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
                     <select name="show_on_listing" id="show_on_listing">
416 416
                         <option
417 417
                             value="1" <?php if (isset($field_info->show_on_listing) && $field_info->show_on_listing == '1') {
418
-                            echo 'selected="selected"';
419
-                        } ?>><?php _e('Yes', 'geodirectory'); ?></option>
418
+							echo 'selected="selected"';
419
+						} ?>><?php _e('Yes', 'geodirectory'); ?></option>
420 420
                         <option
421 421
                             value="0" <?php if ((isset($field_info->show_on_listing) && ($field_info->show_on_listing == '0' || $field_info->show_on_listing == '')) || !isset($field_info->show_on_listing)) {
422
-                            echo 'selected="selected"';
423
-                        } ?>><?php _e('No', 'geodirectory'); ?></option>
422
+							echo 'selected="selected"';
423
+						} ?>><?php _e('No', 'geodirectory'); ?></option>
424 424
                     </select>
425 425
                     <br/> <span><?php _e('Want to show this on listing page ?', 'geodirectory'); ?></span>
426 426
                 </td>
@@ -432,12 +432,12 @@  discard block
 block discarded – undo
432 432
                     <select name="show_on_detail" id="show_on_detail">
433 433
                         <option
434 434
                             value="1" <?php if (isset($field_info->show_on_detail) && $field_info->show_on_detail == '1') {
435
-                            echo 'selected="selected"';
436
-                        } ?>><?php _e('Yes', 'geodirectory'); ?></option>
435
+							echo 'selected="selected"';
436
+						} ?>><?php _e('Yes', 'geodirectory'); ?></option>
437 437
                         <option
438 438
                             value="0" <?php if ((isset($field_info->show_on_detail) && ($field_info->show_on_detail == '0' || $field_info->show_on_detail == '')) || !isset($field_info->show_on_detail)) {
439
-                            echo 'selected="selected"';
440
-                        } ?>><?php _e('No', 'geodirectory'); ?></option>
439
+							echo 'selected="selected"';
440
+						} ?>><?php _e('No', 'geodirectory'); ?></option>
441 441
                     </select>
442 442
                     <br/>
443 443
                     <span><?php _e('Want to show this in More Info tab on detail page?', 'geodirectory'); ?></span>
@@ -450,12 +450,12 @@  discard block
 block discarded – undo
450 450
                         <select name="show_as_tab" id="show_as_tab">
451 451
                             <option
452 452
                                 value="1" <?php if (isset($field_info->show_as_tab) && $field_info->show_as_tab == '1') {
453
-                                echo 'selected="selected"';
454
-                            } ?>><?php _e('Yes', 'geodirectory'); ?></option>
453
+								echo 'selected="selected"';
454
+							} ?>><?php _e('Yes', 'geodirectory'); ?></option>
455 455
                             <option
456 456
                                 value="0" <?php if ((isset($field_info->show_as_tab) && ($field_info->show_as_tab == '0' || $field_info->show_as_tab == '')) || !isset($field_info->show_as_tab)) {
457
-                                echo 'selected="selected"';
458
-                            } ?>><?php _e('No', 'geodirectory'); ?></option>
457
+								echo 'selected="selected"';
458
+							} ?>><?php _e('No', 'geodirectory'); ?></option>
459 459
                         </select>
460 460
                         <br/><span><?php _e('Want to display this as a tab on detail page? If "Yes" then "Show on detail page?" must be Yes.', 'geodirectory'); ?></span>
461 461
                     </td>
@@ -464,23 +464,23 @@  discard block
 block discarded – undo
464 464
 
465 465
             <?php
466 466
 
467
-            switch ($field_type):
468
-                case 'taxonomy': {
469
-                    ?>
467
+			switch ($field_type):
468
+				case 'taxonomy': {
469
+					?>
470 470
                     <tr>
471 471
                         <td><strong><?php _e('Select taxonomy:', 'geodirectory');?></strong></td>
472 472
                         <td align="left">
473 473
                             <select name="htmlvar_name" id="htmlvar_name">
474 474
                                 <?php
475
-                                $gd_taxonomy = geodir_get_taxonomies($post_type);
475
+								$gd_taxonomy = geodir_get_taxonomies($post_type);
476 476
 
477
-                                foreach ($gd_taxonomy as $gd_tax) {
478
-                                    ?>
477
+								foreach ($gd_taxonomy as $gd_tax) {
478
+									?>
479 479
                                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
480
-                                        echo 'selected="selected"';
481
-                                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
482
-                                }
483
-                                ?>
480
+										echo 'selected="selected"';
481
+									}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
482
+								}
483
+								?>
484 484
                             </select>
485 485
 
486 486
                             <br/>
@@ -494,20 +494,20 @@  discard block
 block discarded – undo
494 494
 
495 495
                             <select name="cat_display_type" id="cat_display_type">
496 496
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
497
-                                    echo 'selected="selected"';
498
-                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
497
+									echo 'selected="selected"';
498
+								}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
499 499
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
500
-                                    echo 'selected="selected"';
501
-                                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
500
+									echo 'selected="selected"';
501
+								}?> value="select"><?php _e('Select', 'geodirectory');?></option>
502 502
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
503
-                                    echo 'selected="selected"';
504
-                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
503
+									echo 'selected="selected"';
504
+								}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
505 505
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
506
-                                    echo 'selected="selected"';
507
-                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
506
+									echo 'selected="selected"';
507
+								}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
508 508
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
509
-                                    echo 'selected="selected"';
510
-                                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
509
+									echo 'selected="selected"';
510
+								}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
511 511
                             </select>
512 512
 
513 513
                             <br/>
@@ -515,29 +515,29 @@  discard block
 block discarded – undo
515 515
                         </td>
516 516
                     </tr>
517 517
                 <?php } // end of additional field for taxonomy field type
518
-                    break;
519
-                case 'address': {
520
-                    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
521
-                        $address = unserialize($field_info->extra_fields);
522
-                    }
523
-                    ?>
518
+					break;
519
+				case 'address': {
520
+					if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
521
+						$address = unserialize($field_info->extra_fields);
522
+					}
523
+					?>
524 524
                     <?php
525
-                    /**
526
-                     * Called on the add custom fields settings page before the address field is output.
527
-                     *
528
-                     * @since 1.0.0
529
-                     * @param array $address The address settings array.
530
-                     * @param object $field_info Extra fileds info.
531
-                     */
532
-                    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
525
+					/**
526
+					 * Called on the add custom fields settings page before the address field is output.
527
+					 *
528
+					 * @since 1.0.0
529
+					 * @param array $address The address settings array.
530
+					 * @param object $field_info Extra fileds info.
531
+					 */
532
+					do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
533 533
 
534 534
                     <tr>
535 535
                         <td><strong><?php _e('Display zip/post code :', 'geodirectory');?></strong></td>
536 536
                         <td align="left">
537 537
                             <input type="checkbox" name="extra[show_zip]" id="show_zip"
538 538
                                    value="1" <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
539
-                                echo 'checked="checked"';
540
-                            }?>/>
539
+								echo 'checked="checked"';
540
+							}?>/>
541 541
                             <span><?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?></span>
542 542
                         </td>
543 543
                     </tr>
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
                         <td align="left">
548 548
                             <input type="text" name="extra[zip_lable]" id="zip_lable"
549 549
                                    value="<?php if (isset($address['zip_lable'])) {
550
-                                       echo esc_attr($address['zip_lable']);
551
-                                   }?>"/>
550
+									   echo esc_attr($address['zip_lable']);
551
+								   }?>"/>
552 552
                             <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory');?></span>
553 553
                         </td>
554 554
                     </tr>
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
                         <td align="left">
559 559
                             <input type="checkbox" name="extra[show_map]" id="show_map"
560 560
                                    value="1" <?php if (isset($address['show_map']) && $address['show_map'] == '1') {
561
-                                echo 'checked="checked"';
562
-                            }?>/>
561
+								echo 'checked="checked"';
562
+							}?>/>
563 563
                             <span><?php _e('Select if you want to `set address on map` field in address section.', 'geodirectory');?></span>
564 564
                         </td>
565 565
                     </tr>
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
                         <td align="left">
570 570
                             <input type="text" name="extra[map_lable]" id="map_lable"
571 571
                                    value="<?php if (isset($address['map_lable'])) {
572
-                                       echo esc_attr($address['map_lable']);
573
-                                   }?>"/>
572
+									   echo esc_attr($address['map_lable']);
573
+								   }?>"/>
574 574
                             <span><?php _e('Enter text for  `set address on map` button in address section.', 'geodirectory');?></span>
575 575
                         </td>
576 576
                     </tr>
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
                         <td align="left">
581 581
                             <input type="checkbox" name="extra[show_mapzoom]" id="show_mapzoom"
582 582
                                    value="1" <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
583
-                                echo 'checked="checked"';
584
-                            }?>/>
583
+								echo 'checked="checked"';
584
+							}?>/>
585 585
                             <span><?php _e('Select if you want to use the user defined map zoom level.', 'geodirectory');?></span>
586 586
                         </td>
587 587
                     </tr>
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
                         <td align="left">
592 592
                             <input type="checkbox" name="extra[show_mapview]" id="show_mapview"
593 593
                                    value="1" <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
594
-                                echo 'checked="checked"';
595
-                            }?>/>
594
+								echo 'checked="checked"';
595
+							}?>/>
596 596
                             <span><?php _e('Select if you want to `set default map` options in address section.', 'geodirectory');?></span>
597 597
                         </td>
598 598
                     </tr>
@@ -603,8 +603,8 @@  discard block
 block discarded – undo
603 603
                         <td align="left">
604 604
                             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
605 605
                                    value="<?php if (isset($address['mapview_lable'])) {
606
-                                       echo esc_attr($address['mapview_lable']);
607
-                                   }?>"/>
606
+									   echo esc_attr($address['mapview_lable']);
607
+								   }?>"/>
608 608
                             <span><?php _e('Enter mapview field label in address section.', 'geodirectory');?></span>
609 609
                         </td>
610 610
                     </tr>
@@ -615,33 +615,33 @@  discard block
 block discarded – undo
615 615
                         <td align="left">
616 616
                             <input type="checkbox" name="extra[show_latlng]" id="show_latlng"
617 617
                                    value="1" <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
618
-                                echo 'checked="checked"';
619
-                            }?>/>
618
+								echo 'checked="checked"';
619
+							}?>/>
620 620
                             <span><?php _e('Select if you want to show latitude and logatude fields in address section from front-end.', 'geodirectory');?></span>
621 621
                         </td>
622 622
                     </tr>
623 623
                 <?php } // end of extra fields for address field type
624
-                    break;
625
-                case 'select':
626
-                case 'multiselect':
627
-                case 'radio' : {
628
-                    if ($field_type == 'multiselect') {
624
+					break;
625
+				case 'select':
626
+				case 'multiselect':
627
+				case 'radio' : {
628
+					if ($field_type == 'multiselect') {
629 629
 
630
-                        ?>
630
+						?>
631 631
                         <tr>
632 632
                             <td><strong><?php _e('Multiselect display type :', 'geodirectory');?></strong></td>
633 633
                             <td align="left">
634 634
 
635 635
                                 <select name="multi_display_type" id="multi_display_type">
636 636
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
637
-                                        echo 'selected="selected"';
638
-                                    }?> value="select"><?php _e('Select', 'geodirectory');?></option>
637
+										echo 'selected="selected"';
638
+									}?> value="select"><?php _e('Select', 'geodirectory');?></option>
639 639
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
640
-                                        echo 'selected="selected"';
641
-                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
640
+										echo 'selected="selected"';
641
+									}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
642 642
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
643
-                                        echo 'selected="selected"';
644
-                                    }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
643
+										echo 'selected="selected"';
644
+									}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
645 645
                                 </select>
646 646
 
647 647
                                 <br/>
@@ -649,15 +649,15 @@  discard block
 block discarded – undo
649 649
                             </td>
650 650
                         </tr>
651 651
                     <?php
652
-                    }
653
-                    ?>
652
+					}
653
+					?>
654 654
                     <tr>
655 655
                         <td><strong><?php _e('Option Values :', 'geodirectory');?></strong></td>
656 656
                         <td align="left">
657 657
                             <input type="text" name="option_values" id="option_values"
658 658
                                    value="<?php if (isset($field_info->option_values)) {
659
-                                       echo esc_attr($field_info->option_values);
660
-                                   }?>"/>
659
+									   echo esc_attr($field_info->option_values);
660
+								   }?>"/>
661 661
                             <br/>
662 662
                             <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
663 663
                             <br/>
@@ -673,20 +673,20 @@  discard block
 block discarded – undo
673 673
                         </td>
674 674
                     </tr>
675 675
                 <?php
676
-                } // end of extra fields for select , multiselect and radio type fields
677
-                    break;
678
-                case 'datepicker': {
679
-                    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
680
-                        $extra = unserialize($field_info->extra_fields);
681
-                    }
682
-                    ?>
676
+				} // end of extra fields for select , multiselect and radio type fields
677
+					break;
678
+				case 'datepicker': {
679
+					if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
680
+						$extra = unserialize($field_info->extra_fields);
681
+					}
682
+					?>
683 683
                     <tr>
684 684
                         <td><strong><?php _e('Date Format :', 'geodirectory');?></strong></td>
685 685
                         <td align="left" style="overflow:inherit;">
686 686
                             <input type="text" name="extra[date_format]" id="date_format"
687 687
                                    value="<?php if (isset($extra['date_format'])) {
688
-                                       echo esc_attr($extra['date_format']);
689
-                                   }else{echo "mm/dd/yy";}?>"/>
688
+									   echo esc_attr($extra['date_format']);
689
+								   }else{echo "mm/dd/yy";}?>"/>
690 690
 
691 691
                             <div style="position:relative; cursor:pointer;">
692 692
                         <span onclick="jQuery('#show_dateformat').toggle();">
@@ -768,8 +768,8 @@  discard block
 block discarded – undo
768 768
                         </td>
769 769
                     </tr>
770 770
                 <?php
771
-                }
772
-                    break;
771
+				}
772
+					break;
773 773
 				case 'file': {
774 774
 					$allowed_file_types = geodir_allowed_mime_types();
775 775
 					
@@ -797,9 +797,9 @@  discard block
 block discarded – undo
797 797
 					}
798 798
 					break;
799 799
 
800
-            endswitch; ?>
800
+			endswitch; ?>
801 801
             <?php if ($field_type != 'fieldset') {
802
-                ?>
802
+				?>
803 803
                 <tr>
804 804
                     <td colspan="2" align="left"><h3><?php echo __('Custom css', 'geodirectory'); ?></h3></td>
805 805
                 </tr>
@@ -809,8 +809,8 @@  discard block
 block discarded – undo
809 809
                     <td align="left">
810 810
                         <input type="text" name="field_icon" id="field_icon"
811 811
                                value="<?php if (isset($field_info->field_icon)) {
812
-                                   echo $field_info->field_icon;
813
-                               }?>"/>
812
+								   echo $field_info->field_icon;
813
+							   }?>"/>
814 814
                     <span>
815 815
                         <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
816 816
                     </span>
@@ -823,8 +823,8 @@  discard block
 block discarded – undo
823 823
                     <td align="left">
824 824
                         <input type="text" name="css_class" id="css_class"
825 825
                                value="<?php if (isset($field_info->css_class)) {
826
-                                   echo esc_attr($field_info->css_class);
827
-                               }?>"/>
826
+								   echo esc_attr($field_info->css_class);
827
+							   }?>"/>
828 828
                     <span>
829 829
                         <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
830 830
                     </span>
@@ -832,19 +832,19 @@  discard block
 block discarded – undo
832 832
                     </td>
833 833
                 </tr>
834 834
             <?php
835
-            }
836
-            ?>
835
+			}
836
+			?>
837 837
 
838 838
             <?php
839 839
 
840
-            switch ($field_type):
841
-                case 'html':
842
-                case 'file':
843
-                case 'url':
844
-                case 'fieldset':
845
-                    break;
846
-                default:
847
-                    ?>
840
+			switch ($field_type):
841
+				case 'html':
842
+				case 'file':
843
+				case 'url':
844
+				case 'fieldset':
845
+					break;
846
+				default:
847
+					?>
848 848
 
849 849
                     <tr>
850 850
                         <td colspan="2" align="left">
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 								 */
863 863
 								echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
864 864
 
865
-                                ?></h3>
865
+								?></h3>
866 866
                         </td>
867 867
                     </tr>
868 868
 
@@ -872,23 +872,23 @@  discard block
 block discarded – undo
872 872
                         <td>:
873 873
                             <input type="checkbox" name="cat_sort[]" id="cat_sort"
874 874
                                    value="1" <?php if (isset($field_info->cat_sort[0]) && $field_info->cat_sort[0] == '1') {
875
-                                echo 'checked="checked"';
876
-                            } ?>/>
875
+								echo 'checked="checked"';
876
+							} ?>/>
877 877
                             <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
878 878
                         </td>
879 879
                     </tr>
880 880
                 <?php } ?>
881 881
 
882 882
                     <?php
883
-                    /**
884
-                     * Called at the end of the advanced custom fields settings page loop.
885
-                     *
886
-                     * Can be used to add or deal with different settings types.
887
-                     *
888
-                     * @since 1.0.0
889
-                     * @param object $field_info The current fields info.
890
-                     */
891
-                    do_action('geodir_advance_custom_fields', $field_info);?>
883
+					/**
884
+					 * Called at the end of the advanced custom fields settings page loop.
885
+					 *
886
+					 * Can be used to add or deal with different settings types.
887
+					 *
888
+					 * @since 1.0.0
889
+					 * @param object $field_info The current fields info.
890
+					 */
891
+					do_action('geodir_advance_custom_fields', $field_info);?>
892 892
 
893 893
                     <?php /*if(!in_array($field_type,array() )){?>
894 894
 				<tr>
Please login to merge, or discard this patch.
Braces   +18 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,16 +19,18 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
26 27
 
27 28
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
28 29
 
29 30
 $field_admin_title = '';
30
-if (isset($field_info->admin_title))
31
-    $field_admin_title = $field_info->admin_title;
31
+if (isset($field_info->admin_title)) {
32
+    $field_admin_title = $field_info->admin_title;
33
+}
32 34
 
33 35
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
34 36
 
@@ -52,8 +54,11 @@  discard block
 block discarded – undo
52 54
 
53 55
         <?php if ($default): ?>
54 56
             <div title="<?php _e('Drag and drop to sort', 'geodirectory'); ?>" class="handlediv move"></div>
55
-        <?php else: ?>
56
-            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
57
+        <?php else {
58
+	: ?>
59
+            <div title="<?php _e('Click to remove field', 'geodirectory');
60
+}
61
+?>"
57 62
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
58 63
                  class="handlediv close"></div>
59 64
         <?php endif;
@@ -255,11 +260,13 @@  discard block
 block discarded – undo
255 260
 
256 261
                     <?php
257 262
                     $selected = '';
258
-                    if (isset($field_info->extra_fields))
259
-                        $advanced_editor = unserialize($field_info->extra_fields);
263
+                    if (isset($field_info->extra_fields)) {
264
+                                            $advanced_editor = unserialize($field_info->extra_fields);
265
+                    }
260 266
 
261
-                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
262
-                        $selected = 'checked="checked"';
267
+                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
268
+                                            $selected = 'checked="checked"';
269
+                    }
263 270
                     ?>
264 271
 
265 272
                     <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -686,7 +693,7 @@  discard block
 block discarded – undo
686 693
                             <input type="text" name="extra[date_format]" id="date_format"
687 694
                                    value="<?php if (isset($extra['date_format'])) {
688 695
                                        echo esc_attr($extra['date_format']);
689
-                                   }else{echo "mm/dd/yy";}?>"/>
696
+                                   } else{echo "mm/dd/yy";}?>"/>
690 697
 
691 698
                             <div style="position:relative; cursor:pointer;">
692 699
                         <span onclick="jQuery('#show_dateformat').toggle();">
Please login to merge, or discard this patch.
geodirectory-functions/google_analytics.php 3 patches
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -72,58 +72,58 @@  discard block
 block discarded – undo
72 72
 
73 73
     $start_date = '';
74 74
     $end_date = '';
75
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
76
-        if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
77
-        if(!$ga_end){$ga_end = date('Y-m-d');}
75
+    if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisweek') {
76
+        if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-6 day")); }
77
+        if (!$ga_end) {$ga_end = date('Y-m-d'); }
78 78
         $dimensions = "&dimensions=ga:date,ga:nthDay";
79
-    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
80
-        if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
81
-        if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
79
+    }elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastweek') {
80
+        if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-13 day")); }
81
+        if (!$ga_end) {$ga_end = date('Y-m-d', strtotime("-7 day")); }
82 82
         $dimensions = "&dimensions=ga:date,ga:nthDay";
83 83
     }
84
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
85
-        if(!$ga_start){$ga_start = date('Y')."-01-01";}
86
-        if(!$ga_end){$ga_end = date('Y-m-d');}
84
+    elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisyear') {
85
+        if (!$ga_start) {$ga_start = date('Y') . "-01-01"; }
86
+        if (!$ga_end) {$ga_end = date('Y-m-d'); }
87 87
         $dimensions = "&dimensions=ga:month,ga:nthMonth";
88 88
     }
89
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
90
-        if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
91
-        if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
89
+    elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastyear') {
90
+        if (!$ga_start) {$ga_start = date('Y', strtotime("-1 year")) . "-01-01"; }
91
+        if (!$ga_end) {$ga_end = date('Y', strtotime("-1 year")) . "-12-31"; }
92 92
         $dimensions = "&dimensions=ga:month,ga:nthMonth";
93 93
     }
94
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
95
-        if(!$ga_start){$ga_start = "14daysAgo";}
96
-        if(!$ga_end){$ga_end = "yesterday";}
94
+    elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') {
95
+        if (!$ga_start) {$ga_start = "14daysAgo"; }
96
+        if (!$ga_end) {$ga_end = "yesterday"; }
97 97
         $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5";
98 98
     }
99 99
 
100 100
 
101 101
     $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?";
102
-    $ids = "ids=".$id;
103
-    if(!$start_date){$start_date = "&start-date=".$ga_start;}
104
-    if(!$end_date){$end_date = "&end-date=".$ga_end;}
102
+    $ids = "ids=" . $id;
103
+    if (!$start_date) {$start_date = "&start-date=" . $ga_start; }
104
+    if (!$end_date) {$end_date = "&end-date=" . $ga_end; }
105 105
     $metrics = "&metrics=ga:pageviews";
106
-    $filters = "&filters=ga:pagePath==".$page;
107
-    $access_token = "&access_token=".$at;
106
+    $filters = "&filters=ga:pagePath==" . $page;
107
+    $access_token = "&access_token=" . $at;
108 108
 
109
-    $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token;
109
+    $use_url = $APIURL . $ids . $start_date . $end_date . $dimensions . $metrics . $filters . $access_token;
110 110
 
111
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
111
+    if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'realtime') {
112 112
         $metrics = "&metrics=rt:activeUsers";
113
-        $dimensions = "&filters=ga:pagePath==".$page;
113
+        $dimensions = "&filters=ga:pagePath==" . $page;
114 114
 
115
-        $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions;
115
+        $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?" . $ids . $access_token . $metrics . $dimensions;
116 116
     }
117 117
 
118
-    $response =  wp_remote_get($use_url,array('timeout' => 15));
118
+    $response = wp_remote_get($use_url, array('timeout' => 15));
119 119
 
120 120
     // Make countries translatable
121
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
121
+    if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') {
122 122
         $c_arr = json_decode($response['body']);
123
-        if(is_array($c_arr->rows)){
123
+        if (is_array($c_arr->rows)) {
124 124
             $new_rows = array();
125
-            foreach($c_arr->rows as $wow){
126
-                $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]);
125
+            foreach ($c_arr->rows as $wow) {
126
+                $new_rows[] = array(__($wow[0], 'geodirectory'), $wow[1]);
127 127
             }
128 128
             $c_arr->rows = $new_rows;
129 129
         }
@@ -136,39 +136,39 @@  discard block
 block discarded – undo
136 136
 }// end GA function
137 137
 
138 138
 
139
-function geodir_ga_get_token(){
139
+function geodir_ga_get_token() {
140 140
     $at = get_option('gd_ga_access_token');
141
-    $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at;
142
-    $response =  wp_remote_get($use_url,array('timeout' => 15));
141
+    $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=" . $at;
142
+    $response = wp_remote_get($use_url, array('timeout' => 15));
143 143
 
144
-    if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
144
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {//access token is valid
145 145
 
146 146
     return $at;
147
-    }else{//else get new access token
147
+    } else {//else get new access token
148 148
 
149 149
         $refresh_at = get_option('gd_ga_refresh_token');
150
-        if(!$refresh_at){
151
-            echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
150
+        if (!$refresh_at) {
151
+            echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory'))); exit;
152 152
         }
153 153
 
154 154
         $rat_url = "https://www.googleapis.com/oauth2/v3/token?";
155
-        $client_id = "client_id=".get_option('geodir_ga_client_id');
156
-        $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
157
-        $refresh_token = "&refresh_token=".$refresh_at;
155
+        $client_id = "client_id=" . get_option('geodir_ga_client_id');
156
+        $client_secret = "&client_secret=" . get_option('geodir_ga_client_secret');
157
+        $refresh_token = "&refresh_token=" . $refresh_at;
158 158
         $grant_type = "&grant_type=refresh_token";
159 159
 
160
-        $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type;
160
+        $rat_url_use = $rat_url . $client_id . $client_secret . $refresh_token . $grant_type;
161 161
 
162
-        $rat_response =  wp_remote_post($rat_url_use,array('timeout' => 15));
163
-        if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
162
+        $rat_response = wp_remote_post($rat_url_use, array('timeout' => 15));
163
+        if (!empty($rat_response['response']['code']) && $rat_response['response']['code'] == 200) {
164 164
             $parts = json_decode($rat_response['body']);
165 165
 
166 166
 
167 167
             update_option('gd_ga_access_token', $parts->access_token);
168 168
             return $parts->access_token;
169 169
 
170
-        }else{
171
-            echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
170
+        } else {
171
+            echo json_encode(array('error'=>__('Login failed', 'geodirectory'))); exit;
172 172
         }
173 173
 
174 174
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,22 +76,19 @@  discard block
 block discarded – undo
76 76
         if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
77 77
         if(!$ga_end){$ga_end = date('Y-m-d');}
78 78
         $dimensions = "&dimensions=ga:date,ga:nthDay";
79
-    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
79
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
80 80
         if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
81 81
         if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
82 82
         $dimensions = "&dimensions=ga:date,ga:nthDay";
83
-    }
84
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
83
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
85 84
         if(!$ga_start){$ga_start = date('Y')."-01-01";}
86 85
         if(!$ga_end){$ga_end = date('Y-m-d');}
87 86
         $dimensions = "&dimensions=ga:month,ga:nthMonth";
88
-    }
89
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
87
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
90 88
         if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
91 89
         if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
92 90
         $dimensions = "&dimensions=ga:month,ga:nthMonth";
93
-    }
94
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
91
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
95 92
         if(!$ga_start){$ga_start = "14daysAgo";}
96 93
         if(!$ga_end){$ga_end = "yesterday";}
97 94
         $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5";
@@ -144,7 +141,7 @@  discard block
 block discarded – undo
144 141
     if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
145 142
 
146 143
     return $at;
147
-    }else{//else get new access token
144
+    } else{//else get new access token
148 145
 
149 146
         $refresh_at = get_option('gd_ga_refresh_token');
150 147
         if(!$refresh_at){
@@ -167,7 +164,7 @@  discard block
 block discarded – undo
167 164
             update_option('gd_ga_access_token', $parts->access_token);
168 165
             return $parts->access_token;
169 166
 
170
-        }else{
167
+        } else{
171 168
             echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
172 169
         }
173 170
 
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Google analystics related functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+					 * Google analystics related functions.
4
+					 *
5
+					 * @since 1.0.0
6
+					 * @package GeoDirectory
7
+					 */
8 8
 
9 9
 /**
10 10
  * Formats seconds into to h:m:s.
@@ -17,34 +17,34 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_sec2hms($sec, $padHours = false)
19 19
 {
20
-    // holds formatted string
21
-    $hms = "";
22
-    // there are 3600 seconds in an hour, so if we
23
-    // divide total seconds by 3600 and throw away
24
-    // the remainder, we've got the number of hours
25
-    $hours = intval(intval($sec) / 3600);
26
-
27
-    // add to $hms, with a leading 0 if asked for
28
-    $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':';
29
-
30
-    // dividing the total seconds by 60 will give us
31
-    // the number of minutes, but we're interested in
32
-    // minutes past the hour: to get that, we need to
33
-    // divide by 60 again and keep the remainder
34
-    $minutes = intval(($sec / 60) % 60);
35
-
36
-    // then add to $hms (with a leading 0 if needed)
37
-    $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':';
38
-
39
-    // seconds are simple - just divide the total
40
-    // seconds by 60 and keep the remainder
41
-    $seconds = intval($sec % 60);
42
-
43
-    // add to $hms, again with a leading 0 if needed
44
-    $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
45
-
46
-    // done!
47
-    return $hms;
20
+	// holds formatted string
21
+	$hms = "";
22
+	// there are 3600 seconds in an hour, so if we
23
+	// divide total seconds by 3600 and throw away
24
+	// the remainder, we've got the number of hours
25
+	$hours = intval(intval($sec) / 3600);
26
+
27
+	// add to $hms, with a leading 0 if asked for
28
+	$hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':';
29
+
30
+	// dividing the total seconds by 60 will give us
31
+	// the number of minutes, but we're interested in
32
+	// minutes past the hour: to get that, we need to
33
+	// divide by 60 again and keep the remainder
34
+	$minutes = intval(($sec / 60) % 60);
35
+
36
+	// then add to $hms (with a leading 0 if needed)
37
+	$hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':';
38
+
39
+	// seconds are simple - just divide the total
40
+	// seconds by 60 and keep the remainder
41
+	$seconds = intval($sec % 60);
42
+
43
+	// add to $hms, again with a leading 0 if needed
44
+	$hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
45
+
46
+	// done!
47
+	return $hms;
48 48
 }
49 49
 
50 50
 /**
@@ -61,117 +61,117 @@  discard block
 block discarded – undo
61 61
 {
62 62
 
63 63
 
64
-    // NOTE: the id is in the form ga:12345 and not just 12345
65
-    // if you do e.g. 12345 then no data will be returned
66
-    // read http://www.electrictoolbox.com/get-id-for-google-analytics-api/ for info about how to get this id from the GA web interface
67
-    // or load the accounts (see below) and get it from there
68
-    // if you don't specify an id here, then you'll get the "Badly formatted request to the Google Analytics API..." error message
69
-    $id = trim(get_option('geodir_ga_id'));
70
-
71
-    $at = geodir_ga_get_token();
72
-
73
-    $start_date = '';
74
-    $end_date = '';
75
-    $dimensions = "&filters=ga:pagePath==" . $page;
76
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
77
-        if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
78
-        if(!$ga_end){$ga_end = date('Y-m-d');}
79
-        $dimensions = "&dimensions=ga:date,ga:nthDay";
80
-    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
81
-        if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
82
-        if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
83
-        $dimensions = "&dimensions=ga:date,ga:nthDay";
84
-    }
85
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
86
-        if(!$ga_start){$ga_start = date('Y')."-01-01";}
87
-        if(!$ga_end){$ga_end = date('Y-m-d');}
88
-        $dimensions = "&dimensions=ga:month,ga:nthMonth";
89
-    }
90
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
91
-        if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
92
-        if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
93
-        $dimensions = "&dimensions=ga:month,ga:nthMonth";
94
-    }
95
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
96
-        if(!$ga_start){$ga_start = "14daysAgo";}
97
-        if(!$ga_end){$ga_end = "yesterday";}
98
-        $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5";
99
-    }
100
-
101
-    $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?";
102
-    $ids = "ids=".$id;
103
-    if(!$start_date){$start_date = "&start-date=".$ga_start;}
104
-    if(!$end_date){$end_date = "&end-date=".$ga_end;}
105
-    $metrics = "&metrics=ga:pageviews";
106
-    $filters = "&filters=ga:pagePath==".$page;
107
-    $access_token = "&access_token=".$at;
108
-
109
-    $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token;
110
-
111
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
112
-        $metrics = "&metrics=rt:activeUsers";
113
-        $dimensions = "&filters=ga:pagePath==".$page;
114
-
115
-        $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions;
116
-    }
117
-
118
-    $response =  wp_remote_get($use_url,array('timeout' => 15));
119
-
120
-    // Make countries translatable
121
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
122
-        $c_arr = json_decode($response['body']);
123
-        if(is_array($c_arr->rows)){
124
-            $new_rows = array();
125
-            foreach($c_arr->rows as $wow){
126
-                $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]);
127
-            }
128
-            $c_arr->rows = $new_rows;
129
-        }
130
-        $response['body'] = json_encode($c_arr);
131
-    }
132
-
133
-    echo $response['body'];
134
-    exit;
64
+	// NOTE: the id is in the form ga:12345 and not just 12345
65
+	// if you do e.g. 12345 then no data will be returned
66
+	// read http://www.electrictoolbox.com/get-id-for-google-analytics-api/ for info about how to get this id from the GA web interface
67
+	// or load the accounts (see below) and get it from there
68
+	// if you don't specify an id here, then you'll get the "Badly formatted request to the Google Analytics API..." error message
69
+	$id = trim(get_option('geodir_ga_id'));
70
+
71
+	$at = geodir_ga_get_token();
72
+
73
+	$start_date = '';
74
+	$end_date = '';
75
+	$dimensions = "&filters=ga:pagePath==" . $page;
76
+	if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
77
+		if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
78
+		if(!$ga_end){$ga_end = date('Y-m-d');}
79
+		$dimensions = "&dimensions=ga:date,ga:nthDay";
80
+	}elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
81
+		if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
82
+		if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
83
+		$dimensions = "&dimensions=ga:date,ga:nthDay";
84
+	}
85
+	elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
86
+		if(!$ga_start){$ga_start = date('Y')."-01-01";}
87
+		if(!$ga_end){$ga_end = date('Y-m-d');}
88
+		$dimensions = "&dimensions=ga:month,ga:nthMonth";
89
+	}
90
+	elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
91
+		if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
92
+		if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
93
+		$dimensions = "&dimensions=ga:month,ga:nthMonth";
94
+	}
95
+	elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
96
+		if(!$ga_start){$ga_start = "14daysAgo";}
97
+		if(!$ga_end){$ga_end = "yesterday";}
98
+		$dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5";
99
+	}
100
+
101
+	$APIURL = "https://www.googleapis.com/analytics/v3/data/ga?";
102
+	$ids = "ids=".$id;
103
+	if(!$start_date){$start_date = "&start-date=".$ga_start;}
104
+	if(!$end_date){$end_date = "&end-date=".$ga_end;}
105
+	$metrics = "&metrics=ga:pageviews";
106
+	$filters = "&filters=ga:pagePath==".$page;
107
+	$access_token = "&access_token=".$at;
108
+
109
+	$use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token;
110
+
111
+	if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
112
+		$metrics = "&metrics=rt:activeUsers";
113
+		$dimensions = "&filters=ga:pagePath==".$page;
114
+
115
+		$use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions;
116
+	}
117
+
118
+	$response =  wp_remote_get($use_url,array('timeout' => 15));
119
+
120
+	// Make countries translatable
121
+	if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
122
+		$c_arr = json_decode($response['body']);
123
+		if(is_array($c_arr->rows)){
124
+			$new_rows = array();
125
+			foreach($c_arr->rows as $wow){
126
+				$new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]);
127
+			}
128
+			$c_arr->rows = $new_rows;
129
+		}
130
+		$response['body'] = json_encode($c_arr);
131
+	}
132
+
133
+	echo $response['body'];
134
+	exit;
135 135
 
136 136
 }// end GA function
137 137
 
138 138
 
139 139
 function geodir_ga_get_token(){
140
-    $at = get_option('gd_ga_access_token');
141
-    $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at;
142
-    $response =  wp_remote_get($use_url,array('timeout' => 15));
140
+	$at = get_option('gd_ga_access_token');
141
+	$use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at;
142
+	$response =  wp_remote_get($use_url,array('timeout' => 15));
143 143
 
144
-    if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
144
+	if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
145 145
 
146
-    return $at;
147
-    }else{//else get new access token
146
+	return $at;
147
+	}else{//else get new access token
148 148
 
149
-        $refresh_at = get_option('gd_ga_refresh_token');
150
-        if(!$refresh_at){
151
-            echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
152
-        }
149
+		$refresh_at = get_option('gd_ga_refresh_token');
150
+		if(!$refresh_at){
151
+			echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
152
+		}
153 153
 
154
-        $rat_url = "https://www.googleapis.com/oauth2/v3/token?";
155
-        $client_id = "client_id=".get_option('geodir_ga_client_id');
156
-        $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
157
-        $refresh_token = "&refresh_token=".$refresh_at;
158
-        $grant_type = "&grant_type=refresh_token";
154
+		$rat_url = "https://www.googleapis.com/oauth2/v3/token?";
155
+		$client_id = "client_id=".get_option('geodir_ga_client_id');
156
+		$client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
157
+		$refresh_token = "&refresh_token=".$refresh_at;
158
+		$grant_type = "&grant_type=refresh_token";
159 159
 
160
-        $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type;
160
+		$rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type;
161 161
 
162
-        $rat_response =  wp_remote_post($rat_url_use,array('timeout' => 15));
163
-        if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
164
-            $parts = json_decode($rat_response['body']);
162
+		$rat_response =  wp_remote_post($rat_url_use,array('timeout' => 15));
163
+		if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
164
+			$parts = json_decode($rat_response['body']);
165 165
 
166 166
 
167
-            update_option('gd_ga_access_token', $parts->access_token);
168
-            return $parts->access_token;
167
+			update_option('gd_ga_access_token', $parts->access_token);
168
+			return $parts->access_token;
169 169
 
170
-        }else{
171
-            echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
172
-        }
170
+		}else{
171
+			echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
172
+		}
173 173
 
174 174
 
175
-    }
175
+	}
176 176
 
177 177
 }
178 178
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/helper_functions.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $slug = $post->post_name;
154 154
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155 155
         $login_url = trailingslashit($home_url)."$slug/";
156
-    }else{
156
+    } else{
157 157
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
158 158
     }
159 159
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $slug = $post->post_name;
203 203
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204 204
         $info_url = trailingslashit($home_url)."$slug/";
205
-    }else{
205
+    } else{
206 206
         $info_url = trailingslashit($home_url);
207 207
     }
208 208
 
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since 1.4.6
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16
-function geodir_add_listing_page_id(){
16
+function geodir_add_listing_page_id() {
17 17
     $gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19 19
     if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
20
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
21 21
     }
22 22
 
23 23
     return $gd_page_id;
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @since 1.4.6
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33
-function geodir_preview_page_id(){
33
+function geodir_preview_page_id() {
34 34
     $gd_page_id = get_option('geodir_preview_page');
35 35
 
36 36
     if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
37
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
38 38
     }
39 39
 
40 40
     return $gd_page_id;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * @since 1.4.6
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50
-function geodir_success_page_id(){
50
+function geodir_success_page_id() {
51 51
     $gd_page_id = get_option('geodir_success_page');
52 52
 
53 53
     if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
54
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
55 55
     }
56 56
 
57 57
     return $gd_page_id;
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
  * @since 1.4.6
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67
-function geodir_location_page_id(){
67
+function geodir_location_page_id() {
68 68
     $gd_page_id = get_option('geodir_location_page');
69 69
 
70 70
     if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
71
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
72 72
     }
73 73
 
74 74
     return $gd_page_id;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @since 1.5.4
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84
-function geodir_home_page_id(){
84
+function geodir_home_page_id() {
85 85
     $gd_page_id = get_option('geodir_home_page');
86 86
 
87 87
     if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
88
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
89 89
     }
90 90
 
91 91
     return $gd_page_id;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.3
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101
-function geodir_info_page_id(){
101
+function geodir_info_page_id() {
102 102
     $gd_page_id = get_option('geodir_info_page');
103 103
 
104 104
     if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
105
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
106 106
     }
107 107
 
108 108
     return $gd_page_id;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @since 1.5.3
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118
-function geodir_login_page_id(){
118
+function geodir_login_page_id() {
119 119
     $gd_page_id = get_option('geodir_login_page');
120 120
 
121 121
     if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
122
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
123 123
     }
124 124
 
125 125
     return $gd_page_id;
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136
-function geodir_login_url($args=array()){
136
+function geodir_login_url($args = array()) {
137 137
     $gd_page_id = get_option('geodir_login_page');
138 138
 
139 139
     if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
140
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
141 141
     }
142 142
 
143 143
     if (function_exists('geodir_location_geo_home_link')) {
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
149 149
     }
150 150
 
151
-    if($gd_page_id){
151
+    if ($gd_page_id) {
152 152
         $post = get_post($gd_page_id);
153 153
         $slug = $post->post_name;
154 154
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155
-        $login_url = trailingslashit($home_url)."$slug/";
156
-    }else{
157
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
155
+        $login_url = trailingslashit($home_url) . "$slug/";
156
+    } else {
157
+        $login_url = trailingslashit($home_url) . "?geodir_signup=true";
158 158
     }
159 159
 
160
-    if($args){
161
-        $login_url = add_query_arg($args,$login_url );
160
+    if ($args) {
161
+        $login_url = add_query_arg($args, $login_url);
162 162
     }
163 163
 
164 164
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @param array $args The array of query args used.
173 173
      * @param int $gd_page_id The page id of the GD login page.
174 174
      */
175
-    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
175
+    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id);
176 176
 }
177 177
 
178 178
 /**
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
  * @since 1.5.4
183 183
  * @return string Info page url.
184 184
  */
185
-function geodir_info_url($args=array()){
185
+function geodir_info_url($args = array()) {
186 186
     $gd_page_id = get_option('geodir_info_page');
187 187
 
188 188
     if (function_exists('icl_object_id')) {
189
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
189
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
190 190
     }
191 191
 
192 192
     if (function_exists('geodir_location_geo_home_link')) {
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
198 198
     }
199 199
 
200
-    if($gd_page_id){
200
+    if ($gd_page_id) {
201 201
         $post = get_post($gd_page_id);
202 202
         $slug = $post->post_name;
203 203
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204
-        $info_url = trailingslashit($home_url)."$slug/";
205
-    }else{
204
+        $info_url = trailingslashit($home_url) . "$slug/";
205
+    } else {
206 206
         $info_url = trailingslashit($home_url);
207 207
     }
208 208
 
209
-    if($args){
210
-        $info_url = add_query_arg($args,$info_url );
209
+    if ($args) {
210
+        $info_url = add_query_arg($args, $info_url);
211 211
     }
212 212
 
213 213
     return $info_url;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
  * @param string $charset Character set to use for conversion.
226 226
  * @return string Returns converted string.
227 227
  */
228
-function geodir_ucwords($string, $charset='UTF-8') {
228
+function geodir_ucwords($string, $charset = 'UTF-8') {
229 229
     if (function_exists('mb_convert_case')) {
230 230
         return mb_convert_case($string, MB_CASE_TITLE, $charset);
231 231
     } else {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
  * @param string $charset Character set to use for conversion.
246 246
  * @return string Returns converted string.
247 247
  */
248
-function geodir_strtolower($string, $charset='UTF-8') {
248
+function geodir_strtolower($string, $charset = 'UTF-8') {
249 249
     if (function_exists('mb_convert_case')) {
250 250
         return mb_convert_case($string, MB_CASE_LOWER, $charset);
251 251
     } else {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
  * @param string $charset Character set to use for conversion.
266 266
  * @return string Returns converted string.
267 267
  */
268
-function geodir_strtoupper($string, $charset='UTF-8') {
268
+function geodir_strtoupper($string, $charset = 'UTF-8') {
269 269
     if (function_exists('mb_convert_case')) {
270 270
         return mb_convert_case($string, MB_CASE_UPPER, $charset);
271 271
     } else {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	
297 297
 	$url = trim($parts[0]);
298 298
 	if ($formatted && $url != '') {
299
-		$url = str_replace( ' ', '%20', $url );
299
+		$url = str_replace(' ', '%20', $url);
300 300
 		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
301 301
 		
302 302
 		if (0 !== stripos($url, 'mailto:')) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		
307 307
 		$url = str_replace(';//', '://', $url);
308 308
 		
309
-		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
309
+		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
310 310
 			$url = 'http://' . $url;
311 311
 		}
312 312
 		
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
  * @package GeoDirectory
450 450
  */
451 451
 function _gd_die_handler() {
452
-    if ( defined( 'GD_TESTING_MODE' ) ) {
452
+    if (defined('GD_TESTING_MODE')) {
453 453
         return '_gd_die_handler';
454 454
     } else {
455 455
         die();
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
  * @param string $title   Optional. Error title.
468 468
  * @param int $status     Optional. Status code.
469 469
  */
470
-function gd_die( $message = '', $title = '', $status = 400 ) {
471
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
472
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
473
-    wp_die( $message, $title, array( 'response' => $status ));
470
+function gd_die($message = '', $title = '', $status = 400) {
471
+    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3);
472
+    add_filter('wp_die_handler', '_gd_die_handler', 10, 3);
473
+    wp_die($message, $title, array('response' => $status));
474 474
 }
475 475
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16 16
 function geodir_add_listing_page_id(){
17
-    $gd_page_id = get_option('geodir_add_listing_page');
17
+	$gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19
-    if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
-    }
19
+	if (function_exists('icl_object_id')) {
20
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
+	}
22 22
 
23
-    return $gd_page_id;
23
+	return $gd_page_id;
24 24
 }
25 25
 
26 26
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33 33
 function geodir_preview_page_id(){
34
-    $gd_page_id = get_option('geodir_preview_page');
34
+	$gd_page_id = get_option('geodir_preview_page');
35 35
 
36
-    if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
-    }
36
+	if (function_exists('icl_object_id')) {
37
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
+	}
39 39
 
40
-    return $gd_page_id;
40
+	return $gd_page_id;
41 41
 }
42 42
 
43 43
 /**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50 50
 function geodir_success_page_id(){
51
-    $gd_page_id = get_option('geodir_success_page');
51
+	$gd_page_id = get_option('geodir_success_page');
52 52
 
53
-    if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
-    }
53
+	if (function_exists('icl_object_id')) {
54
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
+	}
56 56
 
57
-    return $gd_page_id;
57
+	return $gd_page_id;
58 58
 }
59 59
 
60 60
 /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67 67
 function geodir_location_page_id(){
68
-    $gd_page_id = get_option('geodir_location_page');
68
+	$gd_page_id = get_option('geodir_location_page');
69 69
 
70
-    if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
-    }
70
+	if (function_exists('icl_object_id')) {
71
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
+	}
73 73
 
74
-    return $gd_page_id;
74
+	return $gd_page_id;
75 75
 }
76 76
 
77 77
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84 84
 function geodir_home_page_id(){
85
-    $gd_page_id = get_option('geodir_home_page');
85
+	$gd_page_id = get_option('geodir_home_page');
86 86
 
87
-    if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
-    }
87
+	if (function_exists('icl_object_id')) {
88
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
+	}
90 90
 
91
-    return $gd_page_id;
91
+	return $gd_page_id;
92 92
 }
93 93
 
94 94
 /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101 101
 function geodir_info_page_id(){
102
-    $gd_page_id = get_option('geodir_info_page');
102
+	$gd_page_id = get_option('geodir_info_page');
103 103
 
104
-    if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
-    }
104
+	if (function_exists('icl_object_id')) {
105
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
+	}
107 107
 
108
-    return $gd_page_id;
108
+	return $gd_page_id;
109 109
 }
110 110
 
111 111
 /**
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118 118
 function geodir_login_page_id(){
119
-    $gd_page_id = get_option('geodir_login_page');
119
+	$gd_page_id = get_option('geodir_login_page');
120 120
 
121
-    if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
-    }
121
+	if (function_exists('icl_object_id')) {
122
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
+	}
124 124
 
125
-    return $gd_page_id;
125
+	return $gd_page_id;
126 126
 }
127 127
 
128 128
 
@@ -134,45 +134,45 @@  discard block
 block discarded – undo
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136 136
 function geodir_login_url($args=array()){
137
-    $gd_page_id = get_option('geodir_login_page');
138
-
139
-    if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
-    }
142
-
143
-    if (function_exists('geodir_location_geo_home_link')) {
144
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
-    }
146
-    $home_url = get_home_url();
147
-    if (function_exists('geodir_location_geo_home_link')) {
148
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
149
-    }
150
-
151
-    if($gd_page_id){
152
-        $post = get_post($gd_page_id);
153
-        $slug = $post->post_name;
154
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155
-        $login_url = trailingslashit($home_url)."$slug/";
156
-    }else{
157
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
158
-    }
159
-
160
-    if($args){
161
-        $login_url = add_query_arg($args,$login_url );
162
-    }
163
-
164
-    /**
165
-     * Filter the GeoDirectory login page url.
166
-     *
167
-     * This filter can be used to change the GeoDirectory page url.
168
-     *
169
-     * @since 1.5.3
170
-     * @package GeoDirectory
171
-     * @param string $login_url The url of the login page.
172
-     * @param array $args The array of query args used.
173
-     * @param int $gd_page_id The page id of the GD login page.
174
-     */
175
-    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
137
+	$gd_page_id = get_option('geodir_login_page');
138
+
139
+	if (function_exists('icl_object_id')) {
140
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
+	}
142
+
143
+	if (function_exists('geodir_location_geo_home_link')) {
144
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
+	}
146
+	$home_url = get_home_url();
147
+	if (function_exists('geodir_location_geo_home_link')) {
148
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
149
+	}
150
+
151
+	if($gd_page_id){
152
+		$post = get_post($gd_page_id);
153
+		$slug = $post->post_name;
154
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155
+		$login_url = trailingslashit($home_url)."$slug/";
156
+	}else{
157
+		$login_url = trailingslashit($home_url)."?geodir_signup=true";
158
+	}
159
+
160
+	if($args){
161
+		$login_url = add_query_arg($args,$login_url );
162
+	}
163
+
164
+	/**
165
+	 * Filter the GeoDirectory login page url.
166
+	 *
167
+	 * This filter can be used to change the GeoDirectory page url.
168
+	 *
169
+	 * @since 1.5.3
170
+	 * @package GeoDirectory
171
+	 * @param string $login_url The url of the login page.
172
+	 * @param array $args The array of query args used.
173
+	 * @param int $gd_page_id The page id of the GD login page.
174
+	 */
175
+	return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
176 176
 }
177 177
 
178 178
 /**
@@ -183,34 +183,34 @@  discard block
 block discarded – undo
183 183
  * @return string Info page url.
184 184
  */
185 185
 function geodir_info_url($args=array()){
186
-    $gd_page_id = get_option('geodir_info_page');
187
-
188
-    if (function_exists('icl_object_id')) {
189
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
190
-    }
191
-
192
-    if (function_exists('geodir_location_geo_home_link')) {
193
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
194
-    }
195
-    $home_url = get_home_url();
196
-    if (function_exists('geodir_location_geo_home_link')) {
197
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
198
-    }
199
-
200
-    if($gd_page_id){
201
-        $post = get_post($gd_page_id);
202
-        $slug = $post->post_name;
203
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204
-        $info_url = trailingslashit($home_url)."$slug/";
205
-    }else{
206
-        $info_url = trailingslashit($home_url);
207
-    }
208
-
209
-    if($args){
210
-        $info_url = add_query_arg($args,$info_url );
211
-    }
212
-
213
-    return $info_url;
186
+	$gd_page_id = get_option('geodir_info_page');
187
+
188
+	if (function_exists('icl_object_id')) {
189
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
190
+	}
191
+
192
+	if (function_exists('geodir_location_geo_home_link')) {
193
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
194
+	}
195
+	$home_url = get_home_url();
196
+	if (function_exists('geodir_location_geo_home_link')) {
197
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
198
+	}
199
+
200
+	if($gd_page_id){
201
+		$post = get_post($gd_page_id);
202
+		$slug = $post->post_name;
203
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204
+		$info_url = trailingslashit($home_url)."$slug/";
205
+	}else{
206
+		$info_url = trailingslashit($home_url);
207
+	}
208
+
209
+	if($args){
210
+		$info_url = add_query_arg($args,$info_url );
211
+	}
212
+
213
+	return $info_url;
214 214
 }
215 215
 
216 216
 /**
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
  * @return string Returns converted string.
227 227
  */
228 228
 function geodir_ucwords($string, $charset='UTF-8') {
229
-    if (function_exists('mb_convert_case')) {
230
-        return mb_convert_case($string, MB_CASE_TITLE, $charset);
231
-    } else {
232
-        return ucwords($string);
233
-    }
229
+	if (function_exists('mb_convert_case')) {
230
+		return mb_convert_case($string, MB_CASE_TITLE, $charset);
231
+	} else {
232
+		return ucwords($string);
233
+	}
234 234
 }
235 235
 
236 236
 /**
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
  * @return string Returns converted string.
247 247
  */
248 248
 function geodir_strtolower($string, $charset='UTF-8') {
249
-    if (function_exists('mb_convert_case')) {
250
-        return mb_convert_case($string, MB_CASE_LOWER, $charset);
251
-    } else {
252
-        return strtolower($string);
253
-    }
249
+	if (function_exists('mb_convert_case')) {
250
+		return mb_convert_case($string, MB_CASE_LOWER, $charset);
251
+	} else {
252
+		return strtolower($string);
253
+	}
254 254
 }
255 255
 
256 256
 /**
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
  * @return string Returns converted string.
267 267
  */
268 268
 function geodir_strtoupper($string, $charset='UTF-8') {
269
-    if (function_exists('mb_convert_case')) {
270
-        return mb_convert_case($string, MB_CASE_UPPER, $charset);
271
-    } else {
272
-        return strtoupper($string);
273
-    }
269
+	if (function_exists('mb_convert_case')) {
270
+		return mb_convert_case($string, MB_CASE_UPPER, $charset);
271
+	} else {
272
+		return strtoupper($string);
273
+	}
274 274
 }
275 275
 
276 276
 /**
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
  * @package GeoDirectory
450 450
  */
451 451
 function _gd_die_handler() {
452
-    if ( defined( 'GD_TESTING_MODE' ) ) {
453
-        return '_gd_die_handler';
454
-    } else {
455
-        die();
456
-    }
452
+	if ( defined( 'GD_TESTING_MODE' ) ) {
453
+		return '_gd_die_handler';
454
+	} else {
455
+		die();
456
+	}
457 457
 }
458 458
 
459 459
 /**
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
  * @param int $status     Optional. Status code.
469 469
  */
470 470
 function gd_die( $message = '', $title = '', $status = 400 ) {
471
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
472
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
473
-    wp_die( $message, $title, array( 'response' => $status ));
471
+	add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
472
+	add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
473
+	wp_die( $message, $title, array( 'response' => $status ));
474 474
 }
475 475
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/get_markers.php 3 patches
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,11 +107,13 @@  discard block
 block discarded – undo
107 107
         }
108 108
     }
109 109
 
110
-    if (!empty($field_default_cat))
111
-        $field_default_cat = '';
110
+    if (!empty($field_default_cat)) {
111
+            $field_default_cat = '';
112
+    }
112 113
 
113
-    if (!empty($cat_find_array))
114
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
114
+    if (!empty($cat_find_array)) {
115
+            $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
116
+    }
115 117
 
116 118
     $main_query_array = $map_cat_ids_array;
117 119
   
@@ -143,8 +145,9 @@  discard block
 block discarded – undo
143 145
         $gd_posttype = " AND p.post_type = %s";
144 146
         $main_query_array[] = $_REQUEST['gd_posttype'];
145 147
 
146
-    } else
147
-        $table = $plugin_prefix . 'gd_place_detail';
148
+    } else {
149
+            $table = $plugin_prefix . 'gd_place_detail';
150
+    }
148 151
 
149 152
     $join = ", " . $table . " AS pd ";
150 153
 
@@ -309,8 +312,7 @@  discard block
 block discarded – undo
309 312
 
310 313
     if (!empty($cat_content_info)) {
311 314
 		return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
312
-    }
313
-    else {
315
+    } else {
314 316
 		return '[{"totalcount":"0"}]';
315 317
 	}
316 318
 }
317 319
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -7,59 +7,59 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
10
-    $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
11
-    $post_taxonomy = geodir_get_taxonomies($gd_post_type);
12
-    $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
13
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
14
-    echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
15
-    die;
10
+	$gd_post_type = sanitize_text_field($_REQUEST['post_type']);
11
+	$post_taxonomy = geodir_get_taxonomies($gd_post_type);
12
+	$map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
13
+	$child_collapse = (bool)$_REQUEST['child_collapse'];
14
+	echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
15
+	die;
16 16
 }
17 17
 
18 18
 // Send the content-type header with correct encoding
19 19
 header("Content-type: text/javascript; charset=utf-8");
20 20
 
21 21
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
22
-    echo get_markers();
23
-    exit;
22
+	echo get_markers();
23
+	exit;
24 24
 } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
25
-    /**
26
-     * @global object $wpdb WordPress Database object.
27
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
28
-     * @global object $gd_session GeoDirectory Session object.
29
-     */
30
-    global $wpdb, $plugin_prefix, $gd_session;
31
-
32
-    if ($_REQUEST['m_id'] != '') {
33
-        $pid = (int)$_REQUEST['m_id'];
34
-    } else {
35
-        echo __('No marker data found', 'geodirectory');
36
-        exit;
37
-    }
38
-
39
-    if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
40
-        $post = (object)$gd_ses_listing;
41
-        echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
42
-    } else {
43
-        $geodir_post_type = get_post_type($pid);
44
-
45
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
46
-
47
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
48
-
49
-        $postinfo = $wpdb->get_results($sql);
50
-
51
-        $data_arr = array();
52
-
53
-        if ($postinfo) {
54
-            $srcharr = array("'", "/", "-", '"', '\\');
55
-            $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
56
-
57
-            foreach ($postinfo as $postinfo_obj) {
58
-                echo geodir_get_infowindow_html($postinfo_obj);
59
-            }
60
-        }
61
-    }
62
-    exit;
25
+	/**
26
+	 * @global object $wpdb WordPress Database object.
27
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
28
+	 * @global object $gd_session GeoDirectory Session object.
29
+	 */
30
+	global $wpdb, $plugin_prefix, $gd_session;
31
+
32
+	if ($_REQUEST['m_id'] != '') {
33
+		$pid = (int)$_REQUEST['m_id'];
34
+	} else {
35
+		echo __('No marker data found', 'geodirectory');
36
+		exit;
37
+	}
38
+
39
+	if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
40
+		$post = (object)$gd_ses_listing;
41
+		echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
42
+	} else {
43
+		$geodir_post_type = get_post_type($pid);
44
+
45
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
46
+
47
+		$sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
48
+
49
+		$postinfo = $wpdb->get_results($sql);
50
+
51
+		$data_arr = array();
52
+
53
+		if ($postinfo) {
54
+			$srcharr = array("'", "/", "-", '"', '\\');
55
+			$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
56
+
57
+			foreach ($postinfo as $postinfo_obj) {
58
+				echo geodir_get_infowindow_html($postinfo_obj);
59
+			}
60
+		}
61
+	}
62
+	exit;
63 63
 }
64 64
 
65 65
 /**
@@ -75,80 +75,80 @@  discard block
 block discarded – undo
75 75
  * @return string
76 76
  */
77 77
 function get_markers() {
78
-    global $wpdb, $plugin_prefix, $geodir_cat_icons;
78
+	global $wpdb, $plugin_prefix, $geodir_cat_icons;
79 79
 
80
-    $search = '';
81
-    $main_query_array;
80
+	$search = '';
81
+	$main_query_array;
82 82
 
83
-    $srcharr = array("'", "/", "-", '"', '\\');
84
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
83
+	$srcharr = array("'", "/", "-", '"', '\\');
84
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
85 85
 
86
-    $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
86
+	$post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
87 87
 
88
-    $map_cat_ids_array = array('0');
89
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
88
+	$map_cat_ids_array = array('0');
89
+	$cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
90 90
 
91 91
 
92
-    $field_default_cat = '';
93
-    if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
94
-        $map_cat_arr = trim($_REQUEST['cat_id'], ',');
92
+	$field_default_cat = '';
93
+	if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
94
+		$map_cat_arr = trim($_REQUEST['cat_id'], ',');
95 95
 
96
-        if (!empty($map_cat_arr)) {
97
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
96
+		if (!empty($map_cat_arr)) {
97
+			$field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
98 98
 
99
-            $map_cat_ids_array = explode(',', $map_cat_arr);
100
-            $cat_find_array = array();
101
-            foreach ($map_cat_ids_array as $cat_id) {
102
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
103
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
104
-                $main_query_array[] = $cat_id;
105
-            }
99
+			$map_cat_ids_array = explode(',', $map_cat_arr);
100
+			$cat_find_array = array();
101
+			foreach ($map_cat_ids_array as $cat_id) {
102
+				$field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
103
+				$cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
104
+				$main_query_array[] = $cat_id;
105
+			}
106 106
 
107
-        }
108
-    }
107
+		}
108
+	}
109 109
 
110
-    if (!empty($field_default_cat))
111
-        $field_default_cat = '';
110
+	if (!empty($field_default_cat))
111
+		$field_default_cat = '';
112 112
 
113
-    if (!empty($cat_find_array))
114
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
113
+	if (!empty($cat_find_array))
114
+		$search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
115 115
 
116
-    $main_query_array = $map_cat_ids_array;
116
+	$main_query_array = $map_cat_ids_array;
117 117
   
118
-    if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
119
-        $search .= " AND p.post_title LIKE %s";
120
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
121
-    }
122
-
123
-    /**
124
-     * Filter the marker query search SQL, values are replaces with %s or %d.
125
-     *
126
-     * @since 1.5.3
127
-     *
128
-     * @param string $search The SQL query for search/where.
129
-     */
130
-    $search = apply_filters('geodir_marker_search', $search);
131
-    /**
132
-     * Filter the marker query search SQL values %s and %d, this is an array of values.
133
-     *
134
-     * @since 1.5.3
135
-     *
136
-     * @param array $main_query_array The SQL query values for search/where.
137
-     */
138
-    $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
139
-
140
-    $gd_posttype = '';
141
-    if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
142
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
143
-        $gd_posttype = " AND p.post_type = %s";
144
-        $main_query_array[] = $_REQUEST['gd_posttype'];
145
-
146
-    } else
147
-        $table = $plugin_prefix . 'gd_place_detail';
148
-
149
-    $join = ", " . $table . " AS pd ";
150
-
151
-    /**
118
+	if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
119
+		$search .= " AND p.post_title LIKE %s";
120
+		$main_query_array[] = "%" . $_REQUEST['search'] . "%";
121
+	}
122
+
123
+	/**
124
+	 * Filter the marker query search SQL, values are replaces with %s or %d.
125
+	 *
126
+	 * @since 1.5.3
127
+	 *
128
+	 * @param string $search The SQL query for search/where.
129
+	 */
130
+	$search = apply_filters('geodir_marker_search', $search);
131
+	/**
132
+	 * Filter the marker query search SQL values %s and %d, this is an array of values.
133
+	 *
134
+	 * @since 1.5.3
135
+	 *
136
+	 * @param array $main_query_array The SQL query values for search/where.
137
+	 */
138
+	$main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
139
+
140
+	$gd_posttype = '';
141
+	if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
142
+		$table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
143
+		$gd_posttype = " AND p.post_type = %s";
144
+		$main_query_array[] = $_REQUEST['gd_posttype'];
145
+
146
+	} else
147
+		$table = $plugin_prefix . 'gd_place_detail';
148
+
149
+	$join = ", " . $table . " AS pd ";
150
+
151
+	/**
152 152
 	 * Filter the SQL JOIN clause for the markers data
153 153
 	 *
154 154
 	 * @since 1.0.0
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	 * @param string $search Row of searched fields to use in WHERE clause.
166 166
 	 */
167 167
 	$search = apply_filters('geodir_home_map_listing_where', $search);
168
-    $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
169
-    $cat_type = $post_type . 'category';
170
-    if ($post_type == 'gd_event') {
171
-        $event_select = ", pd.recurring_dates, pd.is_recurring";
172
-    } else {
173
-        $event_select = "";
174
-    }
175
-
176
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
177
-    /**
168
+	$search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
169
+	$cat_type = $post_type . 'category';
170
+	if ($post_type == 'gd_event') {
171
+		$event_select = ", pd.recurring_dates, pd.is_recurring";
172
+	} else {
173
+		$event_select = "";
174
+	}
175
+
176
+	$sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
177
+	/**
178 178
 	 * Filter the SQL SELECT clause to retrive fields data
179 179
 	 *
180 180
 	 * @since 1.0.0
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
195 195
 
196
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
196
+	$catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
197 197
     
198 198
 	/**
199 199
 	 * Filter the SQL query to retrive markers data
@@ -205,112 +205,112 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	$catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search);
207 207
 	
208
-    $catinfo = $wpdb->get_results($catsql);
208
+	$catinfo = $wpdb->get_results($catsql);
209 209
 	
210
-    $cat_content_info = array();
211
-    $content_data = array();
212
-    $post_ids = array();
213
-
214
-    /**
215
-     * Called before marker data is processed into JSON.
216
-     *
217
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
218
-     *
219
-     * @since 1.5.3
220
-     * @param object $catinfo The posts object containing all marker data.
221
-     * @see 'geodir_after_marker_post_process'
222
-     */
223
-    $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
224
-
225
-    /**
226
-     * Called before marker data is processed into JSON.
227
-     *
228
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
229
-     *
230
-     * @since 1.4.9
231
-     * @param object $catinfo The posts object containing all marker data.
232
-     * @see 'geodir_after_marker_post_process'
233
-     */
234
-    do_action('geodir_before_marker_post_process_action', $catinfo);
235
-
236
-    // Sort any posts into a ajax array
237
-    if (!empty($catinfo)) {
238
-        $geodir_cat_icons = geodir_get_term_icon();
239
-        global $geodir_date_format;
240
-
241
-        $today = strtotime(date_i18n('Y-m-d'));
210
+	$cat_content_info = array();
211
+	$content_data = array();
212
+	$post_ids = array();
213
+
214
+	/**
215
+	 * Called before marker data is processed into JSON.
216
+	 *
217
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
218
+	 *
219
+	 * @since 1.5.3
220
+	 * @param object $catinfo The posts object containing all marker data.
221
+	 * @see 'geodir_after_marker_post_process'
222
+	 */
223
+	$catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
224
+
225
+	/**
226
+	 * Called before marker data is processed into JSON.
227
+	 *
228
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
229
+	 *
230
+	 * @since 1.4.9
231
+	 * @param object $catinfo The posts object containing all marker data.
232
+	 * @see 'geodir_after_marker_post_process'
233
+	 */
234
+	do_action('geodir_before_marker_post_process_action', $catinfo);
235
+
236
+	// Sort any posts into a ajax array
237
+	if (!empty($catinfo)) {
238
+		$geodir_cat_icons = geodir_get_term_icon();
239
+		global $geodir_date_format;
240
+
241
+		$today = strtotime(date_i18n('Y-m-d'));
242 242
         
243
-        foreach ($catinfo as $catinfo_obj) {
244
-            $post_title = $catinfo_obj->post_title;
243
+		foreach ($catinfo as $catinfo_obj) {
244
+			$post_title = $catinfo_obj->post_title;
245 245
             
246
-            if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
247
-                $event_dates = '';
248
-                $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
246
+			if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
247
+				$event_dates = '';
248
+				$recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
249 249
                 
250
-                $post_info = geodir_get_post_info($catinfo_obj->post_id);
251
-                if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
252
-                    $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
250
+				$post_info = geodir_get_post_info($catinfo_obj->post_id);
251
+				if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
252
+					$recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
253 253
                     
254
-                    if (!empty($recurring_dates)) {					
255
-                        $e = 0;
256
-                        foreach ($recurring_dates as $date) {
257
-                            if (strtotime($date) >= $today) {
258
-                                $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
254
+					if (!empty($recurring_dates)) {					
255
+						$e = 0;
256
+						foreach ($recurring_dates as $date) {
257
+							if (strtotime($date) >= $today) {
258
+								$event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
259 259
                                 
260
-                                $e++;
261
-                                if ($e == 3) { // only show 3 event dates
262
-                                    break;
263
-                                }
264
-                            }
265
-                        }
266
-                    }
267
-                } else {
268
-                    $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : '';
269
-                    $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
260
+								$e++;
261
+								if ($e == 3) { // only show 3 event dates
262
+									break;
263
+								}
264
+							}
265
+						}
266
+					}
267
+				} else {
268
+					$start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : '';
269
+					$end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
270 270
                 
271
-                    if ($end_date != '' && strtotime($end_date) >= $today) {
272
-                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
273
-                    }
274
-                }
275
-
276
-                if (empty($event_dates)) {
277
-                    continue;
278
-                }
271
+					if ($end_date != '' && strtotime($end_date) >= $today) {
272
+						$event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
273
+					}
274
+				}
275
+
276
+				if (empty($event_dates)) {
277
+					continue;
278
+				}
279 279
                 
280
-                $post_title .= $event_dates;
281
-            }
282
-
283
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : '';
284
-            $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
285
-            $title = str_replace($srcharr, $replarr, $post_title);
286
-
287
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}';
288
-            $post_ids[] = $catinfo_obj->post_id;
289
-        }
290
-    }
291
-
292
-    /**
293
-     * Called after marker data is processed into JSON.
294
-     *
295
-     * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
296
-     *
297
-     * @since 1.4.9
298
-     * @param array $content_data The array containing all markers in JSON format.
299
-     * @param object $catinfo The posts object containing all marker data.
300
-     * @see 'geodir_before_marker_post_process'
301
-     */
302
-    do_action('geodir_after_marker_post_process', $content_data, $catinfo);
303
-
304
-    if (!empty($content_data)) {
305
-        $cat_content_info[] = implode(',', $content_data);
306
-    }
307
-
308
-    $totalcount = count(array_unique($post_ids));
309
-
310
-    if (!empty($cat_content_info)) {
311
-        return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
312
-    }
313
-    else {
314
-        return '[{"totalcount":"0"}]';
315
-    }
280
+				$post_title .= $event_dates;
281
+			}
282
+
283
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : '';
284
+			$mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
285
+			$title = str_replace($srcharr, $replarr, $post_title);
286
+
287
+			$content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}';
288
+			$post_ids[] = $catinfo_obj->post_id;
289
+		}
290
+	}
291
+
292
+	/**
293
+	 * Called after marker data is processed into JSON.
294
+	 *
295
+	 * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
296
+	 *
297
+	 * @since 1.4.9
298
+	 * @param array $content_data The array containing all markers in JSON format.
299
+	 * @param object $catinfo The posts object containing all marker data.
300
+	 * @see 'geodir_before_marker_post_process'
301
+	 */
302
+	do_action('geodir_after_marker_post_process', $content_data, $catinfo);
303
+
304
+	if (!empty($content_data)) {
305
+		$cat_content_info[] = implode(',', $content_data);
306
+	}
307
+
308
+	$totalcount = count(array_unique($post_ids));
309
+
310
+	if (!empty($cat_content_info)) {
311
+		return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
312
+	}
313
+	else {
314
+		return '[{"totalcount":"0"}]';
315
+	}
316 316
 }
317 317
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
11 11
     $post_taxonomy = geodir_get_taxonomies($gd_post_type);
12 12
     $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
13
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
13
+    $child_collapse = (bool) $_REQUEST['child_collapse'];
14 14
     echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
15 15
     die;
16 16
 }
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
     global $wpdb, $plugin_prefix, $gd_session;
31 31
 
32 32
     if ($_REQUEST['m_id'] != '') {
33
-        $pid = (int)$_REQUEST['m_id'];
33
+        $pid = (int) $_REQUEST['m_id'];
34 34
     } else {
35 35
         echo __('No marker data found', 'geodirectory');
36 36
         exit;
37 37
     }
38 38
 
39 39
     if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
40
-        $post = (object)$gd_ses_listing;
40
+        $post = (object) $gd_ses_listing;
41 41
         echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
42 42
     } else {
43 43
         $geodir_post_type = get_post_type($pid);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
195 195
 
196
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
196
+    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby, $main_query_array);
197 197
     
198 198
 	/**
199 199
 	 * Filter the SQL query to retrive markers data
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                     $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
270 270
                 
271 271
                     if ($end_date != '' && strtotime($end_date) >= $today) {
272
-                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
272
+                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) . ' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
273 273
                     }
274 274
                 }
275 275
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
285 285
             $title = str_replace($srcharr, $replarr, $post_title);
286 286
 
287
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}';
287
+            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"' . $mark_extra . '}';
288 288
             $post_ids[] = $catinfo_obj->post_id;
289 289
         }
290 290
     }
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_functions.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $title = str_replace($srcharr, $replarr, $post_title);
62 62
 
63 63
         if (is_ssl()) {
64
-            $icon = str_replace("http:","https:",$icon );
64
+            $icon = str_replace("http:", "https:", $icon);
65 65
         }
66 66
 
67 67
         $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '"}';
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
          * @param string $post_json JSON representation of the post marker info.
74 74
          * @param object $post The post object.
75 75
          */
76
-        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
76
+        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
77 77
     }
78 78
 }
79 79
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
                     }
213 213
                 }
214 214
 
215
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
215
+                $term_check = '<input type="checkbox" ' . $checked . ' id="' . $map_canvas_name . '_tick_cat_' . $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
216 216
                 $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
217 217
                 $term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
218 218
                 $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
219
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
219
+                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name . '_tick_cat_' . $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
220 220
 
221 221
             endif;
222 222
 
Please login to merge, or discard this patch.
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Google Map related functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Google Map related functions.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 /**
10 10
  * Creates a global variable for storing map json data.
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function  geodir_init_map_jason()
17 17
 {
18
-    global $map_jason;
19
-    $map_jason = array();
18
+	global $map_jason;
19
+	$map_jason = array();
20 20
 }
21 21
 
22 22
 /**
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function geodir_init_map_canvas_array()
30 30
 {
31
-    global $map_canvas_arr;
32
-    $map_canvas_arr = array();
31
+	global $map_canvas_arr;
32
+	$map_canvas_arr = array();
33 33
 }
34 34
 
35 35
 
@@ -47,34 +47,34 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function create_marker_jason_of_posts($post)
49 49
 {
50
-    global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons;
50
+	global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons;
51 51
 
52
-    if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
53
-        $srcharr = array("'", "/", "-", '"', '\\');
54
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
52
+	if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
53
+		$srcharr = array("'", "/", "-", '"', '\\');
54
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
55 55
 
56 56
 
57
-        $geodir_cat_icons = geodir_get_term_icon();
58
-        $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
57
+		$geodir_cat_icons = geodir_get_term_icon();
58
+		$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
59 59
 
60
-        $post_title = $post->post_title;
61
-        $title = str_replace($srcharr, $replarr, $post_title);
60
+		$post_title = $post->post_title;
61
+		$title = str_replace($srcharr, $replarr, $post_title);
62 62
 
63
-        if (is_ssl()) {
64
-            $icon = str_replace("http:","https:",$icon );
65
-        }
63
+		if (is_ssl()) {
64
+			$icon = str_replace("http:","https:",$icon );
65
+		}
66 66
 
67
-        $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '"}';
67
+		$post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '"}';
68 68
 
69
-        /**
70
-         * Filter the json data when creating output for post json marker..
71
-         *
72
-         * @since 1.5.7
73
-         * @param string $post_json JSON representation of the post marker info.
74
-         * @param object $post The post object.
75
-         */
76
-        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
77
-    }
69
+		/**
70
+		 * Filter the json data when creating output for post json marker..
71
+		 *
72
+		 * @since 1.5.7
73
+		 * @param string $post_json JSON representation of the post marker info.
74
+		 * @param object $post The post object.
75
+		 */
76
+		$map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
77
+	}
78 78
 }
79 79
 
80 80
 /**
@@ -87,60 +87,60 @@  discard block
 block discarded – undo
87 87
  */
88 88
 function send_marker_jason_to_js()
89 89
 {
90
-    global $map_jason, $map_canvas_arr;
91
-
92
-    if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
93
-        foreach ($map_canvas_arr as $canvas => $jason) {
94
-            if (is_array($map_jason) && !empty($map_jason)) {
95
-
96
-                $canvas_jason = $canvas . "_jason";
97
-                $map_canvas_arr[$canvas] = array_unique($map_jason);
98
-                unset($cat_content_info);
99
-                $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
100
-                $totalcount = count(array_unique($map_jason));
101
-                if (!empty($cat_content_info)) {
102
-                    $json_content = substr(implode(',', $cat_content_info), 1);
103
-                    $json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
104
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
105
-                } else {
106
-                    $canvas_jason = '[{"totalcount":"0"}]';
107
-                }
108
-
109
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
110
-
111
-                /**
112
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
113
-                 *
114
-                 * You can use this filter to modify map canvas json args.
115
-                 *
116
-                 * @since 1.0.0
117
-                 * @package GeoDirectory
118
-                 * @param string $canvas Map canvas array key.
119
-                 * @param array $map_canvas_jason_args Map canvas args.
120
-                 */
121
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
122
-
123
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
124
-            } else {
125
-                $canvas_jason = '[{"totalcount":"0"}]';
126
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
127
-
128
-                /**
129
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
130
-                 *
131
-                 * You can use this filter to modify map canvas json args.
132
-                 *
133
-                 * @since 1.0.0
134
-                 * @package GeoDirectory
135
-                 * @param string $canvas Map canvas array key.
136
-                 * @param array $map_canvas_jason_args Map canvas args.
137
-                 */
138
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
139
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
140
-            }
141
-        }
142
-
143
-    }
90
+	global $map_jason, $map_canvas_arr;
91
+
92
+	if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
93
+		foreach ($map_canvas_arr as $canvas => $jason) {
94
+			if (is_array($map_jason) && !empty($map_jason)) {
95
+
96
+				$canvas_jason = $canvas . "_jason";
97
+				$map_canvas_arr[$canvas] = array_unique($map_jason);
98
+				unset($cat_content_info);
99
+				$cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
100
+				$totalcount = count(array_unique($map_jason));
101
+				if (!empty($cat_content_info)) {
102
+					$json_content = substr(implode(',', $cat_content_info), 1);
103
+					$json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
104
+					$canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
105
+				} else {
106
+					$canvas_jason = '[{"totalcount":"0"}]';
107
+				}
108
+
109
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
110
+
111
+				/**
112
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
113
+				 *
114
+				 * You can use this filter to modify map canvas json args.
115
+				 *
116
+				 * @since 1.0.0
117
+				 * @package GeoDirectory
118
+				 * @param string $canvas Map canvas array key.
119
+				 * @param array $map_canvas_jason_args Map canvas args.
120
+				 */
121
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
122
+
123
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
124
+			} else {
125
+				$canvas_jason = '[{"totalcount":"0"}]';
126
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
127
+
128
+				/**
129
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
130
+				 *
131
+				 * You can use this filter to modify map canvas json args.
132
+				 *
133
+				 * @since 1.0.0
134
+				 * @package GeoDirectory
135
+				 * @param string $canvas Map canvas array key.
136
+				 * @param array $map_canvas_jason_args Map canvas args.
137
+				 */
138
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
139
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
140
+			}
141
+		}
142
+
143
+	}
144 144
 }
145 145
 
146 146
 /**
@@ -159,86 +159,86 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false)
161 161
 {
162
-    global $cat_count, $geodir_cat_icons;
162
+	global $cat_count, $geodir_cat_icons;
163 163
 
164
-    $exclude_categories = get_option('geodir_exclude_cat_on_map');
165
-    $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
164
+	$exclude_categories = get_option('geodir_exclude_cat_on_map');
165
+	$exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
166 166
 
167
-    // check if exclude categories saved before fix of categories identical names
168
-    if ($exclude_categories_new) {
169
-        $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
170
-        $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
171
-    }
167
+	// check if exclude categories saved before fix of categories identical names
168
+	if ($exclude_categories_new) {
169
+		$gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
170
+		$exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
171
+	}
172 172
 
173
-    $exclude_cat_str = implode(',', $exclude_categories);
173
+	$exclude_cat_str = implode(',', $exclude_categories);
174 174
 
175
-    if ($exclude_cat_str == '') {
176
-        $exclude_cat_str = '0';
177
-    }
175
+	if ($exclude_cat_str == '') {
176
+		$exclude_cat_str = '0';
177
+	}
178 178
 
179
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
179
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
180 180
 
181
-    $main_list_class = '';
182
-    //If there are terms, start displaying
183
-    if (count($cat_terms) > 0) {
184
-        //Displaying as a list
185
-        $p = $pading * 15;
186
-        $pading++;
181
+	$main_list_class = '';
182
+	//If there are terms, start displaying
183
+	if (count($cat_terms) > 0) {
184
+		//Displaying as a list
185
+		$p = $pading * 15;
186
+		$pading++;
187 187
 
188
-        if ($cat_parent == 0) {
189
-            $list_class = 'main_list';
190
-            $display = '';
191
-        } else {
192
-            $list_class = 'sub_list';
193
-            $display = !$child_collapse ? '' : 'display:none';
194
-        }
188
+		if ($cat_parent == 0) {
189
+			$list_class = 'main_list';
190
+			$display = '';
191
+		} else {
192
+			$list_class = 'sub_list';
193
+			$display = !$child_collapse ? '' : 'display:none';
194
+		}
195 195
 
196 196
 
197
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
197
+		$out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
198 198
 
199
-        $geodir_cat_icons = geodir_get_term_icon();
199
+		$geodir_cat_icons = geodir_get_term_icon();
200 200
 
201
-        foreach ($cat_terms as $cat_term):
201
+		foreach ($cat_terms as $cat_term):
202 202
 
203
-            $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : 'gd_place';
203
+			$post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : 'gd_place';
204 204
 
205
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
205
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
206 206
 
207
-            if (!in_array($cat_term->term_id, $exclude_categories)):
208
-                //Secret sauce.  Function calls itself to display child elements, if any
209
-                $checked = 'checked="checked"';
207
+			if (!in_array($cat_term->term_id, $exclude_categories)):
208
+				//Secret sauce.  Function calls itself to display child elements, if any
209
+				$checked = 'checked="checked"';
210 210
 
211
-                // Untick the category by default on home map
212
-                if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
213
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
214
-                        $checked = '';
215
-                    }
216
-                }
211
+				// Untick the category by default on home map
212
+				if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
213
+					if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
214
+						$checked = '';
215
+					}
216
+				}
217 217
 
218
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
219
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
220
-                $term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
221
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
222
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
218
+				$term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
219
+				$term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
220
+				$term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
221
+				$term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
222
+				$out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
223 223
 
224
-            endif;
224
+			endif;
225 225
 
226 226
 
227
-            // get sub category by recurson
228
-            $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
227
+			// get sub category by recurson
228
+			$out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
229 229
 
230
-            $out .= '</li>';
230
+			$out .= '</li>';
231 231
 
232
-        endforeach;
232
+		endforeach;
233 233
 
234
-        $out .= '</ul>';
234
+		$out .= '</ul>';
235 235
 
236
-        return $out;
237
-    } else {
238
-        if ($cat_parent == 0)
239
-            return _e('No category', 'geodirectory');
240
-    }
241
-    return;
236
+		return $out;
237
+	} else {
238
+		if ($cat_parent == 0)
239
+			return _e('No category', 'geodirectory');
240
+	}
241
+	return;
242 242
 }
243 243
 
244 244
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -235,8 +235,9 @@
 block discarded – undo
235 235
 
236 236
         return $out;
237 237
     } else {
238
-        if ($cat_parent == 0)
239
-            return _e('No category', 'geodirectory');
238
+        if ($cat_parent == 0) {
239
+                    return _e('No category', 'geodirectory');
240
+        }
240 241
     }
241 242
     return;
242 243
 }
Please login to merge, or discard this patch.