Passed
Pull Request — master (#223)
by Kiran
10:03
created
geodirectory-admin/option-pages/general_settings_array.php 1 patch
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -16,87 +16,87 @@  discard block
 block discarded – undo
16 16
  */
17 17
 $general_options = apply_filters('geodir_general_options', array(
18 18
 
19
-    array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
-
21
-    array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
-
23
-    array(
24
-        'name' => __('Sender name', 'geodirectory'),
25
-        'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
-        'id' => 'site_email_name',
27
-        'type' => 'text',
28
-        'css' => 'min-width:300px;',
29
-        'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
-    ),
31
-
32
-    array(
33
-        'name' => __('Email address', 'geodirectory'),
34
-        'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
-        'id' => 'site_email',
36
-        'type' => 'text',
37
-        'css' => 'min-width:300px;',
38
-        'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
-    ),
40
-    array(
41
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
-        'desc' => __('Yes', 'geodirectory'),
43
-        'id' => 'geodir_allow_wpadmin',
44
-        'std' => '1',
45
-        'type' => 'radio',
46
-        'value' => '1',
47
-        'radiogroup' => 'start'
48
-    ),
49
-    array(
50
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
-        'desc' => __('No', 'geodirectory'),
52
-        'id' => 'geodir_allow_wpadmin',
53
-        'std' => '0',
54
-        'type' => 'radio',
55
-        'value' => '0',
56
-        'radiogroup' => 'end'
57
-    ),
58
-
59
-    array(
60
-        'name' => __('Allow user to choose own password', 'geodirectory'),
61
-        'desc' => __('Yes', 'geodirectory'),
62
-        'id' => 'geodir_allow_cpass',
63
-        'std' => '1',
64
-        'type' => 'radio',
65
-        'value' => '1',
66
-        'radiogroup' => 'start'
67
-    ),
68
-    array(
69
-        'name' => __('Allow user to choose own password', 'geodirectory'),
70
-        'desc' => __('No', 'geodirectory'),
71
-        'id' => 'geodir_allow_cpass',
72
-        'std' => '0',
73
-        'type' => 'radio',
74
-        'value' => '0',
75
-        'radiogroup' => 'end'
76
-    ),
77
-    array(
78
-        'name' => __('Disable rating on comments', 'geodirectory'),
79
-        'desc' => __('Disable rating without disabling comments on listings', 'geodirectory'),
80
-        'id' => 'geodir_disable_rating',
81
-        'type' => 'checkbox',
82
-        'std' => '0'
83
-    ),
84
-    array(
85
-        'name' => __('User deleted posts go to trash', 'geodirectory'),
86
-        'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
87
-        'id' => 'geodir_disable_perm_delete',
88
-        'type' => 'checkbox',
89
-        'std' => '1'
90
-    ),
91
-    array(
92
-        'name' => __('Max upload file size(in mb)', 'geodirectory'),
93
-        'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
94
-        'id' => 'geodir_upload_max_filesize',
95
-        'type' => 'text',
96
-        'css' => 'min-width:300px;',
97
-        'std' => '2'
98
-    ),
99
-    array('type' => 'sectionend', 'id' => 'general_options'),
19
+	array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
+
21
+	array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
+
23
+	array(
24
+		'name' => __('Sender name', 'geodirectory'),
25
+		'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
+		'id' => 'site_email_name',
27
+		'type' => 'text',
28
+		'css' => 'min-width:300px;',
29
+		'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
+	),
31
+
32
+	array(
33
+		'name' => __('Email address', 'geodirectory'),
34
+		'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
+		'id' => 'site_email',
36
+		'type' => 'text',
37
+		'css' => 'min-width:300px;',
38
+		'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
+	),
40
+	array(
41
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
+		'desc' => __('Yes', 'geodirectory'),
43
+		'id' => 'geodir_allow_wpadmin',
44
+		'std' => '1',
45
+		'type' => 'radio',
46
+		'value' => '1',
47
+		'radiogroup' => 'start'
48
+	),
49
+	array(
50
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
+		'desc' => __('No', 'geodirectory'),
52
+		'id' => 'geodir_allow_wpadmin',
53
+		'std' => '0',
54
+		'type' => 'radio',
55
+		'value' => '0',
56
+		'radiogroup' => 'end'
57
+	),
58
+
59
+	array(
60
+		'name' => __('Allow user to choose own password', 'geodirectory'),
61
+		'desc' => __('Yes', 'geodirectory'),
62
+		'id' => 'geodir_allow_cpass',
63
+		'std' => '1',
64
+		'type' => 'radio',
65
+		'value' => '1',
66
+		'radiogroup' => 'start'
67
+	),
68
+	array(
69
+		'name' => __('Allow user to choose own password', 'geodirectory'),
70
+		'desc' => __('No', 'geodirectory'),
71
+		'id' => 'geodir_allow_cpass',
72
+		'std' => '0',
73
+		'type' => 'radio',
74
+		'value' => '0',
75
+		'radiogroup' => 'end'
76
+	),
77
+	array(
78
+		'name' => __('Disable rating on comments', 'geodirectory'),
79
+		'desc' => __('Disable rating without disabling comments on listings', 'geodirectory'),
80
+		'id' => 'geodir_disable_rating',
81
+		'type' => 'checkbox',
82
+		'std' => '0'
83
+	),
84
+	array(
85
+		'name' => __('User deleted posts go to trash', 'geodirectory'),
86
+		'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
87
+		'id' => 'geodir_disable_perm_delete',
88
+		'type' => 'checkbox',
89
+		'std' => '1'
90
+	),
91
+	array(
92
+		'name' => __('Max upload file size(in mb)', 'geodirectory'),
93
+		'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
94
+		'id' => 'geodir_upload_max_filesize',
95
+		'type' => 'text',
96
+		'css' => 'min-width:300px;',
97
+		'std' => '2'
98
+	),
99
+	array('type' => 'sectionend', 'id' => 'general_options'),
100 100
 
101 101
 ));/* General Options End*/
102 102
 
@@ -108,95 +108,95 @@  discard block
 block discarded – undo
108 108
  */
109 109
 $google_analytic_settings = apply_filters('geodir_google_analytic_settings', array(
110 110
 
111
-    array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
112
-
113
-    array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
114
-
115
-
116
-
117
-    array(
118
-        'name' => __('Show business owner google analytics stats?', 'geodirectory'),
119
-        'desc' => __('Yes', 'geodirectory'),
120
-        'id' => 'geodir_ga_stats',
121
-        'std' => '0',
122
-        'type' => 'radio',
123
-        'value' => '1',
124
-        'radiogroup' => 'start'
125
-    ),
126
-    array(
127
-        'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
128
-        'desc' => __('No', 'geodirectory'),
129
-        'id' => 'geodir_ga_stats',
130
-        'std' => '1',
131
-        'type' => 'radio',
132
-        'value' => '0',
133
-        'radiogroup' => 'end'
134
-    ),
135
-
136
-    array(
137
-        'name' => __('Google analytics "Profile ID(ie: ga:12345678)?', 'geodirectory') . ' ' .
138
-            '<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
139
-        'desc' => '',
140
-        'id' => 'geodir_ga_id',
141
-        'type' => 'text',
142
-        'css' => 'min-width:300px;',
143
-        'std' => '' // Default value for the page title - changed in settings
144
-    ),
145
-
146
-    array(
147
-        'name' => __('Client ID', 'geodirectory') . ' ' .
148
-            '<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
149
-        'desc' => '',
150
-        'id' => 'geodir_ga_client_id',
151
-        'type' => 'text',
152
-        'css' => 'min-width:300px;',
153
-        'std' => '' // Default value for the page title - changed in settings
154
-    ),
155
-
156
-    array(
157
-        'name' => __('Client secret', 'geodirectory') . ' ' .
158
-            '<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
159
-        'desc' => '',
160
-        'id' => 'geodir_ga_client_secret',
161
-        'type' => 'password',
162
-        'css' => 'min-width:300px;',
163
-        'std' => '' // Default value for the page title - changed in settings
164
-    ),
165
-
166
-    array(
167
-        'name' => __('Google analytics access', 'geodirectory'),
168
-        'desc' => '',
169
-        'id' => 'geodir_ga_token',
170
-        'type' => 'google_analytics',
171
-        'css' => 'min-width:300px;',
172
-        'std' => '' // Default value for the page title - changed in settings
173
-    ),
174
-
175
-
176
-    array(
177
-        'name' => __('Google analytics tracking code', 'geodirectory'),
178
-        'desc' => '',
179
-        'id' => 'geodir_ga_tracking_code',
180
-        'type' => 'textarea',
181
-        'css' => 'min-width:300px;',
182
-        'std' => '' // Default value for the page title - changed in settings
183
-    ),
184
-    array(
185
-        'name' => __('Hide refresh button', 'geodirectory'),
186
-        'desc' => __('Hide refresh button to check & refresh new users', 'geodirectory'),
187
-        'id' => 'geodir_ga_no_refresh',
188
-        'type' => 'checkbox',
189
-        'std' => '0'
190
-    ),
191
-    array(
192
-        'name' => __('Time interval for check new users', 'geodirectory'),
193
-        'desc' => __('Time interval in seconds to check for new users. The new users results will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
194
-        'id' => 'geodir_ga_refresh_time',
195
-        'type' => 'text',
196
-        'std' => '5'
197
-    ),
198
-
199
-    array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
111
+	array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
112
+
113
+	array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
114
+
115
+
116
+
117
+	array(
118
+		'name' => __('Show business owner google analytics stats?', 'geodirectory'),
119
+		'desc' => __('Yes', 'geodirectory'),
120
+		'id' => 'geodir_ga_stats',
121
+		'std' => '0',
122
+		'type' => 'radio',
123
+		'value' => '1',
124
+		'radiogroup' => 'start'
125
+	),
126
+	array(
127
+		'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
128
+		'desc' => __('No', 'geodirectory'),
129
+		'id' => 'geodir_ga_stats',
130
+		'std' => '1',
131
+		'type' => 'radio',
132
+		'value' => '0',
133
+		'radiogroup' => 'end'
134
+	),
135
+
136
+	array(
137
+		'name' => __('Google analytics "Profile ID(ie: ga:12345678)?', 'geodirectory') . ' ' .
138
+			'<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
139
+		'desc' => '',
140
+		'id' => 'geodir_ga_id',
141
+		'type' => 'text',
142
+		'css' => 'min-width:300px;',
143
+		'std' => '' // Default value for the page title - changed in settings
144
+	),
145
+
146
+	array(
147
+		'name' => __('Client ID', 'geodirectory') . ' ' .
148
+			'<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
149
+		'desc' => '',
150
+		'id' => 'geodir_ga_client_id',
151
+		'type' => 'text',
152
+		'css' => 'min-width:300px;',
153
+		'std' => '' // Default value for the page title - changed in settings
154
+	),
155
+
156
+	array(
157
+		'name' => __('Client secret', 'geodirectory') . ' ' .
158
+			'<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
159
+		'desc' => '',
160
+		'id' => 'geodir_ga_client_secret',
161
+		'type' => 'password',
162
+		'css' => 'min-width:300px;',
163
+		'std' => '' // Default value for the page title - changed in settings
164
+	),
165
+
166
+	array(
167
+		'name' => __('Google analytics access', 'geodirectory'),
168
+		'desc' => '',
169
+		'id' => 'geodir_ga_token',
170
+		'type' => 'google_analytics',
171
+		'css' => 'min-width:300px;',
172
+		'std' => '' // Default value for the page title - changed in settings
173
+	),
174
+
175
+
176
+	array(
177
+		'name' => __('Google analytics tracking code', 'geodirectory'),
178
+		'desc' => '',
179
+		'id' => 'geodir_ga_tracking_code',
180
+		'type' => 'textarea',
181
+		'css' => 'min-width:300px;',
182
+		'std' => '' // Default value for the page title - changed in settings
183
+	),
184
+	array(
185
+		'name' => __('Hide refresh button', 'geodirectory'),
186
+		'desc' => __('Hide refresh button to check & refresh new users', 'geodirectory'),
187
+		'id' => 'geodir_ga_no_refresh',
188
+		'type' => 'checkbox',
189
+		'std' => '0'
190
+	),
191
+	array(
192
+		'name' => __('Time interval for check new users', 'geodirectory'),
193
+		'desc' => __('Time interval in seconds to check for new users. The new users results will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
194
+		'id' => 'geodir_ga_refresh_time',
195
+		'type' => 'text',
196
+		'std' => '5'
197
+	),
198
+
199
+	array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
200 200
 
201 201
 )); // google_analytic_settings End
202 202
 
@@ -208,84 +208,84 @@  discard block
 block discarded – undo
208 208
  */
209 209
 $search_settings = apply_filters('geodir_search_settings', array(
210 210
 
211
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
212
-
213
-    array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
214
-
215
-    array(
216
-        'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
217
-        'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
218
-        'id' => 'geodir_search_dist',
219
-        'type' => 'text',
220
-        'css' => 'min-width:300px;',
221
-        'std' => '40' // Default value for the page title - changed in settings
222
-    ),
223
-
224
-    array(
225
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
226
-        'desc' => __('Miles', 'geodirectory'),
227
-        'id' => 'geodir_search_dist_1',
228
-        'std' => 'miles',
229
-        'type' => 'radio',
230
-        'value' => 'miles',
231
-        'radiogroup' => 'start'
232
-    ),
233
-    array(
234
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
235
-        'desc' => __('Kilometers', 'geodirectory'),
236
-        'id' => 'geodir_search_dist_1',
237
-        'std' => 'miles',
238
-        'type' => 'radio',
239
-        'value' => 'km',
240
-        'radiogroup' => 'end'
241
-    ),
242
-
243
-    array(
244
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
245
-        'desc' => __('Meters', 'geodirectory'),
246
-        'id' => 'geodir_search_dist_2',
247
-        'std' => 'meters',
248
-        'type' => 'radio',
249
-        'value' => 'meters',
250
-        'radiogroup' => 'start'
251
-    ),
252
-
253
-    array(
254
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
255
-        'desc' => __('Feet', 'geodirectory'),
256
-        'id' => 'geodir_search_dist_2',
257
-        'std' => 'meters',
258
-        'type' => 'radio',
259
-        'value' => 'feet',
260
-        'radiogroup' => 'end'
261
-    ),
262
-
263
-    array(
264
-        'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
265
-        'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
266
-        'id' => 'geodir_search_near_addition',
267
-        'type' => 'text',
268
-        'css' => 'min-width:300px;',
269
-        'std' => ''
270
-    ),
271
-    array(
272
-        'name' => __('Individual word search limit', 'geodirectory'),
273
-        'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
274
-        'id' => 'geodir_search_word_limit',
275
-        'css' => 'min-width:300px;',
276
-        'std' => 'gridview_onehalf',
277
-        'type' => 'select',
278
-        'class' => 'chosen_select',
279
-        'options' => array_unique(array(
280
-            '0' => __('Disabled', 'geodirectory'),
281
-            '1' => __('1 Character words excluded', 'geodirectory'),
282
-            '2' => __('2 Character words and less excluded', 'geodirectory'),
283
-            '3' => __('3 Character words and less excluded', 'geodirectory'),
284
-        ))
285
-    ),
286
-
287
-
288
-    array('type' => 'sectionend', 'id' => 'search_settings'),
211
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
212
+
213
+	array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
214
+
215
+	array(
216
+		'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
217
+		'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
218
+		'id' => 'geodir_search_dist',
219
+		'type' => 'text',
220
+		'css' => 'min-width:300px;',
221
+		'std' => '40' // Default value for the page title - changed in settings
222
+	),
223
+
224
+	array(
225
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
226
+		'desc' => __('Miles', 'geodirectory'),
227
+		'id' => 'geodir_search_dist_1',
228
+		'std' => 'miles',
229
+		'type' => 'radio',
230
+		'value' => 'miles',
231
+		'radiogroup' => 'start'
232
+	),
233
+	array(
234
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
235
+		'desc' => __('Kilometers', 'geodirectory'),
236
+		'id' => 'geodir_search_dist_1',
237
+		'std' => 'miles',
238
+		'type' => 'radio',
239
+		'value' => 'km',
240
+		'radiogroup' => 'end'
241
+	),
242
+
243
+	array(
244
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
245
+		'desc' => __('Meters', 'geodirectory'),
246
+		'id' => 'geodir_search_dist_2',
247
+		'std' => 'meters',
248
+		'type' => 'radio',
249
+		'value' => 'meters',
250
+		'radiogroup' => 'start'
251
+	),
252
+
253
+	array(
254
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
255
+		'desc' => __('Feet', 'geodirectory'),
256
+		'id' => 'geodir_search_dist_2',
257
+		'std' => 'meters',
258
+		'type' => 'radio',
259
+		'value' => 'feet',
260
+		'radiogroup' => 'end'
261
+	),
262
+
263
+	array(
264
+		'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
265
+		'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
266
+		'id' => 'geodir_search_near_addition',
267
+		'type' => 'text',
268
+		'css' => 'min-width:300px;',
269
+		'std' => ''
270
+	),
271
+	array(
272
+		'name' => __('Individual word search limit', 'geodirectory'),
273
+		'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
274
+		'id' => 'geodir_search_word_limit',
275
+		'css' => 'min-width:300px;',
276
+		'std' => 'gridview_onehalf',
277
+		'type' => 'select',
278
+		'class' => 'chosen_select',
279
+		'options' => array_unique(array(
280
+			'0' => __('Disabled', 'geodirectory'),
281
+			'1' => __('1 Character words excluded', 'geodirectory'),
282
+			'2' => __('2 Character words and less excluded', 'geodirectory'),
283
+			'3' => __('3 Character words and less excluded', 'geodirectory'),
284
+		))
285
+	),
286
+
287
+
288
+	array('type' => 'sectionend', 'id' => 'search_settings'),
289 289
 
290 290
 )); //search_settings End
291 291
 
@@ -297,17 +297,17 @@  discard block
 block discarded – undo
297 297
  */
298 298
 $dummy_data_settings = apply_filters('geodir_dummy_data_settings', array(
299 299
 
300
-    array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
301
-
302
-    array(
303
-        'name' => '',
304
-        'desc' => '',
305
-        'id' => 'geodir_dummy_data_installer',
306
-        'type' => 'dummy_installer',
307
-        'css' => 'min-width:300px;',
308
-        'std' => '40' // Default value for the page title - changed in settings
309
-    ),
310
-    array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
300
+	array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
301
+
302
+	array(
303
+		'name' => '',
304
+		'desc' => '',
305
+		'id' => 'geodir_dummy_data_installer',
306
+		'type' => 'dummy_installer',
307
+		'css' => 'min-width:300px;',
308
+		'std' => '40' // Default value for the page title - changed in settings
309
+	),
310
+	array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
311 311
 
312 312
 )); //dummy_data_settings End
313 313
 
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 3 patches
Indentation   +1481 added lines, -1481 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Hook and filter actions used by the plugin
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- * @global array $geodir_addon_list List of active GeoDirectory extensions.
8
- * @global string $plugin_file_name Plugin main file name. 'geodirectory/geodirectory.php'.
9
- */
3
+	 * Hook and filter actions used by the plugin
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
8
+	 * @global string $plugin_file_name Plugin main file name. 'geodirectory/geodirectory.php'.
9
+	 */
10 10
 
11 11
 /**
12 12
  * Return the GeoDirectory ajax specific url.
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
  */
222 222
 function geodir_unset_prev_theme_nav_location($newname)
223 223
 {
224
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
-    if ($geodir_theme_location) {
226
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
227
-    } else {
228
-        update_option('geodir_theme_location_nav', '');
229
-    }
224
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
+	if ($geodir_theme_location) {
226
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
227
+	} else {
228
+		update_option('geodir_theme_location_nav', '');
229
+	}
230 230
 }
231 231
 
232 232
 /// add action for theme switch to blank previous theme navigation location setting
@@ -247,32 +247,32 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function geodir_add_post_filters()
249 249
 {
250
-    /**
251
-     * Contains all function for filtering listing.
252
-     *
253
-     * @since 1.0.0
254
-     * @package GeoDirectory
255
-     */
256
-    include_once('geodirectory-functions/listing_filters.php');
250
+	/**
251
+	 * Contains all function for filtering listing.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @package GeoDirectory
255
+	 */
256
+	include_once('geodirectory-functions/listing_filters.php');
257 257
 }
258 258
 
259 259
 
260 260
 if (!function_exists('geodir_init_defaults')) {
261
-    /**
262
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
263
-     *
264
-     * @since 1.0.0
265
-     * @package GeoDirectory
266
-     */
267
-    function geodir_init_defaults()
268
-    {
269
-        if (function_exists('geodir_register_defaults')) {
261
+	/**
262
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
263
+	 *
264
+	 * @since 1.0.0
265
+	 * @package GeoDirectory
266
+	 */
267
+	function geodir_init_defaults()
268
+	{
269
+		if (function_exists('geodir_register_defaults')) {
270 270
 
271
-            geodir_register_defaults();
271
+			geodir_register_defaults();
272 272
 
273
-        }
273
+		}
274 274
 
275
-    }
275
+	}
276 276
 }
277 277
 
278 278
 
@@ -294,26 +294,26 @@  discard block
 block discarded – undo
294 294
 // CALLED ON 'sidebars_widgets' FILTER
295 295
 
296 296
 if (!function_exists('geodir_restrict_widget')) {
297
-    /**
298
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
299
-     *
300
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
301
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
302
-     * @since 1.0.0
303
-     * @package GeoDirectory
304
-     */
305
-    function geodir_restrict_widget()
306
-    {
307
-        global $is_listing, $is_single_place;
297
+	/**
298
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
299
+	 *
300
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
301
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
302
+	 * @since 1.0.0
303
+	 * @package GeoDirectory
304
+	 */
305
+	function geodir_restrict_widget()
306
+	{
307
+		global $is_listing, $is_single_place;
308 308
 
309
-        // set is listing	
310
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
309
+		// set is listing	
310
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
311 311
 
312
-        // set is single place
313
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
312
+		// set is single place
313
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
314 314
 
315 315
 
316
-    }
316
+	}
317 317
 }
318 318
 
319 319
 
@@ -334,32 +334,32 @@  discard block
 block discarded – undo
334 334
  */
335 335
 function geodir_detail_page_sidebar_content_sorting()
336 336
 {
337
-    $arr_detail_page_sidebar_content =
338
-        /**
339
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
340
-         *
341
-         * This filter can be used to remove sections of the details page sidebar,
342
-         * add new sections or rearrange the order of the sections.
343
-         *
344
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
345
-         * @since 1.0.0
346
-         */
347
-        apply_filters('geodir_detail_page_sidebar_content',
348
-            array('geodir_social_sharing_buttons',
349
-                'geodir_share_this_button',
350
-                'geodir_detail_page_google_analytics',
351
-                'geodir_edit_post_link',
352
-                'geodir_detail_page_review_rating',
353
-                'geodir_detail_page_more_info'
354
-            ) // end of array 
355
-        ); // end of apply filter
356
-    if (!empty($arr_detail_page_sidebar_content)) {
357
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
358
-            if (function_exists($content_function)) {
359
-                add_action('geodir_detail_page_sidebar', $content_function);
360
-            }
361
-        }
362
-    }
337
+	$arr_detail_page_sidebar_content =
338
+		/**
339
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
340
+		 *
341
+		 * This filter can be used to remove sections of the details page sidebar,
342
+		 * add new sections or rearrange the order of the sections.
343
+		 *
344
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
345
+		 * @since 1.0.0
346
+		 */
347
+		apply_filters('geodir_detail_page_sidebar_content',
348
+			array('geodir_social_sharing_buttons',
349
+				'geodir_share_this_button',
350
+				'geodir_detail_page_google_analytics',
351
+				'geodir_edit_post_link',
352
+				'geodir_detail_page_review_rating',
353
+				'geodir_detail_page_more_info'
354
+			) // end of array 
355
+		); // end of apply filter
356
+	if (!empty($arr_detail_page_sidebar_content)) {
357
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
358
+			if (function_exists($content_function)) {
359
+				add_action('geodir_detail_page_sidebar', $content_function);
360
+			}
361
+		}
362
+	}
363 363
 }
364 364
 
365 365
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function geodir_add_to_favourite_link()
376 376
 {
377
-    global $post, $preview;
378
-    if (!$preview && geodir_is_page('detail')) {
379
-        ?>
377
+	global $post, $preview;
378
+	if (!$preview && geodir_is_page('detail')) {
379
+		?>
380 380
         <p class="edit_link">
381 381
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
382 382
         </p>
383 383
     <?php
384
-    }
384
+	}
385 385
 }
386 386
 
387 387
 /**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
  */
396 396
 function geodir_social_sharing_buttons()
397 397
 {
398
-    global $preview;
399
-    ob_start(); // Start  buffering;
400
-    /**
401
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
-     *
403
-     * @since 1.0.0
404
-     */
405
-    do_action('geodir_before_social_sharing_buttons');
406
-    if (!$preview) {
407
-        ?>
398
+	global $preview;
399
+	ob_start(); // Start  buffering;
400
+	/**
401
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
+	 *
403
+	 * @since 1.0.0
404
+	 */
405
+	do_action('geodir_before_social_sharing_buttons');
406
+	if (!$preview) {
407
+		?>
408 408
         <div class="likethis">
409 409
             <?php geodir_twitter_tweet_button(); ?>
410 410
             <?php geodir_fb_like_button(); ?>
411 411
             <?php geodir_google_plus_button(); ?>
412 412
         </div>
413 413
     <?php
414
-    }// end of if, if its a preview or not
415
-
416
-    /**
417
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
-     *
419
-     * @since 1.0.0
420
-     */
421
-    do_action('geodir_after_social_sharing_buttons');
422
-    $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
-        /**
427
-         * Filter the geodir_social_sharing_buttons() function content.
428
-         *
429
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
-         */
431
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
-    }
414
+	}// end of if, if its a preview or not
415
+
416
+	/**
417
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
+	 *
419
+	 * @since 1.0.0
420
+	 */
421
+	do_action('geodir_after_social_sharing_buttons');
422
+	$content_html = ob_get_clean();
423
+	if (trim($content_html) != '')
424
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
+		/**
427
+		 * Filter the geodir_social_sharing_buttons() function content.
428
+		 *
429
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
+		 */
431
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
+	}
433 433
 
434 434
 
435 435
 }
@@ -445,39 +445,39 @@  discard block
 block discarded – undo
445 445
  */
446 446
 function geodir_share_this_button()
447 447
 {
448
-    global $preview;
449
-    ob_start(); // Start buffering;
450
-    /**
451
-     * This is called before the share this html in the function geodir_share_this_button()
452
-     *
453
-     * @since 1.0.0
454
-     */
455
-    do_action('geodir_before_share_this_button');
456
-    if (!$preview) {
457
-        ?>
448
+	global $preview;
449
+	ob_start(); // Start buffering;
450
+	/**
451
+	 * This is called before the share this html in the function geodir_share_this_button()
452
+	 *
453
+	 * @since 1.0.0
454
+	 */
455
+	do_action('geodir_before_share_this_button');
456
+	if (!$preview) {
457
+		?>
458 458
         <div class="share clearfix">
459 459
             <?php geodir_share_this_button_code(); ?>
460 460
         </div>
461 461
     <?php
462
-    }// end of if, if its a preview or not
463
-    /**
464
-     * This is called after the share this html in the function geodir_share_this_button()
465
-     *
466
-     * @since 1.0.0
467
-     */
468
-    do_action('geodir_after_share_this_button');
469
-    $content_html = ob_get_clean();
470
-    if (trim($content_html) != '')
471
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473
-        /**
474
-         * Filter the geodir_share_this_button() function content.
475
-         *
476
-         * @param string $content_html The output html of the geodir_share_this_button() function.
477
-         * @since 1.0.0
478
-         */
479
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
480
-    }
462
+	}// end of if, if its a preview or not
463
+	/**
464
+	 * This is called after the share this html in the function geodir_share_this_button()
465
+	 *
466
+	 * @since 1.0.0
467
+	 */
468
+	do_action('geodir_after_share_this_button');
469
+	$content_html = ob_get_clean();
470
+	if (trim($content_html) != '')
471
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473
+		/**
474
+		 * Filter the geodir_share_this_button() function content.
475
+		 *
476
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
477
+		 * @since 1.0.0
478
+		 */
479
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
480
+	}
481 481
 
482 482
 }
483 483
 
@@ -493,46 +493,46 @@  discard block
 block discarded – undo
493 493
  */
494 494
 function geodir_edit_post_link()
495 495
 {
496
-    global $post, $preview;
497
-    ob_start(); // Start buffering;
498
-    /**
499
-     * This is called before the edit post link html in the function geodir_edit_post_link()
500
-     *
501
-     * @since 1.0.0
502
-     */
503
-    do_action('geodir_before_edit_post_link');
504
-    if (!$preview) {
505
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
496
+	global $post, $preview;
497
+	ob_start(); // Start buffering;
498
+	/**
499
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
500
+	 *
501
+	 * @since 1.0.0
502
+	 */
503
+	do_action('geodir_before_edit_post_link');
504
+	if (!$preview) {
505
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
506 506
         
507
-        if ($is_current_user_owner) {
508
-            $post_id = $post->ID;
507
+		if ($is_current_user_owner) {
508
+			$post_id = $post->ID;
509 509
             
510
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
511
-                $post_id = (int)$_REQUEST['pid'];
512
-            }
510
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
511
+				$post_id = (int)$_REQUEST['pid'];
512
+			}
513 513
 
514
-            $postlink = get_permalink(geodir_add_listing_page_id());
515
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
516
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
-        }
518
-    }// end of if, if its a preview or not
519
-    /**
520
-     * This is called after the edit post link html in the function geodir_edit_post_link()
521
-     *
522
-     * @since 1.0.0
523
-     */
524
-    do_action('geodir_after_edit_post_link');
525
-    $content_html = ob_get_clean();
526
-    if (trim($content_html) != '')
527
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
528
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
529
-        /**
530
-         * Filter the geodir_edit_post_link() function content.
531
-         *
532
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
533
-         */
534
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
535
-    }
514
+			$postlink = get_permalink(geodir_add_listing_page_id());
515
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
516
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
+		}
518
+	}// end of if, if its a preview or not
519
+	/**
520
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
521
+	 *
522
+	 * @since 1.0.0
523
+	 */
524
+	do_action('geodir_after_edit_post_link');
525
+	$content_html = ob_get_clean();
526
+	if (trim($content_html) != '')
527
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
528
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
529
+		/**
530
+		 * Filter the geodir_edit_post_link() function content.
531
+		 *
532
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
533
+		 */
534
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
535
+	}
536 536
 }
537 537
 
538 538
 /**
@@ -546,40 +546,40 @@  discard block
 block discarded – undo
546 546
  */
547 547
 function geodir_detail_page_google_analytics()
548 548
 {
549
-    global $post;
550
-    $package_info = array();
551
-    $package_info = geodir_post_package_info($package_info, $post);
549
+	global $post;
550
+	$package_info = array();
551
+	$package_info = geodir_post_package_info($package_info, $post);
552 552
 
553
-    $id = trim(get_option('geodir_ga_id'));
553
+	$id = trim(get_option('geodir_ga_id'));
554 554
 
555
-    if (!$id) {
556
-        return; //if no Google Analytics ID then bail.
557
-    }
555
+	if (!$id) {
556
+		return; //if no Google Analytics ID then bail.
557
+	}
558 558
 
559
-    ob_start(); // Start buffering;
560
-    /**
561
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
562
-     *
563
-     * @since 1.0.0
564
-     */
565
-    do_action('geodir_before_google_analytics');
559
+	ob_start(); // Start buffering;
560
+	/**
561
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
562
+	 *
563
+	 * @since 1.0.0
564
+	 */
565
+	do_action('geodir_before_google_analytics');
566 566
     
567
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
568
-    /**
569
-     * Filter the time interval to check & refresh new users results.
570
-     *
571
-     * @since 1.5.9
572
-     *
573
-     * @param int $refresh_time Time interval to check & refresh new users results.
574
-     */
575
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
576
-    $refresh_time = absint($refresh_time * 1000);
567
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
568
+	/**
569
+	 * Filter the time interval to check & refresh new users results.
570
+	 *
571
+	 * @since 1.5.9
572
+	 *
573
+	 * @param int $refresh_time Time interval to check & refresh new users results.
574
+	 */
575
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
576
+	$refresh_time = absint($refresh_time * 1000);
577 577
     
578
-    $hide_refresh = get_option('geodir_ga_no_refresh');
578
+	$hide_refresh = get_option('geodir_ga_no_refresh');
579 579
     
580
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
581
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
582
-        ?>
580
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
581
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
582
+		?>
583 583
         <script type="text/javascript">
584 584
             var gd_gaTimeOut;
585 585
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -829,15 +829,15 @@  discard block
 block discarded – undo
829 829
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
830 830
 
831 831
                     <?php
832
-                    // Here we list the shorthand days of the week so it can be used in translation.
833
-                    __("Mon",'geodirectory');
834
-                    __("Tue",'geodirectory');
835
-                    __("Wed",'geodirectory');
836
-                    __("Thu",'geodirectory');
837
-                    __("Fri",'geodirectory');
838
-                    __("Sat",'geodirectory');
839
-                    __("Sun",'geodirectory');
840
-                    ?>
832
+					// Here we list the shorthand days of the week so it can be used in translation.
833
+					__("Mon",'geodirectory');
834
+					__("Tue",'geodirectory');
835
+					__("Wed",'geodirectory');
836
+					__("Thu",'geodirectory');
837
+					__("Fri",'geodirectory');
838
+					__("Sat",'geodirectory');
839
+					__("Sun",'geodirectory');
840
+					?>
841 841
 
842 842
                     labels = [
843 843
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1082,24 +1082,24 @@  discard block
 block discarded – undo
1082 1082
         </span>
1083 1083
 
1084 1084
     <?php
1085
-    }
1086
-    /**
1087
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1088
-     *
1089
-     * @since 1.0.0
1090
-     */
1091
-    do_action('geodir_after_google_analytics');
1092
-    $content_html = ob_get_clean();
1093
-    if (trim($content_html) != '')
1094
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1095
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1096
-        /**
1097
-         * Filter the geodir_edit_post_link() function content.
1098
-         *
1099
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1100
-         */
1101
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1102
-    }
1085
+	}
1086
+	/**
1087
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1088
+	 *
1089
+	 * @since 1.0.0
1090
+	 */
1091
+	do_action('geodir_after_google_analytics');
1092
+	$content_html = ob_get_clean();
1093
+	if (trim($content_html) != '')
1094
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1095
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1096
+		/**
1097
+		 * Filter the geodir_edit_post_link() function content.
1098
+		 *
1099
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1100
+		 */
1101
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1102
+	}
1103 1103
 }
1104 1104
 
1105 1105
 /**
@@ -1113,90 +1113,90 @@  discard block
 block discarded – undo
1113 1113
  */
1114 1114
 function geodir_detail_page_review_rating()
1115 1115
 {
1116
-    global $post, $preview, $post_images;
1117
-    ob_start(); // Start  buffering;
1118
-    /**
1119
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1120
-     *
1121
-     * This is called outside the check for an actual rating and the check for preview page.
1122
-     *
1123
-     * @since 1.0.0
1124
-     */
1125
-    do_action('geodir_before_detail_page_review_rating');
1126
-
1127
-    $comment_count = geodir_get_review_count_total($post->ID);
1128
-    $post_avgratings = geodir_get_post_rating($post->ID);
1129
-
1130
-    if ($post_avgratings != 0 && !$preview) {
1131
-        /**
1132
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1133
-         *
1134
-         * This is called inside the check for an actual rating and the check for preview page.
1135
-         *
1136
-         * @since 1.0.0
1137
-         * @param float $post_avgratings Average rating for the surrent post.
1138
-         * @param int $post->ID Current post ID.
1139
-         */
1140
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1141
-
1142
-        $html = '<p style=" float:left;">';
1143
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1144
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1145
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1116
+	global $post, $preview, $post_images;
1117
+	ob_start(); // Start  buffering;
1118
+	/**
1119
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1120
+	 *
1121
+	 * This is called outside the check for an actual rating and the check for preview page.
1122
+	 *
1123
+	 * @since 1.0.0
1124
+	 */
1125
+	do_action('geodir_before_detail_page_review_rating');
1126
+
1127
+	$comment_count = geodir_get_review_count_total($post->ID);
1128
+	$post_avgratings = geodir_get_post_rating($post->ID);
1129
+
1130
+	if ($post_avgratings != 0 && !$preview) {
1131
+		/**
1132
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1133
+		 *
1134
+		 * This is called inside the check for an actual rating and the check for preview page.
1135
+		 *
1136
+		 * @since 1.0.0
1137
+		 * @param float $post_avgratings Average rating for the surrent post.
1138
+		 * @param int $post->ID Current post ID.
1139
+		 */
1140
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1141
+
1142
+		$html = '<p style=" float:left;">';
1143
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1144
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1145
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1146 1146
        
1147 1147
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1148 1148
 	   
1149 1149
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1150 1150
 
1151
-        $html .= '<span class="item">';
1152
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1151
+		$html .= '<span class="item">';
1152
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1153 1153
 
1154
-        if ($post_images) {
1155
-            foreach ($post_images as $img) {
1156
-                $post_img = $img->src;
1157
-                break;
1158
-            }
1159
-        }
1160
-
1161
-        if (isset($post_img) && $post_img) {
1162
-            $html .= '<br /><img src="' . $post_img . '" class="photo hreview-img" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo hreview-img" />';
1163
-        }
1164
-
1165
-        $html .= '</span>';
1166
-
1167
-        echo $html .= '</div>';
1168
-        /**
1169
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1170
-         *
1171
-         * This is called inside the check for an actual rating and the check for preview page.
1172
-         *
1173
-         * @since 1.0.0
1174
-         * @param float $post_avgratings Average rating for the surrent post.
1175
-         * @param int $post->ID Current post ID.
1176
-         */
1177
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1178
-    }
1179
-    /**
1180
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1181
-     *
1182
-     * This is called outside the check for an actual rating and the check for preview page.
1183
-     *
1184
-     * @since 1.0.0
1185
-     */
1186
-    do_action('geodir_after_detail_page_review_rating');
1187
-    $content_html = ob_get_clean();
1188
-    if (trim($content_html) != '') {
1189
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1190
-    }
1191
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1192
-        /**
1193
-         * Filter the geodir_detail_page_review_rating() function content.
1194
-         *
1195
-         * @since 1.0.0
1196
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1197
-         */
1198
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1199
-    }
1154
+		if ($post_images) {
1155
+			foreach ($post_images as $img) {
1156
+				$post_img = $img->src;
1157
+				break;
1158
+			}
1159
+		}
1160
+
1161
+		if (isset($post_img) && $post_img) {
1162
+			$html .= '<br /><img src="' . $post_img . '" class="photo hreview-img" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo hreview-img" />';
1163
+		}
1164
+
1165
+		$html .= '</span>';
1166
+
1167
+		echo $html .= '</div>';
1168
+		/**
1169
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1170
+		 *
1171
+		 * This is called inside the check for an actual rating and the check for preview page.
1172
+		 *
1173
+		 * @since 1.0.0
1174
+		 * @param float $post_avgratings Average rating for the surrent post.
1175
+		 * @param int $post->ID Current post ID.
1176
+		 */
1177
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1178
+	}
1179
+	/**
1180
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1181
+	 *
1182
+	 * This is called outside the check for an actual rating and the check for preview page.
1183
+	 *
1184
+	 * @since 1.0.0
1185
+	 */
1186
+	do_action('geodir_after_detail_page_review_rating');
1187
+	$content_html = ob_get_clean();
1188
+	if (trim($content_html) != '') {
1189
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1190
+	}
1191
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1192
+		/**
1193
+		 * Filter the geodir_detail_page_review_rating() function content.
1194
+		 *
1195
+		 * @since 1.0.0
1196
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1197
+		 */
1198
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1199
+	}
1200 1200
 }
1201 1201
 
1202 1202
 /**
@@ -1208,35 +1208,35 @@  discard block
 block discarded – undo
1208 1208
  */
1209 1209
 function geodir_detail_page_more_info()
1210 1210
 {
1211
-    ob_start(); // Start  buffering;
1212
-    /**
1213
-     * This is called before the info section html.
1214
-     *
1215
-     * @since 1.0.0
1216
-     */
1217
-    do_action('geodir_before_detail_page_more_info');
1218
-    if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1219
-        echo $geodir_post_detail_fields;
1220
-    }
1221
-    /**
1222
-     * This is called after the info section html.
1223
-     *
1224
-     * @since 1.0.0
1225
-     */
1226
-    do_action('geodir_after_detail_page_more_info');
1227
-
1228
-    $content_html = ob_get_clean();
1229
-    if (trim($content_html) != '')
1230
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1231
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1232
-        /**
1233
-         * Filter the output html for function geodir_detail_page_more_info().
1234
-         *
1235
-         * @since 1.0.0
1236
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1237
-         */
1238
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1239
-    }
1211
+	ob_start(); // Start  buffering;
1212
+	/**
1213
+	 * This is called before the info section html.
1214
+	 *
1215
+	 * @since 1.0.0
1216
+	 */
1217
+	do_action('geodir_before_detail_page_more_info');
1218
+	if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1219
+		echo $geodir_post_detail_fields;
1220
+	}
1221
+	/**
1222
+	 * This is called after the info section html.
1223
+	 *
1224
+	 * @since 1.0.0
1225
+	 */
1226
+	do_action('geodir_after_detail_page_more_info');
1227
+
1228
+	$content_html = ob_get_clean();
1229
+	if (trim($content_html) != '')
1230
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1231
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1232
+		/**
1233
+		 * Filter the output html for function geodir_detail_page_more_info().
1234
+		 *
1235
+		 * @since 1.0.0
1236
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1237
+		 */
1238
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1239
+	}
1240 1240
 }
1241 1241
 
1242 1242
 
@@ -1250,15 +1250,15 @@  discard block
 block discarded – undo
1250 1250
  */
1251 1251
 function geodir_localize_all_js_msg()
1252 1252
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1253
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1254
-        $ajax_url = admin_url('admin-ajax.php');
1255
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1256
-        $ajax_url = admin_url('admin-ajax.php');
1257
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1258
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1259
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1260
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1261
-    }
1253
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1254
+		$ajax_url = admin_url('admin-ajax.php');
1255
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1256
+		$ajax_url = admin_url('admin-ajax.php');
1257
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1258
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1259
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1260
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1261
+	}
1262 1262
 	
1263 1263
 	/**
1264 1264
 	 * Filter the allowed image type extensions for post images.
@@ -1268,52 +1268,52 @@  discard block
 block discarded – undo
1268 1268
 	 */
1269 1269
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1270 1270
 	
1271
-    $arr_alert_msg = array(
1272
-        'geodir_plugin_url' => geodir_plugin_url(),
1273
-        'geodir_admin_ajax_url' => $ajax_url,
1274
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1275
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1276
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1277
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1278
-        //start not show alert msg
1279
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1280
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1281
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1282
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1283
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1284
-        // end not show alert msg
1285
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1286
-        //start not show alert msg
1287
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1288
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1289
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1290
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1291
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1292
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1293
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1294
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1295
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1296
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1297
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1298
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1299
-        'geodir_default_marker_icon' => get_option('geodir_default_marker_icon'),
1300
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1301
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1302
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1303
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1304
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1305
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1306
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1307
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1308
-        /* on/off dragging for phone devices */
1309
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1310
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1311
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1312
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1313
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1314
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1315
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1316
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1271
+	$arr_alert_msg = array(
1272
+		'geodir_plugin_url' => geodir_plugin_url(),
1273
+		'geodir_admin_ajax_url' => $ajax_url,
1274
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1275
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1276
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1277
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1278
+		//start not show alert msg
1279
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1280
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1281
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1282
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1283
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1284
+		// end not show alert msg
1285
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1286
+		//start not show alert msg
1287
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1288
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1289
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1290
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1291
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1292
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1293
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1294
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1295
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1296
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1297
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1298
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1299
+		'geodir_default_marker_icon' => get_option('geodir_default_marker_icon'),
1300
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1301
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1302
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1303
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1304
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1305
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1306
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1307
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1308
+		/* on/off dragging for phone devices */
1309
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1310
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1311
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1312
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1313
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1314
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1315
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1316
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1317 1317
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1318 1318
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1319 1319
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1321,28 +1321,28 @@  discard block
 block discarded – undo
1321 1321
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1322 1322
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1323 1323
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1324
-    );
1325
-
1326
-    /**
1327
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1328
-     *
1329
-     * With this filter you can add, remove or change translated JS strings.
1330
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1331
-     *
1332
-     * @since 1.0.0
1333
-     */
1334
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1335
-
1336
-    foreach ($arr_alert_msg as $key => $value) {
1337
-        if (!is_scalar($value))
1338
-            continue;
1339
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1340
-    }
1324
+	);
1325
+
1326
+	/**
1327
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1328
+	 *
1329
+	 * With this filter you can add, remove or change translated JS strings.
1330
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1331
+	 *
1332
+	 * @since 1.0.0
1333
+	 */
1334
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1335
+
1336
+	foreach ($arr_alert_msg as $key => $value) {
1337
+		if (!is_scalar($value))
1338
+			continue;
1339
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1340
+	}
1341 1341
 
1342
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1343
-    echo '<script>';
1344
-    echo $script;
1345
-    echo '</script>';
1342
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1343
+	echo '<script>';
1344
+	echo $script;
1345
+	echo '</script>';
1346 1346
 }
1347 1347
 
1348 1348
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1358,9 +1358,9 @@  discard block
 block discarded – undo
1358 1358
  */
1359 1359
 function geodir_admin_bar_site_menu($wp_admin_bar)
1360 1360
 {
1361
-    if (get_option("geodir_installed")) {
1362
-        $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1363
-    }
1361
+	if (get_option("geodir_installed")) {
1362
+		$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1363
+	}
1364 1364
 }
1365 1365
 
1366 1366
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1386,25 +1386,25 @@  discard block
 block discarded – undo
1386 1386
  */
1387 1387
 function geodir_store_sidebars()
1388 1388
 {
1389
-    global $geodir_sidebars;
1390
-    global $sidebars_widgets;
1391
-
1392
-    if (!is_array($sidebars_widgets))
1393
-        $sidebars_widgets = wp_get_sidebars_widgets();
1394
-    $geodir_old_sidebars = array();
1395
-
1396
-    if (is_array($geodir_sidebars)) {
1397
-        foreach ($geodir_sidebars as $val) {
1398
-            if (is_array($sidebars_widgets)) {
1399
-                if (array_key_exists($val, $sidebars_widgets))
1400
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1401
-                else
1402
-                    $geodir_old_sidebars[$val] = array();
1403
-            }
1404
-        }
1405
-    }
1406
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1407
-    geodir_option_version_backup('geodir_sidebars');
1389
+	global $geodir_sidebars;
1390
+	global $sidebars_widgets;
1391
+
1392
+	if (!is_array($sidebars_widgets))
1393
+		$sidebars_widgets = wp_get_sidebars_widgets();
1394
+	$geodir_old_sidebars = array();
1395
+
1396
+	if (is_array($geodir_sidebars)) {
1397
+		foreach ($geodir_sidebars as $val) {
1398
+			if (is_array($sidebars_widgets)) {
1399
+				if (array_key_exists($val, $sidebars_widgets))
1400
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1401
+				else
1402
+					$geodir_old_sidebars[$val] = array();
1403
+			}
1404
+		}
1405
+	}
1406
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1407
+	geodir_option_version_backup('geodir_sidebars');
1408 1408
 
1409 1409
 }
1410 1410
 
@@ -1418,34 +1418,34 @@  discard block
 block discarded – undo
1418 1418
  */
1419 1419
 function geodir_restore_sidebars()
1420 1420
 {
1421
-    global $sidebars_widgets;
1422
-
1423
-    if (!is_array($sidebars_widgets))
1424
-        $sidebars_widgets = wp_get_sidebars_widgets();
1425
-
1426
-    if (is_array($sidebars_widgets)) {
1427
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1428
-        if (is_array($geodir_old_sidebars)) {
1429
-            foreach ($geodir_old_sidebars as $key => $val) {
1430
-                //if(array_key_exists($key, $sidebars_widgets))
1431
-                {
1432
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1433
-                }
1421
+	global $sidebars_widgets;
1434 1422
 
1423
+	if (!is_array($sidebars_widgets))
1424
+		$sidebars_widgets = wp_get_sidebars_widgets();
1435 1425
 
1436
-            }
1437
-        }
1426
+	if (is_array($sidebars_widgets)) {
1427
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1428
+		if (is_array($geodir_old_sidebars)) {
1429
+			foreach ($geodir_old_sidebars as $key => $val) {
1430
+				//if(array_key_exists($key, $sidebars_widgets))
1431
+				{
1432
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1433
+				}
1438 1434
 
1439
-        // now clear all non geodiretory sidebars 
1440
-        foreach ($sidebars_widgets as $key => $val) {
1441
-            if (!array_key_exists($key, $geodir_old_sidebars)) {
1442
-                $sidebars_widgets[$key] = array();
1443
-            }
1444
-        }
1445
-    }
1446 1435
 
1447
-    update_option('sidebars_widgets', $sidebars_widgets);
1448
-    update_option('geodir_sidebars', '');
1436
+			}
1437
+		}
1438
+
1439
+		// now clear all non geodiretory sidebars 
1440
+		foreach ($sidebars_widgets as $key => $val) {
1441
+			if (!array_key_exists($key, $geodir_old_sidebars)) {
1442
+				$sidebars_widgets[$key] = array();
1443
+			}
1444
+		}
1445
+	}
1446
+
1447
+	update_option('sidebars_widgets', $sidebars_widgets);
1448
+	update_option('geodir_sidebars', '');
1449 1449
 }
1450 1450
 
1451 1451
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1458,9 +1458,9 @@  discard block
 block discarded – undo
1458 1458
  */
1459 1459
 function geodir_after_listing_post_gridview()
1460 1460
 {
1461
-    global $gridview_columns;
1461
+	global $gridview_columns;
1462 1462
 
1463
-    $gridview_columns = '';
1463
+	$gridview_columns = '';
1464 1464
 
1465 1465
 }
1466 1466
 
@@ -1488,11 +1488,11 @@  discard block
 block discarded – undo
1488 1488
  */
1489 1489
 function so_handle_038($url, $original_url, $_context)
1490 1490
 {
1491
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1492
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1493
-    }
1491
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1492
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1493
+	}
1494 1494
 
1495
-    return $url;
1495
+	return $url;
1496 1496
 }
1497 1497
 
1498 1498
 
@@ -1508,34 +1508,34 @@  discard block
 block discarded – undo
1508 1508
 function geodir_after_main_form_fields() {
1509 1509
 	global $gd_session;
1510 1510
 	
1511
-    if (get_option('geodir_accept_term_condition')) {
1512
-        global $post;
1513
-        $term_condition = '';
1514
-        if (isset($_REQUEST['backandedit'])) {
1515
-            $post = (object)$gd_session->get('listing');
1516
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1517
-        }
1518
-
1519
-        ?>
1511
+	if (get_option('geodir_accept_term_condition')) {
1512
+		global $post;
1513
+		$term_condition = '';
1514
+		if (isset($_REQUEST['backandedit'])) {
1515
+			$post = (object)$gd_session->get('listing');
1516
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1517
+		}
1518
+
1519
+		?>
1520 1520
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1521 1521
             <label>&nbsp;</label>
1522 1522
 
1523 1523
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1524 1524
 				<span style="display:block"> 
1525 1525
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1526
-                    echo 'checked="checked"';
1527
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1526
+					echo 'checked="checked"';
1527
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1528 1528
                        class="geodir_textfield" value="1"
1529 1529
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1530 1530
 				</span>
1531 1531
             </div>
1532 1532
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1533
-                    _e($required_msg, 'geodirectory');
1534
-                } ?></span>
1533
+					_e($required_msg, 'geodirectory');
1534
+				} ?></span>
1535 1535
         </div>
1536 1536
     <?php
1537 1537
 
1538
-    }
1538
+	}
1539 1539
 }
1540 1540
 
1541 1541
 
@@ -1560,42 +1560,42 @@  discard block
 block discarded – undo
1560 1560
  */
1561 1561
 function geodir_detail_page_tab_is_display($is_display, $tab)
1562 1562
 {
1563
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1563
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1564 1564
 
1565
-    if ($tab == 'post_profile') {
1566
-        /** This action is documented in geodirectory_template_actions.php */
1567
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1565
+	if ($tab == 'post_profile') {
1566
+		/** This action is documented in geodirectory_template_actions.php */
1567
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1568 1568
         
1569
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1570
-            $is_display = false;
1571
-        }
1572
-    }
1569
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1570
+			$is_display = false;
1571
+		}
1572
+	}
1573 1573
     
1574
-    if ($tab == 'post_info')
1575
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1574
+	if ($tab == 'post_info')
1575
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1576 1576
 
1577
-    if ($tab == 'post_images')
1578
-        $is_display = (!empty($post_images)) ? true : false;
1577
+	if ($tab == 'post_images')
1578
+		$is_display = (!empty($post_images)) ? true : false;
1579 1579
 
1580
-    if ($tab == 'post_video')
1581
-        $is_display = (!empty($video)) ? true : false;
1580
+	if ($tab == 'post_video')
1581
+		$is_display = (!empty($video)) ? true : false;
1582 1582
 
1583
-    if ($tab == 'special_offers')
1584
-        $is_display = (!empty($special_offers)) ? true : false;
1583
+	if ($tab == 'special_offers')
1584
+		$is_display = (!empty($special_offers)) ? true : false;
1585 1585
 
1586
-    if ($tab == 'reviews')
1587
-        $is_display = (geodir_is_page('detail')) ? true : false;
1586
+	if ($tab == 'reviews')
1587
+		$is_display = (geodir_is_page('detail')) ? true : false;
1588 1588
 
1589
-    if ($tab == 'related_listing') {
1590
-       $message = __('No listings found which match your selection.', 'geodirectory');
1589
+	if ($tab == 'related_listing') {
1590
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1591 1591
        
1592
-       /** This action is documented in geodirectory-functions/template_functions.php */
1593
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1592
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1593
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1594 1594
        
1595
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1596
-    }
1595
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1596
+	}
1597 1597
 
1598
-    return $is_display;
1598
+	return $is_display;
1599 1599
 }
1600 1600
 
1601 1601
 
@@ -1611,69 +1611,69 @@  discard block
 block discarded – undo
1611 1611
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1612 1612
  */
1613 1613
 function geodir_changes_in_custom_fields_table() {
1614
-    global $wpdb, $plugin_prefix;
1614
+	global $wpdb, $plugin_prefix;
1615 1615
 	
1616 1616
 	// Remove unused virtual page
1617 1617
 	$listings_page_id = (int)get_option('geodir_listing_page');
1618 1618
 	if ($listings_page_id) {
1619 1619
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1620
-        delete_option('geodir_listing_page');
1620
+		delete_option('geodir_listing_page');
1621 1621
 	}
1622 1622
 
1623
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1624
-        $wpdb->query(
1625
-            $wpdb->prepare(
1626
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1627
-                array('1', '1', 'admin')
1628
-            )
1629
-        );
1623
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1624
+		$wpdb->query(
1625
+			$wpdb->prepare(
1626
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1627
+				array('1', '1', 'admin')
1628
+			)
1629
+		);
1630 1630
 
1631 1631
 
1632
-        /* --- terms meta value set --- */
1632
+		/* --- terms meta value set --- */
1633 1633
 
1634
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1634
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1635 1635
 
1636
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1636
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1637 1637
 
1638
-        if (!empty($options_data)) {
1638
+		if (!empty($options_data)) {
1639 1639
 
1640
-            foreach ($options_data as $optobj) {
1640
+			foreach ($options_data as $optobj) {
1641 1641
 
1642
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1642
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1643 1643
 
1644
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1644
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1645 1645
 
1646
-                if (!empty($taxonomies_data)) {
1646
+				if (!empty($taxonomies_data)) {
1647 1647
 
1648
-                    foreach ($taxonomies_data as $taxobj) {
1648
+					foreach ($taxonomies_data as $taxobj) {
1649 1649
 
1650
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1651
-                        $post_type = $taxObject->object_type[0];
1650
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1651
+						$post_type = $taxObject->object_type[0];
1652 1652
 
1653
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1653
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1654 1654
 
1655
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1655
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1656 1656
 
1657
-                        if ($duplicate_data) {
1657
+						if ($duplicate_data) {
1658 1658
 
1659
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1659
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1660 1660
 
1661
-                        } else {
1661
+						} else {
1662 1662
 
1663
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1663
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1664 1664
 
1665
-                        }
1665
+						}
1666 1666
 
1667
-                    }
1667
+					}
1668 1668
 
1669
-                }
1669
+				}
1670 1670
 
1671
-            }
1672
-        }
1671
+			}
1672
+		}
1673 1673
 
1674
-        update_option('geodir_changes_in_custom_fields_table', '1');
1674
+		update_option('geodir_changes_in_custom_fields_table', '1');
1675 1675
 
1676
-    }
1676
+	}
1677 1677
 
1678 1678
 }
1679 1679
 
@@ -1692,24 +1692,24 @@  discard block
 block discarded – undo
1692 1692
 function geodir_location_slug_check($slug)
1693 1693
 {
1694 1694
 
1695
-    global $wpdb, $table_prefix;
1695
+	global $wpdb, $table_prefix;
1696 1696
 
1697
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1697
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1698 1698
 
1699
-    if ($slug_exists) {
1699
+	if ($slug_exists) {
1700 1700
 
1701
-        $suffix = 1;
1702
-        do {
1703
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1704
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1705
-            $suffix++;
1706
-        } while ($location_slug_check && $suffix < 100);
1701
+		$suffix = 1;
1702
+		do {
1703
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1704
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1705
+			$suffix++;
1706
+		} while ($location_slug_check && $suffix < 100);
1707 1707
 
1708
-        $slug = $alt_location_name;
1708
+		$slug = $alt_location_name;
1709 1709
 
1710
-    }
1710
+	}
1711 1711
 
1712
-    return $slug;
1712
+	return $slug;
1713 1713
 
1714 1714
 }
1715 1715
 
@@ -1734,42 +1734,42 @@  discard block
 block discarded – undo
1734 1734
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1735 1735
 {
1736 1736
 
1737
-    global $wpdb, $plugin_prefix, $table_prefix;
1737
+	global $wpdb, $plugin_prefix, $table_prefix;
1738 1738
 
1739
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1739
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1740 1740
 
1741
-    $slug = $tern_data->slug;
1741
+	$slug = $tern_data->slug;
1742 1742
 
1743
-    /**
1744
-     * Filter if a term slug exists.
1745
-     *
1746
-     * @since 1.0.0
1747
-     * @package GeoDirectory
1748
-     * @param bool $bool Default: false.
1749
-     * @param string $slug The term slug.
1750
-     * @param int $term_id The term ID.
1751
-     */
1752
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1743
+	/**
1744
+	 * Filter if a term slug exists.
1745
+	 *
1746
+	 * @since 1.0.0
1747
+	 * @package GeoDirectory
1748
+	 * @param bool $bool Default: false.
1749
+	 * @param string $slug The term slug.
1750
+	 * @param int $term_id The term ID.
1751
+	 */
1752
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1753 1753
 
1754
-    if ($slug_exists) {
1754
+	if ($slug_exists) {
1755 1755
 
1756
-        $suffix = 1;
1757
-        do {
1758
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1756
+		$suffix = 1;
1757
+		do {
1758
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1759 1759
 
1760
-            /** This action is documented in geodirectory_hooks_actions.php */
1761
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1760
+			/** This action is documented in geodirectory_hooks_actions.php */
1761
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1762 1762
 
1763
-            $suffix++;
1764
-        } while ($term_slug_check && $suffix < 100);
1763
+			$suffix++;
1764
+		} while ($term_slug_check && $suffix < 100);
1765 1765
 
1766
-        $slug = $new_slug;
1766
+		$slug = $new_slug;
1767 1767
 
1768
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1768
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1769 1769
 
1770
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1770
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1771 1771
 
1772
-    }
1772
+	}
1773 1773
 	
1774 1774
 	// Update tag in detail table.
1775 1775
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1810,21 +1810,21 @@  discard block
 block discarded – undo
1810 1810
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1811 1811
 {
1812 1812
 
1813
-    global $wpdb, $table_prefix;
1813
+	global $wpdb, $table_prefix;
1814 1814
 
1815
-    $default_location = geodir_get_default_location();
1815
+	$default_location = geodir_get_default_location();
1816 1816
 
1817
-    $country_slug = $default_location->country_slug;
1818
-    $region_slug = $default_location->region_slug;
1819
-    $city_slug = $default_location->city_slug;
1817
+	$country_slug = $default_location->country_slug;
1818
+	$region_slug = $default_location->region_slug;
1819
+	$city_slug = $default_location->city_slug;
1820 1820
 
1821
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1822
-        return $slug_exists = true;
1821
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1822
+		return $slug_exists = true;
1823 1823
 
1824
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1825
-        return $slug_exists = true;
1824
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1825
+		return $slug_exists = true;
1826 1826
 
1827
-    return $slug_exists;
1827
+	return $slug_exists;
1828 1828
 }
1829 1829
 
1830 1830
 
@@ -1843,75 +1843,75 @@  discard block
 block discarded – undo
1843 1843
  */
1844 1844
 function geodir_custom_page_title($title = '', $sep = '')
1845 1845
 {
1846
-    global $wp;
1847
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1848
-        return $title;
1849
-    }
1846
+	global $wp;
1847
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1848
+		return $title;
1849
+	}
1850 1850
 
1851
-    if ($sep == '') {
1852
-        /**
1853
-         * Filter the page title separator.
1854
-         *
1855
-         * @since 1.0.0
1856
-         * @package GeoDirectory
1857
-         * @param string $sep The separator, default: `|`.
1858
-         */
1859
-        $sep = apply_filters('geodir_page_title_separator', '|');
1860
-    }
1851
+	if ($sep == '') {
1852
+		/**
1853
+		 * Filter the page title separator.
1854
+		 *
1855
+		 * @since 1.0.0
1856
+		 * @package GeoDirectory
1857
+		 * @param string $sep The separator, default: `|`.
1858
+		 */
1859
+		$sep = apply_filters('geodir_page_title_separator', '|');
1860
+	}
1861 1861
 
1862 1862
 
1863
-    $gd_page = '';
1864
-    if(geodir_is_page('home')){
1865
-        $gd_page = 'home';
1866
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('detail')){
1869
-        $gd_page = 'detail';
1870
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('pt')){
1873
-        $gd_page = 'pt';
1874
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('listing')){
1877
-        $gd_page = 'listing';
1878
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('location')){
1881
-        $gd_page = 'location';
1882
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('search')){
1885
-        $gd_page = 'search';
1886
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('add-listing')){
1889
-        $gd_page = 'add-listing';
1890
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('author')){
1893
-        $gd_page = 'author';
1894
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1895
-    }
1896
-    elseif(geodir_is_page('login')){
1897
-        $gd_page = 'login';
1898
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1899
-    }
1900
-    elseif(geodir_is_page('listing-success')){
1901
-        $gd_page = 'listing-success';
1902
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1903
-    }
1863
+	$gd_page = '';
1864
+	if(geodir_is_page('home')){
1865
+		$gd_page = 'home';
1866
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1867
+	}
1868
+	elseif(geodir_is_page('detail')){
1869
+		$gd_page = 'detail';
1870
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1871
+	}
1872
+	elseif(geodir_is_page('pt')){
1873
+		$gd_page = 'pt';
1874
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1875
+	}
1876
+	elseif(geodir_is_page('listing')){
1877
+		$gd_page = 'listing';
1878
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('location')){
1881
+		$gd_page = 'location';
1882
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1883
+	}
1884
+	elseif(geodir_is_page('search')){
1885
+		$gd_page = 'search';
1886
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1887
+	}
1888
+	elseif(geodir_is_page('add-listing')){
1889
+		$gd_page = 'add-listing';
1890
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1891
+	}
1892
+	elseif(geodir_is_page('author')){
1893
+		$gd_page = 'author';
1894
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1895
+	}
1896
+	elseif(geodir_is_page('login')){
1897
+		$gd_page = 'login';
1898
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1899
+	}
1900
+	elseif(geodir_is_page('listing-success')){
1901
+		$gd_page = 'listing-success';
1902
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1903
+	}
1904 1904
 
1905 1905
 
1906
-    /**
1907
-     * Filter page meta title to replace variables.
1908
-     *
1909
-     * @since 1.5.4
1910
-     * @param string $title The page title including variables.
1911
-     * @param string $gd_page The GeoDirectory page type if any.
1912
-     * @param string $sep The title separator symbol.
1913
-     */
1914
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1906
+	/**
1907
+	 * Filter page meta title to replace variables.
1908
+	 *
1909
+	 * @since 1.5.4
1910
+	 * @param string $title The page title including variables.
1911
+	 * @param string $gd_page The GeoDirectory page type if any.
1912
+	 * @param string $sep The title separator symbol.
1913
+	 */
1914
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1915 1915
 
1916 1916
 }
1917 1917
 
@@ -1927,33 +1927,33 @@  discard block
 block discarded – undo
1927 1927
 function geodir_set_post_attachment()
1928 1928
 {
1929 1929
 
1930
-    if (!get_option('geodir_set_post_attachments')) {
1930
+	if (!get_option('geodir_set_post_attachments')) {
1931 1931
 
1932
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1933
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1932
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1933
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1934 1934
 
1935
-        $all_postypes = geodir_get_posttypes();
1935
+		$all_postypes = geodir_get_posttypes();
1936 1936
 
1937
-        $args = array(
1938
-            'posts_per_page' => -1,
1939
-            'post_type' => $all_postypes,
1940
-            'post_status' => 'publish');
1937
+		$args = array(
1938
+			'posts_per_page' => -1,
1939
+			'post_type' => $all_postypes,
1940
+			'post_status' => 'publish');
1941 1941
 
1942
-        $posts_array = get_posts($args);
1942
+		$posts_array = get_posts($args);
1943 1943
 
1944
-        if (!empty($posts_array)) {
1944
+		if (!empty($posts_array)) {
1945 1945
 
1946
-            foreach ($posts_array as $post) {
1946
+			foreach ($posts_array as $post) {
1947 1947
 
1948
-                geodir_set_wp_featured_image($post->ID);
1948
+				geodir_set_wp_featured_image($post->ID);
1949 1949
 
1950
-            }
1950
+			}
1951 1951
 
1952
-        }
1952
+		}
1953 1953
 
1954
-        update_option('geodir_set_post_attachments', '1');
1954
+		update_option('geodir_set_post_attachments', '1');
1955 1955
 
1956
-    }
1956
+	}
1957 1957
 
1958 1958
 }
1959 1959
 
@@ -1970,19 +1970,19 @@  discard block
 block discarded – undo
1970 1970
 function geodir_remove_url_seperator()
1971 1971
 {
1972 1972
 
1973
-    if (!get_option('geodir_remove_url_seperator')) {
1973
+	if (!get_option('geodir_remove_url_seperator')) {
1974 1974
 
1975
-        if (get_option('geodir_listingurl_separator'))
1976
-            delete_option('geodir_listingurl_separator');
1975
+		if (get_option('geodir_listingurl_separator'))
1976
+			delete_option('geodir_listingurl_separator');
1977 1977
 
1978
-        if (get_option('geodir_detailurl_separator'))
1979
-            delete_option('geodir_detailurl_separator');
1978
+		if (get_option('geodir_detailurl_separator'))
1979
+			delete_option('geodir_detailurl_separator');
1980 1980
 
1981
-        flush_rewrite_rules(false);
1981
+		flush_rewrite_rules(false);
1982 1982
 
1983
-        update_option('geodir_remove_url_seperator', '1');
1983
+		update_option('geodir_remove_url_seperator', '1');
1984 1984
 
1985
-    }
1985
+	}
1986 1986
 
1987 1987
 }
1988 1988
 
@@ -1998,38 +1998,38 @@  discard block
 block discarded – undo
1998 1998
  */
1999 1999
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2000 2000
 {
2001
-    foreach ($permalink_arr as $key => $value) {
2001
+	foreach ($permalink_arr as $key => $value) {
2002 2002
 
2003
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2004
-            unset($permalink_arr[$key]);
2003
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2004
+			unset($permalink_arr[$key]);
2005 2005
 
2006
-    }
2006
+	}
2007 2007
 
2008
-    return $permalink_arr;
2008
+	return $permalink_arr;
2009 2009
 
2010 2010
 }
2011 2011
 
2012 2012
 if (!is_admin()) {
2013
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2013
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2014 2014
 }
2015 2015
 /**
2016
- * Set status from draft to publish.
2017
- *
2018
- * @since 1.0.0
2019
- * @package GeoDirectory
2020
- * @global object $wp WordPress object.
2021
- * @param object $post Post object.
2022
- * @return object Modified post object.
2023
- */
2016
+	 * Set status from draft to publish.
2017
+	 *
2018
+	 * @since 1.0.0
2019
+	 * @package GeoDirectory
2020
+	 * @global object $wp WordPress object.
2021
+	 * @param object $post Post object.
2022
+	 * @return object Modified post object.
2023
+	 */
2024 2024
 function geodir_set_status_draft_to_publish_for_own_post($post)
2025 2025
 {
2026
-    global $wp;
2027
-    $user_id = get_current_user_id();
2026
+	global $wp;
2027
+	$user_id = get_current_user_id();
2028 2028
 
2029
-    if (!empty($post) && $post[0]->post_author == $user_id) {
2030
-        $post[0]->post_status = 'publish';
2031
-    }
2032
-    return $post;
2029
+	if (!empty($post) && $post[0]->post_author == $user_id) {
2030
+		$post[0]->post_status = 'publish';
2031
+	}
2032
+	return $post;
2033 2033
 }
2034 2034
 
2035 2035
 
@@ -2121,33 +2121,33 @@  discard block
 block discarded – undo
2121 2121
  */
2122 2122
 function geodir_detail_page_tab_headings_change($tabs_arr)
2123 2123
 {
2124
-    global $wpdb;
2124
+	global $wpdb;
2125 2125
 
2126
-    $post_type = geodir_get_current_posttype();
2126
+	$post_type = geodir_get_current_posttype();
2127 2127
 
2128
-    $all_postypes = geodir_get_posttypes();
2128
+	$all_postypes = geodir_get_posttypes();
2129 2129
 
2130
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2130
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2131 2131
 
2132
-        if (array_key_exists('post_video', $tabs_arr)) {
2132
+		if (array_key_exists('post_video', $tabs_arr)) {
2133 2133
 
2134
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2134
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2135 2135
 
2136
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2137
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2138
-        }
2136
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2137
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2138
+		}
2139 2139
 
2140
-        if (array_key_exists('special_offers', $tabs_arr)) {
2140
+		if (array_key_exists('special_offers', $tabs_arr)) {
2141 2141
 
2142
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2142
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2143 2143
 
2144
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2145
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2146
-        }
2144
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2145
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2146
+		}
2147 2147
 
2148
-    }
2148
+	}
2149 2149
 
2150
-    return $tabs_arr;
2150
+	return $tabs_arr;
2151 2151
 
2152 2152
 }
2153 2153
 
@@ -2160,10 +2160,10 @@  discard block
 block discarded – undo
2160 2160
  */
2161 2161
 function geodir_remove_template_redirect_actions()
2162 2162
 {
2163
-    if (geodir_is_page('login')){
2164
-        remove_all_actions('template_redirect');
2165
-        remove_action('init', 'avia_modify_front', 10);
2166
-    }
2163
+	if (geodir_is_page('login')){
2164
+		remove_all_actions('template_redirect');
2165
+		remove_action('init', 'avia_modify_front', 10);
2166
+	}
2167 2167
 }
2168 2168
 
2169 2169
 
@@ -2185,51 +2185,51 @@  discard block
 block discarded – undo
2185 2185
 function geodirectory_before_featured_image_delete($attachment_id)
2186 2186
 {
2187 2187
 
2188
-    global $wpdb, $plugin_prefix;
2188
+	global $wpdb, $plugin_prefix;
2189 2189
 
2190
-    $post_id = get_post_field('post_parent', $attachment_id);
2190
+	$post_id = get_post_field('post_parent', $attachment_id);
2191 2191
 
2192
-    $attachment_url = wp_get_attachment_url($attachment_id);
2192
+	$attachment_url = wp_get_attachment_url($attachment_id);
2193 2193
 
2194
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2194
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2195 2195
 
2196
-        $post_type = get_post_type($post_id);
2196
+		$post_type = get_post_type($post_id);
2197 2197
 
2198
-        $all_postypes = geodir_get_posttypes();
2198
+		$all_postypes = geodir_get_posttypes();
2199 2199
 
2200
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2201
-            return false;
2200
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2201
+			return false;
2202 2202
 
2203
-        $uploads = wp_upload_dir();
2203
+		$uploads = wp_upload_dir();
2204 2204
 
2205
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2205
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2206 2206
 
2207
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2207
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2208 2208
 
2209
-        $wpdb->query(
2210
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2211
-                array($post_id, $split_img_file_path)
2212
-            )
2213
-        );
2209
+		$wpdb->query(
2210
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2211
+				array($post_id, $split_img_file_path)
2212
+			)
2213
+		);
2214 2214
 
2215
-        $attachment_data = $wpdb->get_row(
2216
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2217
-                array($post_id)
2218
-            )
2219
-        );
2215
+		$attachment_data = $wpdb->get_row(
2216
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2217
+				array($post_id)
2218
+			)
2219
+		);
2220 2220
 
2221
-        if (!empty($attachment_data)) {
2222
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2223
-        }
2221
+		if (!empty($attachment_data)) {
2222
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2223
+		}
2224 2224
 
2225 2225
 
2226
-        $table_name = $plugin_prefix . $post_type . '_detail';
2226
+		$table_name = $plugin_prefix . $post_type . '_detail';
2227 2227
 
2228
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2228
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2229 2229
 
2230
-        geodir_set_wp_featured_image($post_id);
2230
+		geodir_set_wp_featured_image($post_id);
2231 2231
 
2232
-    }
2232
+	}
2233 2233
 
2234 2234
 }
2235 2235
 
@@ -2247,79 +2247,79 @@  discard block
 block discarded – undo
2247 2247
 function geodir_temp_set_post_attachment()
2248 2248
 {
2249 2249
 
2250
-    global $wpdb, $plugin_prefix;
2250
+	global $wpdb, $plugin_prefix;
2251 2251
 
2252
-    $all_postypes = geodir_get_posttypes();
2252
+	$all_postypes = geodir_get_posttypes();
2253 2253
 
2254
-    foreach ($all_postypes as $posttype) {
2254
+	foreach ($all_postypes as $posttype) {
2255 2255
 
2256
-        $tablename = $plugin_prefix . $posttype . '_detail';
2256
+		$tablename = $plugin_prefix . $posttype . '_detail';
2257 2257
 
2258
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2258
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2259 2259
 
2260
-        if (!empty($get_post_data)) {
2260
+		if (!empty($get_post_data)) {
2261 2261
 
2262
-            foreach ($get_post_data as $data) {
2262
+			foreach ($get_post_data as $data) {
2263 2263
 
2264
-                $post_id = $data->post_id;
2264
+				$post_id = $data->post_id;
2265 2265
 
2266
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2266
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2267 2267
 
2268
-                if (!empty($attachment_data)) {
2268
+				if (!empty($attachment_data)) {
2269 2269
 
2270
-                    foreach ($attachment_data as $attach) {
2270
+					foreach ($attachment_data as $attach) {
2271 2271
 
2272
-                        $file_info = pathinfo($attach->file);
2272
+						$file_info = pathinfo($attach->file);
2273 2273
 
2274
-                        $sub_dir = '';
2275
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2276
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2274
+						$sub_dir = '';
2275
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2276
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2277 2277
 
2278
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2279
-                        $uploads_path = $uploads['basedir'];
2278
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2279
+						$uploads_path = $uploads['basedir'];
2280 2280
 
2281
-                        $file_name = $file_info['basename'];
2281
+						$file_name = $file_info['basename'];
2282 2282
 
2283
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2283
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2284 2284
 
2285
-                        if (!file_exists($img_arr['path'])) {
2285
+						if (!file_exists($img_arr['path'])) {
2286 2286
 
2287
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2287
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2288 2288
 
2289
-                        }
2289
+						}
2290 2290
 
2291
-                    }
2291
+					}
2292 2292
 
2293
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2293
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2294 2294
 
2295
-                    if (!empty($attachment_data)) {
2295
+					if (!empty($attachment_data)) {
2296 2296
 
2297
-                        if ($attachment_data->ID)
2298
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2297
+						if ($attachment_data->ID)
2298
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2299 2299
 
2300
-                    } else {
2300
+					} else {
2301 2301
 
2302
-                        if (has_post_thumbnail($post_id)) {
2302
+						if (has_post_thumbnail($post_id)) {
2303 2303
 
2304
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2304
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2305 2305
 
2306
-                            wp_delete_attachment($post_thumbnail_id);
2306
+							wp_delete_attachment($post_thumbnail_id);
2307 2307
 
2308
-                        }
2308
+						}
2309 2309
 
2310
-                    }
2310
+					}
2311 2311
 
2312
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2312
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2313 2313
 
2314
-                    geodir_set_wp_featured_image($post_id);
2314
+					geodir_set_wp_featured_image($post_id);
2315 2315
 
2316
-                }
2316
+				}
2317 2317
 
2318
-            }
2318
+			}
2319 2319
 
2320
-        }
2320
+		}
2321 2321
 
2322
-    }
2322
+	}
2323 2323
 
2324 2324
 }
2325 2325
 
@@ -2337,9 +2337,9 @@  discard block
 block discarded – undo
2337 2337
 function geodir_default_rating_star_icon()
2338 2338
 {
2339 2339
 
2340
-    if (!get_option('geodir_default_rating_star_icon')) {
2341
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2342
-    }
2340
+	if (!get_option('geodir_default_rating_star_icon')) {
2341
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2342
+	}
2343 2343
 
2344 2344
 }
2345 2345
 
@@ -2357,23 +2357,23 @@  discard block
 block discarded – undo
2357 2357
  */
2358 2358
 function geodir_user_post_listing_count()
2359 2359
 {
2360
-    global $wpdb, $plugin_prefix, $current_user;
2360
+	global $wpdb, $plugin_prefix, $current_user;
2361 2361
 
2362
-    $user_id = $current_user->ID;
2363
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2362
+	$user_id = $current_user->ID;
2363
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2364 2364
 
2365
-    $user_listing = array();
2366
-    if (is_array($all_posts) && !empty($all_posts)) {
2367
-        foreach ($all_posts as $ptype) {
2368
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2365
+	$user_listing = array();
2366
+	if (is_array($all_posts) && !empty($all_posts)) {
2367
+		foreach ($all_posts as $ptype) {
2368
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2369 2369
 
2370
-            if ($total_posts > 0) {
2371
-                $user_listing[$ptype] = $total_posts;
2372
-            }
2373
-        }
2374
-    }
2370
+			if ($total_posts > 0) {
2371
+				$user_listing[$ptype] = $total_posts;
2372
+			}
2373
+		}
2374
+	}
2375 2375
 
2376
-    return $user_listing;
2376
+	return $user_listing;
2377 2377
 }
2378 2378
 
2379 2379
 
@@ -2393,579 +2393,579 @@  discard block
 block discarded – undo
2393 2393
  */
2394 2394
 function geodir_detail_page_custom_field_tab($tabs_arr)
2395 2395
 {
2396
-    global $post;
2397
-
2398
-    $post_type = geodir_get_current_posttype();
2399
-    $all_postypes = geodir_get_posttypes();
2400
-
2401
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2402
-        $package_info = array();
2403
-        $package_info = geodir_post_package_info($package_info, $post);
2404
-        $post_package_id = $package_info->pid;
2405
-        $fields_location = 'detail';
2406
-
2407
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2408
-        if (!empty($custom_fields)) {
2409
-            $parse_custom_fields = array();
2410
-            foreach ($custom_fields as $field) {
2411
-                $field = stripslashes_deep($field); // strip slashes
2396
+	global $post;
2397
+
2398
+	$post_type = geodir_get_current_posttype();
2399
+	$all_postypes = geodir_get_posttypes();
2400
+
2401
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2402
+		$package_info = array();
2403
+		$package_info = geodir_post_package_info($package_info, $post);
2404
+		$post_package_id = $package_info->pid;
2405
+		$fields_location = 'detail';
2406
+
2407
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2408
+		if (!empty($custom_fields)) {
2409
+			$parse_custom_fields = array();
2410
+			foreach ($custom_fields as $field) {
2411
+				$field = stripslashes_deep($field); // strip slashes
2412 2412
                 
2413
-                $type = $field;
2414
-                $field_name = $field['htmlvar_name'];
2415
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2416
-                    $post->$field_name = $_REQUEST[$field_name];
2417
-                }
2418
-
2419
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2420
-                    if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2421
-                        continue;
2422
-                    }
2423
-
2424
-                    $parse_custom_fields[] = $field;
2425
-                }
2426
-            }
2427
-            $custom_fields = $parse_custom_fields;
2428
-        }
2429
-
2430
-        if (!empty($custom_fields)) {
2431
-            $field_set_start = 0;
2432
-            $fieldset_count = 0;
2433
-            $fieldset = '';
2434
-            $total_fields = count($custom_fields);
2435
-            $count_field = 0;
2436
-            $fieldset_arr = array();
2437
-            $i = 0;
2438
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2439
-
2440
-            foreach ($custom_fields as $field) {
2441
-                $count_field++;
2442
-                $field_name = $field['htmlvar_name'];
2443
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2444
-                    $post->$field_name = $_REQUEST[$field_name];
2445
-                }
2446
-
2447
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2448
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2449
-                    $site_title = trim($field['site_title']);
2450
-                    $type = $field;
2451
-                    $html = '';
2452
-                    $html_var = $field_name;
2453
-                    $field_icon = '';
2454
-                    $variables_array = array();
2455
-
2456
-                    if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2457
-                        continue;
2458
-                    }
2459
-
2460
-                    if ($type['type'] != 'fieldset') {
2461
-                        $i++;
2462
-                        $variables_array['post_id'] = $post->ID;
2463
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2464
-                        $variables_array['value'] = '';
2465
-                        $variables_array['value'] = $post->$type['htmlvar_name'];
2466
-                    }
2467
-
2468
-                    if (strpos($type['field_icon'], 'http') !== false) {
2469
-                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2470
-                    } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2471
-                        $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2472
-                    }
2413
+				$type = $field;
2414
+				$field_name = $field['htmlvar_name'];
2415
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2416
+					$post->$field_name = $_REQUEST[$field_name];
2417
+				}
2418
+
2419
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2420
+					if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2421
+						continue;
2422
+					}
2423
+
2424
+					$parse_custom_fields[] = $field;
2425
+				}
2426
+			}
2427
+			$custom_fields = $parse_custom_fields;
2428
+		}
2473 2429
 
2474
-                    switch ($type['type']) {
2475
-                        case 'fieldset': {
2476
-                            $i = 0;
2477
-                            $fieldset_count++;
2478
-                            $field_set_start = 1;
2479
-                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2480
-                            $fieldset_arr[$fieldset_count]['label'] = $label;
2481
-                        }
2482
-                            break;
2483
-                        case 'url': {
2484
-                            if (strpos($field_icon, 'http') !== false) {
2485
-                                $field_icon_af = '';
2486
-                            } elseif ($field_icon == '') {
2487
-
2488
-                                if ($type['name'] == 'geodir_facebook') {
2489
-                                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
2490
-                                } elseif ($type['name'] == 'geodir_twitter') {
2491
-                                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
2492
-                                } else {
2493
-                                    $field_icon_af = '<i class="fa fa-link"></i>';
2494
-                                }
2495
-
2496
-                            } else {
2497
-                                $field_icon_af = $field_icon;
2498
-                                $field_icon = '';
2499
-                            }
2430
+		if (!empty($custom_fields)) {
2431
+			$field_set_start = 0;
2432
+			$fieldset_count = 0;
2433
+			$fieldset = '';
2434
+			$total_fields = count($custom_fields);
2435
+			$count_field = 0;
2436
+			$fieldset_arr = array();
2437
+			$i = 0;
2438
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2439
+
2440
+			foreach ($custom_fields as $field) {
2441
+				$count_field++;
2442
+				$field_name = $field['htmlvar_name'];
2443
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2444
+					$post->$field_name = $_REQUEST[$field_name];
2445
+				}
2446
+
2447
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2448
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2449
+					$site_title = trim($field['site_title']);
2450
+					$type = $field;
2451
+					$html = '';
2452
+					$html_var = $field_name;
2453
+					$field_icon = '';
2454
+					$variables_array = array();
2455
+
2456
+					if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2457
+						continue;
2458
+					}
2459
+
2460
+					if ($type['type'] != 'fieldset') {
2461
+						$i++;
2462
+						$variables_array['post_id'] = $post->ID;
2463
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2464
+						$variables_array['value'] = '';
2465
+						$variables_array['value'] = $post->$type['htmlvar_name'];
2466
+					}
2467
+
2468
+					if (strpos($type['field_icon'], 'http') !== false) {
2469
+						$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2470
+					} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2471
+						$field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2472
+					}
2473
+
2474
+					switch ($type['type']) {
2475
+						case 'fieldset': {
2476
+							$i = 0;
2477
+							$fieldset_count++;
2478
+							$field_set_start = 1;
2479
+							$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2480
+							$fieldset_arr[$fieldset_count]['label'] = $label;
2481
+						}
2482
+							break;
2483
+						case 'url': {
2484
+							if (strpos($field_icon, 'http') !== false) {
2485
+								$field_icon_af = '';
2486
+							} elseif ($field_icon == '') {
2487
+
2488
+								if ($type['name'] == 'geodir_facebook') {
2489
+									$field_icon_af = '<i class="fa fa-facebook-square"></i>';
2490
+								} elseif ($type['name'] == 'geodir_twitter') {
2491
+									$field_icon_af = '<i class="fa fa-twitter-square"></i>';
2492
+								} else {
2493
+									$field_icon_af = '<i class="fa fa-link"></i>';
2494
+								}
2495
+
2496
+							} else {
2497
+								$field_icon_af = $field_icon;
2498
+								$field_icon = '';
2499
+							}
2500 2500
                             
2501
-                            $a_url = geodir_parse_custom_field_url($post->$type['htmlvar_name']);
2502
-
2503
-                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2504
-                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2505
-                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2506
-
2507
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2508
-
2509
-                            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2510
-                            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2511
-
2512
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2513
-                                /**
2514
-                                 * Filer the custom field website name.
2515
-                                 *
2516
-                                 * @since 1.0.0
2517
-                                 * @param string $title The field name default: "Website".
2518
-                                 * @param string $website The website address.
2519
-                                 * @param int $post->ID The post ID.
2520
-                                 */
2521
-                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2522
-                        }
2523
-                            break;
2524
-                        case 'phone': {
2525
-                            if (strpos($field_icon, 'http') !== false) {
2526
-                                $field_icon_af = '';
2527
-                            } elseif ($field_icon == '') {
2528
-                                $field_icon_af = '<i class="fa fa-phone"></i>';
2529
-                            } else {
2530
-                                $field_icon_af = $field_icon;
2531
-                                $field_icon = '';
2532
-                            }
2533
-
2534
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2535
-
2536
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2537
-                            if ($field_set_start == 1 && $site_title != '') {
2538
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2539
-                            }
2540
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2541
-                        }
2542
-                            break;
2543
-                        case 'time': {
2544
-                            $value = '';
2545
-                            if ($post->$type['htmlvar_name'] != '')
2546
-                                $value = date_i18n(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2547
-
2548
-                            if (strpos($field_icon, 'http') !== false) {
2549
-                                $field_icon_af = '';
2550
-                            } elseif ($field_icon == '') {
2551
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2552
-                            } else {
2553
-                                $field_icon_af = $field_icon;
2554
-                                $field_icon = '';
2555
-                            }
2556
-
2557
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2558
-
2559
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2560
-                            if ($field_set_start == 1 && $site_title != '') {
2561
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2562
-                            }
2563
-                            $html .= ' </span>' . stripslashes($value) . '</div>';
2564
-                        }
2565
-                            break;
2566
-                        case 'datepicker': {
2567
-                            $date_format = geodir_default_date_format();
2568
-                            if ($type['extra_fields'] != '') {
2569
-                                $date_format = unserialize($type['extra_fields']);
2570
-                                $date_format = $date_format['date_format'];
2571
-                            }
2572
-
2573
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2574
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2575
-
2576
-                            $date_format = str_replace($search, $replace, $date_format);
2577
-
2578
-                            $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2579
-
2580
-                            $value = '';
2581
-                            if ($post->$type['htmlvar_name'] != '')
2582
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2583
-
2584
-                            if (strpos($field_icon, 'http') !== false) {
2585
-                                $field_icon_af = '';
2586
-                            } elseif ($field_icon == '') {
2587
-                                $field_icon_af = '<i class="fa fa-calendar"></i>';
2588
-                            } else {
2589
-                                $field_icon_af = $field_icon;
2590
-                                $field_icon = '';
2591
-                            }
2592
-
2593
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2594
-
2595
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2596
-                            if ($field_set_start == 1 && $site_title != '') {
2597
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2598
-                            }
2599
-                            $html .= ' </span>' . $value . '</div>';
2600
-                        }
2601
-                            break;
2602
-                        case 'text': {
2603
-                            if (strpos($field_icon, 'http') !== false) {
2604
-                                $field_icon_af = '';
2605
-                            } elseif ($field_icon == '') {
2606
-                                $field_icon_af = '';
2607
-                            } else {
2608
-                                $field_icon_af = $field_icon;
2609
-                                $field_icon = '';
2610
-                            }
2611
-
2612
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2613
-
2614
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2615
-                            if ($field_set_start == 1 && $site_title != '') {
2616
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2617
-                            }
2618
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2619
-                        }
2620
-                            break;
2621
-                        case 'radio': {
2622
-
2623
-                            if ($post->$type['htmlvar_name'] != '') {
2624
-                                if ($post->$type['htmlvar_name'] == 'f' || $post->$type['htmlvar_name'] == '0') {
2625
-                                    $html_val = __('No', 'geodirectory');
2626
-                                } else if ($post->$type['htmlvar_name'] == 't' || $post->$type['htmlvar_name'] == '1') {
2627
-                                    $html_val = __('Yes', 'geodirectory');
2628
-                                } else {
2629
-                                    $html_val = __($post->$type['htmlvar_name'], 'geodirectory');
2501
+							$a_url = geodir_parse_custom_field_url($post->$type['htmlvar_name']);
2502
+
2503
+							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2504
+							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2505
+							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2506
+
2507
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2508
+
2509
+							// all search engines that use the nofollow value exclude links that use it from their ranking calculation
2510
+							$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2511
+
2512
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2513
+								/**
2514
+								 * Filer the custom field website name.
2515
+								 *
2516
+								 * @since 1.0.0
2517
+								 * @param string $title The field name default: "Website".
2518
+								 * @param string $website The website address.
2519
+								 * @param int $post->ID The post ID.
2520
+								 */
2521
+								apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2522
+						}
2523
+							break;
2524
+						case 'phone': {
2525
+							if (strpos($field_icon, 'http') !== false) {
2526
+								$field_icon_af = '';
2527
+							} elseif ($field_icon == '') {
2528
+								$field_icon_af = '<i class="fa fa-phone"></i>';
2529
+							} else {
2530
+								$field_icon_af = $field_icon;
2531
+								$field_icon = '';
2532
+							}
2533
+
2534
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2535
+
2536
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2537
+							if ($field_set_start == 1 && $site_title != '') {
2538
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2539
+							}
2540
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2541
+						}
2542
+							break;
2543
+						case 'time': {
2544
+							$value = '';
2545
+							if ($post->$type['htmlvar_name'] != '')
2546
+								$value = date_i18n(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2547
+
2548
+							if (strpos($field_icon, 'http') !== false) {
2549
+								$field_icon_af = '';
2550
+							} elseif ($field_icon == '') {
2551
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2552
+							} else {
2553
+								$field_icon_af = $field_icon;
2554
+								$field_icon = '';
2555
+							}
2556
+
2557
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2558
+
2559
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2560
+							if ($field_set_start == 1 && $site_title != '') {
2561
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2562
+							}
2563
+							$html .= ' </span>' . stripslashes($value) . '</div>';
2564
+						}
2565
+							break;
2566
+						case 'datepicker': {
2567
+							$date_format = geodir_default_date_format();
2568
+							if ($type['extra_fields'] != '') {
2569
+								$date_format = unserialize($type['extra_fields']);
2570
+								$date_format = $date_format['date_format'];
2571
+							}
2572
+
2573
+							$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2574
+							$replace = array('d','j','l','m','n','F','Y');//PHP date format
2575
+
2576
+							$date_format = str_replace($search, $replace, $date_format);
2577
+
2578
+							$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2579
+
2580
+							$value = '';
2581
+							if ($post->$type['htmlvar_name'] != '')
2582
+								$value = date($date_format, strtotime($post_htmlvar_value));
2583
+
2584
+							if (strpos($field_icon, 'http') !== false) {
2585
+								$field_icon_af = '';
2586
+							} elseif ($field_icon == '') {
2587
+								$field_icon_af = '<i class="fa fa-calendar"></i>';
2588
+							} else {
2589
+								$field_icon_af = $field_icon;
2590
+								$field_icon = '';
2591
+							}
2592
+
2593
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2594
+
2595
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2596
+							if ($field_set_start == 1 && $site_title != '') {
2597
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2598
+							}
2599
+							$html .= ' </span>' . $value . '</div>';
2600
+						}
2601
+							break;
2602
+						case 'text': {
2603
+							if (strpos($field_icon, 'http') !== false) {
2604
+								$field_icon_af = '';
2605
+							} elseif ($field_icon == '') {
2606
+								$field_icon_af = '';
2607
+							} else {
2608
+								$field_icon_af = $field_icon;
2609
+								$field_icon = '';
2610
+							}
2611
+
2612
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2613
+
2614
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2615
+							if ($field_set_start == 1 && $site_title != '') {
2616
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2617
+							}
2618
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2619
+						}
2620
+							break;
2621
+						case 'radio': {
2622
+
2623
+							if ($post->$type['htmlvar_name'] != '') {
2624
+								if ($post->$type['htmlvar_name'] == 'f' || $post->$type['htmlvar_name'] == '0') {
2625
+									$html_val = __('No', 'geodirectory');
2626
+								} else if ($post->$type['htmlvar_name'] == 't' || $post->$type['htmlvar_name'] == '1') {
2627
+									$html_val = __('Yes', 'geodirectory');
2628
+								} else {
2629
+									$html_val = __($post->$type['htmlvar_name'], 'geodirectory');
2630 2630
                                     
2631
-                                    if (!empty($type['option_values'])) {
2632
-                                        $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2631
+									if (!empty($type['option_values'])) {
2632
+										$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2633 2633
                                         
2634
-                                        if (!empty($cf_option_values)) {
2635
-                                            foreach ($cf_option_values as $cf_option_value) {
2636
-                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2637
-                                                    $html_val = $cf_option_value['label'];
2638
-                                                }
2639
-                                            }
2640
-                                        }
2641
-                                    }
2642
-                                }
2643
-
2644
-                                if (strpos($field_icon, 'http') !== false) {
2645
-                                    $field_icon_af = '';
2646
-                                } else if ($field_icon == '') {
2647
-                                    $field_icon_af = '';
2648
-                                } else {
2649
-                                    $field_icon_af = $field_icon;
2650
-                                    $field_icon = '';
2651
-                                }
2652
-
2653
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2654
-
2655
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2656
-
2657
-                                if ($field_set_start == 1 && $site_title != '') {
2658
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2659
-                                }
2660
-
2661
-                                $html .= ' </span>' . $html_val . '</div>';
2662
-                            }
2663
-                        }
2664
-                            break;
2665
-                        case 'checkbox': {
2666
-                            $html_var = $type['htmlvar_name'];
2667
-                            $html_val = $type['htmlvar_name'];
2668
-
2669
-                            if ((int)$post->$html_var == 1) {
2670
-
2671
-                                if ($post->$type['htmlvar_name'] == '1') {
2672
-                                    $html_val = __('Yes', 'geodirectory');
2673
-                                } else {
2674
-                                    $html_val = __('No', 'geodirectory');
2675
-                                }
2676
-
2677
-                                if (strpos($field_icon, 'http') !== false) {
2678
-                                    $field_icon_af = '';
2679
-                                } else if ($field_icon == '') {
2680
-                                    $field_icon_af = '';
2681
-                                } else {
2682
-                                    $field_icon_af = $field_icon;
2683
-                                    $field_icon = '';
2684
-                                }
2685
-
2686
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2687
-
2688
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2689
-
2690
-                                if ($field_set_start == 1 && $site_title != '') {
2691
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2692
-                                }
2693
-
2694
-                                $html .= ' </span>' . $html_val . '</div>';
2695
-                            }
2696
-                        }
2697
-                            break;
2698
-                        case 'select': {
2699
-                            if (strpos($field_icon, 'http') !== false) {
2700
-                                $field_icon_af = '';
2701
-                            } elseif ($field_icon == '') {
2702
-                                $field_icon_af = '';
2703
-                            } else {
2704
-                                $field_icon_af = $field_icon;
2705
-                                $field_icon = '';
2706
-                            }
2634
+										if (!empty($cf_option_values)) {
2635
+											foreach ($cf_option_values as $cf_option_value) {
2636
+												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2637
+													$html_val = $cf_option_value['label'];
2638
+												}
2639
+											}
2640
+										}
2641
+									}
2642
+								}
2643
+
2644
+								if (strpos($field_icon, 'http') !== false) {
2645
+									$field_icon_af = '';
2646
+								} else if ($field_icon == '') {
2647
+									$field_icon_af = '';
2648
+								} else {
2649
+									$field_icon_af = $field_icon;
2650
+									$field_icon = '';
2651
+								}
2652
+
2653
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2654
+
2655
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2656
+
2657
+								if ($field_set_start == 1 && $site_title != '') {
2658
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2659
+								}
2660
+
2661
+								$html .= ' </span>' . $html_val . '</div>';
2662
+							}
2663
+						}
2664
+							break;
2665
+						case 'checkbox': {
2666
+							$html_var = $type['htmlvar_name'];
2667
+							$html_val = $type['htmlvar_name'];
2668
+
2669
+							if ((int)$post->$html_var == 1) {
2670
+
2671
+								if ($post->$type['htmlvar_name'] == '1') {
2672
+									$html_val = __('Yes', 'geodirectory');
2673
+								} else {
2674
+									$html_val = __('No', 'geodirectory');
2675
+								}
2676
+
2677
+								if (strpos($field_icon, 'http') !== false) {
2678
+									$field_icon_af = '';
2679
+								} else if ($field_icon == '') {
2680
+									$field_icon_af = '';
2681
+								} else {
2682
+									$field_icon_af = $field_icon;
2683
+									$field_icon = '';
2684
+								}
2685
+
2686
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2687
+
2688
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2689
+
2690
+								if ($field_set_start == 1 && $site_title != '') {
2691
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2692
+								}
2693
+
2694
+								$html .= ' </span>' . $html_val . '</div>';
2695
+							}
2696
+						}
2697
+							break;
2698
+						case 'select': {
2699
+							if (strpos($field_icon, 'http') !== false) {
2700
+								$field_icon_af = '';
2701
+							} elseif ($field_icon == '') {
2702
+								$field_icon_af = '';
2703
+							} else {
2704
+								$field_icon_af = $field_icon;
2705
+								$field_icon = '';
2706
+							}
2707 2707
                             
2708
-                            $field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2708
+							$field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2709 2709
                             
2710
-                            if (!empty($type['option_values'])) {
2711
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2710
+							if (!empty($type['option_values'])) {
2711
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2712 2712
                                 
2713
-                                if (!empty($cf_option_values)) {
2714
-                                    foreach ($cf_option_values as $cf_option_value) {
2715
-                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2716
-                                            $field_value = $cf_option_value['label'];
2717
-                                        }
2718
-                                    }
2719
-                                }
2720
-                            }
2721
-
2722
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2723
-
2724
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2725
-                            if ($field_set_start == 1 && $site_title != '') {
2726
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2727
-                            }
2728
-                            $html .= ' </span>' . $field_value . '</div>';
2729
-                        }
2730
-                            break;
2731
-                        case 'multiselect': {
2732
-                            if (is_array($post->$type['htmlvar_name'])) {
2733
-                                $post->$type['htmlvar_name'] = implode(', ', $post->$type['htmlvar_name']);
2734
-                            }
2735
-
2736
-                            if (strpos($field_icon, 'http') !== false) {
2737
-                                $field_icon_af = '';
2738
-                            } elseif ($field_icon == '') {
2739
-                                $field_icon_af = '';
2740
-                            } else {
2741
-                                $field_icon_af = $field_icon;
2742
-                                $field_icon = '';
2743
-                            }
2744
-
2745
-                            $field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2746
-
2747
-                            $option_values = array();
2748
-                            if (!empty($type['option_values'])) {
2749
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2713
+								if (!empty($cf_option_values)) {
2714
+									foreach ($cf_option_values as $cf_option_value) {
2715
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2716
+											$field_value = $cf_option_value['label'];
2717
+										}
2718
+									}
2719
+								}
2720
+							}
2721
+
2722
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2723
+
2724
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2725
+							if ($field_set_start == 1 && $site_title != '') {
2726
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2727
+							}
2728
+							$html .= ' </span>' . $field_value . '</div>';
2729
+						}
2730
+							break;
2731
+						case 'multiselect': {
2732
+							if (is_array($post->$type['htmlvar_name'])) {
2733
+								$post->$type['htmlvar_name'] = implode(', ', $post->$type['htmlvar_name']);
2734
+							}
2735
+
2736
+							if (strpos($field_icon, 'http') !== false) {
2737
+								$field_icon_af = '';
2738
+							} elseif ($field_icon == '') {
2739
+								$field_icon_af = '';
2740
+							} else {
2741
+								$field_icon_af = $field_icon;
2742
+								$field_icon = '';
2743
+							}
2744
+
2745
+							$field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2746
+
2747
+							$option_values = array();
2748
+							if (!empty($type['option_values'])) {
2749
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2750 2750
                                 
2751
-                                if (!empty($cf_option_values)) {
2752
-                                    foreach ($cf_option_values as $cf_option_value) {
2753
-                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2754
-                                            $option_values[] = $cf_option_value['label'];
2755
-                                        }
2756
-                                    }
2757
-                                }
2758
-                            }
2759
-
2760
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2761
-
2762
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2763
-                            if ($field_set_start == 1 && $site_title != '') {
2764
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2765
-                            }
2766
-                            $html .= ' </span>';
2767
-
2768
-                            if (count($option_values) > 1) {
2769
-                                $html .= '<ul>';
2770
-                                foreach ($option_values as $val) {
2771
-                                    $html .= '<li>' . $val . '</li>';
2772
-                                }
2773
-                                $html .= '</ul>';
2774
-                            } else {
2775
-                                $html .= $post->$type['htmlvar_name'];
2776
-                            }
2777
-                            $html .= '</div>';
2778
-                        }
2779
-                            break;
2780
-                        case 'email': {
2781
-                            if (strpos($field_icon, 'http') !== false) {
2782
-                                $field_icon_af = '';
2783
-                            } elseif ($field_icon == '') {
2784
-                                $field_icon_af = '<i class="fa fa-envelope"></i>';
2785
-                            } else {
2786
-                                $field_icon_af = $field_icon;
2787
-                                $field_icon = '';
2788
-                            }
2789
-
2790
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2791
-
2792
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2793
-                            if ($field_set_start == 1 && $site_title != '') {
2794
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2795
-                            }
2796
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2797
-                        }
2798
-                            break;
2799
-                        case 'textarea': {
2800
-                            if (strpos($field_icon, 'http') !== false) {
2801
-                                $field_icon_af = '';
2802
-                            } elseif ($field_icon == '') {
2803
-                                $field_icon_af = '';
2804
-                            } else {
2805
-                                $field_icon_af = $field_icon;
2806
-                                $field_icon = '';
2807
-                            }
2808
-
2809
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2810
-
2811
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2812
-                            if ($field_set_start == 1 && $site_title != '') {
2813
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2814
-                            }
2815
-                            $html .= '</span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2816
-                        }
2817
-                            break;
2818
-                        case 'html': {
2819
-                            if (strpos($field_icon, 'http') !== false) {
2820
-                                $field_icon_af = '';
2821
-                            } elseif ($field_icon == '') {
2822
-                                $field_icon_af = '';
2823
-                            } else {
2824
-                                $field_icon_af = $field_icon;
2825
-                                $field_icon = '';
2826
-                            }
2827
-
2828
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2829
-
2830
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2831
-                            if ($field_set_start == 1 && $site_title != '') {
2832
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2833
-                            }
2834
-                            $html .= ' </span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2835
-                        }
2836
-                        break;
2837
-                        case 'file': {
2838
-                            $html_var = $type['htmlvar_name'];
2839
-
2840
-                            if (!empty($post->$type['htmlvar_name'])) {
2841
-                                $files = explode(",", $post->$type['htmlvar_name']);
2842
-
2843
-                                if (!empty($files)) {
2844
-                                    $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2845
-                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2751
+								if (!empty($cf_option_values)) {
2752
+									foreach ($cf_option_values as $cf_option_value) {
2753
+										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2754
+											$option_values[] = $cf_option_value['label'];
2755
+										}
2756
+									}
2757
+								}
2758
+							}
2759
+
2760
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2761
+
2762
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2763
+							if ($field_set_start == 1 && $site_title != '') {
2764
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2765
+							}
2766
+							$html .= ' </span>';
2767
+
2768
+							if (count($option_values) > 1) {
2769
+								$html .= '<ul>';
2770
+								foreach ($option_values as $val) {
2771
+									$html .= '<li>' . $val . '</li>';
2772
+								}
2773
+								$html .= '</ul>';
2774
+							} else {
2775
+								$html .= $post->$type['htmlvar_name'];
2776
+							}
2777
+							$html .= '</div>';
2778
+						}
2779
+							break;
2780
+						case 'email': {
2781
+							if (strpos($field_icon, 'http') !== false) {
2782
+								$field_icon_af = '';
2783
+							} elseif ($field_icon == '') {
2784
+								$field_icon_af = '<i class="fa fa-envelope"></i>';
2785
+							} else {
2786
+								$field_icon_af = $field_icon;
2787
+								$field_icon = '';
2788
+							}
2789
+
2790
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2791
+
2792
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2793
+							if ($field_set_start == 1 && $site_title != '') {
2794
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2795
+							}
2796
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2797
+						}
2798
+							break;
2799
+						case 'textarea': {
2800
+							if (strpos($field_icon, 'http') !== false) {
2801
+								$field_icon_af = '';
2802
+							} elseif ($field_icon == '') {
2803
+								$field_icon_af = '';
2804
+							} else {
2805
+								$field_icon_af = $field_icon;
2806
+								$field_icon = '';
2807
+							}
2808
+
2809
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2810
+
2811
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2812
+							if ($field_set_start == 1 && $site_title != '') {
2813
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2814
+							}
2815
+							$html .= '</span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2816
+						}
2817
+							break;
2818
+						case 'html': {
2819
+							if (strpos($field_icon, 'http') !== false) {
2820
+								$field_icon_af = '';
2821
+							} elseif ($field_icon == '') {
2822
+								$field_icon_af = '';
2823
+							} else {
2824
+								$field_icon_af = $field_icon;
2825
+								$field_icon = '';
2826
+							}
2827
+
2828
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2829
+
2830
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2831
+							if ($field_set_start == 1 && $site_title != '') {
2832
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2833
+							}
2834
+							$html .= ' </span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2835
+						}
2836
+						break;
2837
+						case 'file': {
2838
+							$html_var = $type['htmlvar_name'];
2839
+
2840
+							if (!empty($post->$type['htmlvar_name'])) {
2841
+								$files = explode(",", $post->$type['htmlvar_name']);
2842
+
2843
+								if (!empty($files)) {
2844
+									$extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2845
+									$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2846 2846
                                
2847
-                                    $file_paths = '';
2848
-                                    foreach ($files as $file) {
2849
-                                        if (!empty($file)) {
2850
-                                            $image_name_arr = explode('/', $file);
2851
-                                            $filename = end($image_name_arr);
2852
-
2853
-                                            $arr_file_type = wp_check_filetype($filename);
2854
-                                            if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2855
-                                                continue;
2856
-                                            }
2857
-                                            $uploaded_file_type = $arr_file_type['type'];
2858
-                                            $uploaded_file_ext = $arr_file_type['ext'];
2847
+									$file_paths = '';
2848
+									foreach ($files as $file) {
2849
+										if (!empty($file)) {
2850
+											$image_name_arr = explode('/', $file);
2851
+											$filename = end($image_name_arr);
2852
+
2853
+											$arr_file_type = wp_check_filetype($filename);
2854
+											if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2855
+												continue;
2856
+											}
2857
+											$uploaded_file_type = $arr_file_type['type'];
2858
+											$uploaded_file_ext = $arr_file_type['ext'];
2859 2859
                                             
2860
-                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2861
-                                                continue; // Invalid file type.
2862
-                                            }
2863
-
2864
-                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2865
-
2866
-                                            // If the uploaded file is image
2867
-                                            if (in_array($uploaded_file_type, $image_file_types)) {
2868
-                                                $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2869
-                                                $file_paths .= '<a href="'.$file.'">';
2870
-                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2871
-                                                $file_paths .= '</a>';
2872
-                                                $file_paths .= '</div>';
2873
-                                            } else {
2874
-                                                $ext_path = '_' . $html_var . '_';
2875
-                                                $filename = explode($ext_path, $filename);
2876
-                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2877
-                                            }
2878
-                                        }
2879
-                                    }
2880
-
2881
-                                    if (strpos($field_icon, 'http') !== false) {
2882
-                                        $field_icon_af = '';
2883
-                                    } else if ($field_icon == '') {
2884
-                                        $field_icon_af = '';
2885
-                                    } else {
2886
-                                        $field_icon_af = $field_icon;
2887
-                                        $field_icon = '';
2888
-                                    }
2889
-
2890
-                                    $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2891
-
2892
-
2893
-                                    $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2894
-
2895
-                                    if ($field_set_start == 1 && $site_title != '') {
2896
-                                        $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2897
-                                    }
2898
-
2899
-                                    $html .= ' </span>' . $file_paths . '</div>';
2900
-                                }
2901
-                            }
2902
-                        }
2903
-                            break;
2904
-                    }
2905
-
2906
-
2907
-                    /**
2908
-                     * Filter custom field output in tab.
2909
-                     *
2910
-                     * @since 1.5.6
2911
-                     *
2912
-                     * @param string $html_var The HTML variable name for the field.
2913
-                     * @param string $html Custom field unfiltered HTML.
2914
-                     * @param array $variables_array Custom field variables array.
2915
-                     */
2916
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2917
-
2918
-                    $fieldset_html = '';
2919
-                    if ($field_set_start == 1) {
2920
-                        $add_html = false;
2921
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2922
-                            if ($fieldset != '') {
2923
-                                $add_html = true;
2924
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2925
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2926
-                            }
2927
-                            $fieldset_html = $fieldset;
2928
-                            $fieldset = '';
2929
-                        } else {
2930
-                            $fieldset .= $html;
2931
-                            if ($total_fields == $count_field && $fieldset != '') {
2932
-                                $add_html = true;
2933
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2934
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2935
-                                $fieldset_html = $fieldset;
2936
-                            }
2937
-                        }
2938
-
2939
-                        if ($add_html) {
2940
-                            $tabs_arr[$htmlvar_name] = array(
2941
-                                'heading_text' => __($label, 'geodirectory'),
2942
-                                'is_active_tab' => false,
2943
-                                /**
2944
-                                 * Filter if a custom field should be displayed on the details page tab.
2945
-                                 *
2946
-                                 * @since 1.0.0
2947
-                                 * @param string $htmlvar_name The field HTML var name.
2948
-                                 */
2949
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2950
-                                'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2951
-                            );
2952
-                        }
2953
-                    } else {
2954
-                        if ($html != '') {
2955
-                            $tabs_arr[$field['htmlvar_name']] = array(
2956
-                                'heading_text' => __($label, 'geodirectory'),
2957
-                                'is_active_tab' => false,
2958
-                                /** This action is documented in geodirectory_hooks_actions.php */
2959
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2960
-                                'tab_content' => $html
2961
-                            );
2962
-                        }
2963
-                    }
2964
-                }
2965
-            }
2966
-        }
2967
-    }
2968
-    return $tabs_arr;
2860
+											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2861
+												continue; // Invalid file type.
2862
+											}
2863
+
2864
+											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2865
+
2866
+											// If the uploaded file is image
2867
+											if (in_array($uploaded_file_type, $image_file_types)) {
2868
+												$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2869
+												$file_paths .= '<a href="'.$file.'">';
2870
+												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2871
+												$file_paths .= '</a>';
2872
+												$file_paths .= '</div>';
2873
+											} else {
2874
+												$ext_path = '_' . $html_var . '_';
2875
+												$filename = explode($ext_path, $filename);
2876
+												$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2877
+											}
2878
+										}
2879
+									}
2880
+
2881
+									if (strpos($field_icon, 'http') !== false) {
2882
+										$field_icon_af = '';
2883
+									} else if ($field_icon == '') {
2884
+										$field_icon_af = '';
2885
+									} else {
2886
+										$field_icon_af = $field_icon;
2887
+										$field_icon = '';
2888
+									}
2889
+
2890
+									$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2891
+
2892
+
2893
+									$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2894
+
2895
+									if ($field_set_start == 1 && $site_title != '') {
2896
+										$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2897
+									}
2898
+
2899
+									$html .= ' </span>' . $file_paths . '</div>';
2900
+								}
2901
+							}
2902
+						}
2903
+							break;
2904
+					}
2905
+
2906
+
2907
+					/**
2908
+					 * Filter custom field output in tab.
2909
+					 *
2910
+					 * @since 1.5.6
2911
+					 *
2912
+					 * @param string $html_var The HTML variable name for the field.
2913
+					 * @param string $html Custom field unfiltered HTML.
2914
+					 * @param array $variables_array Custom field variables array.
2915
+					 */
2916
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2917
+
2918
+					$fieldset_html = '';
2919
+					if ($field_set_start == 1) {
2920
+						$add_html = false;
2921
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2922
+							if ($fieldset != '') {
2923
+								$add_html = true;
2924
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2925
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2926
+							}
2927
+							$fieldset_html = $fieldset;
2928
+							$fieldset = '';
2929
+						} else {
2930
+							$fieldset .= $html;
2931
+							if ($total_fields == $count_field && $fieldset != '') {
2932
+								$add_html = true;
2933
+								$label = $fieldset_arr[$fieldset_count]['label'];
2934
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2935
+								$fieldset_html = $fieldset;
2936
+							}
2937
+						}
2938
+
2939
+						if ($add_html) {
2940
+							$tabs_arr[$htmlvar_name] = array(
2941
+								'heading_text' => __($label, 'geodirectory'),
2942
+								'is_active_tab' => false,
2943
+								/**
2944
+								 * Filter if a custom field should be displayed on the details page tab.
2945
+								 *
2946
+								 * @since 1.0.0
2947
+								 * @param string $htmlvar_name The field HTML var name.
2948
+								 */
2949
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2950
+								'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2951
+							);
2952
+						}
2953
+					} else {
2954
+						if ($html != '') {
2955
+							$tabs_arr[$field['htmlvar_name']] = array(
2956
+								'heading_text' => __($label, 'geodirectory'),
2957
+								'is_active_tab' => false,
2958
+								/** This action is documented in geodirectory_hooks_actions.php */
2959
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2960
+								'tab_content' => $html
2961
+							);
2962
+						}
2963
+					}
2964
+				}
2965
+			}
2966
+		}
2967
+	}
2968
+	return $tabs_arr;
2969 2969
 }
2970 2970
 
2971 2971
 /* display add listing page for wpml */
@@ -2989,37 +2989,37 @@  discard block
 block discarded – undo
2989 2989
  */
2990 2990
 function geodir_add_post_status_author_page()
2991 2991
 {
2992
-    global $wpdb, $post;
2993
-
2994
-    $html = '';
2995
-    if (get_current_user_id()) {
2996
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2997
-
2998
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2999
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3000
-            $status = "<strong>(";
3001
-            $status_icon = '<i class="fa fa-play"></i>';
3002
-            if ($real_status == 'publish') {
3003
-                $status .= __('Published', 'geodirectory');
3004
-            } else {
3005
-                $status .= __('Not published', 'geodirectory');
3006
-                $status_icon = '<i class="fa fa-pause"></i>';
3007
-            }
3008
-            $status .= ")</strong>";
2992
+	global $wpdb, $post;
2993
+
2994
+	$html = '';
2995
+	if (get_current_user_id()) {
2996
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2997
+
2998
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2999
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3000
+			$status = "<strong>(";
3001
+			$status_icon = '<i class="fa fa-play"></i>';
3002
+			if ($real_status == 'publish') {
3003
+				$status .= __('Published', 'geodirectory');
3004
+			} else {
3005
+				$status .= __('Not published', 'geodirectory');
3006
+				$status_icon = '<i class="fa fa-pause"></i>';
3007
+			}
3008
+			$status .= ")</strong>";
3009 3009
 
3010
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3011
-        }
3012
-    }
3010
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3011
+		}
3012
+	}
3013 3013
 
3014
-    if ($html != '') {
3015
-        /**
3016
-         * Filter the post status text on the author page.
3017
-         *
3018
-         * @since 1.0.0
3019
-         * @param string $html The HTML of the status.
3020
-         */
3021
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3022
-    }
3014
+	if ($html != '') {
3015
+		/**
3016
+		 * Filter the post status text on the author page.
3017
+		 *
3018
+		 * @since 1.0.0
3019
+		 * @param string $html The HTML of the status.
3020
+		 */
3021
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3022
+	}
3023 3023
 
3024 3024
 
3025 3025
 }
@@ -3033,21 +3033,21 @@  discard block
 block discarded – undo
3033 3033
  */
3034 3034
 function geodir_init_no_rating()
3035 3035
 {
3036
-    if (get_option('geodir_disable_rating')) {
3037
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3038
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3039
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3040
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3041
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3042
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3043
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3044
-
3045
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3046
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3047
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3048
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3049
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3050
-    }
3036
+	if (get_option('geodir_disable_rating')) {
3037
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3038
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3039
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3040
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3041
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3042
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3043
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3044
+
3045
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3046
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3047
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3048
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3049
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3050
+	}
3051 3051
 }
3052 3052
 
3053 3053
 /**
@@ -3059,20 +3059,20 @@  discard block
 block discarded – undo
3059 3059
  */
3060 3060
 function geodir_no_rating_rating_fields()
3061 3061
 {
3062
-    global $post;
3062
+	global $post;
3063 3063
 
3064
-    $post_types = geodir_get_posttypes();
3064
+	$post_types = geodir_get_posttypes();
3065 3065
 
3066
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3067
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3068
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3069
-            if (get_option('geodir_reviewrating_enable_images')) {
3070
-                geodir_reviewrating_rating_img_html();
3071
-            }
3072
-        } else {
3073
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3074
-        }
3075
-    }
3066
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3067
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3068
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3069
+			if (get_option('geodir_reviewrating_enable_images')) {
3070
+				geodir_reviewrating_rating_img_html();
3071
+			}
3072
+		} else {
3073
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3074
+		}
3075
+	}
3076 3076
 }
3077 3077
 
3078 3078
 /**
@@ -3086,11 +3086,11 @@  discard block
 block discarded – undo
3086 3086
  */
3087 3087
 function geodir_no_rating_comment_text($content, $comment = '')
3088 3088
 {
3089
-    if (!is_admin()) {
3090
-        return '<div class="description">' . $content . '</div>';
3091
-    } else {
3092
-        return $content;
3093
-    }
3089
+	if (!is_admin()) {
3090
+		return '<div class="description">' . $content . '</div>';
3091
+	} else {
3092
+		return $content;
3093
+	}
3094 3094
 }
3095 3095
 
3096 3096
 /**
@@ -3103,7 +3103,7 @@  discard block
 block discarded – undo
3103 3103
  */
3104 3104
 function geodir_no_rating_review_rating_html($content = '')
3105 3105
 {
3106
-    return NULL;
3106
+	return NULL;
3107 3107
 }
3108 3108
 
3109 3109
 /**
@@ -3117,19 +3117,19 @@  discard block
 block discarded – undo
3117 3117
  */
3118 3118
 function geodir_no_rating_get_sort_options($options, $post_type = '')
3119 3119
 {
3120
-    $new_options = array();
3121
-    if (!empty($options)) {
3122
-        foreach ($options as $option) {
3123
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3124
-                continue;
3125
-            }
3126
-            $new_options[] = $option;
3127
-        }
3120
+	$new_options = array();
3121
+	if (!empty($options)) {
3122
+		foreach ($options as $option) {
3123
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3124
+				continue;
3125
+			}
3126
+			$new_options[] = $option;
3127
+		}
3128 3128
 
3129
-        $options = $new_options;
3130
-    }
3129
+		$options = $new_options;
3130
+	}
3131 3131
 
3132
-    return $options;
3132
+	return $options;
3133 3133
 }
3134 3134
 
3135 3135
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -3143,11 +3143,11 @@  discard block
 block discarded – undo
3143 3143
  */
3144 3144
 function geodir_all_js_msg_no_rating($msg = array())
3145 3145
 {
3146
-    if (get_option('geodir_disable_rating')) {
3147
-        $msg['gd_cmt_no_rating'] = true;
3148
-    }
3146
+	if (get_option('geodir_disable_rating')) {
3147
+		$msg['gd_cmt_no_rating'] = true;
3148
+	}
3149 3149
 
3150
-    return $msg;
3150
+	return $msg;
3151 3151
 }
3152 3152
 
3153 3153
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -3161,11 +3161,11 @@  discard block
 block discarded – undo
3161 3161
  */
3162 3162
 function geodir_body_class_no_rating($classes = array())
3163 3163
 {
3164
-    if (get_option('geodir_disable_rating')) {
3165
-        $classes[] = 'gd-no-rating';
3166
-    }
3164
+	if (get_option('geodir_disable_rating')) {
3165
+		$classes[] = 'gd-no-rating';
3166
+	}
3167 3167
 
3168
-    return $classes;
3168
+	return $classes;
3169 3169
 }
3170 3170
 
3171 3171
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -3179,11 +3179,11 @@  discard block
 block discarded – undo
3179 3179
  */
3180 3180
 function geodir_admin_body_class_no_rating($class = '')
3181 3181
 {
3182
-    if (get_option('geodir_disable_rating')) {
3183
-        $class .= ' gd-no-rating';
3184
-    }
3182
+	if (get_option('geodir_disable_rating')) {
3183
+		$class .= ' gd-no-rating';
3184
+	}
3185 3185
 
3186
-    return $class;
3186
+	return $class;
3187 3187
 }
3188 3188
 
3189 3189
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -3196,10 +3196,10 @@  discard block
 block discarded – undo
3196 3196
  */
3197 3197
 function geodir_wp_head_no_rating()
3198 3198
 {
3199
-    if (get_option('geodir_disable_rating')) {
3200
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3201
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3202
-    }
3199
+	if (get_option('geodir_disable_rating')) {
3200
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3201
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3202
+	}
3203 3203
 }
3204 3204
 
3205 3205
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -3216,36 +3216,36 @@  discard block
 block discarded – undo
3216 3216
  * @return array Translation texts.
3217 3217
  */
3218 3218
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3219
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3220
-
3221
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3222
-
3223
-    /**
3224
-     * Filters the geodirectory option names that requires to add for translation.
3225
-     *
3226
-     * @since 1.5.7
3227
-     * @package GeoDirectory
3228
-     *
3229
-     * @param  array $gd_options Array of option names.
3230
-     */
3231
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3232
-    $gd_options = array_unique($gd_options);
3233
-
3234
-    if (!empty($gd_options)) {
3235
-        foreach ($gd_options as $gd_option) {
3236
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
3237
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3219
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3220
+
3221
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3222
+
3223
+	/**
3224
+	 * Filters the geodirectory option names that requires to add for translation.
3225
+	 *
3226
+	 * @since 1.5.7
3227
+	 * @package GeoDirectory
3228
+	 *
3229
+	 * @param  array $gd_options Array of option names.
3230
+	 */
3231
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3232
+	$gd_options = array_unique($gd_options);
3233
+
3234
+	if (!empty($gd_options)) {
3235
+		foreach ($gd_options as $gd_option) {
3236
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
3237
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3238 3238
                 
3239
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3240
-                    $translation_texts[] = stripslashes_deep($option_value);
3241
-                }
3242
-            }
3243
-        }
3244
-    }
3239
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3240
+					$translation_texts[] = stripslashes_deep($option_value);
3241
+				}
3242
+			}
3243
+		}
3244
+	}
3245 3245
 
3246
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3246
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3247 3247
 
3248
-    return $translation_texts;
3248
+	return $translation_texts;
3249 3249
 }
3250 3250
 
3251 3251
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 ////////////////////////
178 178
 
179 179
 add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
180
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
180
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
181 181
 add_action('created_term', 'geodir_term_review_count_force_update', 100);
182 182
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 
320 320
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
321 321
 
322
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
323
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
322
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
323
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
324 324
 
325 325
 // Detail page sidebar content 
326 326
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
     $content_html = ob_get_clean();
423 423
     if (trim($content_html) != '')
424 424
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
425
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
426 426
         /**
427 427
          * Filter the geodir_social_sharing_buttons() function content.
428 428
          *
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
     $content_html = ob_get_clean();
470 470
     if (trim($content_html) != '')
471 471
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
472
+    if ((int) get_option('geodir_disable_sharethis_button_section') != 1) {
473 473
         /**
474 474
          * Filter the geodir_share_this_button() function content.
475 475
          *
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
             $post_id = $post->ID;
509 509
             
510 510
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
511
-                $post_id = (int)$_REQUEST['pid'];
511
+                $post_id = (int) $_REQUEST['pid'];
512 512
             }
513 513
 
514 514
             $postlink = get_permalink(geodir_add_listing_page_id());
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
     $content_html = ob_get_clean();
526 526
     if (trim($content_html) != '')
527 527
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
528
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
528
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
529 529
         /**
530 530
          * Filter the geodir_edit_post_link() function content.
531 531
          *
@@ -577,13 +577,13 @@  discard block
 block discarded – undo
577 577
     
578 578
     $hide_refresh = get_option('geodir_ga_no_refresh');
579 579
     
580
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
580
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
581 581
         $page_url = urlencode($_SERVER['REQUEST_URI']);
582 582
         ?>
583 583
         <script type="text/javascript">
584 584
             var gd_gaTimeOut;
585
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
586
-            var gd_gaNoRefresh = <?php echo (int)$hide_refresh;?>;
585
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
586
+            var gd_gaNoRefresh = <?php echo (int) $hide_refresh; ?>;
587 587
             ga_data1 = false;
588 588
             ga_data2 = false;
589 589
             ga_data3 = false;
@@ -610,34 +610,34 @@  discard block
 block discarded – undo
610 610
             });
611 611
 
612 612
             function gdga_weekVSweek() {
613
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=thisweek", success: function(result){
613
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=thisweek", success: function(result){
614 614
                     ga_data1 = jQuery.parseJSON(result);
615 615
                     if(ga_data1.error){jQuery('#ga_stats').html(result);return;}
616 616
                     gd_renderWeekOverWeekChart();
617 617
                 }});
618 618
 
619
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=lastweek", success: function(result){
619
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=lastweek", success: function(result){
620 620
                     ga_data2 = jQuery.parseJSON(result);
621 621
                     gd_renderWeekOverWeekChart();
622 622
                 }});
623 623
             }
624 624
 
625 625
             function gdga_yearVSyear() {
626
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=thisyear", success: function(result){
626
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=thisyear", success: function(result){
627 627
                     ga_data3 = jQuery.parseJSON(result);
628 628
                     if(ga_data3.error){jQuery('#ga_stats').html(result);return;}
629 629
 
630 630
                     gd_renderYearOverYearChart()
631 631
                 }});
632 632
 
633
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=lastyear", success: function(result){
633
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=lastyear", success: function(result){
634 634
                     ga_data4 = jQuery.parseJSON(result);
635 635
                     gd_renderYearOverYearChart()
636 636
                 }});
637 637
             }
638 638
 
639 639
             function gdga_country() {
640
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=country", success: function(result){
640
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=country", success: function(result){
641 641
                     ga_data5 = jQuery.parseJSON(result);
642 642
                     if(ga_data5.error){jQuery('#ga_stats').html(result);return;}
643 643
                     gd_renderTopCountriesChart();
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
             }
646 646
 
647 647
             function gdga_realtime(dom_ready) {
648
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=realtime", success: function(result) {
648
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=realtime", success: function(result) {
649 649
                     ga_data6 = jQuery.parseJSON(result);
650 650
                     if (ga_data6.error) {
651 651
                         jQuery('#ga_stats').html(result);
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
             }
724 724
 
725 725
             function gdga_noResults() {
726
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
726
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
727 727
                 jQuery('#gdga-legend-container').html('');
728 728
             }
729 729
 
@@ -755,18 +755,18 @@  discard block
 block discarded – undo
755 755
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
756 756
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
757 757
 
758
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
759
-                        '<?php _e('Feb', 'geodirectory');?>',
760
-                        '<?php _e('Mar', 'geodirectory');?>',
761
-                        '<?php _e('Apr', 'geodirectory');?>',
762
-                        '<?php _e('May', 'geodirectory');?>',
763
-                        '<?php _e('Jun', 'geodirectory');?>',
764
-                        '<?php _e('Jul', 'geodirectory');?>',
765
-                        '<?php _e('Aug', 'geodirectory');?>',
766
-                        '<?php _e('Sep', 'geodirectory');?>',
767
-                        '<?php _e('Oct', 'geodirectory');?>',
768
-                        '<?php _e('Nov', 'geodirectory');?>',
769
-                        '<?php _e('Dec', 'geodirectory');?>'];
758
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
759
+                        '<?php _e('Feb', 'geodirectory'); ?>',
760
+                        '<?php _e('Mar', 'geodirectory'); ?>',
761
+                        '<?php _e('Apr', 'geodirectory'); ?>',
762
+                        '<?php _e('May', 'geodirectory'); ?>',
763
+                        '<?php _e('Jun', 'geodirectory'); ?>',
764
+                        '<?php _e('Jul', 'geodirectory'); ?>',
765
+                        '<?php _e('Aug', 'geodirectory'); ?>',
766
+                        '<?php _e('Sep', 'geodirectory'); ?>',
767
+                        '<?php _e('Oct', 'geodirectory'); ?>',
768
+                        '<?php _e('Nov', 'geodirectory'); ?>',
769
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
770 770
 
771 771
                     // Ensure the data arrays are at least as long as the labels array.
772 772
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -779,13 +779,13 @@  discard block
 block discarded – undo
779 779
                         labels : labels,
780 780
                         datasets : [
781 781
                             {
782
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
782
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
783 783
                                 fillColor : "rgba(220,220,220,0.5)",
784 784
                                 strokeColor : "rgba(220,220,220,1)",
785 785
                                 data : data2
786 786
                             },
787 787
                             {
788
-                                label: '<?php _e('This Year', 'geodirectory');?>',
788
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
789 789
                                 fillColor : "rgba(151,187,205,0.5)",
790 790
                                 strokeColor : "rgba(151,187,205,1)",
791 791
                                 data : data1
@@ -830,30 +830,30 @@  discard block
 block discarded – undo
830 830
 
831 831
                     <?php
832 832
                     // Here we list the shorthand days of the week so it can be used in translation.
833
-                    __("Mon",'geodirectory');
834
-                    __("Tue",'geodirectory');
835
-                    __("Wed",'geodirectory');
836
-                    __("Thu",'geodirectory');
837
-                    __("Fri",'geodirectory');
838
-                    __("Sat",'geodirectory');
839
-                    __("Sun",'geodirectory');
833
+                    __("Mon", 'geodirectory');
834
+                    __("Tue", 'geodirectory');
835
+                    __("Wed", 'geodirectory');
836
+                    __("Thu", 'geodirectory');
837
+                    __("Fri", 'geodirectory');
838
+                    __("Sat", 'geodirectory');
839
+                    __("Sun", 'geodirectory');
840 840
                     ?>
841 841
 
842 842
                     labels = [
843
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
844
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
845
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
846
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
847
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
848
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
849
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
843
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
844
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
845
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
846
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
847
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
848
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
849
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
850 850
                     ];
851 851
 
852 852
                     var data = {
853 853
                         labels : labels,
854 854
                         datasets : [
855 855
                             {
856
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
856
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
857 857
                                 fillColor : "rgba(220,220,220,0.5)",
858 858
                                 strokeColor : "rgba(220,220,220,1)",
859 859
                                 pointColor : "rgba(220,220,220,1)",
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
                                 data : data2
862 862
                             },
863 863
                             {
864
-                                label: '<?php _e('This Week', 'geodirectory');?>',
864
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
865 865
                                 fillColor : "rgba(151,187,205,0.5)",
866 866
                                 strokeColor : "rgba(151,187,205,1)",
867 867
                                 pointColor : "rgba(151,187,205,1)",
@@ -1066,16 +1066,16 @@  discard block
 block discarded – undo
1066 1066
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1067 1067
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1068 1068
         <span id="ga_stats">
1069
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>&nbsp;<i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i>
1069
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>&nbsp;<i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i>
1070 1070
             <div id="gd-active-users-container">
1071
-                <div class="gd-ActiveUsers"><?php _e("Active Users:", 'geodirectory');?>
1071
+                <div class="gd-ActiveUsers"><?php _e("Active Users:", 'geodirectory'); ?>
1072 1072
                     <b class="gd-ActiveUsers-value">0</b>
1073 1073
                 </div>
1074 1074
             </div>
1075 1075
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1076
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1077
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1078
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1076
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1077
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1078
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1079 1079
             </select>
1080 1080
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1081 1081
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
     $content_html = ob_get_clean();
1093 1093
     if (trim($content_html) != '')
1094 1094
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1095
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1095
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1096 1096
         /**
1097 1097
          * Filter the geodir_edit_post_link() function content.
1098 1098
          *
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
     if (trim($content_html) != '') {
1189 1189
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1190 1190
     }
1191
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1191
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1192 1192
         /**
1193 1193
          * Filter the geodir_detail_page_review_rating() function content.
1194 1194
          *
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
     $content_html = ob_get_clean();
1229 1229
     if (trim($content_html) != '')
1230 1230
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1231
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1231
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1232 1232
         /**
1233 1233
          * Filter the output html for function geodir_detail_page_more_info().
1234 1234
          *
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1320 1320
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1321 1321
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1322
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1322
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1323 1323
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1324 1324
     );
1325 1325
 
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
     foreach ($arr_alert_msg as $key => $value) {
1337 1337
         if (!is_scalar($value))
1338 1338
             continue;
1339
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1339
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1340 1340
     }
1341 1341
 
1342 1342
     $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
         global $post;
1513 1513
         $term_condition = '';
1514 1514
         if (isset($_REQUEST['backandedit'])) {
1515
-            $post = (object)$gd_session->get('listing');
1515
+            $post = (object) $gd_session->get('listing');
1516 1516
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1517 1517
         }
1518 1518
 
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
                     echo 'checked="checked"';
1527 1527
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1528 1528
                        class="geodir_textfield" value="1"
1529
-                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1529
+                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1530 1530
 				</span>
1531 1531
             </div>
1532 1532
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
         /** This action is documented in geodirectory_template_actions.php */
1567 1567
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1568 1568
         
1569
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1569
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1570 1570
             $is_display = false;
1571 1571
         }
1572 1572
     }
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
     global $wpdb, $plugin_prefix;
1615 1615
 	
1616 1616
 	// Remove unused virtual page
1617
-	$listings_page_id = (int)get_option('geodir_listing_page');
1617
+	$listings_page_id = (int) get_option('geodir_listing_page');
1618 1618
 	if ($listings_page_id) {
1619 1619
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1620 1620
         delete_option('geodir_listing_page');
@@ -1861,43 +1861,43 @@  discard block
 block discarded – undo
1861 1861
 
1862 1862
 
1863 1863
     $gd_page = '';
1864
-    if(geodir_is_page('home')){
1864
+    if (geodir_is_page('home')) {
1865 1865
         $gd_page = 'home';
1866 1866
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1867 1867
     }
1868
-    elseif(geodir_is_page('detail')){
1868
+    elseif (geodir_is_page('detail')) {
1869 1869
         $gd_page = 'detail';
1870 1870
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1871 1871
     }
1872
-    elseif(geodir_is_page('pt')){
1872
+    elseif (geodir_is_page('pt')) {
1873 1873
         $gd_page = 'pt';
1874 1874
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1875 1875
     }
1876
-    elseif(geodir_is_page('listing')){
1876
+    elseif (geodir_is_page('listing')) {
1877 1877
         $gd_page = 'listing';
1878 1878
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1879 1879
     }
1880
-    elseif(geodir_is_page('location')){
1880
+    elseif (geodir_is_page('location')) {
1881 1881
         $gd_page = 'location';
1882 1882
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1883 1883
     }
1884
-    elseif(geodir_is_page('search')){
1884
+    elseif (geodir_is_page('search')) {
1885 1885
         $gd_page = 'search';
1886 1886
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1887 1887
     }
1888
-    elseif(geodir_is_page('add-listing')){
1888
+    elseif (geodir_is_page('add-listing')) {
1889 1889
         $gd_page = 'add-listing';
1890 1890
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1891 1891
     }
1892
-    elseif(geodir_is_page('author')){
1892
+    elseif (geodir_is_page('author')) {
1893 1893
         $gd_page = 'author';
1894 1894
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1895 1895
     }
1896
-    elseif(geodir_is_page('login')){
1896
+    elseif (geodir_is_page('login')) {
1897 1897
         $gd_page = 'login';
1898 1898
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1899 1899
     }
1900
-    elseif(geodir_is_page('listing-success')){
1900
+    elseif (geodir_is_page('listing-success')) {
1901 1901
         $gd_page = 'listing-success';
1902 1902
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1903 1903
     }
@@ -2160,7 +2160,7 @@  discard block
 block discarded – undo
2160 2160
  */
2161 2161
 function geodir_remove_template_redirect_actions()
2162 2162
 {
2163
-    if (geodir_is_page('login')){
2163
+    if (geodir_is_page('login')) {
2164 2164
         remove_all_actions('template_redirect');
2165 2165
         remove_action('init', 'avia_modify_front', 10);
2166 2166
     }
@@ -2570,8 +2570,8 @@  discard block
 block discarded – undo
2570 2570
                                 $date_format = $date_format['date_format'];
2571 2571
                             }
2572 2572
 
2573
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2574
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2573
+                            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
2574
+                            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
2575 2575
 
2576 2576
                             $date_format = str_replace($search, $replace, $date_format);
2577 2577
 
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
                             $html_var = $type['htmlvar_name'];
2667 2667
                             $html_val = $type['htmlvar_name'];
2668 2668
 
2669
-                            if ((int)$post->$html_var == 1) {
2669
+                            if ((int) $post->$html_var == 1) {
2670 2670
 
2671 2671
                                 if ($post->$type['htmlvar_name'] == '1') {
2672 2672
                                     $html_val = __('Yes', 'geodirectory');
@@ -2842,7 +2842,7 @@  discard block
 block discarded – undo
2842 2842
 
2843 2843
                                 if (!empty($files)) {
2844 2844
                                     $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2845
-                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2845
+                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
2846 2846
                                
2847 2847
                                     $file_paths = '';
2848 2848
                                     foreach ($files as $file) {
@@ -2866,7 +2866,7 @@  discard block
 block discarded – undo
2866 2866
                                             // If the uploaded file is image
2867 2867
                                             if (in_array($uploaded_file_type, $image_file_types)) {
2868 2868
                                                 $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2869
-                                                $file_paths .= '<a href="'.$file.'">';
2869
+                                                $file_paths .= '<a href="' . $file . '">';
2870 2870
                                                 $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2871 2871
                                                 $file_paths .= '</a>';
2872 2872
                                                 $file_paths .= '</div>';
@@ -3216,7 +3216,7 @@  discard block
 block discarded – undo
3216 3216
  * @return array Translation texts.
3217 3217
  */
3218 3218
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3219
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3219
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
3220 3220
 
3221 3221
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3222 3222
 
Please login to merge, or discard this patch.
Braces   +92 added lines, -74 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 add_filter('query_vars', 'geodir_add_location_var');
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89
-if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
89
+if (get_option('permalink_structure') != '') {
90
+    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91
+}
91 92
 
92 93
 add_filter('parse_query', 'geodir_modified_query');
93 94
 
@@ -420,8 +421,9 @@  discard block
 block discarded – undo
420 421
      */
421 422
     do_action('geodir_after_social_sharing_buttons');
422 423
     $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
424
+    if (trim($content_html) != '') {
425
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+    }
425 427
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426 428
         /**
427 429
          * Filter the geodir_social_sharing_buttons() function content.
@@ -467,8 +469,9 @@  discard block
 block discarded – undo
467 469
      */
468 470
     do_action('geodir_after_share_this_button');
469 471
     $content_html = ob_get_clean();
470
-    if (trim($content_html) != '')
471
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
+    if (trim($content_html) != '') {
473
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
474
+    }
472 475
     if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473 476
         /**
474 477
          * Filter the geodir_share_this_button() function content.
@@ -523,8 +526,9 @@  discard block
 block discarded – undo
523 526
      */
524 527
     do_action('geodir_after_edit_post_link');
525 528
     $content_html = ob_get_clean();
526
-    if (trim($content_html) != '')
527
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
+    if (trim($content_html) != '') {
530
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
531
+    }
528 532
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
529 533
         /**
530 534
          * Filter the geodir_edit_post_link() function content.
@@ -1090,8 +1094,9 @@  discard block
 block discarded – undo
1090 1094
      */
1091 1095
     do_action('geodir_after_google_analytics');
1092 1096
     $content_html = ob_get_clean();
1093
-    if (trim($content_html) != '')
1094
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1097
+    if (trim($content_html) != '') {
1098
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1099
+    }
1095 1100
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1096 1101
         /**
1097 1102
          * Filter the geodir_edit_post_link() function content.
@@ -1226,8 +1231,9 @@  discard block
 block discarded – undo
1226 1231
     do_action('geodir_after_detail_page_more_info');
1227 1232
 
1228 1233
     $content_html = ob_get_clean();
1229
-    if (trim($content_html) != '')
1230
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1234
+    if (trim($content_html) != '') {
1235
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1236
+    }
1231 1237
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1232 1238
         /**
1233 1239
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1334,8 +1340,9 @@  discard block
 block discarded – undo
1334 1340
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1335 1341
 
1336 1342
     foreach ($arr_alert_msg as $key => $value) {
1337
-        if (!is_scalar($value))
1338
-            continue;
1343
+        if (!is_scalar($value)) {
1344
+                    continue;
1345
+        }
1339 1346
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1340 1347
     }
1341 1348
 
@@ -1389,17 +1396,19 @@  discard block
 block discarded – undo
1389 1396
     global $geodir_sidebars;
1390 1397
     global $sidebars_widgets;
1391 1398
 
1392
-    if (!is_array($sidebars_widgets))
1393
-        $sidebars_widgets = wp_get_sidebars_widgets();
1399
+    if (!is_array($sidebars_widgets)) {
1400
+            $sidebars_widgets = wp_get_sidebars_widgets();
1401
+    }
1394 1402
     $geodir_old_sidebars = array();
1395 1403
 
1396 1404
     if (is_array($geodir_sidebars)) {
1397 1405
         foreach ($geodir_sidebars as $val) {
1398 1406
             if (is_array($sidebars_widgets)) {
1399
-                if (array_key_exists($val, $sidebars_widgets))
1400
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1401
-                else
1402
-                    $geodir_old_sidebars[$val] = array();
1407
+                if (array_key_exists($val, $sidebars_widgets)) {
1408
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1409
+                } else {
1410
+                                    $geodir_old_sidebars[$val] = array();
1411
+                }
1403 1412
             }
1404 1413
         }
1405 1414
     }
@@ -1420,8 +1429,9 @@  discard block
 block discarded – undo
1420 1429
 {
1421 1430
     global $sidebars_widgets;
1422 1431
 
1423
-    if (!is_array($sidebars_widgets))
1424
-        $sidebars_widgets = wp_get_sidebars_widgets();
1432
+    if (!is_array($sidebars_widgets)) {
1433
+            $sidebars_widgets = wp_get_sidebars_widgets();
1434
+    }
1425 1435
 
1426 1436
     if (is_array($sidebars_widgets)) {
1427 1437
         $geodir_old_sidebars = get_option('geodir_sidebars');
@@ -1571,20 +1581,25 @@  discard block
 block discarded – undo
1571 1581
         }
1572 1582
     }
1573 1583
     
1574
-    if ($tab == 'post_info')
1575
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1584
+    if ($tab == 'post_info') {
1585
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1586
+    }
1576 1587
 
1577
-    if ($tab == 'post_images')
1578
-        $is_display = (!empty($post_images)) ? true : false;
1588
+    if ($tab == 'post_images') {
1589
+            $is_display = (!empty($post_images)) ? true : false;
1590
+    }
1579 1591
 
1580
-    if ($tab == 'post_video')
1581
-        $is_display = (!empty($video)) ? true : false;
1592
+    if ($tab == 'post_video') {
1593
+            $is_display = (!empty($video)) ? true : false;
1594
+    }
1582 1595
 
1583
-    if ($tab == 'special_offers')
1584
-        $is_display = (!empty($special_offers)) ? true : false;
1596
+    if ($tab == 'special_offers') {
1597
+            $is_display = (!empty($special_offers)) ? true : false;
1598
+    }
1585 1599
 
1586
-    if ($tab == 'reviews')
1587
-        $is_display = (geodir_is_page('detail')) ? true : false;
1600
+    if ($tab == 'reviews') {
1601
+            $is_display = (geodir_is_page('detail')) ? true : false;
1602
+    }
1588 1603
 
1589 1604
     if ($tab == 'related_listing') {
1590 1605
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1818,11 +1833,13 @@  discard block
 block discarded – undo
1818 1833
     $region_slug = $default_location->region_slug;
1819 1834
     $city_slug = $default_location->city_slug;
1820 1835
 
1821
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1822
-        return $slug_exists = true;
1836
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1837
+            return $slug_exists = true;
1838
+    }
1823 1839
 
1824
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1825
-        return $slug_exists = true;
1840
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1841
+            return $slug_exists = true;
1842
+    }
1826 1843
 
1827 1844
     return $slug_exists;
1828 1845
 }
@@ -1864,40 +1881,31 @@  discard block
 block discarded – undo
1864 1881
     if(geodir_is_page('home')){
1865 1882
         $gd_page = 'home';
1866 1883
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('detail')){
1884
+    } elseif(geodir_is_page('detail')){
1869 1885
         $gd_page = 'detail';
1870 1886
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('pt')){
1887
+    } elseif(geodir_is_page('pt')){
1873 1888
         $gd_page = 'pt';
1874 1889
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('listing')){
1890
+    } elseif(geodir_is_page('listing')){
1877 1891
         $gd_page = 'listing';
1878 1892
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('location')){
1893
+    } elseif(geodir_is_page('location')){
1881 1894
         $gd_page = 'location';
1882 1895
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('search')){
1896
+    } elseif(geodir_is_page('search')){
1885 1897
         $gd_page = 'search';
1886 1898
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('add-listing')){
1899
+    } elseif(geodir_is_page('add-listing')){
1889 1900
         $gd_page = 'add-listing';
1890 1901
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('author')){
1902
+    } elseif(geodir_is_page('author')){
1893 1903
         $gd_page = 'author';
1894 1904
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1895
-    }
1896
-    elseif(geodir_is_page('login')){
1905
+    } elseif(geodir_is_page('login')){
1897 1906
         $gd_page = 'login';
1898 1907
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1899
-    }
1900
-    elseif(geodir_is_page('listing-success')){
1908
+    } elseif(geodir_is_page('listing-success')){
1901 1909
         $gd_page = 'listing-success';
1902 1910
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1903 1911
     }
@@ -1972,11 +1980,13 @@  discard block
 block discarded – undo
1972 1980
 
1973 1981
     if (!get_option('geodir_remove_url_seperator')) {
1974 1982
 
1975
-        if (get_option('geodir_listingurl_separator'))
1976
-            delete_option('geodir_listingurl_separator');
1983
+        if (get_option('geodir_listingurl_separator')) {
1984
+                    delete_option('geodir_listingurl_separator');
1985
+        }
1977 1986
 
1978
-        if (get_option('geodir_detailurl_separator'))
1979
-            delete_option('geodir_detailurl_separator');
1987
+        if (get_option('geodir_detailurl_separator')) {
1988
+                    delete_option('geodir_detailurl_separator');
1989
+        }
1980 1990
 
1981 1991
         flush_rewrite_rules(false);
1982 1992
 
@@ -2000,8 +2010,9 @@  discard block
 block discarded – undo
2000 2010
 {
2001 2011
     foreach ($permalink_arr as $key => $value) {
2002 2012
 
2003
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2004
-            unset($permalink_arr[$key]);
2013
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2014
+                    unset($permalink_arr[$key]);
2015
+        }
2005 2016
 
2006 2017
     }
2007 2018
 
@@ -2133,16 +2144,18 @@  discard block
 block discarded – undo
2133 2144
 
2134 2145
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2135 2146
 
2136
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2137
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2147
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2148
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2149
+            }
2138 2150
         }
2139 2151
 
2140 2152
         if (array_key_exists('special_offers', $tabs_arr)) {
2141 2153
 
2142 2154
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2143 2155
 
2144
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2145
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2156
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2157
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2158
+            }
2146 2159
         }
2147 2160
 
2148 2161
     }
@@ -2197,8 +2210,9 @@  discard block
 block discarded – undo
2197 2210
 
2198 2211
         $all_postypes = geodir_get_posttypes();
2199 2212
 
2200
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2201
-            return false;
2213
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2214
+                    return false;
2215
+        }
2202 2216
 
2203 2217
         $uploads = wp_upload_dir();
2204 2218
 
@@ -2272,8 +2286,9 @@  discard block
 block discarded – undo
2272 2286
                         $file_info = pathinfo($attach->file);
2273 2287
 
2274 2288
                         $sub_dir = '';
2275
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2276
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2289
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2290
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2291
+                        }
2277 2292
 
2278 2293
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2279 2294
                         $uploads_path = $uploads['basedir'];
@@ -2294,8 +2309,9 @@  discard block
 block discarded – undo
2294 2309
 
2295 2310
                     if (!empty($attachment_data)) {
2296 2311
 
2297
-                        if ($attachment_data->ID)
2298
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2312
+                        if ($attachment_data->ID) {
2313
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2314
+                        }
2299 2315
 
2300 2316
                     } else {
2301 2317
 
@@ -2542,8 +2558,9 @@  discard block
 block discarded – undo
2542 2558
                             break;
2543 2559
                         case 'time': {
2544 2560
                             $value = '';
2545
-                            if ($post->$type['htmlvar_name'] != '')
2546
-                                $value = date_i18n(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2561
+                            if ($post->$type['htmlvar_name'] != '') {
2562
+                                                            $value = date_i18n(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2563
+                            }
2547 2564
 
2548 2565
                             if (strpos($field_icon, 'http') !== false) {
2549 2566
                                 $field_icon_af = '';
@@ -2578,8 +2595,9 @@  discard block
 block discarded – undo
2578 2595
                             $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2579 2596
 
2580 2597
                             $value = '';
2581
-                            if ($post->$type['htmlvar_name'] != '')
2582
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2598
+                            if ($post->$type['htmlvar_name'] != '') {
2599
+                                                            $value = date($date_format, strtotime($post_htmlvar_value));
2600
+                            }
2583 2601
 
2584 2602
                             if (strpos($field_icon, 'http') !== false) {
2585 2603
                                 $field_icon_af = '';
Please login to merge, or discard this patch.
geodirectory-functions/google_analytics.php 1 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.