Test Failed
Pull Request — master (#437)
by Kiran
22:03
created
geodirectory-functions/custom_fields_input_functions.php 3 patches
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @return string The html to output for the custom field.
19 19
  */
20
-function geodir_cfi_fieldset($html,$cf){
20
+function geodir_cfi_fieldset($html, $cf) {
21 21
 
22 22
     $html_var = $cf['htmlvar_name'];
23 23
 
24 24
     // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
25
+    if (has_filter("geodir_custom_field_input_fieldset_{$html_var}")) {
26 26
         /**
27 27
          * Filter the fieldset html by individual custom field.
28 28
          *
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
          * @param array $cf The custom field array.
31 31
          * @since 1.6.6
32 32
          */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
33
+        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}", $html, $cf);
34 34
     }
35 35
 
36 36
     // If no html then we run the standard output.
37
-    if(empty($html)) {
37
+    if (empty($html)) {
38 38
 
39 39
         ob_start(); // Start  buffering;
40 40
         ?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42
-            gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?>
43
-            <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
42
+            gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __($cf['site_title'], 'geodirectory'); ?>
43
+            <?php if ($cf['desc'] != '') {
44
+                echo '<small>( '.__($cf['desc'], 'geodirectory').' )</small>';
45 45
             } ?></h5>
46 46
         <?php
47 47
         $html = ob_get_clean();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     return $html;
51 51
 }
52
-add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
52
+add_filter('geodir_custom_field_input_fieldset', 'geodir_cfi_fieldset', 10, 2);
53 53
 
54 54
 
55 55
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return string The html to output for the custom field.
64 64
  */
65
-function geodir_cfi_text($html,$cf){
65
+function geodir_cfi_text($html, $cf) {
66 66
 
67 67
     $html_var = $cf['htmlvar_name'];
68 68
 
69 69
     // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
70
+    if (has_filter("geodir_custom_field_input_text_{$html_var}")) {
71 71
         /**
72 72
          * Filter the text html by individual custom field.
73 73
          *
@@ -75,41 +75,41 @@  discard block
 block discarded – undo
75 75
          * @param array $cf The custom field array.
76 76
          * @since 1.6.6
77 77
          */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
78
+        $html = apply_filters("geodir_custom_field_input_text_{$html_var}", $html, $cf);
79 79
     }
80 80
 
81 81
     // If no html then we run the standard output.
82
-    if(empty($html)) {
82
+    if (empty($html)) {
83 83
 
84 84
         ob_start(); // Start  buffering;
85 85
 
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if (isset($cf['data_type']) && $cf['data_type'] == 'INT') {$type = 'number'; }
90
+        elseif (isset($cf['data_type']) && $cf['data_type'] == 'FLOAT') {$type = 'float'; }
91 91
 
92 92
         //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
93
+        if (isset($cf['validation_pattern']) && $cf['validation_pattern']) {
94 94
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
95
+        } else {$validation = ''; }
96 96
 
97 97
         // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
98
+        if (isset($cf['validation_msg']) && $cf['validation_msg']) {
99 99
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
100
+        } else {$validation_msg = ''; }
101 101
         ?>
102 102
 
103
-        <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+        <div id="<?php echo $cf['name']; ?>_row"
104
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 107
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
108
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
109 109
             </label>
110
-            <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
112
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
110
+            <input field_type="<?php echo $type; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
111
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
112
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
113 113
             <?php if ($cf['is_required']) { ?>
114 114
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
115 115
             <?php } ?>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     return $html;
123 123
 }
124
-add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
124
+add_filter('geodir_custom_field_input_text', 'geodir_cfi_text', 10, 2);
125 125
 
126 126
 
127 127
 /**
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return string The html to output for the custom field.
135 135
  */
136
-function geodir_cfi_email($html,$cf){
136
+function geodir_cfi_email($html, $cf) {
137 137
 
138 138
     $html_var = $cf['htmlvar_name'];
139 139
 
140 140
     // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
141
+    if (has_filter("geodir_custom_field_input_email_{$html_var}")) {
142 142
         /**
143 143
          * Filter the email html by individual custom field.
144 144
          *
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
          * @param array $cf The custom field array.
147 147
          * @since 1.6.6
148 148
          */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
149
+        $html = apply_filters("geodir_custom_field_input_email_{$html_var}", $html, $cf);
150 150
     }
151 151
 
152 152
     // If no html then we run the standard output.
153
-    if(empty($html)) {
153
+    if (empty($html)) {
154 154
 
155 155
         ob_start(); // Start  buffering;
156 156
         $value = geodir_get_cf_value($cf);
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
             $value = '';
160 160
         }?>
161 161
 
162
-        <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
162
+        <div id="<?php echo $cf['name']; ?>_row"
163
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 166
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
167
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
168 168
             </label>
169
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
170
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
171
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
169
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
170
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
171
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
172 172
             <?php if ($cf['is_required']) { ?>
173 173
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
174 174
             <?php } ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
     return $html;
182 182
 }
183
-add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
183
+add_filter('geodir_custom_field_input_email', 'geodir_cfi_email', 10, 2);
184 184
 
185 185
 
186 186
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string The html to output for the custom field.
195 195
  */
196
-function geodir_cfi_phone($html,$cf){
196
+function geodir_cfi_phone($html, $cf) {
197 197
 
198 198
     $html_var = $cf['htmlvar_name'];
199 199
 
200 200
     // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
201
+    if (has_filter("geodir_custom_field_input_phone_{$html_var}")) {
202 202
         /**
203 203
          * Filter the phone html by individual custom field.
204 204
          *
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
          * @param array $cf The custom field array.
207 207
          * @since 1.6.6
208 208
          */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
209
+        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}", $html, $cf);
210 210
     }
211 211
 
212 212
     // If no html then we run the standard output.
213
-    if(empty($html)) {
213
+    if (empty($html)) {
214 214
 
215 215
         ob_start(); // Start  buffering;
216 216
         $value = geodir_get_cf_value($cf);
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
             $value = '';
220 220
         }?>
221 221
 
222
-        <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
222
+        <div id="<?php echo $cf['name']; ?>_row"
223
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 226
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
227
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
228 228
             </label>
229
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
230
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
231
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
229
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
230
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
231
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
232 232
             <?php if ($cf['is_required']) { ?>
233 233
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
234 234
             <?php } ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
     return $html;
242 242
 }
243
-add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
243
+add_filter('geodir_custom_field_input_phone', 'geodir_cfi_phone', 10, 2);
244 244
 
245 245
 
246 246
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string The html to output for the custom field.
255 255
  */
256
-function geodir_cfi_url($html,$cf){
256
+function geodir_cfi_url($html, $cf) {
257 257
 
258 258
     $html_var = $cf['htmlvar_name'];
259 259
 
260 260
     // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
261
+    if (has_filter("geodir_custom_field_input_url_{$html_var}")) {
262 262
         /**
263 263
          * Filter the url html by individual custom field.
264 264
          *
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
          * @param array $cf The custom field array.
267 267
          * @since 1.6.6
268 268
          */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
269
+        $html = apply_filters("geodir_custom_field_input_url_{$html_var}", $html, $cf);
270 270
     }
271 271
 
272 272
     // If no html then we run the standard output.
273
-    if(empty($html)) {
273
+    if (empty($html)) {
274 274
 
275 275
         ob_start(); // Start  buffering;
276 276
         $value = geodir_get_cf_value($cf);
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
             $value = '';
280 280
         }?>
281 281
 
282
-        <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
282
+        <div id="<?php echo $cf['name']; ?>_row"
283
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 286
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
287
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
288 288
             </label>
289
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
289
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
290
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
291 291
                    oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
292 292
                    onchange="try{setCustomValidity('')}catch(e){}"
293 293
             />
294
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
294
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
295 295
             <?php if ($cf['is_required']) { ?>
296 296
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
297 297
             <?php } ?>
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
     return $html;
305 305
 }
306
-add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
306
+add_filter('geodir_custom_field_input_url', 'geodir_cfi_url', 10, 2);
307 307
 
308 308
 
309 309
 /**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return string The html to output for the custom field.
317 317
  */
318
-function geodir_cfi_radio($html,$cf){
318
+function geodir_cfi_radio($html, $cf) {
319 319
 
320 320
     $html_var = $cf['htmlvar_name'];
321 321
 
322 322
     // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
323
+    if (has_filter("geodir_custom_field_input_radio_{$html_var}")) {
324 324
         /**
325 325
          * Filter the radio html by individual custom field.
326 326
          *
@@ -328,22 +328,22 @@  discard block
 block discarded – undo
328 328
          * @param array $cf The custom field array.
329 329
          * @since 1.6.6
330 330
          */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
331
+        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}", $html, $cf);
332 332
     }
333 333
 
334 334
     // If no html then we run the standard output.
335
-    if(empty($html)) {
335
+    if (empty($html)) {
336 336
 
337 337
         ob_start(); // Start  buffering;
338 338
         $value = geodir_get_cf_value($cf);
339 339
 
340 340
         ?>
341
-        <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
341
+        <div id="<?php echo $cf['name']; ?>_row"
342
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 345
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
346
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349 349
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
                     foreach ($option_values as $option_value) {
353 353
                         if (empty($option_value['optgroup'])) {
354 354
                             ?>
355
-                            <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked(stripslashes($value), $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
355
+                            <span class="gd-radios"><input name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" <?php checked(stripslashes($value), $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357 357
                         }
358 358
                     }
359 359
                 }
360 360
             }
361 361
             ?>
362
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
362
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
365 365
             <?php } ?>
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
     return $html;
373 373
 }
374
-add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
374
+add_filter('geodir_custom_field_input_radio', 'geodir_cfi_radio', 10, 2);
375 375
 
376 376
 
377 377
 /**
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return string The html to output for the custom field.
385 385
  */
386
-function geodir_cfi_checkbox($html,$cf){
386
+function geodir_cfi_checkbox($html, $cf) {
387 387
 
388 388
     $html_var = $cf['htmlvar_name'];
389 389
 
390 390
     // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
391
+    if (has_filter("geodir_custom_field_input_checkbox_{$html_var}")) {
392 392
         /**
393 393
          * Filter the checkbox html by individual custom field.
394 394
          *
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
          * @param array $cf The custom field array.
397 397
          * @since 1.6.6
398 398
          */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
399
+        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}", $html, $cf);
400 400
     }
401 401
 
402 402
     // If no html then we run the standard output.
403
-    if(empty($html)) {
403
+    if (empty($html)) {
404 404
 
405 405
         ob_start(); // Start  buffering;
406 406
         $value = geodir_get_cf_value($cf);
@@ -411,22 +411,22 @@  discard block
 block discarded – undo
411 411
         }
412 412
         ?>
413 413
 
414
-        <div id="<?php echo $cf['name'];?>_row"
415
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
414
+        <div id="<?php echo $cf['name']; ?>_row"
415
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
416 416
             <label>
417 417
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418 418
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
419
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
420 420
             </label>
421 421
             <?php if ($value != '1') {
422 422
                 $value = '0';
423 423
             }?>
424
-            <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
424
+            <input type="hidden" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" value="<?php echo esc_attr($value); ?>"/>
425 425
             <input  <?php if ($value == '1') {
426 426
                 echo 'checked="checked"';
427
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
428
-                 onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
429
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
427
+            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="checkbox"
428
+                 onchange="if(this.checked){jQuery('#<?php echo $cf['name']; ?>').val('1');} else{ jQuery('#<?php echo $cf['name']; ?>').val('0');}"/>
429
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
430 430
             <?php if ($cf['is_required']) { ?>
431 431
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
432 432
             <?php } ?>
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
     return $html;
440 440
 }
441
-add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
441
+add_filter('geodir_custom_field_input_checkbox', 'geodir_cfi_checkbox', 10, 2);
442 442
 
443 443
 
444 444
 /**
@@ -450,12 +450,12 @@  discard block
 block discarded – undo
450 450
  *
451 451
  * @return string The html to output for the custom field.
452 452
  */
453
-function geodir_cfi_textarea($html,$cf){
453
+function geodir_cfi_textarea($html, $cf) {
454 454
 
455 455
     $html_var = $cf['htmlvar_name'];
456 456
 
457 457
     // Check if there is a custom field specific filter.
458
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
458
+    if (has_filter("geodir_custom_field_input_textarea_{$html_var}")) {
459 459
         /**
460 460
          * Filter the textarea html by individual custom field.
461 461
          *
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
          * @param array $cf The custom field array.
464 464
          * @since 1.6.6
465 465
          */
466
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
466
+        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}", $html, $cf);
467 467
     }
468 468
 
469 469
     // If no html then we run the standard output.
470
-    if(empty($html)) {
470
+    if (empty($html)) {
471 471
 
472 472
         ob_start(); // Start  buffering;
473 473
         $value = geodir_get_cf_value($cf);
@@ -475,32 +475,32 @@  discard block
 block discarded – undo
475 475
         $extra_fields = unserialize($cf['extra_fields']);
476 476
         ?>
477 477
 
478
-        <div id="<?php echo $cf['name'];?>_row"
479
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
478
+        <div id="<?php echo $cf['name']; ?>_row"
479
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
480 480
             <label>
481 481
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482 482
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
483
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
484 484
             </label><?php
485 485
 
486 486
 
487 487
             if (is_array($extra_fields) && in_array('1', $extra_fields)) {
488 488
 
489
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
489
+                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
490 490
 
491
-            <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
491
+            <div class="editor" field_id="<?php echo $cf['name']; ?>" field_type="editor">
492 492
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
493 493
                 </div><?php
494 494
 
495 495
             } else {
496 496
 
497
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
498
-                            id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
497
+                ?><textarea field_type="<?php echo $cf['type']; ?>" class="geodir_textarea" name="<?php echo $cf['name']; ?>"
498
+                            id="<?php echo $cf['name']; ?>"><?php echo stripslashes($value); ?></textarea><?php
499 499
 
500 500
             }?>
501 501
 
502 502
 
503
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
503
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
504 504
             <?php if ($cf['is_required']) { ?>
505 505
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
506 506
             <?php } ?>
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
     return $html;
514 514
 }
515
-add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
515
+add_filter('geodir_custom_field_input_textarea', 'geodir_cfi_textarea', 10, 2);
516 516
 
517 517
 
518 518
 /**
@@ -524,12 +524,12 @@  discard block
 block discarded – undo
524 524
  *
525 525
  * @return string The html to output for the custom field.
526 526
  */
527
-function geodir_cfi_select($html,$cf){
527
+function geodir_cfi_select($html, $cf) {
528 528
 
529 529
     $html_var = $cf['htmlvar_name'];
530 530
 
531 531
     // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
532
+    if (has_filter("geodir_custom_field_input_select_{$html_var}")) {
533 533
         /**
534 534
          * Filter the select html by individual custom field.
535 535
          *
@@ -537,22 +537,22 @@  discard block
 block discarded – undo
537 537
          * @param array $cf The custom field array.
538 538
          * @since 1.6.6
539 539
          */
540
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
540
+        $html = apply_filters("geodir_custom_field_input_select_{$html_var}", $html, $cf);
541 541
     }
542 542
 
543 543
     // If no html then we run the standard output.
544
-    if(empty($html)) {
544
+    if (empty($html)) {
545 545
 
546 546
         ob_start(); // Start  buffering;
547 547
         $value = geodir_get_cf_value($cf);
548 548
 
549 549
         ?>
550
-        <div id="<?php echo $cf['name'];?>_row"
551
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550
+        <div id="<?php echo $cf['name']; ?>_row"
551
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 552
             <label>
553 553
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554 554
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
555
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
556 556
             </label>
557 557
             <?php
558 558
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -562,22 +562,22 @@  discard block
 block discarded – undo
562 562
                     if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563 563
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
564 564
 
565
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
565
+                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
566 566
                     } else {
567 567
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
568 568
                         $option_value = isset($option_row['value']) ? $option_row['value'] : '';
569 569
                         $selected = $option_value == stripslashes($value) ? 'selected="selected"' : '';
570 570
 
571
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
571
+                        $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
572 572
                     }
573 573
                 }
574 574
             }
575 575
             ?>
576
-            <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
576
+            <select field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
577 577
                     class="geodir_textfield textfield_x chosen_select"
578
-                    data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
579
-                    option-ajaxchosen="false"><?php echo $select_options;?></select>
580
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
578
+                    data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'&hellip;'; ?>"
579
+                    option-ajaxchosen="false"><?php echo $select_options; ?></select>
580
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
581 581
             <?php if ($cf['is_required']) { ?>
582 582
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
583 583
             <?php } ?>
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
     return $html;
591 591
 }
592
-add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
592
+add_filter('geodir_custom_field_input_select', 'geodir_cfi_select', 10, 2);
593 593
 
594 594
 
595 595
 /**
@@ -601,12 +601,12 @@  discard block
 block discarded – undo
601 601
  *
602 602
  * @return string The html to output for the custom field.
603 603
  */
604
-function geodir_cfi_multiselect($html,$cf){
604
+function geodir_cfi_multiselect($html, $cf) {
605 605
 
606 606
     $html_var = $cf['htmlvar_name'];
607 607
 
608 608
     // Check if there is a custom field specific filter.
609
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
609
+    if (has_filter("geodir_custom_field_input_multiselect_{$html_var}")) {
610 610
         /**
611 611
          * Filter the multiselect html by individual custom field.
612 612
          *
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
          * @param array $cf The custom field array.
615 615
          * @since 1.6.6
616 616
          */
617
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
617
+        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}", $html, $cf);
618 618
     }
619 619
 
620 620
     // If no html then we run the standard output.
621
-    if(empty($html)) {
621
+    if (empty($html)) {
622 622
 
623 623
         ob_start(); // Start  buffering;
624 624
         $value = geodir_get_cf_value($cf);
@@ -655,9 +655,9 @@  discard block
 block discarded – undo
655 655
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
656 656
 
657 657
                                 if ($multi_display == 'select') {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
658
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
659 659
                                 } else {
660
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
660
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : '';
661 661
                                 }
662 662
                             } else {
663 663
                                 if (!is_array($value) && $value != '') {
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
                                 }
691 691
 
692 692
                                 if ($multi_display == 'select') {
693
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
693
+                                    $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
694 694
                                 } else {
695
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
695
+                                    $select_options .= '<li><input name="'.$cf['name'].'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" />&nbsp;'.$option_label.' </li>';
696 696
                                 }
697 697
                             }
698 698
                         }
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
     return $html;
714 714
 }
715
-add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
715
+add_filter('geodir_custom_field_input_multiselect', 'geodir_cfi_multiselect', 10, 2);
716 716
 
717 717
 
718 718
 /**
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
  *
725 725
  * @return string The html to output for the custom field.
726 726
  */
727
-function geodir_cfi_html($html,$cf){
727
+function geodir_cfi_html($html, $cf) {
728 728
 
729 729
     $html_var = $cf['htmlvar_name'];
730 730
 
731 731
     // Check if there is a custom field specific filter.
732
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
732
+    if (has_filter("geodir_custom_field_input_html_{$html_var}")) {
733 733
         /**
734 734
          * Filter the html html by individual custom field.
735 735
          *
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
          * @param array $cf The custom field array.
738 738
          * @since 1.6.6
739 739
          */
740
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
740
+        $html = apply_filters("geodir_custom_field_input_html_{$html_var}", $html, $cf);
741 741
     }
742 742
 
743 743
     // If no html then we run the standard output.
744
-    if(empty($html)) {
744
+    if (empty($html)) {
745 745
 
746 746
         ob_start(); // Start  buffering;
747 747
         $value = geodir_get_cf_value($cf);
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 
775 775
     return $html;
776 776
 }
777
-add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
777
+add_filter('geodir_custom_field_input_html', 'geodir_cfi_html', 10, 2);
778 778
 
779 779
 
780 780
 
@@ -787,12 +787,12 @@  discard block
 block discarded – undo
787 787
  *
788 788
  * @return string The html to output for the custom field.
789 789
  */
790
-function geodir_cfi_datepicker($html,$cf){
790
+function geodir_cfi_datepicker($html, $cf) {
791 791
 
792 792
     $html_var = $cf['htmlvar_name'];
793 793
 
794 794
     // Check if there is a custom field specific filter.
795
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
795
+    if (has_filter("geodir_custom_field_input_datepicker_{$html_var}")) {
796 796
         /**
797 797
          * Filter the datepicker html by individual custom field.
798 798
          *
@@ -800,11 +800,11 @@  discard block
 block discarded – undo
800 800
          * @param array $cf The custom field array.
801 801
          * @since 1.6.6
802 802
          */
803
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
803
+        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}", $html, $cf);
804 804
     }
805 805
 
806 806
     // If no html then we run the standard output.
807
-    if(empty($html)) {
807
+    if (empty($html)) {
808 808
 
809 809
         ob_start(); // Start  buffering;
810 810
         $value = geodir_get_cf_value($cf);
@@ -816,23 +816,23 @@  discard block
 block discarded – undo
816 816
             $extra_fields['date_format'] = 'yy-mm-dd';
817 817
 
818 818
         $date_format = $extra_fields['date_format'];
819
-        $jquery_date_format  = $date_format;
819
+        $jquery_date_format = $date_format;
820 820
 
821 821
 
822 822
         // check if we need to change the format or not
823 823
         $date_format_len = strlen(str_replace(' ', '', $date_format));
824
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
824
+        if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
825 825
 
826
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
827
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
826
+            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
827
+            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
828 828
 
829 829
             $date_format = str_replace($search, $replace, $date_format);
830
-        }else{
831
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
830
+        } else {
831
+            $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format);
832 832
         }
833 833
 
834
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
835
-        if($value && !isset($_REQUEST['backandedit'])) {
834
+        if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
835
+        if ($value && !isset($_REQUEST['backandedit'])) {
836 836
             //$time = strtotime($value);
837 837
             //$value = date_i18n($date_format, $time);
838 838
         }
@@ -843,37 +843,37 @@  discard block
 block discarded – undo
843 843
 
844 844
             jQuery(function () {
845 845
 
846
-                jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
846
+                jQuery("#<?php echo $cf['name']; ?>").datepicker({changeMonth: true, changeYear: true <?php
847 847
                     /**
848 848
                      * Used to add extra option to datepicker per custom field.
849 849
                      *
850 850
                      * @since 1.5.7
851 851
                      * @param string $name The custom field name.
852 852
                      */
853
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
853
+                    echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
854 854
 
855
-                jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
855
+                jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>');
856 856
 
857
-                <?php if(!empty($value)){?>
858
-                jQuery("#<?php echo $name;?>").datepicker("setDate", '<?php echo $value;?>');
857
+                <?php if (!empty($value)) {?>
858
+                jQuery("#<?php echo $name; ?>").datepicker("setDate", '<?php echo $value; ?>');
859 859
                 <?php } ?>
860 860
 
861 861
             });
862 862
 
863 863
         </script>
864
-        <div id="<?php echo $name;?>_row"
865
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
864
+        <div id="<?php echo $name; ?>_row"
865
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
866 866
             <label>
867 867
 
868 868
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
869 869
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
870
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
870
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
871 871
             </label>
872 872
 
873
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
874
-                   value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
873
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
874
+                   value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
875 875
 
876
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
876
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
877 877
             <?php if ($cf['is_required']) { ?>
878 878
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
879 879
             <?php } ?>
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
     return $html;
887 887
 }
888
-add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
888
+add_filter('geodir_custom_field_input_datepicker', 'geodir_cfi_datepicker', 10, 2);
889 889
 
890 890
 
891 891
 /**
@@ -897,12 +897,12 @@  discard block
 block discarded – undo
897 897
  *
898 898
  * @return string The html to output for the custom field.
899 899
  */
900
-function geodir_cfi_time($html,$cf){
900
+function geodir_cfi_time($html, $cf) {
901 901
 
902 902
     $html_var = $cf['htmlvar_name'];
903 903
 
904 904
     // Check if there is a custom field specific filter.
905
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
905
+    if (has_filter("geodir_custom_field_input_time_{$html_var}")) {
906 906
         /**
907 907
          * Filter the time html by individual custom field.
908 908
          *
@@ -910,11 +910,11 @@  discard block
 block discarded – undo
910 910
          * @param array $cf The custom field array.
911 911
          * @since 1.6.6
912 912
          */
913
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
913
+        $html = apply_filters("geodir_custom_field_input_time_{$html_var}", $html, $cf);
914 914
     }
915 915
 
916 916
     // If no html then we run the standard output.
917
-    if(empty($html)) {
917
+    if (empty($html)) {
918 918
 
919 919
         ob_start(); // Start  buffering;
920 920
         $value = geodir_get_cf_value($cf);
@@ -927,25 +927,25 @@  discard block
 block discarded – undo
927 927
         <script type="text/javascript">
928 928
             jQuery(document).ready(function () {
929 929
 
930
-                jQuery('#<?php echo $name;?>').timepicker({
930
+                jQuery('#<?php echo $name; ?>').timepicker({
931 931
                     showPeriod: true,
932 932
                     showLeadingZero: true,
933 933
                     showPeriod: true,
934 934
                 });
935 935
             });
936 936
         </script>
937
-        <div id="<?php echo $name;?>_row"
938
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
937
+        <div id="<?php echo $name; ?>_row"
938
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
939 939
             <label>
940 940
 
941 941
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
942 942
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
943
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
943
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
944 944
             </label>
945
-            <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
946
-                   id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
945
+            <input readonly="readonly" field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>"
946
+                   id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
947 947
 
948
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
948
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
949 949
             <?php if ($cf['is_required']) { ?>
950 950
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
951 951
             <?php } ?>
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 
957 957
     return $html;
958 958
 }
959
-add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
959
+add_filter('geodir_custom_field_input_time', 'geodir_cfi_time', 10, 2);
960 960
 
961 961
 
962 962
 /**
@@ -968,12 +968,12 @@  discard block
 block discarded – undo
968 968
  *
969 969
  * @return string The html to output for the custom field.
970 970
  */
971
-function geodir_cfi_address($html,$cf){
971
+function geodir_cfi_address($html, $cf) {
972 972
 
973 973
     $html_var = $cf['htmlvar_name'];
974 974
 
975 975
     // Check if there is a custom field specific filter.
976
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
976
+    if (has_filter("geodir_custom_field_input_address_{$html_var}")) {
977 977
         /**
978 978
          * Filter the address html by individual custom field.
979 979
          *
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
          * @param array $cf The custom field array.
982 982
          * @since 1.6.6
983 983
          */
984
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
984
+        $html = apply_filters("geodir_custom_field_input_address_{$html_var}", $html, $cf);
985 985
     }
986 986
 
987 987
     // If no html then we run the standard output.
988
-    if(empty($html)) {
988
+    if (empty($html)) {
989 989
 
990 990
         global $gd_session;
991 991
         ob_start(); // Start  buffering;
@@ -998,12 +998,12 @@  discard block
 block discarded – undo
998 998
         $site_title = $cf['site_title'];
999 999
         $is_admin = $cf['is_admin'];
1000 1000
         $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1001
-        $prefix = $name . '_';
1001
+        $prefix = $name.'_';
1002 1002
 
1003
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1004
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1003
+        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address');
1004
+        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code ');
1005 1005
         ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1006
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1006
+        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview');
1007 1007
 
1008 1008
         $address = '';
1009 1009
         $zip = '';
@@ -1014,21 +1014,21 @@  discard block
 block discarded – undo
1014 1014
 
1015 1015
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1016 1016
             $post = $gd_ses_listing;
1017
-            $address = $post[$prefix . 'address'];
1018
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1019
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1020
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1021
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1022
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1017
+            $address = $post[$prefix.'address'];
1018
+            $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : '';
1019
+            $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : '';
1020
+            $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : '';
1021
+            $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : '';
1022
+            $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : '';
1023 1023
         } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1024
-            $post_info = (array)$post_info;
1025
-
1026
-            $address = $post_info[$prefix . 'address'];
1027
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1028
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1029
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1030
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1031
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1024
+            $post_info = (array) $post_info;
1025
+
1026
+            $address = $post_info[$prefix.'address'];
1027
+            $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : '';
1028
+            $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : '';
1029
+            $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : '';
1030
+            $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : '';
1031
+            $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : '';
1032 1032
         }
1033 1033
 
1034 1034
         $location = geodir_get_default_location();
@@ -1066,18 +1066,18 @@  discard block
 block discarded – undo
1066 1066
         $locate_me = !empty($extra_fields['show_map']) && geodir_map_name() != 'none' ? true : false;
1067 1067
         $locate_me_class = $locate_me ? ' gd-form-control' : '';
1068 1068
         ?>
1069
-        <div id="geodir_<?php echo $prefix . 'address';?>_row"
1070
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1071
-            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>';?></label>
1069
+        <div id="geodir_<?php echo $prefix.'address'; ?>_row"
1070
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1071
+            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>'; ?></label>
1072 1072
             <?php if ($locate_me) { ?>
1073 1073
             <div class="gd-input-group gd-locate-me">
1074 1074
             <?php } ?>
1075
-                <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>" id="<?php echo $prefix . 'address';?>" class="geodir_textfield<?php echo $locate_me_class;?>" value="<?php echo esc_attr(stripslashes($address)); ?>" />
1075
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>" id="<?php echo $prefix.'address'; ?>" class="geodir_textfield<?php echo $locate_me_class; ?>" value="<?php echo esc_attr(stripslashes($address)); ?>" />
1076 1076
                 <?php if ($locate_me) { ?>
1077 1077
                 <span onclick="gdGeoLocateMe(this, 'add-listing');" class="gd-locate-me-btn gd-input-group-addon" title="<?php esc_attr_e('My location', 'geodirlocation'); ?>"><i class="fa fa-crosshairs fa-fw" aria-hidden="true"></i></span>
1078 1078
             </div>
1079 1079
             <?php } ?>
1080
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1080
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1081 1081
             <?php if ($is_required) { ?>
1082 1082
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1083 1083
             <?php } ?>
@@ -1096,14 +1096,14 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
         if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1098 1098
 
1099
-            <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1099
+            <div id="geodir_<?php echo $prefix.'zip'; ?>_row"
1100 1100
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
1101 1101
                 <label>
1102 1102
                     <?php _e($zip_title, 'geodirectory'); ?>
1103 1103
                     <?php /*if($is_required) echo '<span>*</span>';*/ ?>
1104 1104
                 </label>
1105
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>"
1106
-                       id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill"
1105
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>"
1106
+                       id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill"
1107 1107
                        value="<?php echo esc_attr(stripslashes($zip)); ?>"/>
1108 1108
                 <?php /*if($is_required) {?>
1109 1109
 					<span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span>
@@ -1113,14 +1113,14 @@  discard block
 block discarded – undo
1113 1113
 
1114 1114
         <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1115 1115
 
1116
-            <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1116
+            <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1117 1117
                 <?php
1118 1118
                 /**
1119 1119
                  * Contains add listing page map functions.
1120 1120
                  *
1121 1121
                  * @since 1.0.0
1122 1122
                  */
1123
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1123
+                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1124 1124
                 if ($lat_lng_blank) {
1125 1125
                     $lat = '';
1126 1126
                     $lng = '';
@@ -1131,14 +1131,14 @@  discard block
 block discarded – undo
1131 1131
             <?php
1132 1132
             /* show lat lng */
1133 1133
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1134
-            <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1134
+            <div id="geodir_<?php echo $prefix.'latitude'; ?>_row"
1135 1135
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1136 1136
                 <label>
1137 1137
                     <?php echo PLACE_ADDRESS_LAT; ?>
1138 1138
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1139 1139
                 </label>
1140
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1141
-                       id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
1140
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>"
1141
+                       id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield"
1142 1142
                        value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/>
1143 1143
                 <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span>
1144 1144
                 <?php if ($is_required) { ?>
@@ -1146,14 +1146,14 @@  discard block
 block discarded – undo
1146 1146
                 <?php } ?>
1147 1147
             </div>
1148 1148
 
1149
-            <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1149
+            <div id="geodir_<?php echo $prefix.'longitude'; ?>_row"
1150 1150
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1151 1151
                 <label>
1152 1152
                     <?php echo PLACE_ADDRESS_LNG; ?>
1153 1153
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1154 1154
                 </label>
1155
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1156
-                       id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
1155
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>"
1156
+                       id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield"
1157 1157
                        value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/>
1158 1158
                 <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span>
1159 1159
                 <?php if ($is_required) { ?>
@@ -1163,32 +1163,32 @@  discard block
 block discarded – undo
1163 1163
         <?php } ?>
1164 1164
 
1165 1165
         <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1166
-            <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1166
+            <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1167 1167
                 <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1168 1168
 
1169 1169
 
1170 1170
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1171 1171
                                                             class="gd-checkbox"
1172
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1173
-                                                            id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1172
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1173
+                                                            id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1174 1174
                             echo 'checked="checked"';
1175 1175
                         } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1176 1176
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1177 1177
                                                              class="gd-checkbox"
1178
-                                                             name="<?php echo $prefix . 'mapview'; ?>"
1178
+                                                             name="<?php echo $prefix.'mapview'; ?>"
1179 1179
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1180 1180
                             echo 'checked="checked"';
1181 1181
                         } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1182 1182
 
1183 1183
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1184 1184
                                                             class="gd-checkbox"
1185
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1185
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1186 1186
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1187 1187
                             echo 'checked="checked"';
1188 1188
                         } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1189 1189
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1190 1190
                                                             class="gd-checkbox"
1191
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1191
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1192 1192
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1193 1193
                             echo 'checked="checked"';
1194 1194
                         } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1201 1201
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1202 1202
                 echo esc_attr($mapzoom);
1203
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1203
+            } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/>
1204 1204
         <?php }
1205 1205
 
1206 1206
         $html = ob_get_clean();
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
     return $html;
1210 1210
 }
1211
-add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1211
+add_filter('geodir_custom_field_input_address', 'geodir_cfi_address', 10, 2);
1212 1212
 
1213 1213
 
1214 1214
 
@@ -1221,12 +1221,12 @@  discard block
 block discarded – undo
1221 1221
  *
1222 1222
  * @return string The html to output for the custom field.
1223 1223
  */
1224
-function geodir_cfi_taxonomy($html,$cf){
1224
+function geodir_cfi_taxonomy($html, $cf) {
1225 1225
 
1226 1226
     $html_var = $cf['htmlvar_name'];
1227 1227
 
1228 1228
     // Check if there is a custom field specific filter.
1229
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1229
+    if (has_filter("geodir_custom_field_input_taxonomy_{$html_var}")) {
1230 1230
         /**
1231 1231
          * Filter the taxonomy html by individual custom field.
1232 1232
          *
@@ -1234,11 +1234,11 @@  discard block
 block discarded – undo
1234 1234
          * @param array $cf The custom field array.
1235 1235
          * @since 1.6.6
1236 1236
          */
1237
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1237
+        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}", $html, $cf);
1238 1238
     }
1239 1239
 
1240 1240
     // If no html then we run the standard output.
1241
-    if(empty($html)) {
1241
+    if (empty($html)) {
1242 1242
 
1243 1243
         ob_start(); // Start  buffering;
1244 1244
         $value = geodir_get_cf_value($cf);
@@ -1253,15 +1253,15 @@  discard block
 block discarded – undo
1253 1253
         if ($value == $cf['default']) {
1254 1254
             $value = '';
1255 1255
         } ?>
1256
-        <div id="<?php echo $name;?>_row"
1257
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1256
+        <div id="<?php echo $name; ?>_row"
1257
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1258 1258
             <label>
1259 1259
                 <?php $site_title = __($site_title, 'geodirectory');
1260 1260
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1261
-                <?php if ($is_required) echo '<span>*</span>';?>
1261
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1262 1262
             </label>
1263 1263
 
1264
-            <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1264
+            <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1265 1265
                 <?php
1266 1266
                 global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1267 1267
 
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 
1274 1274
                     $package_info = array();
1275 1275
 
1276
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1276
+                    $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1277 1277
 
1278 1278
                     if (!empty($package_info)) {
1279 1279
 
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 
1303 1303
                     $catadd_limit = $wpdb->get_var(
1304 1304
                         $wpdb->prepare(
1305
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1305
+                            "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d",
1306 1306
                             array($package_id)
1307 1307
                         )
1308 1308
                     );
@@ -1318,13 +1318,13 @@  discard block
 block discarded – undo
1318 1318
                     $required_limit_msg = '';
1319 1319
                     if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1320 1320
 
1321
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1321
+                        $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
1322 1322
 
1323 1323
                     } else {
1324 1324
                         $required_limit_msg = $required_msg;
1325 1325
                     }
1326 1326
 
1327
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1327
+                    echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']"  />';
1328 1328
 
1329 1329
 
1330 1330
                     if ($cat_display == 'select' || $cat_display == 'multiselect') {
@@ -1334,11 +1334,11 @@  discard block
 block discarded – undo
1334 1334
                         if ($cat_display == 'multiselect')
1335 1335
                             $multiple = 'multiple="multiple"';
1336 1336
 
1337
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1337
+                        echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">';
1338 1338
 
1339 1339
 
1340 1340
                         if ($cat_display == 'select')
1341
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1341
+                            echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
1342 1342
 
1343 1343
                     }
1344 1344
 
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
                 ?>
1357 1357
             </div>
1358 1358
 
1359
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1359
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1360 1360
             <?php if ($is_required) { ?>
1361 1361
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1362 1362
             <?php } ?>
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 
1369 1369
     return $html;
1370 1370
 }
1371
-add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1371
+add_filter('geodir_custom_field_input_taxonomy', 'geodir_cfi_taxonomy', 10, 2);
1372 1372
 
1373 1373
 
1374 1374
 /**
@@ -1380,12 +1380,12 @@  discard block
 block discarded – undo
1380 1380
  *
1381 1381
  * @return string The html to output for the custom field.
1382 1382
  */
1383
-function geodir_cfi_file($html,$cf){
1383
+function geodir_cfi_file($html, $cf) {
1384 1384
 
1385 1385
     $html_var = $cf['htmlvar_name'];
1386 1386
 
1387 1387
     // Check if there is a custom field specific filter.
1388
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1388
+    if (has_filter("geodir_custom_field_input_file_{$html_var}")) {
1389 1389
         /**
1390 1390
          * Filter the file html by individual custom field.
1391 1391
          *
@@ -1393,11 +1393,11 @@  discard block
 block discarded – undo
1393 1393
          * @param array $cf The custom field array.
1394 1394
          * @since 1.6.6
1395 1395
          */
1396
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1396
+        $html = apply_filters("geodir_custom_field_input_file_{$html_var}", $html, $cf);
1397 1397
     }
1398 1398
 
1399 1399
     // If no html then we run the standard output.
1400
-    if(empty($html)) {
1400
+    if (empty($html)) {
1401 1401
 
1402 1402
         ob_start(); // Start  buffering;
1403 1403
         $value = geodir_get_cf_value($cf);
@@ -1440,8 +1440,8 @@  discard block
 block discarded – undo
1440 1440
                 $file_totImg = count($curImages);
1441 1441
         }
1442 1442
 
1443
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1444
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1443
+        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
1444
+        $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
1445 1445
 
1446 1446
         ?>
1447 1447
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -1451,13 +1451,13 @@  discard block
 block discarded – undo
1451 1451
 			</h5>   <?php */
1452 1452
         ?>
1453 1453
 
1454
-        <div id="<?php echo $name;?>_row"
1455
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1454
+        <div id="<?php echo $name; ?>_row"
1455
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1456 1456
 
1457 1457
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1458 1458
                 <label
1459 1459
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1460
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1460
+                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
1461 1461
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1462 1462
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1463 1463
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
                        id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
1466 1466
                 <?php if ($allowed_file_types != '') { ?>
1467 1467
                     <input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
1468
-                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
1468
+                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
1469 1469
                 <?php } ?>
1470 1470
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1471 1471
                        value="<?php if (isset($file_totImg)) {
@@ -1481,10 +1481,10 @@  discard block
 block discarded – undo
1481 1481
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1482 1482
                         ?>
1483 1483
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1484
-                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1484
+                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
1485 1485
                                class="geodir_button" style="margin-top:10px;"/>
1486 1486
                             <span class="ajaxnonceplu"
1487
-                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
1487
+                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span>
1488 1488
                         <?php if ($file_width && $file_height): ?>
1489 1489
                             <span class="plupload-resize"></span>
1490 1490
                             <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span>
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
 
1505 1505
                 </div>
1506 1506
             </div>
1507
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
1507
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
1508 1508
             <?php if ($is_required) { ?>
1509 1509
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1510 1510
             <?php } ?>
@@ -1517,4 +1517,4 @@  discard block
 block discarded – undo
1517 1517
 
1518 1518
     return $html;
1519 1519
 }
1520
-add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1521 1520
\ No newline at end of file
1521
+add_filter('geodir_custom_field_input_file', 'geodir_cfi_file', 10, 2);
1522 1522
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +711 added lines, -711 removed lines patch added patch discarded remove patch
@@ -19,35 +19,35 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_cfi_fieldset($html,$cf){
21 21
 
22
-    $html_var = $cf['htmlvar_name'];
23
-
24
-    // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
-        /**
27
-         * Filter the fieldset html by individual custom field.
28
-         *
29
-         * @param string $html The html to filter.
30
-         * @param array $cf The custom field array.
31
-         * @since 1.6.6
32
-         */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
-    }
35
-
36
-    // If no html then we run the standard output.
37
-    if(empty($html)) {
38
-
39
-        ob_start(); // Start  buffering;
40
-        ?>
22
+	$html_var = $cf['htmlvar_name'];
23
+
24
+	// Check if there is a custom field specific filter.
25
+	if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
+		/**
27
+		 * Filter the fieldset html by individual custom field.
28
+		 *
29
+		 * @param string $html The html to filter.
30
+		 * @param array $cf The custom field array.
31
+		 * @since 1.6.6
32
+		 */
33
+		$html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
+	}
35
+
36
+	// If no html then we run the standard output.
37
+	if(empty($html)) {
38
+
39
+		ob_start(); // Start  buffering;
40
+		?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?>
43 43
             <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
45
-            } ?></h5>
44
+				echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
45
+			} ?></h5>
46 46
         <?php
47
-        $html = ob_get_clean();
48
-    }
47
+		$html = ob_get_clean();
48
+	}
49 49
 
50
-    return $html;
50
+	return $html;
51 51
 }
52 52
 add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
53 53
 
@@ -64,47 +64,47 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function geodir_cfi_text($html,$cf){
66 66
 
67
-    $html_var = $cf['htmlvar_name'];
68
-
69
-    // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
-        /**
72
-         * Filter the text html by individual custom field.
73
-         *
74
-         * @param string $html The html to filter.
75
-         * @param array $cf The custom field array.
76
-         * @since 1.6.6
77
-         */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
-    }
80
-
81
-    // If no html then we run the standard output.
82
-    if(empty($html)) {
83
-
84
-        ob_start(); // Start  buffering;
85
-
86
-        $value = geodir_get_cf_value($cf);
87
-        $type = $cf['type'];
88
-        //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
-
92
-        //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
-            $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
96
-
97
-        // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
-            $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
101
-        ?>
67
+	$html_var = $cf['htmlvar_name'];
68
+
69
+	// Check if there is a custom field specific filter.
70
+	if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
+		/**
72
+		 * Filter the text html by individual custom field.
73
+		 *
74
+		 * @param string $html The html to filter.
75
+		 * @param array $cf The custom field array.
76
+		 * @since 1.6.6
77
+		 */
78
+		$html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
+	}
80
+
81
+	// If no html then we run the standard output.
82
+	if(empty($html)) {
83
+
84
+		ob_start(); // Start  buffering;
85
+
86
+		$value = geodir_get_cf_value($cf);
87
+		$type = $cf['type'];
88
+		//number and float validation $validation_pattern
89
+		if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
+		elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
+
92
+		//validation
93
+		if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
+			$validation = 'pattern="'.$cf['validation_pattern'].'"';
95
+		}else{$validation='';}
96
+
97
+		// validation message
98
+		if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
+			$validation_msg = 'title="'.$cf['validation_msg'].'"';
100
+		}else{$validation_msg='';}
101
+		?>
102 102
 
103 103
         <div id="<?php echo $cf['name'];?>_row"
104 104
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
107
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108 108
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
109 109
             </label>
110 110
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         </div>
117 117
 
118 118
         <?php
119
-        $html = ob_get_clean();
120
-    }
119
+		$html = ob_get_clean();
120
+	}
121 121
 
122
-    return $html;
122
+	return $html;
123 123
 }
124 124
 add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
125 125
 
@@ -135,35 +135,35 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function geodir_cfi_email($html,$cf){
137 137
 
138
-    $html_var = $cf['htmlvar_name'];
138
+	$html_var = $cf['htmlvar_name'];
139 139
 
140
-    // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
-        /**
143
-         * Filter the email html by individual custom field.
144
-         *
145
-         * @param string $html The html to filter.
146
-         * @param array $cf The custom field array.
147
-         * @since 1.6.6
148
-         */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
-    }
140
+	// Check if there is a custom field specific filter.
141
+	if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
+		/**
143
+		 * Filter the email html by individual custom field.
144
+		 *
145
+		 * @param string $html The html to filter.
146
+		 * @param array $cf The custom field array.
147
+		 * @since 1.6.6
148
+		 */
149
+		$html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
+	}
151 151
 
152
-    // If no html then we run the standard output.
153
-    if(empty($html)) {
152
+	// If no html then we run the standard output.
153
+	if(empty($html)) {
154 154
 
155
-        ob_start(); // Start  buffering;
156
-        $value = geodir_get_cf_value($cf);
155
+		ob_start(); // Start  buffering;
156
+		$value = geodir_get_cf_value($cf);
157 157
 
158
-        if ($value == $cf['default']) {
159
-            $value = '';
160
-        }?>
158
+		if ($value == $cf['default']) {
159
+			$value = '';
160
+		}?>
161 161
 
162 162
         <div id="<?php echo $cf['name'];?>_row"
163 163
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
166
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167 167
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
168 168
             </label>
169 169
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         </div>
176 176
 
177 177
         <?php
178
-        $html = ob_get_clean();
179
-    }
178
+		$html = ob_get_clean();
179
+	}
180 180
 
181
-    return $html;
181
+	return $html;
182 182
 }
183 183
 add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
184 184
 
@@ -195,35 +195,35 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function geodir_cfi_phone($html,$cf){
197 197
 
198
-    $html_var = $cf['htmlvar_name'];
198
+	$html_var = $cf['htmlvar_name'];
199 199
 
200
-    // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
-        /**
203
-         * Filter the phone html by individual custom field.
204
-         *
205
-         * @param string $html The html to filter.
206
-         * @param array $cf The custom field array.
207
-         * @since 1.6.6
208
-         */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
-    }
200
+	// Check if there is a custom field specific filter.
201
+	if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
+		/**
203
+		 * Filter the phone html by individual custom field.
204
+		 *
205
+		 * @param string $html The html to filter.
206
+		 * @param array $cf The custom field array.
207
+		 * @since 1.6.6
208
+		 */
209
+		$html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
+	}
211 211
 
212
-    // If no html then we run the standard output.
213
-    if(empty($html)) {
212
+	// If no html then we run the standard output.
213
+	if(empty($html)) {
214 214
 
215
-        ob_start(); // Start  buffering;
216
-        $value = geodir_get_cf_value($cf);
215
+		ob_start(); // Start  buffering;
216
+		$value = geodir_get_cf_value($cf);
217 217
 
218
-        if ($value == $cf['default']) {
219
-            $value = '';
220
-        }?>
218
+		if ($value == $cf['default']) {
219
+			$value = '';
220
+		}?>
221 221
 
222 222
         <div id="<?php echo $cf['name'];?>_row"
223 223
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
226
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227 227
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
228 228
             </label>
229 229
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
         </div>
236 236
 
237 237
         <?php
238
-        $html = ob_get_clean();
239
-    }
238
+		$html = ob_get_clean();
239
+	}
240 240
 
241
-    return $html;
241
+	return $html;
242 242
 }
243 243
 add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
244 244
 
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
  */
256 256
 function geodir_cfi_url($html,$cf){
257 257
 
258
-    $html_var = $cf['htmlvar_name'];
258
+	$html_var = $cf['htmlvar_name'];
259 259
 
260
-    // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
-        /**
263
-         * Filter the url html by individual custom field.
264
-         *
265
-         * @param string $html The html to filter.
266
-         * @param array $cf The custom field array.
267
-         * @since 1.6.6
268
-         */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
-    }
260
+	// Check if there is a custom field specific filter.
261
+	if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
+		/**
263
+		 * Filter the url html by individual custom field.
264
+		 *
265
+		 * @param string $html The html to filter.
266
+		 * @param array $cf The custom field array.
267
+		 * @since 1.6.6
268
+		 */
269
+		$html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
+	}
271 271
 
272
-    // If no html then we run the standard output.
273
-    if(empty($html)) {
272
+	// If no html then we run the standard output.
273
+	if(empty($html)) {
274 274
 
275
-        ob_start(); // Start  buffering;
276
-        $value = geodir_get_cf_value($cf);
275
+		ob_start(); // Start  buffering;
276
+		$value = geodir_get_cf_value($cf);
277 277
 
278
-        if ($value == $cf['default']) {
279
-            $value = '';
280
-        }?>
278
+		if ($value == $cf['default']) {
279
+			$value = '';
280
+		}?>
281 281
 
282 282
         <div id="<?php echo $cf['name'];?>_row"
283 283
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
286
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287 287
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
288 288
             </label>
289 289
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
         </div>
299 299
 
300 300
         <?php
301
-        $html = ob_get_clean();
302
-    }
301
+		$html = ob_get_clean();
302
+	}
303 303
 
304
-    return $html;
304
+	return $html;
305 305
 }
306 306
 add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
307 307
 
@@ -317,48 +317,48 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function geodir_cfi_radio($html,$cf){
319 319
 
320
-    $html_var = $cf['htmlvar_name'];
320
+	$html_var = $cf['htmlvar_name'];
321 321
 
322
-    // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
-        /**
325
-         * Filter the radio html by individual custom field.
326
-         *
327
-         * @param string $html The html to filter.
328
-         * @param array $cf The custom field array.
329
-         * @since 1.6.6
330
-         */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
-    }
322
+	// Check if there is a custom field specific filter.
323
+	if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
+		/**
325
+		 * Filter the radio html by individual custom field.
326
+		 *
327
+		 * @param string $html The html to filter.
328
+		 * @param array $cf The custom field array.
329
+		 * @since 1.6.6
330
+		 */
331
+		$html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
+	}
333 333
 
334
-    // If no html then we run the standard output.
335
-    if(empty($html)) {
334
+	// If no html then we run the standard output.
335
+	if(empty($html)) {
336 336
 
337
-        ob_start(); // Start  buffering;
338
-        $value = geodir_get_cf_value($cf);
337
+		ob_start(); // Start  buffering;
338
+		$value = geodir_get_cf_value($cf);
339 339
 
340
-        ?>
340
+		?>
341 341
         <div id="<?php echo $cf['name'];?>_row"
342 342
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
345
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346 346
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349
-                $option_values = geodir_string_values_to_options($cf['option_values'], true);
349
+				$option_values = geodir_string_values_to_options($cf['option_values'], true);
350 350
 
351
-                if (!empty($option_values)) {
352
-                    foreach ($option_values as $option_value) {
353
-                        if (empty($option_value['optgroup'])) {
354
-                            ?>
351
+				if (!empty($option_values)) {
352
+					foreach ($option_values as $option_value) {
353
+						if (empty($option_value['optgroup'])) {
354
+							?>
355 355
                             <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked(stripslashes($value), $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357
-                        }
358
-                    }
359
-                }
360
-            }
361
-            ?>
357
+						}
358
+					}
359
+				}
360
+			}
361
+			?>
362 362
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
         </div>
367 367
 
368 368
         <?php
369
-        $html = ob_get_clean();
370
-    }
369
+		$html = ob_get_clean();
370
+	}
371 371
 
372
-    return $html;
372
+	return $html;
373 373
 }
374 374
 add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
375 375
 
@@ -385,46 +385,46 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_cfi_checkbox($html,$cf){
387 387
 
388
-    $html_var = $cf['htmlvar_name'];
388
+	$html_var = $cf['htmlvar_name'];
389 389
 
390
-    // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
-        /**
393
-         * Filter the checkbox html by individual custom field.
394
-         *
395
-         * @param string $html The html to filter.
396
-         * @param array $cf The custom field array.
397
-         * @since 1.6.6
398
-         */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
-    }
390
+	// Check if there is a custom field specific filter.
391
+	if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
+		/**
393
+		 * Filter the checkbox html by individual custom field.
394
+		 *
395
+		 * @param string $html The html to filter.
396
+		 * @param array $cf The custom field array.
397
+		 * @since 1.6.6
398
+		 */
399
+		$html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
+	}
401 401
 
402
-    // If no html then we run the standard output.
403
-    if(empty($html)) {
402
+	// If no html then we run the standard output.
403
+	if(empty($html)) {
404 404
 
405
-        ob_start(); // Start  buffering;
406
-        $value = geodir_get_cf_value($cf);
405
+		ob_start(); // Start  buffering;
406
+		$value = geodir_get_cf_value($cf);
407 407
 
408 408
 
409
-        if ($value == '' && $cf['default']) {
410
-            $value = '1';
411
-        }
412
-        ?>
409
+		if ($value == '' && $cf['default']) {
410
+			$value = '1';
411
+		}
412
+		?>
413 413
 
414 414
         <div id="<?php echo $cf['name'];?>_row"
415 415
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
416 416
             <label>
417 417
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
418
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419 419
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
420 420
             </label>
421 421
             <?php if ($value != '1') {
422
-                $value = '0';
423
-            }?>
422
+				$value = '0';
423
+			}?>
424 424
             <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
425 425
             <input  <?php if ($value == '1') {
426
-                echo 'checked="checked"';
427
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426
+				echo 'checked="checked"';
427
+			}?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
428 428
                  onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
429 429
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
430 430
             <?php if ($cf['is_required']) { ?>
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
         </div>
434 434
 
435 435
         <?php
436
-        $html = ob_get_clean();
437
-    }
436
+		$html = ob_get_clean();
437
+	}
438 438
 
439
-    return $html;
439
+	return $html;
440 440
 }
441 441
 add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
442 442
 
@@ -452,52 +452,52 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_cfi_textarea($html,$cf){
454 454
 
455
-    $html_var = $cf['htmlvar_name'];
455
+	$html_var = $cf['htmlvar_name'];
456 456
 
457
-    // Check if there is a custom field specific filter.
458
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
459
-        /**
460
-         * Filter the textarea html by individual custom field.
461
-         *
462
-         * @param string $html The html to filter.
463
-         * @param array $cf The custom field array.
464
-         * @since 1.6.6
465
-         */
466
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
467
-    }
457
+	// Check if there is a custom field specific filter.
458
+	if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
459
+		/**
460
+		 * Filter the textarea html by individual custom field.
461
+		 *
462
+		 * @param string $html The html to filter.
463
+		 * @param array $cf The custom field array.
464
+		 * @since 1.6.6
465
+		 */
466
+		$html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
467
+	}
468 468
 
469
-    // If no html then we run the standard output.
470
-    if(empty($html)) {
469
+	// If no html then we run the standard output.
470
+	if(empty($html)) {
471 471
 
472
-        ob_start(); // Start  buffering;
473
-        $value = geodir_get_cf_value($cf);
472
+		ob_start(); // Start  buffering;
473
+		$value = geodir_get_cf_value($cf);
474 474
 
475
-        $extra_fields = unserialize($cf['extra_fields']);
476
-        ?>
475
+		$extra_fields = unserialize($cf['extra_fields']);
476
+		?>
477 477
 
478 478
         <div id="<?php echo $cf['name'];?>_row"
479 479
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
480 480
             <label>
481 481
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
482
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483 483
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
484 484
             </label><?php
485 485
 
486 486
 
487
-            if (is_array($extra_fields) && in_array('1', $extra_fields)) {
487
+			if (is_array($extra_fields) && in_array('1', $extra_fields)) {
488 488
 
489
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
489
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
490 490
 
491 491
             <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
492 492
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
493 493
                 </div><?php
494 494
 
495
-            } else {
495
+			} else {
496 496
 
497
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
497
+				?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
498 498
                             id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
499 499
 
500
-            }?>
500
+			}?>
501 501
 
502 502
 
503 503
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
         </div>
508 508
 
509 509
         <?php
510
-        $html = ob_get_clean();
511
-    }
510
+		$html = ob_get_clean();
511
+	}
512 512
 
513
-    return $html;
513
+	return $html;
514 514
 }
515 515
 add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
516 516
 
@@ -526,53 +526,53 @@  discard block
 block discarded – undo
526 526
  */
527 527
 function geodir_cfi_select($html,$cf){
528 528
 
529
-    $html_var = $cf['htmlvar_name'];
529
+	$html_var = $cf['htmlvar_name'];
530 530
 
531
-    // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
533
-        /**
534
-         * Filter the select html by individual custom field.
535
-         *
536
-         * @param string $html The html to filter.
537
-         * @param array $cf The custom field array.
538
-         * @since 1.6.6
539
-         */
540
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
541
-    }
531
+	// Check if there is a custom field specific filter.
532
+	if(has_filter("geodir_custom_field_input_select_{$html_var}")){
533
+		/**
534
+		 * Filter the select html by individual custom field.
535
+		 *
536
+		 * @param string $html The html to filter.
537
+		 * @param array $cf The custom field array.
538
+		 * @since 1.6.6
539
+		 */
540
+		$html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
541
+	}
542 542
 
543
-    // If no html then we run the standard output.
544
-    if(empty($html)) {
543
+	// If no html then we run the standard output.
544
+	if(empty($html)) {
545 545
 
546
-        ob_start(); // Start  buffering;
547
-        $value = geodir_get_cf_value($cf);
546
+		ob_start(); // Start  buffering;
547
+		$value = geodir_get_cf_value($cf);
548 548
 
549
-        ?>
549
+		?>
550 550
         <div id="<?php echo $cf['name'];?>_row"
551 551
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 552
             <label>
553 553
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
554
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555 555
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
556 556
             </label>
557 557
             <?php
558
-            $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
559
-            $select_options = '';
560
-            if (!empty($option_values_arr)) {
561
-                foreach ($option_values_arr as $option_row) {
562
-                    if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
564
-
565
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
566
-                    } else {
567
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
568
-                        $option_value = isset($option_row['value']) ? $option_row['value'] : '';
569
-                        $selected = $option_value == stripslashes($value) ? 'selected="selected"' : '';
570
-
571
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
572
-                    }
573
-                }
574
-            }
575
-            ?>
558
+			$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
559
+			$select_options = '';
560
+			if (!empty($option_values_arr)) {
561
+				foreach ($option_values_arr as $option_row) {
562
+					if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
564
+
565
+						$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
566
+					} else {
567
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
568
+						$option_value = isset($option_row['value']) ? $option_row['value'] : '';
569
+						$selected = $option_value == stripslashes($value) ? 'selected="selected"' : '';
570
+
571
+						$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
572
+					}
573
+				}
574
+			}
575
+			?>
576 576
             <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
577 577
                     class="geodir_textfield textfield_x chosen_select"
578 578
                     data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
         </div>
585 585
 
586 586
         <?php
587
-        $html = ob_get_clean();
588
-    }
587
+		$html = ob_get_clean();
588
+	}
589 589
 
590
-    return $html;
590
+	return $html;
591 591
 }
592 592
 add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
593 593
 
@@ -603,36 +603,36 @@  discard block
 block discarded – undo
603 603
  */
604 604
 function geodir_cfi_multiselect($html,$cf){
605 605
 
606
-    $html_var = $cf['htmlvar_name'];
607
-
608
-    // Check if there is a custom field specific filter.
609
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
610
-        /**
611
-         * Filter the multiselect html by individual custom field.
612
-         *
613
-         * @param string $html The html to filter.
614
-         * @param array $cf The custom field array.
615
-         * @since 1.6.6
616
-         */
617
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
618
-    }
619
-
620
-    // If no html then we run the standard output.
621
-    if(empty($html)) {
622
-
623
-        ob_start(); // Start  buffering;
624
-        $value = geodir_get_cf_value($cf);
625
-
626
-        $multi_display = 'select';
627
-        if (!empty($cf['extra_fields'])) {
628
-            $multi_display = unserialize($cf['extra_fields']);
629
-        }
630
-        ?>
606
+	$html_var = $cf['htmlvar_name'];
607
+
608
+	// Check if there is a custom field specific filter.
609
+	if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
610
+		/**
611
+		 * Filter the multiselect html by individual custom field.
612
+		 *
613
+		 * @param string $html The html to filter.
614
+		 * @param array $cf The custom field array.
615
+		 * @since 1.6.6
616
+		 */
617
+		$html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
618
+	}
619
+
620
+	// If no html then we run the standard output.
621
+	if(empty($html)) {
622
+
623
+		ob_start(); // Start  buffering;
624
+		$value = geodir_get_cf_value($cf);
625
+
626
+		$multi_display = 'select';
627
+		if (!empty($cf['extra_fields'])) {
628
+			$multi_display = unserialize($cf['extra_fields']);
629
+		}
630
+		?>
631 631
         <div id="<?php echo $cf['name']; ?>_row"
632 632
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
633 633
             <label>
634 634
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
635
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
635
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
636 636
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
637 637
             </label>
638 638
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
@@ -643,63 +643,63 @@  discard block
 block discarded – undo
643 643
                         data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
644 644
                         option-ajaxchosen="false">
645 645
                     <?php
646
-                    } else {
647
-                        echo '<ul class="gd_multi_choice">';
648
-                    }
649
-
650
-                    $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
651
-                    $select_options = '';
652
-                    if (!empty($option_values_arr)) {
653
-                        foreach ($option_values_arr as $option_row) {
654
-                            if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
655
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
656
-
657
-                                if ($multi_display == 'select') {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
659
-                                } else {
660
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
661
-                                }
662
-                            } else {
663
-                                if (!is_array($value) && $value != '') {
664
-                                    $value = trim($value);
665
-                                }
646
+					} else {
647
+						echo '<ul class="gd_multi_choice">';
648
+					}
649
+
650
+					$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
651
+					$select_options = '';
652
+					if (!empty($option_values_arr)) {
653
+						foreach ($option_values_arr as $option_row) {
654
+							if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
655
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
656
+
657
+								if ($multi_display == 'select') {
658
+									$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
659
+								} else {
660
+									$select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
661
+								}
662
+							} else {
663
+								if (!is_array($value) && $value != '') {
664
+									$value = trim($value);
665
+								}
666 666
                                 
667
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
668
-                                $option_value = isset($option_row['value']) ? $option_row['value'] : '';
669
-                                $selected = $option_value == $value ? 'selected="selected"' : '';
670
-                                $selected = '';
671
-                                $checked = '';
672
-
673
-                                if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
674
-                                    if (!is_array($value)) {
675
-                                        $value_array = explode(',', $value);
676
-                                    } else {
677
-                                        $value_array = $value;
678
-                                    }
667
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
668
+								$option_value = isset($option_row['value']) ? $option_row['value'] : '';
669
+								$selected = $option_value == $value ? 'selected="selected"' : '';
670
+								$selected = '';
671
+								$checked = '';
672
+
673
+								if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
674
+									if (!is_array($value)) {
675
+										$value_array = explode(',', $value);
676
+									} else {
677
+										$value_array = $value;
678
+									}
679 679
                                     
680
-                                    $value_array = stripslashes_deep($value_array);
680
+									$value_array = stripslashes_deep($value_array);
681 681
 
682
-                                    if (is_array($value_array)) {
683
-                                        $value_array = array_map('trim', $value_array);
682
+									if (is_array($value_array)) {
683
+										$value_array = array_map('trim', $value_array);
684 684
                                         
685
-                                        if (in_array($option_value, $value_array)) {
686
-                                            $selected = 'selected="selected"';
687
-                                            $checked = 'checked="checked"';
688
-                                        }
689
-                                    }
690
-                                }
691
-
692
-                                if ($multi_display == 'select') {
693
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
694
-                                } else {
695
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
696
-                                }
697
-                            }
698
-                        }
699
-                    }
700
-                    echo $select_options;
701
-
702
-                    if ($multi_display == 'select') { ?></select></div>
685
+										if (in_array($option_value, $value_array)) {
686
+											$selected = 'selected="selected"';
687
+											$checked = 'checked="checked"';
688
+										}
689
+									}
690
+								}
691
+
692
+								if ($multi_display == 'select') {
693
+									$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
694
+								} else {
695
+									$select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
696
+								}
697
+							}
698
+						}
699
+					}
700
+					echo $select_options;
701
+
702
+					if ($multi_display == 'select') { ?></select></div>
703 703
         <?php } else { ?></ul><?php } ?>
704 704
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
705 705
             <?php if ($cf['is_required']) { ?>
@@ -707,10 +707,10 @@  discard block
 block discarded – undo
707 707
             <?php } ?>
708 708
         </div>
709 709
         <?php
710
-        $html = ob_get_clean();
711
-    }
710
+		$html = ob_get_clean();
711
+	}
712 712
 
713
-    return $html;
713
+	return $html;
714 714
 }
715 715
 add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
716 716
 
@@ -726,32 +726,32 @@  discard block
 block discarded – undo
726 726
  */
727 727
 function geodir_cfi_html($html,$cf){
728 728
 
729
-    $html_var = $cf['htmlvar_name'];
729
+	$html_var = $cf['htmlvar_name'];
730 730
 
731
-    // Check if there is a custom field specific filter.
732
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
733
-        /**
734
-         * Filter the html html by individual custom field.
735
-         *
736
-         * @param string $html The html to filter.
737
-         * @param array $cf The custom field array.
738
-         * @since 1.6.6
739
-         */
740
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
741
-    }
731
+	// Check if there is a custom field specific filter.
732
+	if(has_filter("geodir_custom_field_input_html_{$html_var}")){
733
+		/**
734
+		 * Filter the html html by individual custom field.
735
+		 *
736
+		 * @param string $html The html to filter.
737
+		 * @param array $cf The custom field array.
738
+		 * @since 1.6.6
739
+		 */
740
+		$html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
741
+	}
742 742
 
743
-    // If no html then we run the standard output.
744
-    if(empty($html)) {
743
+	// If no html then we run the standard output.
744
+	if(empty($html)) {
745 745
 
746
-        ob_start(); // Start  buffering;
747
-        $value = geodir_get_cf_value($cf);
748
-        ?>
746
+		ob_start(); // Start  buffering;
747
+		$value = geodir_get_cf_value($cf);
748
+		?>
749 749
 
750 750
         <div id="<?php echo $cf['name']; ?>_row"
751 751
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
752 752
             <label>
753 753
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
754
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
754
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
755 755
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
756 756
             </label>
757 757
 
@@ -769,10 +769,10 @@  discard block
 block discarded – undo
769 769
         </div>
770 770
 
771 771
         <?php
772
-        $html = ob_get_clean();
773
-    }
772
+		$html = ob_get_clean();
773
+	}
774 774
 
775
-    return $html;
775
+	return $html;
776 776
 }
777 777
 add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
778 778
 
@@ -789,68 +789,68 @@  discard block
 block discarded – undo
789 789
  */
790 790
 function geodir_cfi_datepicker($html,$cf){
791 791
 
792
-    $html_var = $cf['htmlvar_name'];
792
+	$html_var = $cf['htmlvar_name'];
793 793
 
794
-    // Check if there is a custom field specific filter.
795
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
796
-        /**
797
-         * Filter the datepicker html by individual custom field.
798
-         *
799
-         * @param string $html The html to filter.
800
-         * @param array $cf The custom field array.
801
-         * @since 1.6.6
802
-         */
803
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
804
-    }
794
+	// Check if there is a custom field specific filter.
795
+	if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
796
+		/**
797
+		 * Filter the datepicker html by individual custom field.
798
+		 *
799
+		 * @param string $html The html to filter.
800
+		 * @param array $cf The custom field array.
801
+		 * @since 1.6.6
802
+		 */
803
+		$html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
804
+	}
805 805
 
806
-    // If no html then we run the standard output.
807
-    if(empty($html)) {
806
+	// If no html then we run the standard output.
807
+	if(empty($html)) {
808 808
 
809
-        ob_start(); // Start  buffering;
810
-        $value = geodir_get_cf_value($cf);
809
+		ob_start(); // Start  buffering;
810
+		$value = geodir_get_cf_value($cf);
811 811
 
812
-        $extra_fields = unserialize($cf['extra_fields']);
813
-        $name = $cf['name'];
812
+		$extra_fields = unserialize($cf['extra_fields']);
813
+		$name = $cf['name'];
814 814
 
815
-        if ($extra_fields['date_format'] == '')
816
-            $extra_fields['date_format'] = 'yy-mm-dd';
815
+		if ($extra_fields['date_format'] == '')
816
+			$extra_fields['date_format'] = 'yy-mm-dd';
817 817
 
818
-        $date_format = $extra_fields['date_format'];
819
-        $jquery_date_format  = $date_format;
818
+		$date_format = $extra_fields['date_format'];
819
+		$jquery_date_format  = $date_format;
820 820
 
821 821
 
822
-        // check if we need to change the format or not
823
-        $date_format_len = strlen(str_replace(' ', '', $date_format));
824
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
822
+		// check if we need to change the format or not
823
+		$date_format_len = strlen(str_replace(' ', '', $date_format));
824
+		if($date_format_len>5){// if greater then 5 then it's the old style format.
825 825
 
826
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
827
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
826
+			$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
827
+			$replace = array('d','j','l','m','n','F','Y');//PHP date format
828 828
 
829
-            $date_format = str_replace($search, $replace, $date_format);
830
-        }else{
831
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
832
-        }
829
+			$date_format = str_replace($search, $replace, $date_format);
830
+		}else{
831
+			$jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
832
+		}
833 833
 
834
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
835
-        if($value && !isset($_REQUEST['backandedit'])) {
836
-            //$time = strtotime($value);
837
-            //$value = date_i18n($date_format, $time);
838
-        }
839
-        $value = geodir_date($value, 'Y-m-d', $date_format);
834
+		if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
835
+		if($value && !isset($_REQUEST['backandedit'])) {
836
+			//$time = strtotime($value);
837
+			//$value = date_i18n($date_format, $time);
838
+		}
839
+		$value = geodir_date($value, 'Y-m-d', $date_format);
840 840
 
841
-        ?>
841
+		?>
842 842
         <script type="text/javascript">
843 843
 
844 844
             jQuery(function () {
845 845
 
846 846
                 jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
847
-                    /**
848
-                     * Used to add extra option to datepicker per custom field.
849
-                     *
850
-                     * @since 1.5.7
851
-                     * @param string $name The custom field name.
852
-                     */
853
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
847
+					/**
848
+					 * Used to add extra option to datepicker per custom field.
849
+					 *
850
+					 * @since 1.5.7
851
+					 * @param string $name The custom field name.
852
+					 */
853
+					echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
854 854
 
855 855
                 jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
856 856
 
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
             <label>
867 867
 
868 868
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
869
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
869
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
870 870
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
871 871
             </label>
872 872
 
@@ -880,10 +880,10 @@  discard block
 block discarded – undo
880 880
         </div>
881 881
 
882 882
         <?php
883
-        $html = ob_get_clean();
884
-    }
883
+		$html = ob_get_clean();
884
+	}
885 885
 
886
-    return $html;
886
+	return $html;
887 887
 }
888 888
 add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
889 889
 
@@ -899,31 +899,31 @@  discard block
 block discarded – undo
899 899
  */
900 900
 function geodir_cfi_time($html,$cf){
901 901
 
902
-    $html_var = $cf['htmlvar_name'];
902
+	$html_var = $cf['htmlvar_name'];
903 903
 
904
-    // Check if there is a custom field specific filter.
905
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
906
-        /**
907
-         * Filter the time html by individual custom field.
908
-         *
909
-         * @param string $html The html to filter.
910
-         * @param array $cf The custom field array.
911
-         * @since 1.6.6
912
-         */
913
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
914
-    }
904
+	// Check if there is a custom field specific filter.
905
+	if(has_filter("geodir_custom_field_input_time_{$html_var}")){
906
+		/**
907
+		 * Filter the time html by individual custom field.
908
+		 *
909
+		 * @param string $html The html to filter.
910
+		 * @param array $cf The custom field array.
911
+		 * @since 1.6.6
912
+		 */
913
+		$html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
914
+	}
915 915
 
916
-    // If no html then we run the standard output.
917
-    if(empty($html)) {
916
+	// If no html then we run the standard output.
917
+	if(empty($html)) {
918 918
 
919
-        ob_start(); // Start  buffering;
920
-        $value = geodir_get_cf_value($cf);
919
+		ob_start(); // Start  buffering;
920
+		$value = geodir_get_cf_value($cf);
921 921
 
922
-        $name = $cf['name'];
922
+		$name = $cf['name'];
923 923
 
924
-        if ($value != '')
925
-            $value = date('H:i', strtotime($value));
926
-        ?>
924
+		if ($value != '')
925
+			$value = date('H:i', strtotime($value));
926
+		?>
927 927
         <script type="text/javascript">
928 928
             jQuery(document).ready(function () {
929 929
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
             <label>
940 940
 
941 941
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
942
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
942
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
943 943
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
944 944
             </label>
945 945
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
@@ -951,10 +951,10 @@  discard block
 block discarded – undo
951 951
             <?php } ?>
952 952
         </div>
953 953
         <?php
954
-        $html = ob_get_clean();
955
-    }
954
+		$html = ob_get_clean();
955
+	}
956 956
 
957
-    return $html;
957
+	return $html;
958 958
 }
959 959
 add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
960 960
 
@@ -970,102 +970,102 @@  discard block
 block discarded – undo
970 970
  */
971 971
 function geodir_cfi_address($html,$cf){
972 972
 
973
-    $html_var = $cf['htmlvar_name'];
974
-
975
-    // Check if there is a custom field specific filter.
976
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
977
-        /**
978
-         * Filter the address html by individual custom field.
979
-         *
980
-         * @param string $html The html to filter.
981
-         * @param array $cf The custom field array.
982
-         * @since 1.6.6
983
-         */
984
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
985
-    }
986
-
987
-    // If no html then we run the standard output.
988
-    if(empty($html)) {
989
-
990
-        global $gd_session;
991
-        ob_start(); // Start  buffering;
992
-        $value = geodir_get_cf_value($cf);
993
-        $name = $cf['name'];
994
-        $type = $cf['type'];
995
-        $admin_desc = $cf['desc'];
996
-        $is_required = $cf['is_required'];
997
-        $required_msg = $cf['required_msg'];
998
-        $site_title = $cf['site_title'];
999
-        $is_admin = $cf['is_admin'];
1000
-        $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1001
-        $prefix = $name . '_';
1002
-
1003
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1004
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1005
-        ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1006
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1007
-
1008
-        $address = '';
1009
-        $zip = '';
1010
-        $mapview = '';
1011
-        $mapzoom = '';
1012
-        $lat = '';
1013
-        $lng = '';
1014
-
1015
-        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1016
-            $post = $gd_ses_listing;
1017
-            $address = $post[$prefix . 'address'];
1018
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1019
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1020
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1021
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1022
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1023
-        } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1024
-            $post_info = (array)$post_info;
1025
-
1026
-            $address = $post_info[$prefix . 'address'];
1027
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1028
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1029
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1030
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1031
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1032
-        }
1033
-
1034
-        $location = geodir_get_default_location();
1035
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1036
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1037
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1038
-
1039
-        $lat_lng_blank = false;
1040
-        if (empty($lat) && empty($lng)) {
1041
-            $lat_lng_blank = true;
1042
-        }
1043
-
1044
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1045
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1046
-
1047
-        /**
1048
-         * Filter the default latitude.
1049
-         *
1050
-         * @since 1.0.0
1051
-         *
1052
-         * @param float $lat Default latitude.
1053
-         * @param bool $is_admin For admin use only?.
1054
-         */
1055
-        $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1056
-        /**
1057
-         * Filter the default longitude.
1058
-         *
1059
-         * @since 1.0.0
1060
-         *
1061
-         * @param float $lat Default longitude.
1062
-         * @param bool $is_admin For admin use only?.
1063
-         */
1064
-        $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1065
-
1066
-        $locate_me = !empty($extra_fields['show_map']) && geodir_map_name() != 'none' ? true : false;
1067
-        $locate_me_class = $locate_me ? ' gd-form-control' : '';
1068
-        ?>
973
+	$html_var = $cf['htmlvar_name'];
974
+
975
+	// Check if there is a custom field specific filter.
976
+	if(has_filter("geodir_custom_field_input_address_{$html_var}")){
977
+		/**
978
+		 * Filter the address html by individual custom field.
979
+		 *
980
+		 * @param string $html The html to filter.
981
+		 * @param array $cf The custom field array.
982
+		 * @since 1.6.6
983
+		 */
984
+		$html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
985
+	}
986
+
987
+	// If no html then we run the standard output.
988
+	if(empty($html)) {
989
+
990
+		global $gd_session;
991
+		ob_start(); // Start  buffering;
992
+		$value = geodir_get_cf_value($cf);
993
+		$name = $cf['name'];
994
+		$type = $cf['type'];
995
+		$admin_desc = $cf['desc'];
996
+		$is_required = $cf['is_required'];
997
+		$required_msg = $cf['required_msg'];
998
+		$site_title = $cf['site_title'];
999
+		$is_admin = $cf['is_admin'];
1000
+		$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1001
+		$prefix = $name . '_';
1002
+
1003
+		($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1004
+		($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1005
+		($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1006
+		($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1007
+
1008
+		$address = '';
1009
+		$zip = '';
1010
+		$mapview = '';
1011
+		$mapzoom = '';
1012
+		$lat = '';
1013
+		$lng = '';
1014
+
1015
+		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1016
+			$post = $gd_ses_listing;
1017
+			$address = $post[$prefix . 'address'];
1018
+			$zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1019
+			$lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1020
+			$lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1021
+			$mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1022
+			$mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1023
+		} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1024
+			$post_info = (array)$post_info;
1025
+
1026
+			$address = $post_info[$prefix . 'address'];
1027
+			$zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1028
+			$lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1029
+			$lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1030
+			$mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1031
+			$mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1032
+		}
1033
+
1034
+		$location = geodir_get_default_location();
1035
+		if (empty($city)) $city = isset($location->city) ? $location->city : '';
1036
+		if (empty($region)) $region = isset($location->region) ? $location->region : '';
1037
+		if (empty($country)) $country = isset($location->country) ? $location->country : '';
1038
+
1039
+		$lat_lng_blank = false;
1040
+		if (empty($lat) && empty($lng)) {
1041
+			$lat_lng_blank = true;
1042
+		}
1043
+
1044
+		if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1045
+		if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1046
+
1047
+		/**
1048
+		 * Filter the default latitude.
1049
+		 *
1050
+		 * @since 1.0.0
1051
+		 *
1052
+		 * @param float $lat Default latitude.
1053
+		 * @param bool $is_admin For admin use only?.
1054
+		 */
1055
+		$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1056
+		/**
1057
+		 * Filter the default longitude.
1058
+		 *
1059
+		 * @since 1.0.0
1060
+		 *
1061
+		 * @param float $lat Default longitude.
1062
+		 * @param bool $is_admin For admin use only?.
1063
+		 */
1064
+		$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1065
+
1066
+		$locate_me = !empty($extra_fields['show_map']) && geodir_map_name() != 'none' ? true : false;
1067
+		$locate_me_class = $locate_me ? ' gd-form-control' : '';
1068
+		?>
1069 1069
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1070 1070
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1071 1071
             <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>';?></label>
@@ -1084,17 +1084,17 @@  discard block
 block discarded – undo
1084 1084
         </div>
1085 1085
         
1086 1086
         <?php
1087
-        /**
1088
-         * Called after the address input on the add listings.
1089
-         *
1090
-         * This is used by the location manage to add further locations info etc.
1091
-         *
1092
-         * @since 1.0.0
1093
-         * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1094
-         */
1095
-        do_action('geodir_address_extra_listing_fields', $cf);
1096
-
1097
-        if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1087
+		/**
1088
+		 * Called after the address input on the add listings.
1089
+		 *
1090
+		 * This is used by the location manage to add further locations info etc.
1091
+		 *
1092
+		 * @since 1.0.0
1093
+		 * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1094
+		 */
1095
+		do_action('geodir_address_extra_listing_fields', $cf);
1096
+
1097
+		if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1098 1098
 
1099 1099
             <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1100 1100
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
@@ -1115,22 +1115,22 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
             <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1117 1117
                 <?php
1118
-                /**
1119
-                 * Contains add listing page map functions.
1120
-                 *
1121
-                 * @since 1.0.0
1122
-                 */
1123
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1124
-                if ($lat_lng_blank) {
1125
-                    $lat = '';
1126
-                    $lng = '';
1127
-                }
1128
-                ?>
1118
+				/**
1119
+				 * Contains add listing page map functions.
1120
+				 *
1121
+				 * @since 1.0.0
1122
+				 */
1123
+				include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1124
+				if ($lat_lng_blank) {
1125
+					$lat = '';
1126
+					$lng = '';
1127
+				}
1128
+				?>
1129 1129
                 <span class="geodir_message_note"><?php echo stripslashes(GET_MAP_MSG); ?></span>
1130 1130
             </div>
1131 1131
             <?php
1132
-            /* show lat lng */
1133
-            $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1132
+			/* show lat lng */
1133
+			$style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1134 1134
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1135 1135
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1136 1136
                 <label>
@@ -1171,27 +1171,27 @@  discard block
 block discarded – undo
1171 1171
                                                             class="gd-checkbox"
1172 1172
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1173 1173
                                                             id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1174
-                            echo 'checked="checked"';
1175
-                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1174
+							echo 'checked="checked"';
1175
+						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1176 1176
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1177 1177
                                                              class="gd-checkbox"
1178 1178
                                                              name="<?php echo $prefix . 'mapview'; ?>"
1179 1179
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1180
-                            echo 'checked="checked"';
1181
-                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1180
+							echo 'checked="checked"';
1181
+						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1182 1182
 
1183 1183
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1184 1184
                                                             class="gd-checkbox"
1185 1185
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1186 1186
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1187
-                            echo 'checked="checked"';
1188
-                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1187
+							echo 'checked="checked"';
1188
+						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1189 1189
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1190 1190
                                                             class="gd-checkbox"
1191 1191
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1192 1192
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1193
-                            echo 'checked="checked"';
1194
-                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1193
+							echo 'checked="checked"';
1194
+						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1195 1195
 
1196 1196
 
1197 1197
             </div>
@@ -1199,14 +1199,14 @@  discard block
 block discarded – undo
1199 1199
 
1200 1200
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1201 1201
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1202
-                echo esc_attr($mapzoom);
1203
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1202
+				echo esc_attr($mapzoom);
1203
+			} ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1204 1204
         <?php }
1205 1205
 
1206
-        $html = ob_get_clean();
1207
-    }
1206
+		$html = ob_get_clean();
1207
+	}
1208 1208
 
1209
-    return $html;
1209
+	return $html;
1210 1210
 }
1211 1211
 add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1212 1212
 
@@ -1223,135 +1223,135 @@  discard block
 block discarded – undo
1223 1223
  */
1224 1224
 function geodir_cfi_taxonomy($html,$cf){
1225 1225
 
1226
-    $html_var = $cf['htmlvar_name'];
1227
-
1228
-    // Check if there is a custom field specific filter.
1229
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1230
-        /**
1231
-         * Filter the taxonomy html by individual custom field.
1232
-         *
1233
-         * @param string $html The html to filter.
1234
-         * @param array $cf The custom field array.
1235
-         * @since 1.6.6
1236
-         */
1237
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1238
-    }
1239
-
1240
-    // If no html then we run the standard output.
1241
-    if(empty($html)) {
1242
-
1243
-        ob_start(); // Start  buffering;
1244
-        $value = geodir_get_cf_value($cf);
1245
-
1246
-        $name = $cf['name'];
1247
-        $site_title = $cf['site_title'];
1248
-        $admin_desc = $cf['desc'];
1249
-        $is_required = $cf['is_required'];
1250
-        $is_admin = $cf['is_admin'];
1251
-        $required_msg = $cf['required_msg'];
1252
-
1253
-        if ($value == $cf['default']) {
1254
-            $value = '';
1255
-        } ?>
1226
+	$html_var = $cf['htmlvar_name'];
1227
+
1228
+	// Check if there is a custom field specific filter.
1229
+	if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1230
+		/**
1231
+		 * Filter the taxonomy html by individual custom field.
1232
+		 *
1233
+		 * @param string $html The html to filter.
1234
+		 * @param array $cf The custom field array.
1235
+		 * @since 1.6.6
1236
+		 */
1237
+		$html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1238
+	}
1239
+
1240
+	// If no html then we run the standard output.
1241
+	if(empty($html)) {
1242
+
1243
+		ob_start(); // Start  buffering;
1244
+		$value = geodir_get_cf_value($cf);
1245
+
1246
+		$name = $cf['name'];
1247
+		$site_title = $cf['site_title'];
1248
+		$admin_desc = $cf['desc'];
1249
+		$is_required = $cf['is_required'];
1250
+		$is_admin = $cf['is_admin'];
1251
+		$required_msg = $cf['required_msg'];
1252
+
1253
+		if ($value == $cf['default']) {
1254
+			$value = '';
1255
+		} ?>
1256 1256
         <div id="<?php echo $name;?>_row"
1257 1257
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1258 1258
             <label>
1259 1259
                 <?php $site_title = __($site_title, 'geodirectory');
1260
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1260
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1261 1261
                 <?php if ($is_required) echo '<span>*</span>';?>
1262 1262
             </label>
1263 1263
 
1264 1264
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1265 1265
                 <?php
1266
-                global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1266
+				global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1267 1267
 
1268
-                $exclude_cats = array();
1268
+				$exclude_cats = array();
1269 1269
 
1270
-                if ($is_admin == '1') {
1270
+				if ($is_admin == '1') {
1271 1271
 
1272
-                    $post_type = get_post_type();
1272
+					$post_type = get_post_type();
1273 1273
 
1274
-                    $package_info = array();
1274
+					$package_info = array();
1275 1275
 
1276
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1276
+					$package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1277 1277
 
1278
-                    if (!empty($package_info)) {
1278
+					if (!empty($package_info)) {
1279 1279
 
1280
-                        if (isset($package_info['cat']) && $package_info['cat'] != '') {
1280
+						if (isset($package_info['cat']) && $package_info['cat'] != '') {
1281 1281
 
1282
-                            $exclude_cats = explode(',', $package_info['cat']);
1282
+							$exclude_cats = explode(',', $package_info['cat']);
1283 1283
 
1284
-                        }
1285
-                    }
1286
-                }
1284
+						}
1285
+					}
1286
+				}
1287 1287
 
1288
-                $cat_display = unserialize($cf['extra_fields']);
1288
+				$cat_display = unserialize($cf['extra_fields']);
1289 1289
 
1290
-                if (isset($_REQUEST['backandedit']) && !empty($post_cat[$name]) && is_array($post_cat[$name])) {
1291
-                    $post_cat = implode(",", $post_cat[$name]);
1292
-                } else {
1293
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1294
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1295
-                }
1290
+				if (isset($_REQUEST['backandedit']) && !empty($post_cat[$name]) && is_array($post_cat[$name])) {
1291
+					$post_cat = implode(",", $post_cat[$name]);
1292
+				} else {
1293
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1294
+						$post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1295
+				}
1296 1296
 
1297 1297
 
1298
-                global $geodir_addon_list;
1299
-                if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1298
+				global $geodir_addon_list;
1299
+				if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1300 1300
 
1301
-                    $catadd_limit = $wpdb->get_var(
1302
-                        $wpdb->prepare(
1303
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1304
-                            array($package_id)
1305
-                        )
1306
-                    );
1301
+					$catadd_limit = $wpdb->get_var(
1302
+						$wpdb->prepare(
1303
+							"SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1304
+							array($package_id)
1305
+						)
1306
+					);
1307 1307
 
1308 1308
 
1309
-                } else {
1310
-                    $catadd_limit = 0;
1311
-                }
1309
+				} else {
1310
+					$catadd_limit = 0;
1311
+				}
1312 1312
 
1313 1313
 
1314
-                if ($cat_display != '' && $cat_display != 'ajax_chained') {
1314
+				if ($cat_display != '' && $cat_display != 'ajax_chained') {
1315 1315
 
1316
-                    $required_limit_msg = '';
1317
-                    if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1316
+					$required_limit_msg = '';
1317
+					if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1318 1318
 
1319
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1319
+						$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1320 1320
 
1321
-                    } else {
1322
-                        $required_limit_msg = $required_msg;
1323
-                    }
1321
+					} else {
1322
+						$required_limit_msg = $required_msg;
1323
+					}
1324 1324
 
1325
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1325
+					echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1326 1326
 
1327 1327
 
1328
-                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1328
+					if ($cat_display == 'select' || $cat_display == 'multiselect') {
1329 1329
 
1330
-                        $cat_display == '';
1331
-                        $multiple = '';
1332
-                        if ($cat_display == 'multiselect')
1333
-                            $multiple = 'multiple="multiple"';
1330
+						$cat_display == '';
1331
+						$multiple = '';
1332
+						if ($cat_display == 'multiselect')
1333
+							$multiple = 'multiple="multiple"';
1334 1334
 
1335
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1335
+						echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1336 1336
 
1337 1337
 
1338
-                        if ($cat_display == 'select')
1339
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1338
+						if ($cat_display == 'select')
1339
+							echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1340 1340
 
1341
-                    }
1341
+					}
1342 1342
 
1343
-                    echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1343
+					echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1344 1344
 
1345
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1346
-                        echo '</select>';
1345
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
1346
+						echo '</select>';
1347 1347
 
1348
-                } else {
1348
+				} else {
1349 1349
 
1350
-                    echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1350
+					echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1351 1351
 
1352
-                }
1352
+				}
1353 1353
 
1354
-                ?>
1354
+				?>
1355 1355
             </div>
1356 1356
 
1357 1357
             <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -1361,10 +1361,10 @@  discard block
 block discarded – undo
1361 1361
         </div>
1362 1362
 
1363 1363
         <?php
1364
-        $html = ob_get_clean();
1365
-    }
1364
+		$html = ob_get_clean();
1365
+	}
1366 1366
 
1367
-    return $html;
1367
+	return $html;
1368 1368
 }
1369 1369
 add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1370 1370
 
@@ -1380,74 +1380,74 @@  discard block
 block discarded – undo
1380 1380
  */
1381 1381
 function geodir_cfi_file($html,$cf){
1382 1382
 
1383
-    $html_var = $cf['htmlvar_name'];
1383
+	$html_var = $cf['htmlvar_name'];
1384 1384
 
1385
-    // Check if there is a custom field specific filter.
1386
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1387
-        /**
1388
-         * Filter the file html by individual custom field.
1389
-         *
1390
-         * @param string $html The html to filter.
1391
-         * @param array $cf The custom field array.
1392
-         * @since 1.6.6
1393
-         */
1394
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1395
-    }
1385
+	// Check if there is a custom field specific filter.
1386
+	if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1387
+		/**
1388
+		 * Filter the file html by individual custom field.
1389
+		 *
1390
+		 * @param string $html The html to filter.
1391
+		 * @param array $cf The custom field array.
1392
+		 * @since 1.6.6
1393
+		 */
1394
+		$html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1395
+	}
1396 1396
 
1397
-    // If no html then we run the standard output.
1398
-    if(empty($html)) {
1397
+	// If no html then we run the standard output.
1398
+	if(empty($html)) {
1399 1399
 
1400
-        ob_start(); // Start  buffering;
1401
-        $value = geodir_get_cf_value($cf);
1400
+		ob_start(); // Start  buffering;
1401
+		$value = geodir_get_cf_value($cf);
1402 1402
 
1403
-        $name = $cf['name'];
1404
-        $site_title = $cf['site_title'];
1405
-        $admin_desc = $cf['desc'];
1406
-        $is_required = $cf['is_required'];
1407
-        $required_msg = $cf['required_msg'];
1408
-        $extra_fields = unserialize($cf['extra_fields']);
1403
+		$name = $cf['name'];
1404
+		$site_title = $cf['site_title'];
1405
+		$admin_desc = $cf['desc'];
1406
+		$is_required = $cf['is_required'];
1407
+		$required_msg = $cf['required_msg'];
1408
+		$extra_fields = unserialize($cf['extra_fields']);
1409 1409
 
1410 1410
 
1411
-        // adjust values here
1412
-        $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1411
+		// adjust values here
1412
+		$file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1413 1413
 
1414
-        if ($value != '') {
1414
+		if ($value != '') {
1415 1415
 
1416
-            $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1416
+			$file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1417 1417
 
1418
-        } else
1419
-            $file_value = '';
1418
+		} else
1419
+			$file_value = '';
1420 1420
 
1421
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1422
-            $file_multiple = true; // allow multiple files upload
1423
-        else
1424
-            $file_multiple = false;
1421
+		if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1422
+			$file_multiple = true; // allow multiple files upload
1423
+		else
1424
+			$file_multiple = false;
1425 1425
 
1426
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1427
-            $file_image_limit = $extra_fields['image_limit'];
1428
-        else
1429
-            $file_image_limit = 1;
1426
+		if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1427
+			$file_image_limit = $extra_fields['image_limit'];
1428
+		else
1429
+			$file_image_limit = 1;
1430 1430
 
1431
-        $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1431
+		$file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1432 1432
 
1433
-        $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1433
+		$file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1434 1434
 
1435
-        if (!empty($file_value)) {
1436
-            $curImages = explode(',', $file_value);
1437
-            if (!empty($curImages))
1438
-                $file_totImg = count($curImages);
1439
-        }
1435
+		if (!empty($file_value)) {
1436
+			$curImages = explode(',', $file_value);
1437
+			if (!empty($curImages))
1438
+				$file_totImg = count($curImages);
1439
+		}
1440 1440
 
1441
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1442
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1441
+		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1442
+		$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1443 1443
 
1444
-        ?>
1444
+		?>
1445 1445
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
1446 1446
 				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
1447 1447
 				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
1448 1448
 				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
1449 1449
 			</h5>   <?php */
1450
-        ?>
1450
+		?>
1451 1451
 
1452 1452
         <div id="<?php echo $name;?>_row"
1453 1453
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1456 1456
                 <label
1457 1457
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1458
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1458
+					echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1459 1459
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1460 1460
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1461 1461
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1467,17 +1467,17 @@  discard block
 block discarded – undo
1467 1467
                 <?php } ?>
1468 1468
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1469 1469
                        value="<?php if (isset($file_totImg)) {
1470
-                           echo esc_attr($file_totImg);
1471
-                       } else {
1472
-                           echo '0';
1473
-                       } ?>"/>
1470
+						   echo esc_attr($file_totImg);
1471
+					   } else {
1472
+						   echo '0';
1473
+					   } ?>"/>
1474 1474
 
1475 1475
                 <div style="float:left; width:55%;">
1476 1476
                     <div
1477 1477
                         class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1478 1478
                         id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">
1479 1479
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1480
-                        ?>
1480
+						?>
1481 1481
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1482 1482
                                value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1483 1483
                                class="geodir_button" style="margin-top:10px;"/>
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
                         style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">
1497 1497
                     </div>
1498 1498
                     <?php /*?><span id="upload-msg" ><?php _e('Please drag &amp; drop the images to rearrange the order');?></span><?php */
1499
-                    ?>
1499
+					?>
1500 1500
 
1501 1501
                     <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>
1502 1502
 
@@ -1510,9 +1510,9 @@  discard block
 block discarded – undo
1510 1510
 
1511 1511
 
1512 1512
         <?php
1513
-        $html = ob_get_clean();
1514
-    }
1513
+		$html = ob_get_clean();
1514
+	}
1515 1515
 
1516
-    return $html;
1516
+	return $html;
1517 1517
 }
1518 1518
 add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1519 1519
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +191 added lines, -68 removed lines patch added patch discarded remove patch
@@ -86,26 +86,31 @@  discard block
 block discarded – undo
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91 90
 
92 91
         //validation
93 92
         if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94 93
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
94
+        } else{$validation='';}
96 95
 
97 96
         // validation message
98 97
         if(isset($cf['validation_msg']) && $cf['validation_msg']){
99 98
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
99
+        } else{$validation_msg='';}
101 100
         ?>
102 101
 
103 102
         <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+             class="<?php if ($cf['is_required']) {
104
+	echo 'required_field';
105
+}
106
+?> geodir_form_row clearfix gd-fieldset-details">
105 107
             <label>
106 108
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 109
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
110
+                <?php if ($cf['is_required']) {
111
+	echo '<span>*</span>';
112
+}
113
+?>
109 114
             </label>
110 115
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111 116
                    value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -160,11 +165,17 @@  discard block
 block discarded – undo
160 165
         }?>
161 166
 
162 167
         <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
168
+             class="<?php if ($cf['is_required']) {
169
+	echo 'required_field';
170
+}
171
+?> geodir_form_row clearfix gd-fieldset-details">
164 172
             <label>
165 173
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 174
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
175
+                <?php if ($cf['is_required']) {
176
+	echo '<span>*</span>';
177
+}
178
+?>
168 179
             </label>
169 180
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
170 181
                    value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -220,11 +231,17 @@  discard block
 block discarded – undo
220 231
         }?>
221 232
 
222 233
         <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
234
+             class="<?php if ($cf['is_required']) {
235
+	echo 'required_field';
236
+}
237
+?> geodir_form_row clearfix gd-fieldset-details">
224 238
             <label>
225 239
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 240
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
241
+                <?php if ($cf['is_required']) {
242
+	echo '<span>*</span>';
243
+}
244
+?>
228 245
             </label>
229 246
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
230 247
                    value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -280,11 +297,17 @@  discard block
 block discarded – undo
280 297
         }?>
281 298
 
282 299
         <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
300
+             class="<?php if ($cf['is_required']) {
301
+	echo 'required_field';
302
+}
303
+?> geodir_form_row clearfix gd-fieldset-details">
284 304
             <label>
285 305
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 306
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
307
+                <?php if ($cf['is_required']) {
308
+	echo '<span>*</span>';
309
+}
310
+?>
288 311
             </label>
289 312
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290 313
                    value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -339,11 +362,17 @@  discard block
 block discarded – undo
339 362
 
340 363
         ?>
341 364
         <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
365
+             class="<?php if ($cf['is_required']) {
366
+	echo 'required_field';
367
+}
368
+?> geodir_form_row clearfix gd-fieldset-details">
343 369
             <label>
344 370
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 371
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
372
+                <?php if ($cf['is_required']) {
373
+	echo '<span>*</span>';
374
+}
375
+?>
347 376
             </label>
348 377
             <?php if ($cf['option_values']) {
349 378
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -412,11 +441,17 @@  discard block
 block discarded – undo
412 441
         ?>
413 442
 
414 443
         <div id="<?php echo $cf['name'];?>_row"
415
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
444
+             class="<?php if ($cf['is_required']) {
445
+	echo 'required_field';
446
+}
447
+?> geodir_form_row clearfix gd-fieldset-details">
416 448
             <label>
417 449
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418 450
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
451
+                <?php if ($cf['is_required']) {
452
+	echo '<span>*</span>';
453
+}
454
+?>
420 455
             </label>
421 456
             <?php if ($value != '1') {
422 457
                 $value = '0';
@@ -476,11 +511,17 @@  discard block
 block discarded – undo
476 511
         ?>
477 512
 
478 513
         <div id="<?php echo $cf['name'];?>_row"
479
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
514
+             class="<?php if ($cf['is_required']) {
515
+	echo 'required_field';
516
+}
517
+?> geodir_form_row clearfix gd-fieldset-details">
480 518
             <label>
481 519
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482 520
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
521
+                <?php if ($cf['is_required']) {
522
+	echo '<span>*</span>';
523
+}
524
+?>
484 525
             </label><?php
485 526
 
486 527
 
@@ -548,11 +589,17 @@  discard block
 block discarded – undo
548 589
 
549 590
         ?>
550 591
         <div id="<?php echo $cf['name'];?>_row"
551
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
592
+             class="<?php if ($cf['is_required']) {
593
+	echo 'required_field';
594
+}
595
+?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 596
             <label>
553 597
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554 598
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
599
+                <?php if ($cf['is_required']) {
600
+	echo '<span>*</span>';
601
+}
602
+?>
556 603
             </label>
557 604
             <?php
558 605
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -629,11 +676,17 @@  discard block
 block discarded – undo
629 676
         }
630 677
         ?>
631 678
         <div id="<?php echo $cf['name']; ?>_row"
632
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
679
+             class="<?php if ($cf['is_required']) {
680
+	echo 'required_field';
681
+}
682
+?> geodir_form_row clearfix gd-fieldset-details">
633 683
             <label>
634 684
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
635 685
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
636
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
686
+                <?php if ($cf['is_required']) {
687
+	echo '<span>*</span>';
688
+}
689
+?>
637 690
             </label>
638 691
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
639 692
             <?php if ($multi_display == 'select') { ?>
@@ -748,11 +801,17 @@  discard block
 block discarded – undo
748 801
         ?>
749 802
 
750 803
         <div id="<?php echo $cf['name']; ?>_row"
751
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
804
+             class="<?php if ($cf['is_required']) {
805
+	echo 'required_field';
806
+}
807
+?> geodir_form_row clearfix gd-fieldset-details">
752 808
             <label>
753 809
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
754 810
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
755
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
811
+                <?php if ($cf['is_required']) {
812
+	echo '<span>*</span>';
813
+}
814
+?>
756 815
             </label>
757 816
 
758 817
             <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -812,8 +871,9 @@  discard block
 block discarded – undo
812 871
         $extra_fields = unserialize($cf['extra_fields']);
813 872
         $name = $cf['name'];
814 873
 
815
-        if ($extra_fields['date_format'] == '')
816
-            $extra_fields['date_format'] = 'yy-mm-dd';
874
+        if ($extra_fields['date_format'] == '') {
875
+                    $extra_fields['date_format'] = 'yy-mm-dd';
876
+        }
817 877
 
818 878
         $date_format = $extra_fields['date_format'];
819 879
         $jquery_date_format  = $date_format;
@@ -827,7 +887,7 @@  discard block
 block discarded – undo
827 887
             $replace = array('d','j','l','m','n','F','Y');//PHP date format
828 888
 
829 889
             $date_format = str_replace($search, $replace, $date_format);
830
-        }else{
890
+        } else{
831 891
             $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
832 892
         }
833 893
 
@@ -862,12 +922,18 @@  discard block
 block discarded – undo
862 922
 
863 923
         </script>
864 924
         <div id="<?php echo $name;?>_row"
865
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
925
+             class="<?php if ($cf['is_required']) {
926
+	echo 'required_field';
927
+}
928
+?> geodir_form_row clearfix gd-fieldset-details">
866 929
             <label>
867 930
 
868 931
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
869 932
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
870
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
933
+                <?php if ($cf['is_required']) {
934
+	echo '<span>*</span>';
935
+}
936
+?>
871 937
             </label>
872 938
 
873 939
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -921,8 +987,9 @@  discard block
 block discarded – undo
921 987
 
922 988
         $name = $cf['name'];
923 989
 
924
-        if ($value != '')
925
-            $value = date('H:i', strtotime($value));
990
+        if ($value != '') {
991
+                    $value = date('H:i', strtotime($value));
992
+        }
926 993
         ?>
927 994
         <script type="text/javascript">
928 995
             jQuery(document).ready(function () {
@@ -935,12 +1002,18 @@  discard block
 block discarded – undo
935 1002
             });
936 1003
         </script>
937 1004
         <div id="<?php echo $name;?>_row"
938
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1005
+             class="<?php if ($cf['is_required']) {
1006
+	echo 'required_field';
1007
+}
1008
+?> geodir_form_row clearfix gd-fieldset-details">
939 1009
             <label>
940 1010
 
941 1011
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
942 1012
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
943
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
1013
+                <?php if ($cf['is_required']) {
1014
+	echo '<span>*</span>';
1015
+}
1016
+?>
944 1017
             </label>
945 1018
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
946 1019
                    id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1032,17 +1105,27 @@  discard block
 block discarded – undo
1032 1105
         }
1033 1106
 
1034 1107
         $location = geodir_get_default_location();
1035
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1036
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1037
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1108
+        if (empty($city)) {
1109
+        	$city = isset($location->city) ? $location->city : '';
1110
+        }
1111
+        if (empty($region)) {
1112
+        	$region = isset($location->region) ? $location->region : '';
1113
+        }
1114
+        if (empty($country)) {
1115
+        	$country = isset($location->country) ? $location->country : '';
1116
+        }
1038 1117
 
1039 1118
         $lat_lng_blank = false;
1040 1119
         if (empty($lat) && empty($lng)) {
1041 1120
             $lat_lng_blank = true;
1042 1121
         }
1043 1122
 
1044
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1045
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1123
+        if (empty($lat)) {
1124
+        	$lat = isset($location->city_latitude) ? $location->city_latitude : '';
1125
+        }
1126
+        if (empty($lng)) {
1127
+        	$lng = isset($location->city_longitude) ? $location->city_longitude : '';
1128
+        }
1046 1129
 
1047 1130
         /**
1048 1131
          * Filter the default latitude.
@@ -1067,8 +1150,14 @@  discard block
 block discarded – undo
1067 1150
         $locate_me_class = $locate_me ? ' gd-form-control' : '';
1068 1151
         ?>
1069 1152
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1070
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1071
-            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>';?></label>
1153
+             class="<?php if ($is_required) {
1154
+	echo 'required_field';
1155
+}
1156
+?> geodir_form_row clearfix gd-fieldset-details">
1157
+            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) {
1158
+	echo '<span>*</span>';
1159
+}
1160
+?></label>
1072 1161
             <?php if ($locate_me) { ?>
1073 1162
             <div class="gd-input-group gd-locate-me">
1074 1163
             <?php } ?>
@@ -1132,10 +1221,16 @@  discard block
 block discarded – undo
1132 1221
             /* show lat lng */
1133 1222
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1134 1223
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1135
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1224
+                 class="<?php if ($is_required) {
1225
+	echo 'required_field';
1226
+}
1227
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1136 1228
                 <label>
1137 1229
                     <?php echo PLACE_ADDRESS_LAT; ?>
1138
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1230
+                    <?php if ($is_required) {
1231
+	echo '<span>*</span>';
1232
+}
1233
+?>
1139 1234
                 </label>
1140 1235
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1141 1236
                        id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1147,10 +1242,16 @@  discard block
 block discarded – undo
1147 1242
             </div>
1148 1243
 
1149 1244
             <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1150
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1245
+                 class="<?php if ($is_required) {
1246
+	echo 'required_field';
1247
+}
1248
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1151 1249
                 <label>
1152 1250
                     <?php echo PLACE_ADDRESS_LNG; ?>
1153
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1251
+                    <?php if ($is_required) {
1252
+	echo '<span>*</span>';
1253
+}
1254
+?>
1154 1255
                 </label>
1155 1256
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1156 1257
                        id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1254,11 +1355,17 @@  discard block
 block discarded – undo
1254 1355
             $value = '';
1255 1356
         } ?>
1256 1357
         <div id="<?php echo $name;?>_row"
1257
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1358
+             class="<?php if ($is_required) {
1359
+	echo 'required_field';
1360
+}
1361
+?> geodir_form_row clearfix gd-fieldset-details">
1258 1362
             <label>
1259 1363
                 <?php $site_title = __($site_title, 'geodirectory');
1260 1364
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1261
-                <?php if ($is_required) echo '<span>*</span>';?>
1365
+                <?php if ($is_required) {
1366
+	echo '<span>*</span>';
1367
+}
1368
+?>
1262 1369
             </label>
1263 1370
 
1264 1371
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1290,8 +1397,9 @@  discard block
 block discarded – undo
1290 1397
                 if (isset($_REQUEST['backandedit']) && !empty($post_cat[$name]) && is_array($post_cat[$name])) {
1291 1398
                     $post_cat = implode(",", $post_cat[$name]);
1292 1399
                 } else {
1293
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1294
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1400
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1401
+                                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1402
+                    }
1295 1403
                 }
1296 1404
 
1297 1405
 
@@ -1329,21 +1437,24 @@  discard block
 block discarded – undo
1329 1437
 
1330 1438
                         $cat_display == '';
1331 1439
                         $multiple = '';
1332
-                        if ($cat_display == 'multiselect')
1333
-                            $multiple = 'multiple="multiple"';
1440
+                        if ($cat_display == 'multiselect') {
1441
+                                                    $multiple = 'multiple="multiple"';
1442
+                        }
1334 1443
 
1335 1444
                         echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1336 1445
 
1337 1446
 
1338
-                        if ($cat_display == 'select')
1339
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1447
+                        if ($cat_display == 'select') {
1448
+                                                    echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1449
+                        }
1340 1450
 
1341 1451
                     }
1342 1452
 
1343 1453
                     echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1344 1454
 
1345
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1346
-                        echo '</select>';
1455
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1456
+                                            echo '</select>';
1457
+                    }
1347 1458
 
1348 1459
                 } else {
1349 1460
 
@@ -1415,18 +1526,23 @@  discard block
 block discarded – undo
1415 1526
 
1416 1527
             $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1417 1528
 
1418
-        } else
1419
-            $file_value = '';
1529
+        } else {
1530
+                    $file_value = '';
1531
+        }
1420 1532
 
1421
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1422
-            $file_multiple = true; // allow multiple files upload
1423
-        else
1424
-            $file_multiple = false;
1533
+        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
1534
+                    $file_multiple = true;
1535
+        }
1536
+        // allow multiple files upload
1537
+        else {
1538
+                    $file_multiple = false;
1539
+        }
1425 1540
 
1426
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1427
-            $file_image_limit = $extra_fields['image_limit'];
1428
-        else
1429
-            $file_image_limit = 1;
1541
+        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
1542
+                    $file_image_limit = $extra_fields['image_limit'];
1543
+        } else {
1544
+                    $file_image_limit = 1;
1545
+        }
1430 1546
 
1431 1547
         $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1432 1548
 
@@ -1434,8 +1550,9 @@  discard block
 block discarded – undo
1434 1550
 
1435 1551
         if (!empty($file_value)) {
1436 1552
             $curImages = explode(',', $file_value);
1437
-            if (!empty($curImages))
1438
-                $file_totImg = count($curImages);
1553
+            if (!empty($curImages)) {
1554
+                            $file_totImg = count($curImages);
1555
+            }
1439 1556
         }
1440 1557
 
1441 1558
         $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
@@ -1450,12 +1567,18 @@  discard block
 block discarded – undo
1450 1567
         ?>
1451 1568
 
1452 1569
         <div id="<?php echo $name;?>_row"
1453
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1570
+             class="<?php if ($is_required) {
1571
+	echo 'required_field';
1572
+}
1573
+?> geodir_form_row clearfix gd-fieldset-details">
1454 1574
 
1455 1575
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1456 1576
                 <label
1457 1577
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1458
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1578
+                    echo $site_title; ?><?php if ($is_required) {
1579
+                    	echo '<span>*</span>';
1580
+                    }
1581
+                    ?></label>
1459 1582
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1460 1583
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1461 1584
                        value="<?php echo esc_attr($file_value); ?>"/>
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/Tax-meta-class.php 4 patches
Braces   +106 added lines, -69 removed lines patch added patch discarded remove patch
@@ -102,8 +102,9 @@  discard block
 block discarded – undo
102 102
         {
103 103
 
104 104
             // If we are not in admin area exit.
105
-            if (!is_admin())
106
-                return;
105
+            if (!is_admin()) {
106
+                            return;
107
+            }
107 108
 
108 109
             // Assign meta box values to local variables and add it's missed values.
109 110
             $this->_meta_box = $meta_box;
@@ -111,15 +112,15 @@  discard block
 block discarded – undo
111 112
             $this->_fields = &$this->_meta_box['fields'];
112 113
             $this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113 114
             $this->add_missed_values();
114
-            if (isset($meta_box['use_with_theme']))
115
-                if ($meta_box['use_with_theme'] === true) {
115
+            if (isset($meta_box['use_with_theme'])) {
116
+                            if ($meta_box['use_with_theme'] === true) {
116 117
                     $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
118
+            }
117 119
                 } elseif ($meta_box['use_with_theme'] === false) {
118 120
                     $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119 121
                 } else {
120 122
                     $this->SelfPath = $meta_box['use_with_theme'];
121
-                }
122
-            else {
123
+                } else {
123 124
                 $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124 125
             }
125 126
 
@@ -190,8 +191,9 @@  discard block
 block discarded – undo
190 191
         {
191 192
 
192 193
             // Check if the field is an image or file. If not, return.
193
-            if (!$this->has_field('image') && !$this->has_field('file'))
194
-                return;
194
+            if (!$this->has_field('image') && !$this->has_field('file')) {
195
+                            return;
196
+            }
195 197
 
196 198
 
197 199
             add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
@@ -235,8 +237,9 @@  discard block
 block discarded – undo
235 237
         {
236 238
 
237 239
             // If post variables are empty, return.
238
-            if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
-                return;
240
+            if (!isset($_POST['at-insert']) || empty($_POST['attachments'])) {
241
+                            return;
242
+            }
240 243
 
241 244
             // Security Check
242 245
             check_admin_referer('media-form');
@@ -256,8 +259,9 @@  discard block
 block discarded – undo
256 259
                 $attachment = stripslashes_deep($attachment);
257 260
 
258 261
                 // If not selected or url is empty, continue in loop.
259
-                if (empty($attachment['selected']) || empty($attachment['url']))
260
-                    continue;
262
+                if (empty($attachment['selected']) || empty($attachment['url'])) {
263
+                                    continue;
264
+                }
261 265
 
262 266
                 $li = "<li id='item_{$attachment_id}'>";
263 267
                 $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
@@ -308,13 +312,15 @@  discard block
 block discarded – undo
308 312
 
309 313
 
310 314
             // If data is not set, die.
311
-            if (!isset($_POST['data']))
312
-                die();
315
+            if (!isset($_POST['data'])) {
316
+                            die();
317
+            }
313 318
 
314 319
             list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315 320
 
316
-            if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
-                die('1');
321
+            if (!wp_verify_nonce($nonce, 'at_ajax_delete')) {
322
+                            die('1');
323
+            }
318 324
 
319 325
             $this->delete_tax_meta($term_id, $key, $attach_id);
320 326
 
@@ -336,8 +342,9 @@  discard block
 block discarded – undo
336 342
             $ok = false;
337 343
             if (strpos($field_id, '[') === false) {
338 344
                 check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
-                if ($term_id > 0)
340
-                    $this->delete_tax_meta($term_id, $field_id);
345
+                if ($term_id > 0) {
346
+                                    $this->delete_tax_meta($term_id, $field_id);
347
+                }
341 348
                 //$ok = wp_delete_attachment( $attachment_id );
342 349
                 $ok = 1;
343 350
             } else {
@@ -349,8 +356,9 @@  discard block
 block discarded – undo
349 356
                 $saved = $this->get_tax_meta($term_id, $f[0], true);
350 357
                 if (isset($saved[$f[1]][$f[2]])) {
351 358
                     unset($saved[$f[1]][$f[2]]);
352
-                    if ($term_id > 0)
353
-                        update_post_meta($term_id, $f[0], $saved);
359
+                    if ($term_id > 0) {
360
+                                            update_post_meta($term_id, $f[0], $saved);
361
+                    }
354 362
                     //$ok = wp_delete_attachment( $attachment_id );
355 363
                     $ok = 1;
356 364
                 }
@@ -375,13 +383,15 @@  discard block
 block discarded – undo
375 383
         public function reorder_images()
376 384
         {
377 385
 
378
-            if (!isset($_POST['data']))
379
-                die();
386
+            if (!isset($_POST['data'])) {
387
+                            die();
388
+            }
380 389
 
381 390
             list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382 391
 
383
-            if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
-                die('1');
392
+            if (!wp_verify_nonce($nonce, 'at_ajax_reorder')) {
393
+                            die('1');
394
+            }
385 395
 
386 396
             parse_str($order, $items);
387 397
             $items = $items['item'];
@@ -513,8 +523,9 @@  discard block
 block discarded – undo
513 523
             foreach ($this->_fields as $field) {
514 524
                 $meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515 525
                 $meta = ($meta !== '') ? $meta : $field['std'];
516
-                if ('image' != $field['type'] && $field['type'] != 'repeater')
517
-                    $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
526
+                if ('image' != $field['type'] && $field['type'] != 'repeater') {
527
+                                    $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
528
+                }
518 529
 
519 530
                 if ($field['validate_func']) {
520 531
                     echo '<tr class="form-field form-required ' . $field['style'] . '">';
@@ -560,8 +571,9 @@  discard block
 block discarded – undo
560 571
                         $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561 572
                         $m = $me[$f['id']];
562 573
                         $m = ($m !== '') ? $m : $f['std'];
563
-                        if ('image' != $f['type'] && $f['type'] != 'repeater')
564
-                            $m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
574
+                        if ('image' != $f['type'] && $f['type'] != 'repeater') {
575
+                                                    $m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
576
+                        }
565 577
                         //set new id for field in array format
566 578
                         $f['id'] = $id;
567 579
                         if (!$field['inline']) {
@@ -802,8 +814,9 @@  discard block
 block discarded – undo
802 814
         public function show_field_select($field, $meta)
803 815
         {
804 816
 
805
-            if (!is_array($meta))
806
-                $meta = (array)$meta;
817
+            if (!is_array($meta)) {
818
+                            $meta = (array)$meta;
819
+            }
807 820
 
808 821
             $this->show_field_begin($field, $meta);
809 822
             echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
@@ -826,8 +839,9 @@  discard block
 block discarded – undo
826 839
         public function show_field_radio($field, $meta)
827 840
         {
828 841
 
829
-            if (!is_array($meta))
830
-                $meta = (array)$meta;
842
+            if (!is_array($meta)) {
843
+                            $meta = (array)$meta;
844
+            }
831 845
 
832 846
             $this->show_field_begin($field, $meta);
833 847
             foreach ($field['options'] as $key => $value) {
@@ -889,8 +903,9 @@  discard block
 block discarded – undo
889 903
 
890 904
             global $post;
891 905
 
892
-            if (!is_array($meta))
893
-                $meta = (array)$meta;
906
+            if (!is_array($meta)) {
907
+                            $meta = (array)$meta;
908
+            }
894 909
 
895 910
             $this->show_field_begin($field, $meta);
896 911
             echo "{$field['desc']}<br />";
@@ -934,16 +949,18 @@  discard block
 block discarded – undo
934 949
             $this->show_field_begin($field, $meta);
935 950
             $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936 951
             if (is_array($meta)) {
937
-                if (isset($meta[0]) && is_array($meta[0]))
938
-                    $meta = $meta[0];
952
+                if (isset($meta[0]) && is_array($meta[0])) {
953
+                                    $meta = $meta[0];
954
+                }
939 955
             }
940 956
 
941 957
             $uploads = wp_upload_dir();
942 958
             if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') {
943 959
                 $file_info = pathinfo($meta['src']);
944 960
 
945
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
946
-                    $sub_dir = $file_info['dirname'];
961
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
962
+                                    $sub_dir = $file_info['dirname'];
963
+                }
947 964
 
948 965
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
949 966
                 $uploads_baseurl = $uploads['baseurl'];
@@ -987,8 +1004,9 @@  discard block
 block discarded – undo
987 1004
         public function show_field_color($field, $meta)
988 1005
         {
989 1006
 
990
-            if (empty($meta))
991
-                $meta = '#';
1007
+            if (empty($meta)) {
1008
+                            $meta = '#';
1009
+            }
992 1010
 
993 1011
             $this->show_field_begin($field, $meta);
994 1012
 
@@ -1011,8 +1029,9 @@  discard block
 block discarded – undo
1011 1029
         public function show_field_checkbox_list($field, $meta)
1012 1030
         {
1013 1031
 
1014
-            if (!is_array($meta))
1015
-                $meta = (array)$meta;
1032
+            if (!is_array($meta)) {
1033
+                            $meta = (array)$meta;
1034
+            }
1016 1035
 
1017 1036
             $this->show_field_begin($field, $meta);
1018 1037
 
@@ -1072,7 +1091,9 @@  discard block
 block discarded – undo
1072 1091
         {
1073 1092
             global $post;
1074 1093
 
1075
-            if (!is_array($meta)) $meta = (array)$meta;
1094
+            if (!is_array($meta)) {
1095
+            	$meta = (array)$meta;
1096
+            }
1076 1097
             $this->show_field_begin($field, $meta);
1077 1098
             $options = $field['options'];
1078 1099
             $posts = get_posts($options['args']);
@@ -1110,7 +1131,9 @@  discard block
 block discarded – undo
1110 1131
         {
1111 1132
             global $post;
1112 1133
 
1113
-            if (!is_array($meta)) $meta = (array)$meta;
1134
+            if (!is_array($meta)) {
1135
+            	$meta = (array)$meta;
1136
+            }
1114 1137
             $this->show_field_begin($field, $meta);
1115 1138
             $options = $field['options'];
1116 1139
             $terms = get_terms($options['taxonomy'], $options['args']);
@@ -1144,17 +1167,20 @@  discard block
 block discarded – undo
1144 1167
         {
1145 1168
 
1146 1169
             $taxnow = '';
1147
-            if (isset($_POST['taxonomy']))
1148
-                $taxnow = $_POST['taxonomy'];
1170
+            if (isset($_POST['taxonomy'])) {
1171
+                            $taxnow = $_POST['taxonomy'];
1172
+            }
1149 1173
 
1150 1174
             if (!isset($term_id)                                                        // Check Revision
1151 1175
                 || (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1152 1176
                 || (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1153 1177
                 || (!current_user_can('manage_categories'))
1154
-            )                                // Check permission
1178
+            ) {
1179
+            	// Check permission
1155 1180
             {
1156 1181
                 return $term_id;
1157 1182
             }
1183
+            }
1158 1184
 
1159 1185
 
1160 1186
             foreach ($this->_fields as $field) {
@@ -1248,8 +1274,9 @@  discard block
 block discarded – undo
1248 1274
         {
1249 1275
             $name = $field['id'];
1250 1276
             $this->delete_tax_meta($term_id, $name);
1251
-            if ($new === '' || $new === array())
1252
-                return;
1277
+            if ($new === '' || $new === array()) {
1278
+                            return;
1279
+            }
1253 1280
 
1254 1281
             $this->update_tax_meta($term_id, $name, $new);
1255 1282
         }
@@ -1269,8 +1296,9 @@  discard block
 block discarded – undo
1269 1296
             $name = $field['id'];
1270 1297
 
1271 1298
             $this->delete_tax_meta($term_id, $name);
1272
-            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1273
-                return;
1299
+            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '') {
1300
+                            return;
1301
+            }
1274 1302
 
1275 1303
             $this->update_tax_meta($term_id, $name, $new);
1276 1304
         }
@@ -1317,8 +1345,9 @@  discard block
 block discarded – undo
1317 1345
                                 break;
1318 1346
                         }
1319 1347
                     }
1320
-                    if (!$this->is_array_empty($n))
1321
-                        $temp[] = $n;
1348
+                    if (!$this->is_array_empty($n)) {
1349
+                                            $temp[] = $n;
1350
+                    }
1322 1351
                 }
1323 1352
                 if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1324 1353
                     $this->update_tax_meta($term_id, $field['id'], $temp);
@@ -1346,14 +1375,16 @@  discard block
 block discarded – undo
1346 1375
         {
1347 1376
 
1348 1377
             $name = $field['id'];
1349
-            if (empty($_FILES[$name]))
1350
-                return;
1378
+            if (empty($_FILES[$name])) {
1379
+                            return;
1380
+            }
1351 1381
             $this->fix_file_array($_FILES[$name]);
1352 1382
             foreach ($_FILES[$name] as $position => $fileitem) {
1353 1383
 
1354 1384
                 $file = wp_handle_upload($fileitem, array('test_form' => false));
1355
-                if (empty($file['file']))
1356
-                    continue;
1385
+                if (empty($file['file'])) {
1386
+                                    continue;
1387
+                }
1357 1388
                 $filename = $file['file'];
1358 1389
 
1359 1390
                 $attachment = array(
@@ -1391,14 +1422,16 @@  discard block
 block discarded – undo
1391 1422
         {
1392 1423
 
1393 1424
             $name = $field['id'];
1394
-            if (empty($_FILES[$name]))
1395
-                return;
1425
+            if (empty($_FILES[$name])) {
1426
+                            return;
1427
+            }
1396 1428
             $this->fix_file_array($_FILES[$name]);
1397 1429
             foreach ($_FILES[$name] as $position => $fileitem) {
1398 1430
 
1399 1431
                 $file = wp_handle_upload($fileitem, array('test_form' => false));
1400
-                if (empty($file['file']))
1401
-                    continue;
1432
+                if (empty($file['file'])) {
1433
+                                    continue;
1434
+                }
1402 1435
                 $filename = $file['file'];
1403 1436
 
1404 1437
                 $attachment = array(
@@ -1453,8 +1486,9 @@  discard block
 block discarded – undo
1453 1486
         {
1454 1487
             if(is_array($this->_fields)) {
1455 1488
                 foreach ($this->_fields as $field) {
1456
-                    if ($type == $field['type'])
1457
-                        return true;
1489
+                    if ($type == $field['type']) {
1490
+                                            return true;
1491
+                    }
1458 1492
                 }
1459 1493
             }
1460 1494
             return false;
@@ -1992,18 +2026,21 @@  discard block
 block discarded – undo
1992 2026
          */
1993 2027
         public function is_array_empty($array)
1994 2028
         {
1995
-            if (!is_array($array))
1996
-                return true;
2029
+            if (!is_array($array)) {
2030
+                            return true;
2031
+            }
1997 2032
 
1998 2033
             foreach ($array as $a) {
1999 2034
                 if (is_array($a)) {
2000 2035
                     foreach ($a as $sub_a) {
2001
-                        if (!empty($sub_a) && $sub_a != '')
2002
-                            return false;
2036
+                        if (!empty($sub_a) && $sub_a != '') {
2037
+                                                    return false;
2038
+                        }
2003 2039
                     }
2004 2040
                 } else {
2005
-                    if (!empty($a) && $a != '')
2006
-                        return false;
2041
+                    if (!empty($a) && $a != '') {
2042
+                                            return false;
2043
+                    }
2007 2044
                 }
2008 2045
             }
2009 2046
             return true;
Please login to merge, or discard this patch.
Indentation   +2046 added lines, -2046 removed lines patch added patch discarded remove patch
@@ -28,260 +28,260 @@  discard block
 block discarded – undo
28 28
 
29 29
 if (!class_exists('Geodir_Tax_Meta_Class')) :
30 30
 
31
-    /**
32
-     * All Types Meta Box class.
33
-     *
34
-     * @package All Types Meta Box
35
-     * @since 1.0
36
-     *
37
-     * @todo Nothing.
38
-     */
39
-
40
-
41
-    class Geodir_Tax_Meta_Class
42
-    {
43
-
44
-        /**
45
-         * Holds meta box object
46
-         *
47
-         * @var object
48
-         * @access protected
49
-         */
50
-        protected $_meta_box;
51
-
52
-        /**
53
-         * Holds meta box fields.
54
-         *
55
-         * @var array
56
-         * @access protected
57
-         */
58
-        protected $_prefix;
59
-
60
-        /**
61
-         * Holds Prefix for meta box fields.
62
-         *
63
-         * @var array
64
-         * @access protected
65
-         */
66
-        protected $_fields;
67
-
68
-        /**
69
-         * Use local images.
70
-         *
71
-         * @var bool
72
-         * @access protected
73
-         */
74
-        protected $_Local_images;
75
-
76
-        /**
77
-         * What form is this? edit or new term.
78
-         *
79
-         * @var string
80
-         * @access protected
81
-         * $since 1.0
82
-         */
83
-        protected $_form_type;
84
-        /**
85
-         * SelfPath to allow themes as well as plugins.
86
-         *
87
-         * @var string
88
-         * @access protected
89
-         * $since 1.0
90
-         */
91
-        protected $SelfPath;
92
-
93
-        /**
94
-         * Constructor
95
-         *
96
-         * @since 1.0
97
-         * @access public
98
-         *
99
-         * @param array $meta_box
100
-         */
101
-        public function __construct($meta_box)
102
-        {
103
-
104
-            // If we are not in admin area exit.
105
-            if (!is_admin())
106
-                return;
107
-
108
-            // Assign meta box values to local variables and add it's missed values.
109
-            $this->_meta_box = $meta_box;
110
-            $this->_prefix = (isset($meta_box['prefix'])) ? $meta_box['prefix'] : '';
111
-            $this->_fields = &$this->_meta_box['fields'];
112
-            $this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113
-            $this->add_missed_values();
114
-            if (isset($meta_box['use_with_theme']))
115
-                if ($meta_box['use_with_theme'] === true) {
116
-                    $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
117
-                } elseif ($meta_box['use_with_theme'] === false) {
118
-                    $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119
-                } else {
120
-                    $this->SelfPath = $meta_box['use_with_theme'];
121
-                }
122
-            else {
123
-                $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124
-            }
125
-
126
-
127
-            // Add Actions
128
-            add_action('admin_init', array(&$this, 'add'));
129
-
130
-            // Check for special fields and add needed actions for them.
131
-            $this->check_field_upload();
132
-            $this->check_field_color();
133
-            $this->check_field_date();
134
-            $this->check_field_time();
135
-
136
-            // Load common js, css files
137
-            // Must enqueue for all pages as we need js for the media upload, too.
138
-            add_action('admin_print_styles', array(&$this, 'load_scripts_styles'));
139
-
140
-        }
141
-
142
-        /**
143
-         * Load all Javascript and CSS
144
-         *
145
-         * @since 1.0
146
-         * @access public
147
-         */
148
-        public function load_scripts_styles()
149
-        {
150
-
151
-            // Get Plugin Path
152
-            $plugin_path = $this->SelfPath;
153
-            //only load styles and js when needed
154
-            /* 
31
+	/**
32
+	 * All Types Meta Box class.
33
+	 *
34
+	 * @package All Types Meta Box
35
+	 * @since 1.0
36
+	 *
37
+	 * @todo Nothing.
38
+	 */
39
+
40
+
41
+	class Geodir_Tax_Meta_Class
42
+	{
43
+
44
+		/**
45
+		 * Holds meta box object
46
+		 *
47
+		 * @var object
48
+		 * @access protected
49
+		 */
50
+		protected $_meta_box;
51
+
52
+		/**
53
+		 * Holds meta box fields.
54
+		 *
55
+		 * @var array
56
+		 * @access protected
57
+		 */
58
+		protected $_prefix;
59
+
60
+		/**
61
+		 * Holds Prefix for meta box fields.
62
+		 *
63
+		 * @var array
64
+		 * @access protected
65
+		 */
66
+		protected $_fields;
67
+
68
+		/**
69
+		 * Use local images.
70
+		 *
71
+		 * @var bool
72
+		 * @access protected
73
+		 */
74
+		protected $_Local_images;
75
+
76
+		/**
77
+		 * What form is this? edit or new term.
78
+		 *
79
+		 * @var string
80
+		 * @access protected
81
+		 * $since 1.0
82
+		 */
83
+		protected $_form_type;
84
+		/**
85
+		 * SelfPath to allow themes as well as plugins.
86
+		 *
87
+		 * @var string
88
+		 * @access protected
89
+		 * $since 1.0
90
+		 */
91
+		protected $SelfPath;
92
+
93
+		/**
94
+		 * Constructor
95
+		 *
96
+		 * @since 1.0
97
+		 * @access public
98
+		 *
99
+		 * @param array $meta_box
100
+		 */
101
+		public function __construct($meta_box)
102
+		{
103
+
104
+			// If we are not in admin area exit.
105
+			if (!is_admin())
106
+				return;
107
+
108
+			// Assign meta box values to local variables and add it's missed values.
109
+			$this->_meta_box = $meta_box;
110
+			$this->_prefix = (isset($meta_box['prefix'])) ? $meta_box['prefix'] : '';
111
+			$this->_fields = &$this->_meta_box['fields'];
112
+			$this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113
+			$this->add_missed_values();
114
+			if (isset($meta_box['use_with_theme']))
115
+				if ($meta_box['use_with_theme'] === true) {
116
+					$this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
117
+				} elseif ($meta_box['use_with_theme'] === false) {
118
+					$this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119
+				} else {
120
+					$this->SelfPath = $meta_box['use_with_theme'];
121
+				}
122
+			else {
123
+				$this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124
+			}
125
+
126
+
127
+			// Add Actions
128
+			add_action('admin_init', array(&$this, 'add'));
129
+
130
+			// Check for special fields and add needed actions for them.
131
+			$this->check_field_upload();
132
+			$this->check_field_color();
133
+			$this->check_field_date();
134
+			$this->check_field_time();
135
+
136
+			// Load common js, css files
137
+			// Must enqueue for all pages as we need js for the media upload, too.
138
+			add_action('admin_print_styles', array(&$this, 'load_scripts_styles'));
139
+
140
+		}
141
+
142
+		/**
143
+		 * Load all Javascript and CSS
144
+		 *
145
+		 * @since 1.0
146
+		 * @access public
147
+		 */
148
+		public function load_scripts_styles()
149
+		{
150
+
151
+			// Get Plugin Path
152
+			$plugin_path = $this->SelfPath;
153
+			//only load styles and js when needed
154
+			/* 
155 155
 		 * since 1.0
156 156
 		 */
157
-            $taxnow = isset($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : '';
158
-
159
-            if (!empty($this->_meta_box['pages'])) {
160
-                if (in_array($taxnow, $this->_meta_box['pages'])) {
161
-                    // Enqueue Meta Box Style
162
-                    //wp_enqueue_style( 'tax-meta-clss', $plugin_path . '/css/Tax-meta-class.css' );
163
-                    // Enqueue Meta Box Scripts
164
-                    //wp_enqueue_script( 'tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array( 'jquery' ), null, true );
165
-
166
-                }
167
-            }
168
-
169
-        }
170
-
171
-        /**
172
-         * Check the Field Upload, Add needed Actions
173
-         *
174
-         * @since 1.0
175
-         * @access public
176
-         */
177
-        public function enqueue_tax_meta_scripts()
178
-        {
179
-            // Make upload feature work event when custom post type doesn't support 'editor'
180
-            wp_enqueue_script('media-upload');
181
-            wp_enqueue_script('thickbox');
182
-            add_thickbox();
183
-            wp_enqueue_script('jquery-ui-core');
184
-            wp_enqueue_script('jquery-ui-sortable');
185
-
186
-
187
-        }
188
-
189
-        public function check_field_upload()
190
-        {
191
-
192
-            // Check if the field is an image or file. If not, return.
193
-            if (!$this->has_field('image') && !$this->has_field('file'))
194
-                return;
195
-
196
-
197
-            add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
198
-
199
-            // Add data encoding type for file uploading.	
200
-            add_action('post_edit_form_tag', array(&$this, 'add_enctype'));
201
-
202
-
203
-            // Add filters for media upload.
204
-            add_filter('media_upload_gallery', array(&$this, 'insert_images'));
205
-            add_filter('media_upload_library', array(&$this, 'insert_images'));
206
-            add_filter('media_upload_image', array(&$this, 'insert_images'));
207
-
208
-            // Delete all attachments when delete custom post type.
209
-            add_action('wp_ajax_at_delete_file', array(&$this, 'delete_file'));
210
-            add_action('wp_ajax_at_reorder_images', array(&$this, 'reorder_images'));
211
-            // Delete file via Ajax
212
-            add_action('wp_ajax_at_delete_mupload', array($this, 'wp_ajax_delete_image'));
213
-        }
214
-
215
-        /**
216
-         * Add data encoding type for file uploading
217
-         *
218
-         * @since 1.0
219
-         * @access public
220
-         */
221
-        public function add_enctype()
222
-        {
223
-            echo ' enctype="multipart/form-data"';
224
-        }
225
-
226
-        /**
227
-         * Process images added to meta field.
228
-         *
229
-         * Modified from Faster Image Insert plugin.
230
-         *
231
-         * @return void
232
-         * @author Cory Crowley
233
-         */
234
-        public function insert_images()
235
-        {
236
-
237
-            // If post variables are empty, return.
238
-            if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
-                return;
240
-
241
-            // Security Check
242
-            check_admin_referer('media-form');
243
-
244
-            // Create Security Nonce
245
-            $nonce = wp_create_nonce('at_ajax_delete');
246
-
247
-            // Get Post Id and Field Id
248
-            $term_id = $_POST['post_id'];
249
-            $id = $_POST['field_id'];
250
-
251
-            // Modify the insertion string
252
-            $html = '';
253
-            foreach ($_POST['attachments'] as $attachment_id => $attachment) {
254
-
255
-                // Strip Slashes
256
-                $attachment = stripslashes_deep($attachment);
257
-
258
-                // If not selected or url is empty, continue in loop.
259
-                if (empty($attachment['selected']) || empty($attachment['url']))
260
-                    continue;
261
-
262
-                $li = "<li id='item_{$attachment_id}'>";
263
-                $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264
-                //$li 	.= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>";
265
-                $li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>";
266
-                $li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267
-                $li .= "</li>";
268
-                $html .= $li;
269
-
270
-            } // End For Each
271
-
272
-            return media_send_to_editor($html);
273
-
274
-        }
275
-
276
-        /**
277
-         * Delete attachments associated with the post.
278
-         *
279
-         * @since 1.0
280
-         * @access public
281
-         *
282
-         * @param int|string $term_id The term ID.
283
-         */
284
-        /*public function delete_attachments( $term_id ) {
157
+			$taxnow = isset($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : '';
158
+
159
+			if (!empty($this->_meta_box['pages'])) {
160
+				if (in_array($taxnow, $this->_meta_box['pages'])) {
161
+					// Enqueue Meta Box Style
162
+					//wp_enqueue_style( 'tax-meta-clss', $plugin_path . '/css/Tax-meta-class.css' );
163
+					// Enqueue Meta Box Scripts
164
+					//wp_enqueue_script( 'tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array( 'jquery' ), null, true );
165
+
166
+				}
167
+			}
168
+
169
+		}
170
+
171
+		/**
172
+		 * Check the Field Upload, Add needed Actions
173
+		 *
174
+		 * @since 1.0
175
+		 * @access public
176
+		 */
177
+		public function enqueue_tax_meta_scripts()
178
+		{
179
+			// Make upload feature work event when custom post type doesn't support 'editor'
180
+			wp_enqueue_script('media-upload');
181
+			wp_enqueue_script('thickbox');
182
+			add_thickbox();
183
+			wp_enqueue_script('jquery-ui-core');
184
+			wp_enqueue_script('jquery-ui-sortable');
185
+
186
+
187
+		}
188
+
189
+		public function check_field_upload()
190
+		{
191
+
192
+			// Check if the field is an image or file. If not, return.
193
+			if (!$this->has_field('image') && !$this->has_field('file'))
194
+				return;
195
+
196
+
197
+			add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
198
+
199
+			// Add data encoding type for file uploading.	
200
+			add_action('post_edit_form_tag', array(&$this, 'add_enctype'));
201
+
202
+
203
+			// Add filters for media upload.
204
+			add_filter('media_upload_gallery', array(&$this, 'insert_images'));
205
+			add_filter('media_upload_library', array(&$this, 'insert_images'));
206
+			add_filter('media_upload_image', array(&$this, 'insert_images'));
207
+
208
+			// Delete all attachments when delete custom post type.
209
+			add_action('wp_ajax_at_delete_file', array(&$this, 'delete_file'));
210
+			add_action('wp_ajax_at_reorder_images', array(&$this, 'reorder_images'));
211
+			// Delete file via Ajax
212
+			add_action('wp_ajax_at_delete_mupload', array($this, 'wp_ajax_delete_image'));
213
+		}
214
+
215
+		/**
216
+		 * Add data encoding type for file uploading
217
+		 *
218
+		 * @since 1.0
219
+		 * @access public
220
+		 */
221
+		public function add_enctype()
222
+		{
223
+			echo ' enctype="multipart/form-data"';
224
+		}
225
+
226
+		/**
227
+		 * Process images added to meta field.
228
+		 *
229
+		 * Modified from Faster Image Insert plugin.
230
+		 *
231
+		 * @return void
232
+		 * @author Cory Crowley
233
+		 */
234
+		public function insert_images()
235
+		{
236
+
237
+			// If post variables are empty, return.
238
+			if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
+				return;
240
+
241
+			// Security Check
242
+			check_admin_referer('media-form');
243
+
244
+			// Create Security Nonce
245
+			$nonce = wp_create_nonce('at_ajax_delete');
246
+
247
+			// Get Post Id and Field Id
248
+			$term_id = $_POST['post_id'];
249
+			$id = $_POST['field_id'];
250
+
251
+			// Modify the insertion string
252
+			$html = '';
253
+			foreach ($_POST['attachments'] as $attachment_id => $attachment) {
254
+
255
+				// Strip Slashes
256
+				$attachment = stripslashes_deep($attachment);
257
+
258
+				// If not selected or url is empty, continue in loop.
259
+				if (empty($attachment['selected']) || empty($attachment['url']))
260
+					continue;
261
+
262
+				$li = "<li id='item_{$attachment_id}'>";
263
+				$li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264
+				//$li 	.= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>";
265
+				$li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>";
266
+				$li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267
+				$li .= "</li>";
268
+				$html .= $li;
269
+
270
+			} // End For Each
271
+
272
+			return media_send_to_editor($html);
273
+
274
+		}
275
+
276
+		/**
277
+		 * Delete attachments associated with the post.
278
+		 *
279
+		 * @since 1.0
280
+		 * @access public
281
+		 *
282
+		 * @param int|string $term_id The term ID.
283
+		 */
284
+		/*public function delete_attachments( $term_id ) {
285 285
 		
286 286
 		// Get Attachments
287 287
 		$attachments = get_posts( array( 'numberposts' => -1, 'post_type' => 'attachment', 'post_parent' => $term_id ) );
@@ -295,349 +295,349 @@  discard block
 block discarded – undo
295 295
 		
296 296
 	}*/
297 297
 
298
-        /**
299
-         * Ajax callback for deleting files.
300
-         *
301
-         * Modified from a function used by "Verve Meta Boxes" plugin ( http://goo.gl/aw64H )
302
-         *
303
-         * @since 1.0
304
-         * @access public
305
-         */
306
-        public function delete_file()
307
-        {
308
-
309
-
310
-            // If data is not set, die.
311
-            if (!isset($_POST['data']))
312
-                die();
313
-
314
-            list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315
-
316
-            if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
-                die('1');
318
-
319
-            $this->delete_tax_meta($term_id, $key, $attach_id);
320
-
321
-            die('0');
322
-
323
-        }
324
-
325
-        /**
326
-         * Ajax callback for deleting files.
327
-         * Modified from a function used by "Verve Meta Boxes" plugin (http://goo.gl/LzYSq)
328
-         * @since 1.0
329
-         * @access public
330
-         */
331
-        public function wp_ajax_delete_image()
332
-        {
333
-            $term_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0;
334
-            $field_id = isset($_GET['field_id']) ? $_GET['field_id'] : 0;
335
-            $attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336
-            $ok = false;
337
-            if (strpos($field_id, '[') === false) {
338
-                check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
-                if ($term_id > 0)
340
-                    $this->delete_tax_meta($term_id, $field_id);
341
-                //$ok = wp_delete_attachment( $attachment_id );
342
-                $ok = 1;
343
-            } else {
344
-                $f = explode('[', urldecode($field_id));
345
-                $f_fiexed = array();
346
-                foreach ($f as $k => $v) {
347
-                    $f[$k] = str_replace(']', '', $v);
348
-                }
349
-                $saved = $this->get_tax_meta($term_id, $f[0], true);
350
-                if (isset($saved[$f[1]][$f[2]])) {
351
-                    unset($saved[$f[1]][$f[2]]);
352
-                    if ($term_id > 0)
353
-                        update_post_meta($term_id, $f[0], $saved);
354
-                    //$ok = wp_delete_attachment( $attachment_id );
355
-                    $ok = 1;
356
-                }
357
-            }
358
-
359
-
360
-            if ($ok) {
361
-                echo json_encode(array('status' => 'success'));
362
-                die();
363
-            } else {
364
-                echo json_encode(array('message' => __('Cannot delete file. Something\'s wrong.', 'geodirectory')));
365
-                die();
366
-            }
367
-        }
368
-
369
-        /**
370
-         * Ajax callback for reordering Images.
371
-         *
372
-         * @since 1.0
373
-         * @access public
374
-         */
375
-        public function reorder_images()
376
-        {
377
-
378
-            if (!isset($_POST['data']))
379
-                die();
380
-
381
-            list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382
-
383
-            if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
-                die('1');
385
-
386
-            parse_str($order, $items);
387
-            $items = $items['item'];
388
-            $order = 1;
389
-            foreach ($items as $item) {
390
-                wp_update_post(array('ID' => $item, 'post_parent' => $term_id, 'menu_order' => $order));
391
-                $order++;
392
-            }
393
-
394
-            die('0');
395
-
396
-        }
397
-
398
-        /**
399
-         * Check Field Color
400
-         *
401
-         * @since 1.0
402
-         * @access public
403
-         */
404
-        public function check_field_color()
405
-        {
406
-
407
-            if ($this->has_field('color') && $this->is_edit_page()) {
408
-                // Enqueu built-in script and style for color picker.
409
-                wp_enqueue_style('farbtastic');
410
-                wp_enqueue_script('farbtastic');
411
-            }
412
-
413
-        }
414
-
415
-        /**
416
-         * Check Field Date
417
-         *
418
-         * @since 1.0
419
-         * @access public
420
-         */
421
-        public function check_field_date()
422
-        {
423
-
424
-            if ($this->has_field('date') && $this->is_edit_page()) {
425
-                // Enqueu JQuery UI, use proper version.
426
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css');
427
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'));
428
-            }
429
-
430
-        }
431
-
432
-        /**
433
-         * Check Field Time
434
-         *
435
-         * @since 1.0
436
-         * @access public
437
-         */
438
-        public function check_field_time()
439
-        {
440
-
441
-            if ($this->has_field('time') && $this->is_edit_page()) {
442
-
443
-                // Enqueu JQuery UI, use proper version.
444
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true);
445
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true);
446
-                wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true);
447
-
448
-            }
449
-
450
-        }
451
-
452
-        /**
453
-         * Add Meta Box for multiple post types.
454
-         *
455
-         * @since 1.0
456
-         * @access public
457
-         */
458
-        public function add()
459
-        {
460
-
461
-            // Loop through array
462
-            if (!empty($this->_meta_box['pages'])) {
463
-                foreach ($this->_meta_box['pages'] as $page) {
464
-                    //add fields to edit form
465
-                    add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
466
-                    //add fields to add new form
467
-                    add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
468
-                    // this saves the edit fields
469
-                    add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
470
-                    // this saves the add fields
471
-                    add_action('created_' . $page, array(&$this, 'save'), 10, 2);
472
-                }
473
-            }
474
-
475
-        }
476
-
477
-        /**
478
-         * Callback function to show fields on add new taxonomy term form.
479
-         *
480
-         * @since 1.0
481
-         * @access public
482
-         */
483
-        public function show_new_form($term_id)
484
-        {
485
-            $this->_form_type = 'new';
486
-            $this->show($term_id);
487
-        }
488
-
489
-        /**
490
-         * Callback function to show fields on term edit form.
491
-         *
492
-         * @since 1.0
493
-         * @access public
494
-         */
495
-        public function show_edit_form($term_id)
496
-        {
497
-            $this->_form_type = 'edit';
498
-            $this->show($term_id);
499
-        }
500
-
501
-
502
-        /**
503
-         * Callback function to show fields in meta box.
504
-         *
505
-         * @since 1.0
506
-         * @access public
507
-         */
508
-        public function show($term_id)
509
-        {
510
-
511
-            wp_nonce_field(basename(__FILE__), 'tax_meta_class_nonce');
512
-
513
-            foreach ($this->_fields as $field) {
514
-                $meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515
-                $meta = ($meta !== '') ? $meta : $field['std'];
516
-                if ('image' != $field['type'] && $field['type'] != 'repeater')
517
-                    $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518
-
519
-                if ($field['validate_func']) {
520
-                    echo '<tr class="form-field form-required ' . $field['style'] . '">';
521
-                } else {
522
-                    echo '<tr class="form-field ' . $field['style'] . '">';
523
-                }
524
-
525
-                // Call Separated methods for displaying each type of field.
526
-                call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
527
-                echo '</tr>';
528
-            }
529
-            echo '</table>';
530
-        }
531
-
532
-        /**
533
-         * Show Repeater Fields.
534
-         *
535
-         * @param string $field
536
-         * @param string $meta
537
-         * @since 1.0
538
-         * @access public
539
-         */
540
-        public function show_field_repeater($field, $meta)
541
-        {
542
-            // Get Plugin Path
543
-            $plugin_path = $this->SelfPath;
544
-            $this->show_field_begin($field, $meta);
545
-            echo "<div class='at-repeat' id='{$field['id']}'>";
546
-
547
-            $c = 0;
548
-
549
-            if (count($meta) > 0 && is_array($meta)) {
550
-                foreach ($meta as $me) {
551
-                    //for labling toggles
552
-                    $mmm = $me[$field['fields'][0]['id']];
553
-                    echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
554
-                    if ($field['inline']) {
555
-                        echo '<tr class="at-inline" VALIGN="top">';
556
-                    }
557
-                    foreach ($field['fields'] as $f) {
558
-                        //reset var $id for repeater
559
-                        $id = '';
560
-                        $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561
-                        $m = $me[$f['id']];
562
-                        $m = ($m !== '') ? $m : $f['std'];
563
-                        if ('image' != $f['type'] && $f['type'] != 'repeater')
564
-                            $m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
565
-                        //set new id for field in array format
566
-                        $f['id'] = $id;
567
-                        if (!$field['inline']) {
568
-                            echo '<tr>';
569
-                        }
570
-                        call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
571
-                        if (!$field['inline']) {
572
-                            echo '</tr>';
573
-                        }
574
-                    }
575
-                    if ($field['inline']) {
576
-                        echo '</tr>';
577
-                    }
578
-                    echo '</table>
298
+		/**
299
+		 * Ajax callback for deleting files.
300
+		 *
301
+		 * Modified from a function used by "Verve Meta Boxes" plugin ( http://goo.gl/aw64H )
302
+		 *
303
+		 * @since 1.0
304
+		 * @access public
305
+		 */
306
+		public function delete_file()
307
+		{
308
+
309
+
310
+			// If data is not set, die.
311
+			if (!isset($_POST['data']))
312
+				die();
313
+
314
+			list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315
+
316
+			if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
+				die('1');
318
+
319
+			$this->delete_tax_meta($term_id, $key, $attach_id);
320
+
321
+			die('0');
322
+
323
+		}
324
+
325
+		/**
326
+		 * Ajax callback for deleting files.
327
+		 * Modified from a function used by "Verve Meta Boxes" plugin (http://goo.gl/LzYSq)
328
+		 * @since 1.0
329
+		 * @access public
330
+		 */
331
+		public function wp_ajax_delete_image()
332
+		{
333
+			$term_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0;
334
+			$field_id = isset($_GET['field_id']) ? $_GET['field_id'] : 0;
335
+			$attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336
+			$ok = false;
337
+			if (strpos($field_id, '[') === false) {
338
+				check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
+				if ($term_id > 0)
340
+					$this->delete_tax_meta($term_id, $field_id);
341
+				//$ok = wp_delete_attachment( $attachment_id );
342
+				$ok = 1;
343
+			} else {
344
+				$f = explode('[', urldecode($field_id));
345
+				$f_fiexed = array();
346
+				foreach ($f as $k => $v) {
347
+					$f[$k] = str_replace(']', '', $v);
348
+				}
349
+				$saved = $this->get_tax_meta($term_id, $f[0], true);
350
+				if (isset($saved[$f[1]][$f[2]])) {
351
+					unset($saved[$f[1]][$f[2]]);
352
+					if ($term_id > 0)
353
+						update_post_meta($term_id, $f[0], $saved);
354
+					//$ok = wp_delete_attachment( $attachment_id );
355
+					$ok = 1;
356
+				}
357
+			}
358
+
359
+
360
+			if ($ok) {
361
+				echo json_encode(array('status' => 'success'));
362
+				die();
363
+			} else {
364
+				echo json_encode(array('message' => __('Cannot delete file. Something\'s wrong.', 'geodirectory')));
365
+				die();
366
+			}
367
+		}
368
+
369
+		/**
370
+		 * Ajax callback for reordering Images.
371
+		 *
372
+		 * @since 1.0
373
+		 * @access public
374
+		 */
375
+		public function reorder_images()
376
+		{
377
+
378
+			if (!isset($_POST['data']))
379
+				die();
380
+
381
+			list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382
+
383
+			if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
+				die('1');
385
+
386
+			parse_str($order, $items);
387
+			$items = $items['item'];
388
+			$order = 1;
389
+			foreach ($items as $item) {
390
+				wp_update_post(array('ID' => $item, 'post_parent' => $term_id, 'menu_order' => $order));
391
+				$order++;
392
+			}
393
+
394
+			die('0');
395
+
396
+		}
397
+
398
+		/**
399
+		 * Check Field Color
400
+		 *
401
+		 * @since 1.0
402
+		 * @access public
403
+		 */
404
+		public function check_field_color()
405
+		{
406
+
407
+			if ($this->has_field('color') && $this->is_edit_page()) {
408
+				// Enqueu built-in script and style for color picker.
409
+				wp_enqueue_style('farbtastic');
410
+				wp_enqueue_script('farbtastic');
411
+			}
412
+
413
+		}
414
+
415
+		/**
416
+		 * Check Field Date
417
+		 *
418
+		 * @since 1.0
419
+		 * @access public
420
+		 */
421
+		public function check_field_date()
422
+		{
423
+
424
+			if ($this->has_field('date') && $this->is_edit_page()) {
425
+				// Enqueu JQuery UI, use proper version.
426
+				wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css');
427
+				wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'));
428
+			}
429
+
430
+		}
431
+
432
+		/**
433
+		 * Check Field Time
434
+		 *
435
+		 * @since 1.0
436
+		 * @access public
437
+		 */
438
+		public function check_field_time()
439
+		{
440
+
441
+			if ($this->has_field('time') && $this->is_edit_page()) {
442
+
443
+				// Enqueu JQuery UI, use proper version.
444
+				wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true);
445
+				wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true);
446
+				wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true);
447
+
448
+			}
449
+
450
+		}
451
+
452
+		/**
453
+		 * Add Meta Box for multiple post types.
454
+		 *
455
+		 * @since 1.0
456
+		 * @access public
457
+		 */
458
+		public function add()
459
+		{
460
+
461
+			// Loop through array
462
+			if (!empty($this->_meta_box['pages'])) {
463
+				foreach ($this->_meta_box['pages'] as $page) {
464
+					//add fields to edit form
465
+					add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
466
+					//add fields to add new form
467
+					add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
468
+					// this saves the edit fields
469
+					add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
470
+					// this saves the add fields
471
+					add_action('created_' . $page, array(&$this, 'save'), 10, 2);
472
+				}
473
+			}
474
+
475
+		}
476
+
477
+		/**
478
+		 * Callback function to show fields on add new taxonomy term form.
479
+		 *
480
+		 * @since 1.0
481
+		 * @access public
482
+		 */
483
+		public function show_new_form($term_id)
484
+		{
485
+			$this->_form_type = 'new';
486
+			$this->show($term_id);
487
+		}
488
+
489
+		/**
490
+		 * Callback function to show fields on term edit form.
491
+		 *
492
+		 * @since 1.0
493
+		 * @access public
494
+		 */
495
+		public function show_edit_form($term_id)
496
+		{
497
+			$this->_form_type = 'edit';
498
+			$this->show($term_id);
499
+		}
500
+
501
+
502
+		/**
503
+		 * Callback function to show fields in meta box.
504
+		 *
505
+		 * @since 1.0
506
+		 * @access public
507
+		 */
508
+		public function show($term_id)
509
+		{
510
+
511
+			wp_nonce_field(basename(__FILE__), 'tax_meta_class_nonce');
512
+
513
+			foreach ($this->_fields as $field) {
514
+				$meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515
+				$meta = ($meta !== '') ? $meta : $field['std'];
516
+				if ('image' != $field['type'] && $field['type'] != 'repeater')
517
+					$meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518
+
519
+				if ($field['validate_func']) {
520
+					echo '<tr class="form-field form-required ' . $field['style'] . '">';
521
+				} else {
522
+					echo '<tr class="form-field ' . $field['style'] . '">';
523
+				}
524
+
525
+				// Call Separated methods for displaying each type of field.
526
+				call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
527
+				echo '</tr>';
528
+			}
529
+			echo '</table>';
530
+		}
531
+
532
+		/**
533
+		 * Show Repeater Fields.
534
+		 *
535
+		 * @param string $field
536
+		 * @param string $meta
537
+		 * @since 1.0
538
+		 * @access public
539
+		 */
540
+		public function show_field_repeater($field, $meta)
541
+		{
542
+			// Get Plugin Path
543
+			$plugin_path = $this->SelfPath;
544
+			$this->show_field_begin($field, $meta);
545
+			echo "<div class='at-repeat' id='{$field['id']}'>";
546
+
547
+			$c = 0;
548
+
549
+			if (count($meta) > 0 && is_array($meta)) {
550
+				foreach ($meta as $me) {
551
+					//for labling toggles
552
+					$mmm = $me[$field['fields'][0]['id']];
553
+					echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
554
+					if ($field['inline']) {
555
+						echo '<tr class="at-inline" VALIGN="top">';
556
+					}
557
+					foreach ($field['fields'] as $f) {
558
+						//reset var $id for repeater
559
+						$id = '';
560
+						$id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561
+						$m = $me[$f['id']];
562
+						$m = ($m !== '') ? $m : $f['std'];
563
+						if ('image' != $f['type'] && $f['type'] != 'repeater')
564
+							$m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
565
+						//set new id for field in array format
566
+						$f['id'] = $id;
567
+						if (!$field['inline']) {
568
+							echo '<tr>';
569
+						}
570
+						call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
571
+						if (!$field['inline']) {
572
+							echo '</tr>';
573
+						}
574
+					}
575
+					if ($field['inline']) {
576
+						echo '</tr>';
577
+					}
578
+					echo '</table>
579 579
 				<span class="at-re-toggle"><img src="';
580
-                    if ($this->_Local_images) {
581
-                        echo $plugin_path . '/images/edit.png';
582
-                    } else {
583
-                        echo 'http://i.imgur.com/ka0E2.png';
584
-                    }
585
-                    echo '" alt="Edit" title="Edit"/></span> 
580
+					if ($this->_Local_images) {
581
+						echo $plugin_path . '/images/edit.png';
582
+					} else {
583
+						echo 'http://i.imgur.com/ka0E2.png';
584
+					}
585
+					echo '" alt="Edit" title="Edit"/></span> 
586 586
 				<img src="';
587
-                    if ($this->_Local_images) {
588
-                        echo $plugin_path . '/images/remove.png';
589
-                    } else {
590
-                        echo 'http://i.imgur.com/g8Duj.png';
591
-                    }
592
-                    echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
593
-                    $c = $c + 1;
594
-
595
-                }
596
-                $this->show_field_end($field, $meta);
597
-            }
598
-
599
-            echo '<img src="';
600
-            if ($this->_Local_images) {
601
-                echo $plugin_path . '/images/add.png';
602
-            } else {
603
-                echo 'http://i.imgur.com/w5Tuc.png';
604
-            }
605
-            echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
606
-
607
-            //create all fields once more for js function and catch with object buffer
608
-            ob_start();
609
-            echo '<div class="at-repater-block"><table class="repeater-table">';
610
-            if ($field['inline']) {
611
-                echo '<tr class="at-inline" VALIGN="top">';
612
-            }
613
-            foreach ($field['fields'] as $f) {
614
-                //reset var $id for repeater
615
-                $id = '';
616
-                $id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
617
-                $f['id'] = $id;
618
-                if (!$field['inline']) {
619
-                    echo '<tr>';
620
-                }
621
-                call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
622
-                if (!$field['inline']) {
623
-                    echo '</tr>';
624
-                }
625
-            }
626
-            if ($field['inline']) {
627
-                echo '</tr>';
628
-            }
629
-            echo '</table><img src="';
630
-            if ($this->_Local_images) {
631
-                echo $plugin_path . '/images/remove.png';
632
-            } else {
633
-                echo 'http://i.imgur.com/g8Duj.png';
634
-            }
635
-            echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
-            $counter = 'countadd_' . $field['id'];
637
-            $js_code = ob_get_clean();
638
-            $js_code = str_replace("'", "\"", $js_code);
639
-            $js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
640
-            echo '<script>
587
+					if ($this->_Local_images) {
588
+						echo $plugin_path . '/images/remove.png';
589
+					} else {
590
+						echo 'http://i.imgur.com/g8Duj.png';
591
+					}
592
+					echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
593
+					$c = $c + 1;
594
+
595
+				}
596
+				$this->show_field_end($field, $meta);
597
+			}
598
+
599
+			echo '<img src="';
600
+			if ($this->_Local_images) {
601
+				echo $plugin_path . '/images/add.png';
602
+			} else {
603
+				echo 'http://i.imgur.com/w5Tuc.png';
604
+			}
605
+			echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
606
+
607
+			//create all fields once more for js function and catch with object buffer
608
+			ob_start();
609
+			echo '<div class="at-repater-block"><table class="repeater-table">';
610
+			if ($field['inline']) {
611
+				echo '<tr class="at-inline" VALIGN="top">';
612
+			}
613
+			foreach ($field['fields'] as $f) {
614
+				//reset var $id for repeater
615
+				$id = '';
616
+				$id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
617
+				$f['id'] = $id;
618
+				if (!$field['inline']) {
619
+					echo '<tr>';
620
+				}
621
+				call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
622
+				if (!$field['inline']) {
623
+					echo '</tr>';
624
+				}
625
+			}
626
+			if ($field['inline']) {
627
+				echo '</tr>';
628
+			}
629
+			echo '</table><img src="';
630
+			if ($this->_Local_images) {
631
+				echo $plugin_path . '/images/remove.png';
632
+			} else {
633
+				echo 'http://i.imgur.com/g8Duj.png';
634
+			}
635
+			echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
+			$counter = 'countadd_' . $field['id'];
637
+			$js_code = ob_get_clean();
638
+			$js_code = str_replace("'", "\"", $js_code);
639
+			$js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
640
+			echo '<script>
641 641
 				jQuery(document).ready(function() {
642 642
 					var ' . $counter . ' = ' . $c . ';
643 643
 					jQuery("#add-' . $field['id'] . '").live(\'click\', function() {
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         			});
651 651
     			});
652 652
     		</script>';
653
-            echo '<br/><style>
653
+			echo '<br/><style>
654 654
 .at-inline{line-height: 1 !important;}
655 655
 .at-inline .at-field{border: 0px !important;}
656 656
 .at-inline .at-label{margin: 0 0 1px !important;}
@@ -658,531 +658,531 @@  discard block
 block discarded – undo
658 658
 .at-inline .at-textarea{width: 100px; height: 75px;}
659 659
 .at-repater-block{background-color: #FFFFFF;border: 1px solid;margin: 2px;}
660 660
 </style>';
661
-            $this->show_field_end($field, $meta);
662
-        }
663
-
664
-        /**
665
-         * Begin Field.
666
-         *
667
-         * @param string $field
668
-         * @param string $meta
669
-         * @since 1.0
670
-         * @access public
671
-         */
672
-        public function show_field_begin($field, $meta)
673
-        {
674
-            if (isset($field['group'])) {
675
-                if ($field['group'] == "start") {
676
-                    echo "<td class='at-field'>";
677
-                }
678
-            } else {
679
-                if ($this->_form_type == 'edit') {
680
-                    echo '<th valign="top" scope="row">';
681
-                } else {
682
-                    if ($field['validate_func']) {
683
-                        echo '<td><div class="form-field form-required">';
684
-                    } else {
685
-                        echo '<td><div class="form-field">';
686
-                    }
687
-                }
688
-            }
689
-            if ($field['name'] != '' || $field['name'] != FALSE) {
690
-                //echo "<div class='at-label'>";
691
-                echo "<label for='{$field['id']}'>{$field['name']}</label>";
692
-                //echo "</div>";
693
-            }
694
-            if ($this->_form_type == 'edit') {
695
-                echo '</th><td>';
696
-            }
697
-        }
698
-
699
-        /**
700
-         * End Field.
701
-         *
702
-         * @param string $field
703
-         * @param string $meta
704
-         * @since 1.0
705
-         * @access public
706
-         */
707
-        public function show_field_end($field, $meta = NULL, $group = false)
708
-        {
709
-            if (isset($field['group'])) {
710
-                if ($group == 'end') {
711
-                    if ($field['desc'] != '') {
712
-                        echo "<p class='desc-field'>{$field['desc']}</p></td>";
713
-                    } else {
714
-                        echo "</td>";
715
-                    }
716
-                } else {
717
-                    if ($field['desc'] != '') {
718
-                        echo "<p class='desc-field'>{$field['desc']}</p><br/>";
719
-                    } else {
720
-                        echo '<br/>';
721
-                    }
722
-                }
723
-            } else {
724
-                if ($field['desc'] != '') {
725
-                    echo "<p class='desc-field'>{$field['desc']}</p>";
726
-                }
727
-                if ($this->_form_type == 'edit') {
728
-                    echo '</td>';
729
-                } else {
730
-                    echo '</td></div>';
731
-                }
732
-            }
733
-        }
734
-
735
-        /**
736
-         * Show Field Text.
737
-         *
738
-         * @param string $field
739
-         * @param string $meta
740
-         * @since 1.0
741
-         * @access public
742
-         */
743
-        public function show_field_text($field, $meta)
744
-        {
745
-            $this->show_field_begin($field, $meta);
746
-            echo "<input type='text' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='30' />";
747
-            $this->show_field_end($field, $meta);
748
-        }
749
-
750
-        /**
751
-         * Show Field hidden.
752
-         *
753
-         * @param string $field
754
-         * @param string|mixed $meta
755
-         * @since 0.1.3
756
-         * @access public
757
-         */
758
-        public function show_field_hidden($field, $meta)
759
-        {
760
-            //$this->show_field_begin( $field, $meta );
761
-            echo "<input type='hidden' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}'/>";
762
-            //$this->show_field_end( $field, $meta );
763
-        }
764
-
765
-        /**
766
-         * Show Field Paragraph.
767
-         *
768
-         * @param string $field
769
-         * @since 0.1.3
770
-         * @access public
771
-         */
772
-        public function show_field_paragraph($field)
773
-        {
774
-            //$this->show_field_begin( $field, $meta );
775
-            echo '<p>' . $field['value'] . '</p>';
776
-            //$this->show_field_end( $field, $meta );
777
-        }
778
-
779
-        /**
780
-         * Show Field Textarea.
781
-         *
782
-         * @param string $field
783
-         * @param string $meta
784
-         * @since 1.0
785
-         * @access public
786
-         */
787
-        public function show_field_textarea($field, $meta)
788
-        {
789
-            $this->show_field_begin($field, $meta);
790
-            echo "<textarea class='at-textarea large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
791
-            $this->show_field_end($field, $meta);
792
-        }
793
-
794
-        /**
795
-         * Show Field Select.
796
-         *
797
-         * @param string $field
798
-         * @param string $meta
799
-         * @since 1.0
800
-         * @access public
801
-         */
802
-        public function show_field_select($field, $meta)
803
-        {
804
-
805
-            if (!is_array($meta))
806
-                $meta = (array)$meta;
807
-
808
-            $this->show_field_begin($field, $meta);
809
-            echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
810
-            foreach ($field['options'] as $key => $value) {
811
-                echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
812
-            }
813
-            echo "</select>";
814
-            $this->show_field_end($field, $meta);
815
-
816
-        }
817
-
818
-        /**
819
-         * Show Radio Field.
820
-         *
821
-         * @param string $field
822
-         * @param string $meta
823
-         * @since 1.0
824
-         * @access public
825
-         */
826
-        public function show_field_radio($field, $meta)
827
-        {
828
-
829
-            if (!is_array($meta))
830
-                $meta = (array)$meta;
831
-
832
-            $this->show_field_begin($field, $meta);
833
-            foreach ($field['options'] as $key => $value) {
834
-                echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>";
835
-            }
836
-            $this->show_field_end($field, $meta);
837
-        }
838
-
839
-        /**
840
-         * Show Checkbox Field.
841
-         *
842
-         * @param string $field
843
-         * @param string $meta
844
-         * @since 1.0
845
-         * @access public
846
-         */
847
-        public function show_field_checkbox($field, $meta)
848
-        {
849
-
850
-            $this->show_field_begin($field, $meta);
851
-            echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}";
852
-            $this->show_field_end($field, $meta);
853
-        }
854
-
855
-        /**
856
-         * Show Wysiwig Field.
857
-         *
858
-         * @param string $field
859
-         * @param string $meta
860
-         * @since 1.0
861
-         * @access public
862
-         */
863
-        public function show_field_wysiwyg($field, $meta)
864
-        {
865
-            $this->show_field_begin($field, $meta);
866
-            // Add TinyMCE script for WP version < 3.3
867
-            global $wp_version;
868
-
869
-            if (version_compare($wp_version, '3.2.1') < 1) {
870
-                echo "<textarea class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
871
-            } else {
872
-                // Use new wp_editor() since WP 3.3
873
-                wp_editor(stripslashes(html_entity_decode($meta)), $field['id'], array('editor_class' => 'at-wysiwyg'));
874
-            }
875
-            $this->show_field_end($field, $meta);
876
-        }
877
-
878
-        /**
879
-         * Show File Field.
880
-         *
881
-         * @global object $post The current post object.
882
-         * @param string $field
883
-         * @param string $meta
884
-         * @since 1.0
885
-         * @access public
886
-         */
887
-        public function show_field_file($field, $meta)
888
-        {
889
-
890
-            global $post;
891
-
892
-            if (!is_array($meta))
893
-                $meta = (array)$meta;
894
-
895
-            $this->show_field_begin($field, $meta);
896
-            echo "{$field['desc']}<br />";
897
-
898
-            if (!empty($meta)) {
899
-                $nonce = wp_create_nonce('at_ajax_delete');
900
-                echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
901
-                echo '<ol class="at-upload">';
902
-                foreach ($meta as $att) {
903
-                    // if (wp_attachment_is_image($att)) continue; // what's image uploader for?
904
-                    echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>";
905
-                }
906
-                echo '</ol>';
907
-            }
908
-
909
-            // show form upload
910
-
911
-            echo "<div class='at-file-upload-label'>";
912
-            echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
913
-            echo "</div>";
914
-            echo "<div class='new-files'>";
915
-            echo "<div class='file-input'>";
916
-            echo "<input type='file' name='{$field['id']}[]' />";
917
-            echo "</div><!-- End .file-input -->";
918
-            echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
919
-            echo "</div><!-- End .new-files -->";
920
-            echo "</td>";
921
-            $this->show_field_end($field, $meta);
922
-        }
923
-
924
-        /**
925
-         * Show Image Field.
926
-         *
927
-         * @param array $field
928
-         * @param array $meta
929
-         * @since 1.0
930
-         * @access public
931
-         */
932
-        public function show_field_image($field, $meta)
933
-        {
934
-            $this->show_field_begin($field, $meta);
935
-            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936
-            if (is_array($meta)) {
937
-                if (isset($meta[0]) && is_array($meta[0]))
938
-                    $meta = $meta[0];
939
-            }
940
-
941
-            $uploads = wp_upload_dir();
942
-            if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') {
943
-                $file_info = pathinfo($meta['src']);
944
-
945
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
946
-                    $sub_dir = $file_info['dirname'];
947
-
948
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
949
-                $uploads_baseurl = $uploads['baseurl'];
950
-                $uploads_path = $uploads['path'];
951
-
952
-                $file_name = $file_info['basename'];
953
-
954
-                if (strpos($sub_dir, 'https://') !== false) {
955
-                    $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
956
-                } else {
957
-                    $uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
958
-                }
959
-                $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
960
-
961
-                $uploads_url = $uploads_baseurl . $sub_dir;
962
-
963
-                $meta['src'] = $uploads_url . '/' . $file_name;
964
-
965
-                $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
-                $html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
-                $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
969
-            } else {
970
-                $html .= "<span class='mupload_img_holder'></span>";
971
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
-                $html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
-                $html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
974
-            }
975
-            echo $html;
976
-            $this->show_field_end($field, $meta);
977
-        }
978
-
979
-        /**
980
-         * Show Color Field.
981
-         *
982
-         * @param string $field
983
-         * @param string $meta
984
-         * @since 1.0
985
-         * @access public
986
-         */
987
-        public function show_field_color($field, $meta)
988
-        {
989
-
990
-            if (empty($meta))
991
-                $meta = '#';
992
-
993
-            $this->show_field_begin($field, $meta);
994
-
995
-            echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996
-            //	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
-            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
998
-            echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999
-            $this->show_field_end($field, $meta);
1000
-
1001
-        }
1002
-
1003
-        /**
1004
-         * Show Checkbox List Field
1005
-         *
1006
-         * @param string $field
1007
-         * @param string $meta
1008
-         * @since 1.0
1009
-         * @access public
1010
-         */
1011
-        public function show_field_checkbox_list($field, $meta)
1012
-        {
1013
-
1014
-            if (!is_array($meta))
1015
-                $meta = (array)$meta;
1016
-
1017
-            $this->show_field_begin($field, $meta);
1018
-
1019
-            $html = array();
1020
-
1021
-            foreach ($field['options'] as $key => $value) {
1022
-                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1023
-            }
1024
-
1025
-            echo implode('<br />', $html);
1026
-
1027
-            $this->show_field_end($field, $meta);
1028
-
1029
-        }
1030
-
1031
-        /**
1032
-         * Show Date Field.
1033
-         *
1034
-         * @param string $field
1035
-         * @param string $meta
1036
-         * @since 1.0
1037
-         * @access public
1038
-         */
1039
-        public function show_field_date($field, $meta)
1040
-        {
1041
-            $this->show_field_begin($field, $meta);
1042
-            echo "<input type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1043
-            $this->show_field_end($field, $meta);
1044
-        }
1045
-
1046
-        /**
1047
-         * Show time field.
1048
-         *
1049
-         * @param string $field
1050
-         * @param string $meta
1051
-         * @since 1.0
1052
-         * @access public
1053
-         */
1054
-        public function show_field_time($field, $meta)
1055
-        {
1056
-            $this->show_field_begin($field, $meta);
1057
-            echo "<input type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1058
-            $this->show_field_end($field, $meta);
1059
-        }
1060
-
1061
-        /**
1062
-         * Show Posts field.
1063
-         * used creating a posts/pages/custom types checkboxlist or a select dropdown
1064
-         *
1065
-         * @global object $post The current post object.
1066
-         * @param string $field
1067
-         * @param string $meta
1068
-         * @since 1.0
1069
-         * @access public
1070
-         */
1071
-        public function show_field_posts($field, $meta)
1072
-        {
1073
-            global $post;
1074
-
1075
-            if (!is_array($meta)) $meta = (array)$meta;
1076
-            $this->show_field_begin($field, $meta);
1077
-            $options = $field['options'];
1078
-            $posts = get_posts($options['args']);
1079
-
1080
-            // checkbox_list
1081
-            if ('checkbox_list' == $options['type']) {
1082
-                foreach ($posts as $p) {
1083
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1084
-                }
1085
-            } // select
1086
-            else {
1087
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1088
-                foreach ($posts as $p) {
1089
-                    echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1090
-                }
1091
-                echo "</select>";
1092
-            }
1093
-
1094
-            $this->show_field_end($field, $meta);
1095
-        }
1096
-
1097
-        /**
1098
-         * Show Taxonomy field.
1099
-         * used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
1100
-         *
1101
-         * @global object $post The current post object.
1102
-         * @param string $field
1103
-         * @param string $meta
1104
-         * @since 1.0
1105
-         * @access public
1106
-         *
1107
-         * @uses get_terms()
1108
-         */
1109
-        public function show_field_taxonomy($field, $meta)
1110
-        {
1111
-            global $post;
1112
-
1113
-            if (!is_array($meta)) $meta = (array)$meta;
1114
-            $this->show_field_begin($field, $meta);
1115
-            $options = $field['options'];
1116
-            $terms = get_terms($options['taxonomy'], $options['args']);
1117
-
1118
-            // checkbox_list
1119
-            if ('checkbox_list' == $options['type']) {
1120
-                foreach ($terms as $term) {
1121
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1122
-                }
1123
-            } // select
1124
-            else {
1125
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1126
-                foreach ($terms as $term) {
1127
-                    echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1128
-                }
1129
-                echo "</select>";
1130
-            }
1131
-
1132
-            $this->show_field_end($field, $meta);
1133
-        }
1134
-
1135
-        /**
1136
-         * Save Data from Metabox
1137
-         *
1138
-         * @param string $term_id The term ID.
1139
-         * @since 1.0
1140
-         * @access public
1141
-         * @return string
1142
-         */
1143
-        public function save($term_id)
1144
-        {
1145
-
1146
-            $taxnow = '';
1147
-            if (isset($_POST['taxonomy']))
1148
-                $taxnow = $_POST['taxonomy'];
1149
-
1150
-            if (!isset($term_id)                                                        // Check Revision
1151
-                || (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1152
-                || (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1153
-                || (!current_user_can('manage_categories'))
1154
-            )                                // Check permission
1155
-            {
1156
-                return $term_id;
1157
-            }
1158
-
1159
-
1160
-            foreach ($this->_fields as $field) {
1161
-
1162
-                $name = $field['id'];
1163
-                $type = $field['type'];
1164
-                $old = $this->get_tax_meta($term_id, $name, !$field['multiple']);
1165
-                $new = (isset($_POST[$name])) ? $_POST[$name] : (($field['multiple']) ? array() : '');
1166
-
1167
-                // Validate meta value
1168
-                if (class_exists('Tax_Meta_Validate') && method_exists('Tax_Meta_Validate', $field['validate_func'])) {
1169
-                    $new = call_user_func(array('Tax_Meta_Validate', $field['validate_func']), $new);
1170
-                }
1171
-
1172
-
1173
-                if ($name == 'ct_cat_icon') {
1174
-
1175
-                    $upload_dir = wp_upload_dir();
1176
-
1177
-                    $image_name_arr = explode('/', $new['src']);
1178
-                    //$old_filename = end($image_name_arr);
1179
-                    //$img_name_arr = explode('.',$old_filename);
1180
-
1181
-                    //$old_filename = $upload_dir['path'].'/'.$old_filename;
1182
-
1183
-                    $new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1184
-
1185
-                    /*rename($old_filename, $new_filename);
661
+			$this->show_field_end($field, $meta);
662
+		}
663
+
664
+		/**
665
+		 * Begin Field.
666
+		 *
667
+		 * @param string $field
668
+		 * @param string $meta
669
+		 * @since 1.0
670
+		 * @access public
671
+		 */
672
+		public function show_field_begin($field, $meta)
673
+		{
674
+			if (isset($field['group'])) {
675
+				if ($field['group'] == "start") {
676
+					echo "<td class='at-field'>";
677
+				}
678
+			} else {
679
+				if ($this->_form_type == 'edit') {
680
+					echo '<th valign="top" scope="row">';
681
+				} else {
682
+					if ($field['validate_func']) {
683
+						echo '<td><div class="form-field form-required">';
684
+					} else {
685
+						echo '<td><div class="form-field">';
686
+					}
687
+				}
688
+			}
689
+			if ($field['name'] != '' || $field['name'] != FALSE) {
690
+				//echo "<div class='at-label'>";
691
+				echo "<label for='{$field['id']}'>{$field['name']}</label>";
692
+				//echo "</div>";
693
+			}
694
+			if ($this->_form_type == 'edit') {
695
+				echo '</th><td>';
696
+			}
697
+		}
698
+
699
+		/**
700
+		 * End Field.
701
+		 *
702
+		 * @param string $field
703
+		 * @param string $meta
704
+		 * @since 1.0
705
+		 * @access public
706
+		 */
707
+		public function show_field_end($field, $meta = NULL, $group = false)
708
+		{
709
+			if (isset($field['group'])) {
710
+				if ($group == 'end') {
711
+					if ($field['desc'] != '') {
712
+						echo "<p class='desc-field'>{$field['desc']}</p></td>";
713
+					} else {
714
+						echo "</td>";
715
+					}
716
+				} else {
717
+					if ($field['desc'] != '') {
718
+						echo "<p class='desc-field'>{$field['desc']}</p><br/>";
719
+					} else {
720
+						echo '<br/>';
721
+					}
722
+				}
723
+			} else {
724
+				if ($field['desc'] != '') {
725
+					echo "<p class='desc-field'>{$field['desc']}</p>";
726
+				}
727
+				if ($this->_form_type == 'edit') {
728
+					echo '</td>';
729
+				} else {
730
+					echo '</td></div>';
731
+				}
732
+			}
733
+		}
734
+
735
+		/**
736
+		 * Show Field Text.
737
+		 *
738
+		 * @param string $field
739
+		 * @param string $meta
740
+		 * @since 1.0
741
+		 * @access public
742
+		 */
743
+		public function show_field_text($field, $meta)
744
+		{
745
+			$this->show_field_begin($field, $meta);
746
+			echo "<input type='text' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='30' />";
747
+			$this->show_field_end($field, $meta);
748
+		}
749
+
750
+		/**
751
+		 * Show Field hidden.
752
+		 *
753
+		 * @param string $field
754
+		 * @param string|mixed $meta
755
+		 * @since 0.1.3
756
+		 * @access public
757
+		 */
758
+		public function show_field_hidden($field, $meta)
759
+		{
760
+			//$this->show_field_begin( $field, $meta );
761
+			echo "<input type='hidden' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}'/>";
762
+			//$this->show_field_end( $field, $meta );
763
+		}
764
+
765
+		/**
766
+		 * Show Field Paragraph.
767
+		 *
768
+		 * @param string $field
769
+		 * @since 0.1.3
770
+		 * @access public
771
+		 */
772
+		public function show_field_paragraph($field)
773
+		{
774
+			//$this->show_field_begin( $field, $meta );
775
+			echo '<p>' . $field['value'] . '</p>';
776
+			//$this->show_field_end( $field, $meta );
777
+		}
778
+
779
+		/**
780
+		 * Show Field Textarea.
781
+		 *
782
+		 * @param string $field
783
+		 * @param string $meta
784
+		 * @since 1.0
785
+		 * @access public
786
+		 */
787
+		public function show_field_textarea($field, $meta)
788
+		{
789
+			$this->show_field_begin($field, $meta);
790
+			echo "<textarea class='at-textarea large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
791
+			$this->show_field_end($field, $meta);
792
+		}
793
+
794
+		/**
795
+		 * Show Field Select.
796
+		 *
797
+		 * @param string $field
798
+		 * @param string $meta
799
+		 * @since 1.0
800
+		 * @access public
801
+		 */
802
+		public function show_field_select($field, $meta)
803
+		{
804
+
805
+			if (!is_array($meta))
806
+				$meta = (array)$meta;
807
+
808
+			$this->show_field_begin($field, $meta);
809
+			echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
810
+			foreach ($field['options'] as $key => $value) {
811
+				echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
812
+			}
813
+			echo "</select>";
814
+			$this->show_field_end($field, $meta);
815
+
816
+		}
817
+
818
+		/**
819
+		 * Show Radio Field.
820
+		 *
821
+		 * @param string $field
822
+		 * @param string $meta
823
+		 * @since 1.0
824
+		 * @access public
825
+		 */
826
+		public function show_field_radio($field, $meta)
827
+		{
828
+
829
+			if (!is_array($meta))
830
+				$meta = (array)$meta;
831
+
832
+			$this->show_field_begin($field, $meta);
833
+			foreach ($field['options'] as $key => $value) {
834
+				echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>";
835
+			}
836
+			$this->show_field_end($field, $meta);
837
+		}
838
+
839
+		/**
840
+		 * Show Checkbox Field.
841
+		 *
842
+		 * @param string $field
843
+		 * @param string $meta
844
+		 * @since 1.0
845
+		 * @access public
846
+		 */
847
+		public function show_field_checkbox($field, $meta)
848
+		{
849
+
850
+			$this->show_field_begin($field, $meta);
851
+			echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}";
852
+			$this->show_field_end($field, $meta);
853
+		}
854
+
855
+		/**
856
+		 * Show Wysiwig Field.
857
+		 *
858
+		 * @param string $field
859
+		 * @param string $meta
860
+		 * @since 1.0
861
+		 * @access public
862
+		 */
863
+		public function show_field_wysiwyg($field, $meta)
864
+		{
865
+			$this->show_field_begin($field, $meta);
866
+			// Add TinyMCE script for WP version < 3.3
867
+			global $wp_version;
868
+
869
+			if (version_compare($wp_version, '3.2.1') < 1) {
870
+				echo "<textarea class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
871
+			} else {
872
+				// Use new wp_editor() since WP 3.3
873
+				wp_editor(stripslashes(html_entity_decode($meta)), $field['id'], array('editor_class' => 'at-wysiwyg'));
874
+			}
875
+			$this->show_field_end($field, $meta);
876
+		}
877
+
878
+		/**
879
+		 * Show File Field.
880
+		 *
881
+		 * @global object $post The current post object.
882
+		 * @param string $field
883
+		 * @param string $meta
884
+		 * @since 1.0
885
+		 * @access public
886
+		 */
887
+		public function show_field_file($field, $meta)
888
+		{
889
+
890
+			global $post;
891
+
892
+			if (!is_array($meta))
893
+				$meta = (array)$meta;
894
+
895
+			$this->show_field_begin($field, $meta);
896
+			echo "{$field['desc']}<br />";
897
+
898
+			if (!empty($meta)) {
899
+				$nonce = wp_create_nonce('at_ajax_delete');
900
+				echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
901
+				echo '<ol class="at-upload">';
902
+				foreach ($meta as $att) {
903
+					// if (wp_attachment_is_image($att)) continue; // what's image uploader for?
904
+					echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>";
905
+				}
906
+				echo '</ol>';
907
+			}
908
+
909
+			// show form upload
910
+
911
+			echo "<div class='at-file-upload-label'>";
912
+			echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
913
+			echo "</div>";
914
+			echo "<div class='new-files'>";
915
+			echo "<div class='file-input'>";
916
+			echo "<input type='file' name='{$field['id']}[]' />";
917
+			echo "</div><!-- End .file-input -->";
918
+			echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
919
+			echo "</div><!-- End .new-files -->";
920
+			echo "</td>";
921
+			$this->show_field_end($field, $meta);
922
+		}
923
+
924
+		/**
925
+		 * Show Image Field.
926
+		 *
927
+		 * @param array $field
928
+		 * @param array $meta
929
+		 * @since 1.0
930
+		 * @access public
931
+		 */
932
+		public function show_field_image($field, $meta)
933
+		{
934
+			$this->show_field_begin($field, $meta);
935
+			$html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936
+			if (is_array($meta)) {
937
+				if (isset($meta[0]) && is_array($meta[0]))
938
+					$meta = $meta[0];
939
+			}
940
+
941
+			$uploads = wp_upload_dir();
942
+			if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') {
943
+				$file_info = pathinfo($meta['src']);
944
+
945
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
946
+					$sub_dir = $file_info['dirname'];
947
+
948
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
949
+				$uploads_baseurl = $uploads['baseurl'];
950
+				$uploads_path = $uploads['path'];
951
+
952
+				$file_name = $file_info['basename'];
953
+
954
+				if (strpos($sub_dir, 'https://') !== false) {
955
+					$uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
956
+				} else {
957
+					$uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
958
+				}
959
+				$sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
960
+
961
+				$uploads_url = $uploads_baseurl . $sub_dir;
962
+
963
+				$meta['src'] = $uploads_url . '/' . $file_name;
964
+
965
+				$html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
+				$html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
+				$html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
+				$html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
969
+			} else {
970
+				$html .= "<span class='mupload_img_holder'></span>";
971
+				$html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
+				$html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
+				$html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
974
+			}
975
+			echo $html;
976
+			$this->show_field_end($field, $meta);
977
+		}
978
+
979
+		/**
980
+		 * Show Color Field.
981
+		 *
982
+		 * @param string $field
983
+		 * @param string $meta
984
+		 * @since 1.0
985
+		 * @access public
986
+		 */
987
+		public function show_field_color($field, $meta)
988
+		{
989
+
990
+			if (empty($meta))
991
+				$meta = '#';
992
+
993
+			$this->show_field_begin($field, $meta);
994
+
995
+			echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996
+			//	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
+			echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
998
+			echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999
+			$this->show_field_end($field, $meta);
1000
+
1001
+		}
1002
+
1003
+		/**
1004
+		 * Show Checkbox List Field
1005
+		 *
1006
+		 * @param string $field
1007
+		 * @param string $meta
1008
+		 * @since 1.0
1009
+		 * @access public
1010
+		 */
1011
+		public function show_field_checkbox_list($field, $meta)
1012
+		{
1013
+
1014
+			if (!is_array($meta))
1015
+				$meta = (array)$meta;
1016
+
1017
+			$this->show_field_begin($field, $meta);
1018
+
1019
+			$html = array();
1020
+
1021
+			foreach ($field['options'] as $key => $value) {
1022
+				$html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1023
+			}
1024
+
1025
+			echo implode('<br />', $html);
1026
+
1027
+			$this->show_field_end($field, $meta);
1028
+
1029
+		}
1030
+
1031
+		/**
1032
+		 * Show Date Field.
1033
+		 *
1034
+		 * @param string $field
1035
+		 * @param string $meta
1036
+		 * @since 1.0
1037
+		 * @access public
1038
+		 */
1039
+		public function show_field_date($field, $meta)
1040
+		{
1041
+			$this->show_field_begin($field, $meta);
1042
+			echo "<input type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1043
+			$this->show_field_end($field, $meta);
1044
+		}
1045
+
1046
+		/**
1047
+		 * Show time field.
1048
+		 *
1049
+		 * @param string $field
1050
+		 * @param string $meta
1051
+		 * @since 1.0
1052
+		 * @access public
1053
+		 */
1054
+		public function show_field_time($field, $meta)
1055
+		{
1056
+			$this->show_field_begin($field, $meta);
1057
+			echo "<input type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1058
+			$this->show_field_end($field, $meta);
1059
+		}
1060
+
1061
+		/**
1062
+		 * Show Posts field.
1063
+		 * used creating a posts/pages/custom types checkboxlist or a select dropdown
1064
+		 *
1065
+		 * @global object $post The current post object.
1066
+		 * @param string $field
1067
+		 * @param string $meta
1068
+		 * @since 1.0
1069
+		 * @access public
1070
+		 */
1071
+		public function show_field_posts($field, $meta)
1072
+		{
1073
+			global $post;
1074
+
1075
+			if (!is_array($meta)) $meta = (array)$meta;
1076
+			$this->show_field_begin($field, $meta);
1077
+			$options = $field['options'];
1078
+			$posts = get_posts($options['args']);
1079
+
1080
+			// checkbox_list
1081
+			if ('checkbox_list' == $options['type']) {
1082
+				foreach ($posts as $p) {
1083
+					echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1084
+				}
1085
+			} // select
1086
+			else {
1087
+				echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1088
+				foreach ($posts as $p) {
1089
+					echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1090
+				}
1091
+				echo "</select>";
1092
+			}
1093
+
1094
+			$this->show_field_end($field, $meta);
1095
+		}
1096
+
1097
+		/**
1098
+		 * Show Taxonomy field.
1099
+		 * used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
1100
+		 *
1101
+		 * @global object $post The current post object.
1102
+		 * @param string $field
1103
+		 * @param string $meta
1104
+		 * @since 1.0
1105
+		 * @access public
1106
+		 *
1107
+		 * @uses get_terms()
1108
+		 */
1109
+		public function show_field_taxonomy($field, $meta)
1110
+		{
1111
+			global $post;
1112
+
1113
+			if (!is_array($meta)) $meta = (array)$meta;
1114
+			$this->show_field_begin($field, $meta);
1115
+			$options = $field['options'];
1116
+			$terms = get_terms($options['taxonomy'], $options['args']);
1117
+
1118
+			// checkbox_list
1119
+			if ('checkbox_list' == $options['type']) {
1120
+				foreach ($terms as $term) {
1121
+					echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1122
+				}
1123
+			} // select
1124
+			else {
1125
+				echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1126
+				foreach ($terms as $term) {
1127
+					echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1128
+				}
1129
+				echo "</select>";
1130
+			}
1131
+
1132
+			$this->show_field_end($field, $meta);
1133
+		}
1134
+
1135
+		/**
1136
+		 * Save Data from Metabox
1137
+		 *
1138
+		 * @param string $term_id The term ID.
1139
+		 * @since 1.0
1140
+		 * @access public
1141
+		 * @return string
1142
+		 */
1143
+		public function save($term_id)
1144
+		{
1145
+
1146
+			$taxnow = '';
1147
+			if (isset($_POST['taxonomy']))
1148
+				$taxnow = $_POST['taxonomy'];
1149
+
1150
+			if (!isset($term_id)                                                        // Check Revision
1151
+				|| (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1152
+				|| (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1153
+				|| (!current_user_can('manage_categories'))
1154
+			)                                // Check permission
1155
+			{
1156
+				return $term_id;
1157
+			}
1158
+
1159
+
1160
+			foreach ($this->_fields as $field) {
1161
+
1162
+				$name = $field['id'];
1163
+				$type = $field['type'];
1164
+				$old = $this->get_tax_meta($term_id, $name, !$field['multiple']);
1165
+				$new = (isset($_POST[$name])) ? $_POST[$name] : (($field['multiple']) ? array() : '');
1166
+
1167
+				// Validate meta value
1168
+				if (class_exists('Tax_Meta_Validate') && method_exists('Tax_Meta_Validate', $field['validate_func'])) {
1169
+					$new = call_user_func(array('Tax_Meta_Validate', $field['validate_func']), $new);
1170
+				}
1171
+
1172
+
1173
+				if ($name == 'ct_cat_icon') {
1174
+
1175
+					$upload_dir = wp_upload_dir();
1176
+
1177
+					$image_name_arr = explode('/', $new['src']);
1178
+					//$old_filename = end($image_name_arr);
1179
+					//$img_name_arr = explode('.',$old_filename);
1180
+
1181
+					//$old_filename = $upload_dir['path'].'/'.$old_filename;
1182
+
1183
+					$new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1184
+
1185
+					/*rename($old_filename, $new_filename);
1186 1186
 				
1187 1187
 				//subdir
1188 1188
 				$new['src'] = $upload_dir['url'].'/'.'cat_icon_'.$term_id.'.png';
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 				update_attached_file( $new['id'], $new['src'] );*/
1191 1191
 
1192 1192
 
1193
-                    /*	
1193
+					/*	
1194 1194
 		
1195 1195
 		$new['src'] = $upload_dir['url'].'/'.'cat_icon_'.$term_id.'.png';
1196 1196
 		
@@ -1215,67 +1215,67 @@  discard block
 block discarded – undo
1215 1215
 		$attach_id = wp_insert_attachment( $attachment, $filename);*/
1216 1216
 
1217 1217
 
1218
-                }
1219
-
1220
-
1221
-                //skip on Paragraph field
1222
-                if ($type != "paragraph") {
1223
-
1224
-                    // Call defined method to save meta value, if there's no methods, call common one.
1225
-                    $save_func = 'save_field_' . $type;
1226
-                    if (method_exists($this, $save_func)) {
1227
-                        call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1228
-                    } else {
1229
-                        $this->save_field($term_id, $field, $old, $new);
1230
-                    }
1231
-                }
1232
-
1233
-            } // End foreach
1234
-
1235
-        }
1236
-
1237
-        /**
1238
-         * Common function for saving fields.
1239
-         *
1240
-         * @param string $term_id The term ID.
1241
-         * @param string $field
1242
-         * @param string $old
1243
-         * @param string|mixed $new
1244
-         * @since 1.0
1245
-         * @access public
1246
-         */
1247
-        public function save_field($term_id, $field, $old, $new)
1248
-        {
1249
-            $name = $field['id'];
1250
-            $this->delete_tax_meta($term_id, $name);
1251
-            if ($new === '' || $new === array())
1252
-                return;
1253
-
1254
-            $this->update_tax_meta($term_id, $name, $new);
1255
-        }
1256
-
1257
-        /**
1258
-         * function for saving image field.
1259
-         *
1260
-         * @param string $term_id The term ID.
1261
-         * @param string $field
1262
-         * @param string $old
1263
-         * @param string|mixed $new
1264
-         * @since 1.0
1265
-         * @access public
1266
-         */
1267
-        public function save_field_image($term_id, $field, $old, $new)
1268
-        {
1269
-            $name = $field['id'];
1270
-
1271
-            $this->delete_tax_meta($term_id, $name);
1272
-            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1273
-                return;
1274
-
1275
-            $this->update_tax_meta($term_id, $name, $new);
1276
-        }
1277
-
1278
-        /*
1218
+				}
1219
+
1220
+
1221
+				//skip on Paragraph field
1222
+				if ($type != "paragraph") {
1223
+
1224
+					// Call defined method to save meta value, if there's no methods, call common one.
1225
+					$save_func = 'save_field_' . $type;
1226
+					if (method_exists($this, $save_func)) {
1227
+						call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1228
+					} else {
1229
+						$this->save_field($term_id, $field, $old, $new);
1230
+					}
1231
+				}
1232
+
1233
+			} // End foreach
1234
+
1235
+		}
1236
+
1237
+		/**
1238
+		 * Common function for saving fields.
1239
+		 *
1240
+		 * @param string $term_id The term ID.
1241
+		 * @param string $field
1242
+		 * @param string $old
1243
+		 * @param string|mixed $new
1244
+		 * @since 1.0
1245
+		 * @access public
1246
+		 */
1247
+		public function save_field($term_id, $field, $old, $new)
1248
+		{
1249
+			$name = $field['id'];
1250
+			$this->delete_tax_meta($term_id, $name);
1251
+			if ($new === '' || $new === array())
1252
+				return;
1253
+
1254
+			$this->update_tax_meta($term_id, $name, $new);
1255
+		}
1256
+
1257
+		/**
1258
+		 * function for saving image field.
1259
+		 *
1260
+		 * @param string $term_id The term ID.
1261
+		 * @param string $field
1262
+		 * @param string $old
1263
+		 * @param string|mixed $new
1264
+		 * @since 1.0
1265
+		 * @access public
1266
+		 */
1267
+		public function save_field_image($term_id, $field, $old, $new)
1268
+		{
1269
+			$name = $field['id'];
1270
+
1271
+			$this->delete_tax_meta($term_id, $name);
1272
+			if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1273
+				return;
1274
+
1275
+			$this->update_tax_meta($term_id, $name, $new);
1276
+		}
1277
+
1278
+		/*
1279 1279
 	 * Save Wysiwyg Field.
1280 1280
 	 *
1281 1281
 	 * @param string $term_id The term ID. 
@@ -1285,806 +1285,806 @@  discard block
 block discarded – undo
1285 1285
 	 * @since 1.0
1286 1286
 	 * @access public 
1287 1287
 	 */
1288
-        public function save_field_wysiwyg($term_id, $field, $old, $new)
1289
-        {
1290
-            $this->save_field($term_id, $field, $old, $new);
1291
-        }
1292
-
1293
-        /**
1294
-         * Save repeater Fields.
1295
-         *
1296
-         * @param string $term_id The term ID.
1297
-         * @param string $field
1298
-         * @param string|mixed $old
1299
-         * @param string|mixed $new
1300
-         * @since 1.0
1301
-         * @access public
1302
-         */
1303
-        public function save_field_repeater($term_id, $field, $old, $new)
1304
-        {
1305
-            if (is_array($new) && count($new) > 0) {
1306
-                foreach ($new as $n) {
1307
-                    foreach ($field['fields'] as $f) {
1308
-                        $type = $f['type'];
1309
-                        switch ($type) {
1310
-                            case 'wysiwyg':
1311
-                                $n[$f['id']] = wpautop($n[$f['id']]);
1312
-                                break;
1313
-                            case 'file':
1314
-                                $n[$f['id']] = $this->save_field_file_repeater($term_id, $f, '', $n[$f['id']]);
1315
-                                break;
1316
-                            default:
1317
-                                break;
1318
-                        }
1319
-                    }
1320
-                    if (!$this->is_array_empty($n))
1321
-                        $temp[] = $n;
1322
-                }
1323
-                if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1324
-                    $this->update_tax_meta($term_id, $field['id'], $temp);
1325
-                } else {
1326
-                    //	remove old meta if exists
1327
-                    delete_post_meta($term_id, $field['id']);
1328
-                }
1329
-            } else {
1330
-                //	remove old meta if exists
1331
-                delete_post_meta($term_id, $field['id']);
1332
-            }
1333
-        }
1334
-
1335
-        /**
1336
-         * Save File Field.
1337
-         *
1338
-         * @param string $term_id The term ID.
1339
-         * @param string $field
1340
-         * @param string $old
1341
-         * @param string $new
1342
-         * @since 1.0
1343
-         * @access public
1344
-         */
1345
-        public function save_field_file($term_id, $field, $old, $new)
1346
-        {
1347
-
1348
-            $name = $field['id'];
1349
-            if (empty($_FILES[$name]))
1350
-                return;
1351
-            $this->fix_file_array($_FILES[$name]);
1352
-            foreach ($_FILES[$name] as $position => $fileitem) {
1353
-
1354
-                $file = wp_handle_upload($fileitem, array('test_form' => false));
1355
-                if (empty($file['file']))
1356
-                    continue;
1357
-                $filename = $file['file'];
1358
-
1359
-                $attachment = array(
1360
-                    'post_mime_type' => $file['type'],
1361
-                    'guid' => $file['url'],
1362
-                    'post_parent' => $term_id,
1363
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1364
-                    'post_content' => ''
1365
-                );
1366
-
1367
-                $id = wp_insert_attachment($attachment, $filename, $term_id);
1368
-
1369
-                if (!is_wp_error($id)) {
1370
-
1371
-                    wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
-                    add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1373
-
1374
-                } // End if
1375
-
1376
-            } // End foreach
1377
-
1378
-        }
1379
-
1380
-        /**
1381
-         * Save repeater File Field.
1382
-         * @param string $term_id The term ID.
1383
-         * @param string $field
1384
-         * @param string $old
1385
-         * @param string $new
1386
-         * @since 1.0
1387
-         * @access public
1388
-         * @return int|void
1389
-         */
1390
-        public function save_field_file_repeater($term_id, $field, $old, $new)
1391
-        {
1392
-
1393
-            $name = $field['id'];
1394
-            if (empty($_FILES[$name]))
1395
-                return;
1396
-            $this->fix_file_array($_FILES[$name]);
1397
-            foreach ($_FILES[$name] as $position => $fileitem) {
1398
-
1399
-                $file = wp_handle_upload($fileitem, array('test_form' => false));
1400
-                if (empty($file['file']))
1401
-                    continue;
1402
-                $filename = $file['file'];
1403
-
1404
-                $attachment = array(
1405
-                    'post_mime_type' => $file['type'],
1406
-                    'guid' => $file['url'],
1407
-                    'post_parent' => $term_id,
1408
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1409
-                    'post_content' => ''
1410
-                );
1411
-
1412
-                $id = wp_insert_attachment($attachment, $filename);
1413
-
1414
-                if (!is_wp_error($id)) {
1415
-
1416
-                    wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
-                    return $id;    // return file's url in meta fields
1418
-                } // End if
1419
-            } // End foreach
1420
-        }
1421
-
1422
-        /**
1423
-         * Add missed values for meta box.
1424
-         *
1425
-         * @since 1.0
1426
-         * @access public
1427
-         */
1428
-        public function add_missed_values()
1429
-        {
1430
-
1431
-            // Default values for meta box
1432
-            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1433
-
1434
-            if(is_array($this->_fields)) {
1435
-                // Default values for fields
1436
-                foreach ($this->_fields as &$field) {
1437
-                    $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
1438
-                    $std = $multiple ? array() : '';
1439
-                    $format = 'date' == $field['type'] ? 'yy-mm-dd' : ('time' == $field['type'] ? 'hh:mm' : '');
1440
-                    $field = array_merge(array('multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => ''), $field);
1441
-                } // End foreach
1442
-            }
1443
-        }
1444
-
1445
-        /**
1446
-         * Check if field with $type exists.
1447
-         *
1448
-         * @param string $type
1449
-         * @since 1.0
1450
-         * @access public
1451
-         */
1452
-        public function has_field($type)
1453
-        {
1454
-            if(is_array($this->_fields)) {
1455
-                foreach ($this->_fields as $field) {
1456
-                    if ($type == $field['type'])
1457
-                        return true;
1458
-                }
1459
-            }
1460
-            return false;
1461
-        }
1462
-
1463
-        /**
1464
-         * Check if current page is edit page.
1465
-         *
1466
-         * @since 1.0
1467
-         * @access public
1468
-         */
1469
-        public function is_edit_page()
1470
-        {
1471
-            global $pagenow;
1472
-            return ($pagenow == 'edit-tags.php' || $pagenow == 'term.php');
1473
-        }
1474
-
1475
-        /**
1476
-         * Fixes the odd indexing of multiple file uploads.
1477
-         *
1478
-         * Goes from the format:
1479
-         * $_FILES['field']['key']['index']
1480
-         * to
1481
-         * The More standard and appropriate:
1482
-         * $_FILES['field']['index']['key']
1483
-         *
1484
-         * @param string $files
1485
-         * @since 1.0
1486
-         * @access public
1487
-         */
1488
-        public function fix_file_array(&$files)
1489
-        {
1490
-
1491
-            $output = array();
1492
-
1493
-            foreach ($files as $key => $list) {
1494
-                foreach ($list as $index => $value) {
1495
-                    $output[$index][$key] = $value;
1496
-                }
1497
-            }
1498
-
1499
-            return $files = $output;
1500
-
1501
-        }
1502
-
1503
-        /**
1504
-         * Get proper JQuery UI version.
1505
-         *
1506
-         * Used in order to not conflict with WP Admin Scripts.
1507
-         *
1508
-         * @since 1.0
1509
-         * @access public
1510
-         */
1511
-        public function get_jqueryui_ver()
1512
-        {
1513
-
1514
-            global $wp_version;
1515
-
1516
-            if (version_compare($wp_version, '3.1', '>=')) {
1517
-                return '1.8.10';
1518
-            }
1519
-
1520
-            return '1.7.3';
1521
-
1522
-        }
1523
-
1524
-        /**
1525
-         *  Add Field to meta box (generic function)
1526
-         * @author Ohad Raz
1527
-         * @since 1.0
1528
-         * @access public
1529
-         * @param $id string  field id, i.e. the meta key
1530
-         * @param $args mixed|array
1531
-         */
1532
-        public function addField($id, $args)
1533
-        {
1534
-            $new_field = array('id' => $id, 'std' => '', 'desc' => '', 'style' => '');
1535
-            $new_field = array_merge($new_field, $args);
1536
-            $this->_fields[] = $new_field;
1537
-        }
1538
-
1539
-
1540
-        /**
1541
-         *  Add Text Field to meta box
1542
-         * @author Ohad Raz
1543
-         * @since 1.0
1544
-         * @access public
1545
-         * @param $id string  field id, i.e. the meta key
1546
-         * @param $args mixed|array
1547
-         *    'name' => // field name/label string optional
1548
-         *    'desc' => // field description, string optional
1549
-         *    'std' => // default value, string optional
1550
-         *    'style' =>    // custom style for field, string optional
1551
-         *    'validate_func' => // validate function, string optional
1552
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1553
-         */
1554
-        public function addText($id, $args, $repeater = false)
1555
-        {
1556
-            $new_field = array('type' => 'text', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1557
-            $new_field = array_merge($new_field, $args);
1558
-            if (false === $repeater) {
1559
-                $this->_fields[] = $new_field;
1560
-            } else {
1561
-                return $new_field;
1562
-            }
1563
-        }
1564
-
1565
-        /**
1566
-         *  Add Hidden Field to meta box
1567
-         * @author Ohad Raz
1568
-         * @since 0.1.3
1569
-         * @access public
1570
-         * @param $id string  field id, i.e. the meta key
1571
-         * @param $args mixed|array
1572
-         *    'name' => // field name/label string optional
1573
-         *    'desc' => // field description, string optional
1574
-         *    'std' => // default value, string optional
1575
-         *    'style' =>    // custom style for field, string optional
1576
-         *    'validate_func' => // validate function, string optional
1577
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1578
-         */
1579
-        public function addHidden($id, $args, $repeater = false)
1580
-        {
1581
-            $new_field = array('type' => 'hidden', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1582
-            $new_field = array_merge($new_field, $args);
1583
-            if (false === $repeater) {
1584
-                $this->_fields[] = $new_field;
1585
-            } else {
1586
-                return $new_field;
1587
-            }
1588
-        }
1589
-
1590
-        /**
1591
-         *  Add Paragraph to meta box
1592
-         * @author Ohad Raz
1593
-         * @since 0.1.3
1594
-         * @access public
1595
-         * @param $id string  field id, i.e. the meta key
1596
-         * @param $value  paragraph html
1597
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1598
-         */
1599
-        public function addParagraph($id, $args, $repeater = false)
1600
-        {
1601
-            $new_field = array('type' => 'paragraph', 'id' => $id, 'value' => '', 'style' => '');
1602
-            $new_field = array_merge($new_field, $args);
1603
-            if (false === $repeater) {
1604
-                $this->_fields[] = $new_field;
1605
-            } else {
1606
-                return $new_field;
1607
-            }
1608
-        }
1609
-
1610
-        /**
1611
-         *  Add Checkbox Field to meta box
1612
-         * @author Ohad Raz
1613
-         * @since 1.0
1614
-         * @access public
1615
-         * @param $id string  field id, i.e. the meta key
1616
-         * @param $args mixed|array
1617
-         *    'name' => // field name/label string optional
1618
-         *    'desc' => // field description, string optional
1619
-         *    'std' => // default value, string optional
1620
-         *    'validate_func' => // validate function, string optional
1621
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1622
-         */
1623
-        public function addCheckbox($id, $args, $repeater = false)
1624
-        {
1625
-            $new_field = array('type' => 'checkbox', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox Field', 'geodirectory'));
1626
-            $new_field = array_merge($new_field, $args);
1627
-            if (false === $repeater) {
1628
-                $this->_fields[] = $new_field;
1629
-            } else {
1630
-                return $new_field;
1631
-            }
1632
-        }
1633
-
1634
-        /**
1635
-         *  Add CheckboxList Field to meta box
1636
-         * @author Ohad Raz
1637
-         * @since 1.0
1638
-         * @access public
1639
-         * @param $id string  field id, i.e. the meta key
1640
-         * @param $options (array)  array of key => value pairs for select options
1641
-         * @param $args mixed|array
1642
-         *    'name' => // field name/label string optional
1643
-         *    'desc' => // field description, string optional
1644
-         *    'std' => // default value, string optional
1645
-         *    'validate_func' => // validate function, string optional
1646
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1647
-         *
1648
-         * @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
1649
-         *   which means the last param as false to get the values in an array
1650
-         */
1651
-        public function addCheckboxList($id, $options, $args, $repeater = false)
1652
-        {
1653
-            $new_field = array('type' => 'checkbox_list', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox List Field', 'geodirectory'));
1654
-            $new_field = array_merge($new_field, $args);
1655
-            if (false === $repeater) {
1656
-                $this->_fields[] = $new_field;
1657
-            } else {
1658
-                return $new_field;
1659
-            }
1660
-        }
1661
-
1662
-        /**
1663
-         *  Add Textarea Field to meta box
1664
-         * @author Ohad Raz
1665
-         * @since 1.0
1666
-         * @access public
1667
-         * @param $id string  field id, i.e. the meta key
1668
-         * @param $args mixed|array
1669
-         *    'name' => // field name/label string optional
1670
-         *    'desc' => // field description, string optional
1671
-         *    'std' => // default value, string optional
1672
-         *    'style' =>    // custom style for field, string optional
1673
-         *    'validate_func' => // validate function, string optional
1674
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1675
-         */
1676
-        public function addTextarea($id, $args, $repeater = false)
1677
-        {
1678
-            $new_field = array('type' => 'textarea', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Textarea Field', 'geodirectory'));
1679
-            $new_field = array_merge($new_field, $args);
1680
-            if (false === $repeater) {
1681
-                $this->_fields[] = $new_field;
1682
-            } else {
1683
-                return $new_field;
1684
-            }
1685
-        }
1686
-
1687
-        /**
1688
-         *  Add Select Field to meta box
1689
-         * @author Ohad Raz
1690
-         * @since 1.0
1691
-         * @access public
1692
-         * @param $id string field id, i.e. the meta key
1693
-         * @param $options (array)  array of key => value pairs for select options
1694
-         * @param $args mixed|array
1695
-         *    'name' => // field name/label string optional
1696
-         *    'desc' => // field description, string optional
1697
-         *    'std' => // default value, (array) optional
1698
-         *    'multiple' => // select multiple values, optional. Default is false.
1699
-         *    'validate_func' => // validate function, string optional
1700
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1701
-         */
1702
-        public function addSelect($id, $options, $args, $repeater = false)
1703
-        {
1704
-            $new_field = array('type' => 'select', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Select Field', 'geodirectory'), 'multiple' => false, 'options' => $options);
1705
-            $new_field = array_merge($new_field, $args);
1706
-            if (false === $repeater) {
1707
-                $this->_fields[] = $new_field;
1708
-            } else {
1709
-                return $new_field;
1710
-            }
1711
-        }
1712
-
1713
-
1714
-        /**
1715
-         *  Add Radio Field to meta box
1716
-         * @author Ohad Raz
1717
-         * @since 1.0
1718
-         * @access public
1719
-         * @param $id string field id, i.e. the meta key
1720
-         * @param $options (array)  array of key => value pairs for radio options
1721
-         * @param $args mixed|array
1722
-         *    'name' => // field name/label string optional
1723
-         *    'desc' => // field description, string optional
1724
-         *    'std' => // default value, string optional
1725
-         *    'validate_func' => // validate function, string optional
1726
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1727
-         */
1728
-        public function addRadio($id, $options, $args, $repeater = false)
1729
-        {
1730
-            $new_field = array('type' => 'radio', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Radio Field', 'geodirectory'), 'options' => $options);
1731
-            $new_field = array_merge($new_field, $args);
1732
-            if (false === $repeater) {
1733
-                $this->_fields[] = $new_field;
1734
-            } else {
1735
-                return $new_field;
1736
-            }
1737
-        }
1738
-
1739
-        /**
1740
-         *  Add Date Field to meta box
1741
-         * @author Ohad Raz
1742
-         * @since 1.0
1743
-         * @access public
1744
-         * @param $id string  field id, i.e. the meta key
1745
-         * @param $args mixed|array
1746
-         *    'name' => // field name/label string optional
1747
-         *    'desc' => // field description, string optional
1748
-         *    'std' => // default value, string optional
1749
-         *    'validate_func' => // validate function, string optional
1750
-         *    'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'"  See more formats here: http://goo.gl/Wcwxn
1751
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1752
-         */
1753
-        public function addDate($id, $args, $repeater = false)
1754
-        {
1755
-            $new_field = array('type' => 'date', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'yy-mm-dd', 'name' => __('Date Field', 'geodirectory'));
1756
-            $new_field = array_merge($new_field, $args);
1757
-            if (false === $repeater) {
1758
-                $this->_fields[] = $new_field;
1759
-            } else {
1760
-                return $new_field;
1761
-            }
1762
-        }
1763
-
1764
-        /**
1765
-         *  Add Time Field to meta box
1766
-         * @author Ohad Raz
1767
-         * @since 1.0
1768
-         * @access public
1769
-         * @param $id string- field id, i.e. the meta key
1770
-         * @param $args mixed|array
1771
-         *    'name' => // field name/label string optional
1772
-         *    'desc' => // field description, string optional
1773
-         *    'std' => // default value, string optional
1774
-         *    'validate_func' => // validate function, string optional
1775
-         *    'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
1776
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1777
-         */
1778
-        public function addTime($id, $args, $repeater = false)
1779
-        {
1780
-            $new_field = array('type' => 'time', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'hh:mm', 'name' => __('Time Field', 'geodirectory'));
1781
-            $new_field = array_merge($new_field, $args);
1782
-            if (false === $repeater) {
1783
-                $this->_fields[] = $new_field;
1784
-            } else {
1785
-                return $new_field;
1786
-            }
1787
-        }
1788
-
1789
-        /**
1790
-         *  Add Color Field to meta box
1791
-         * @author Ohad Raz
1792
-         * @since 1.0
1793
-         * @access public
1794
-         * @param $id string  field id, i.e. the meta key
1795
-         * @param $args mixed|array
1796
-         *    'name' => // field name/label string optional
1797
-         *    'desc' => // field description, string optional
1798
-         *    'std' => // default value, string optional
1799
-         *    'validate_func' => // validate function, string optional
1800
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1801
-         */
1802
-        public function addColor($id, $args, $repeater = false)
1803
-        {
1804
-            $new_field = array('type' => 'color', 'id' => $id, 'std' => '', 'desc' => '', 'name' => __('ColorPicker Field', 'geodirectory'));
1805
-            $new_field = array_merge($new_field, $args);
1806
-            if (false === $repeater) {
1807
-                $this->_fields[] = $new_field;
1808
-            } else {
1809
-                return $new_field;
1810
-            }
1811
-        }
1812
-
1813
-        /**
1814
-         *  Add Image Field to meta box
1815
-         * @author Ohad Raz
1816
-         * @since 1.0
1817
-         * @access public
1818
-         * @param $id string  field id, i.e. the meta key
1819
-         * @param $args mixed|array
1820
-         *    'name' => // field name/label string optional
1821
-         *    'desc' => // field description, string optional
1822
-         *    'validate_func' => // validate function, string optional
1823
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1824
-         */
1825
-        public function addImage($id, $args, $repeater = false)
1826
-        {
1827
-            $new_field = array('type' => 'image', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('Image Field', 'geodirectory'));
1828
-            $new_field = array_merge($new_field, $args);
1829
-
1830
-            if (false === $repeater) {
1831
-                $this->_fields[] = $new_field;
1832
-            } else {
1833
-                return $new_field;
1834
-            }
1835
-        }
1836
-
1837
-        /**
1838
-         *  Add File Field to meta box
1839
-         * @author Ohad Raz
1840
-         * @since 1.0
1841
-         * @access public
1842
-         * @param $id string  field id, i.e. the meta key
1843
-         * @param $args mixed|array
1844
-         *    'name' => // field name/label string optional
1845
-         *    'desc' => // field description, string optional
1846
-         *    'validate_func' => // validate function, string optional
1847
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1848
-         */
1849
-        public function addFile($id, $args, $repeater = false)
1850
-        {
1851
-            $new_field = array('type' => 'file', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('File Field', 'geodirectory'));
1852
-            $new_field = array_merge($new_field, $args);
1853
-            if (false === $repeater) {
1854
-                $this->_fields[] = $new_field;
1855
-            } else {
1856
-                return $new_field;
1857
-            }
1858
-        }
1859
-
1860
-        /**
1861
-         *  Add WYSIWYG Field to meta box
1862
-         * @author Ohad Raz
1863
-         * @since 1.0
1864
-         * @access public
1865
-         * @param $id string  field id, i.e. the meta key
1866
-         * @param $args mixed|array
1867
-         *    'name' => // field name/label string optional
1868
-         *    'desc' => // field description, string optional
1869
-         *    'std' => // default value, string optional
1870
-         *    'style' =>    // custom style for field, string optional Default 'width: 300px; height: 400px'
1871
-         *    'validate_func' => // validate function, string optional
1872
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1873
-         */
1874
-        public function addWysiwyg($id, $args, $repeater = false)
1875
-        {
1876
-            $new_field = array('type' => 'wysiwyg', 'id' => $id, 'std' => '', 'desc' => '', 'style' => 'width: 300px; height: 400px', 'name' => __('WYSIWYG Editor Field', 'geodirectory'));
1877
-            $new_field = array_merge($new_field, $args);
1878
-            if (false === $repeater) {
1879
-                $this->_fields[] = $new_field;
1880
-            } else {
1881
-                return $new_field;
1882
-            }
1883
-        }
1884
-
1885
-        /**
1886
-         *  Add Taxonomy Field to meta box
1887
-         * @author Ohad Raz
1888
-         * @since 1.0
1889
-         * @access public
1890
-         * @param $id string  field id, i.e. the meta key
1891
-         * @param $options mixed|array options of taxonomy field
1892
-         *    'taxonomy' =>    // taxonomy name can be category,post_tag or any custom taxonomy default is category
1893
-         * 'type' =>  // how to show taxonomy? 'select' (default) or 'checkbox_list'
1894
-         * 'args' =>  // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
1895
-         * @param $args mixed|array
1896
-         *    'name' => // field name/label string optional
1897
-         *    'desc' => // field description, string optional
1898
-         *    'std' => // default value, string optional
1899
-         *    'validate_func' => // validate function, string optional
1900
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1901
-         */
1902
-        public function addTaxonomy($id, $options, $args, $repeater = false)
1903
-        {
1904
-            $q = array('hide_empty' => 0);
1905
-            $tax = 'category';
1906
-            $type = 'select';
1907
-            $temp = array($tax, $type, $q);
1908
-            $options = array_merge($temp, $options);
1909
-            $new_field = array('type' => 'taxonomy', 'id' => $id, 'desc' => '', 'name' => __('Taxonomy Field', 'geodirectory'), 'options' => $options);
1910
-            $new_field = array_merge($new_field, $args);
1911
-            if (false === $repeater) {
1912
-                $this->_fields[] = $new_field;
1913
-            } else {
1914
-                return $new_field;
1915
-            }
1916
-        }
1917
-
1918
-        /**
1919
-         *  Add posts Field to meta box
1920
-         * @author Ohad Raz
1921
-         * @since 1.0
1922
-         * @access public
1923
-         * @param $id string  field id, i.e. the meta key
1924
-         * @param $options mixed|array options of taxonomy field
1925
-         *    'post_type' =>    // post type name, 'post' (default) 'page' or any custom post type
1926
-         * 'type' =>  // how to show posts? 'select' (default) or 'checkbox_list'
1927
-         * 'args' =>  // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1)
1928
-         * @param $args mixed|array
1929
-         *    'name' => // field name/label string optional
1930
-         *    'desc' => // field description, string optional
1931
-         *    'std' => // default value, string optional
1932
-         *    'validate_func' => // validate function, string optional
1933
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1934
-         */
1935
-        public function addPosts($id, $options, $args, $repeater = false)
1936
-        {
1937
-            $q = array('posts_per_page' => -1);
1938
-            $temp = array('post_type' => 'post', 'type' => 'select', 'args' => $q);
1939
-            $options = array_merge($temp, $options);
1940
-            $new_field = array('type' => 'posts', 'id' => $id, 'desc' => '', 'name' => __('Posts Field', 'geodirectory'), 'options' => $options);
1941
-            $new_field = array_merge($new_field, $args);
1942
-            if (false === $repeater) {
1943
-                $this->_fields[] = $new_field;
1944
-            } else {
1945
-                return $new_field;
1946
-            }
1947
-        }
1948
-
1949
-        /**
1950
-         *  Add repeater Field Block to meta box
1951
-         * @author Ohad Raz
1952
-         * @since 1.0
1953
-         * @access public
1954
-         * @param $id string  field id, i.e. the meta key
1955
-         * @param $args mixed|array
1956
-         *    'name' => // field name/label string optional
1957
-         *    'desc' => // field description, string optional
1958
-         *    'std' => // default value, string optional
1959
-         *    'style' =>    // custom style for field, string optional
1960
-         *    'validate_func' => // validate function, string optional
1961
-         *    'fields' => //fields to repeater
1962
-         */
1963
-        public function addRepeaterBlock($id, $args)
1964
-        {
1965
-            $new_field = array('type' => 'repeater', 'id' => $id, 'name' => __('Reapeater Field', 'geodirectory'), 'fields' => array(), 'inline' => false);
1966
-            $new_field = array_merge($new_field, $args);
1967
-            $this->_fields[] = $new_field;
1968
-        }
1969
-
1970
-
1971
-        /**
1972
-         * Finish Declaration of Meta Box
1973
-         * @author Ohad Raz
1974
-         * @since 1.0
1975
-         * @access public
1976
-         */
1977
-        public function Finish()
1978
-        {
1979
-            $this->add_missed_values();
1980
-            $this->check_field_upload();
1981
-            $this->check_field_color();
1982
-            $this->check_field_date();
1983
-            $this->check_field_time();
1984
-        }
1985
-
1986
-        /**
1987
-         * Helper function to check for empty arrays
1988
-         * @author Ohad Raz
1989
-         * @since 1.0
1990
-         * @access public
1991
-         * @param $args mixed|array
1992
-         */
1993
-        public function is_array_empty($array)
1994
-        {
1995
-            if (!is_array($array))
1996
-                return true;
1997
-
1998
-            foreach ($array as $a) {
1999
-                if (is_array($a)) {
2000
-                    foreach ($a as $sub_a) {
2001
-                        if (!empty($sub_a) && $sub_a != '')
2002
-                            return false;
2003
-                    }
2004
-                } else {
2005
-                    if (!empty($a) && $a != '')
2006
-                        return false;
2007
-                }
2008
-            }
2009
-            return true;
2010
-        }
2011
-
2012
-
2013
-        //get term meta field
2014
-        public function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2015
-        {
2016
-
2017
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2018
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2019
-                $post_type = $taxObject->object_type[0];
2020
-            }
2021
-
2022
-            if($post_type=='post'){$post_type='';}
2023
-            if($post_type){$post_type = $post_type.'_';}
2024
-
2025
-            $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026
-
2027
-            $m = get_option('tax_meta_' . $post_type  . $t_id);
2028
-            if (isset($m[$key])) {
2029
-                return $m[$key];
2030
-            } else {
2031
-                return '';
2032
-            }
2033
-        }
2034
-
2035
-        //delete meta
2036
-        public function delete_tax_meta($term_id, $key, $post_type = '')
2037
-        {
2038
-
2039
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2040
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2041
-                $post_type = $taxObject->object_type[0];
2042
-            }
2043
-
2044
-            if($post_type=='post'){$post_type='';}
2045
-            if($post_type){$post_type = $post_type.'_';}
2046
-
2047
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2048
-
2049
-            if (isset($m[$key])) {
2050
-                unset($m[$key]);
2051
-            }
2052
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2053
-        }
2054
-
2055
-        //update meta
2056
-        public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057
-        {
2058
-
2059
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2060
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2061
-                $post_type = $taxObject->object_type[0];
2062
-            }
2063
-
2064
-            if($post_type=='post'){$post_type='';}
2065
-            if($post_type){$post_type = $post_type.'_';}
2066
-
2067
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2068
-
2069
-            $m[$key] = $value;
2070
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2071
-
2072
-            /**
2073
-             * Called after the tax meta is updated.
2074
-             *
2075
-             * Used to update things after a GD category is saved.
2076
-             *
2077
-             * @since 1.0.0
2078
-             * @param bool $false False.
2079
-             * @param bool $true True.
2080
-             * @param int $term_id The term id being updated.
2081
-             * @param string $post_type The post type of the cat being updated.
2082
-             */
2083
-            do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2084
-        }
2085
-
2086
-
2087
-    } // End Class
1288
+		public function save_field_wysiwyg($term_id, $field, $old, $new)
1289
+		{
1290
+			$this->save_field($term_id, $field, $old, $new);
1291
+		}
1292
+
1293
+		/**
1294
+		 * Save repeater Fields.
1295
+		 *
1296
+		 * @param string $term_id The term ID.
1297
+		 * @param string $field
1298
+		 * @param string|mixed $old
1299
+		 * @param string|mixed $new
1300
+		 * @since 1.0
1301
+		 * @access public
1302
+		 */
1303
+		public function save_field_repeater($term_id, $field, $old, $new)
1304
+		{
1305
+			if (is_array($new) && count($new) > 0) {
1306
+				foreach ($new as $n) {
1307
+					foreach ($field['fields'] as $f) {
1308
+						$type = $f['type'];
1309
+						switch ($type) {
1310
+							case 'wysiwyg':
1311
+								$n[$f['id']] = wpautop($n[$f['id']]);
1312
+								break;
1313
+							case 'file':
1314
+								$n[$f['id']] = $this->save_field_file_repeater($term_id, $f, '', $n[$f['id']]);
1315
+								break;
1316
+							default:
1317
+								break;
1318
+						}
1319
+					}
1320
+					if (!$this->is_array_empty($n))
1321
+						$temp[] = $n;
1322
+				}
1323
+				if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1324
+					$this->update_tax_meta($term_id, $field['id'], $temp);
1325
+				} else {
1326
+					//	remove old meta if exists
1327
+					delete_post_meta($term_id, $field['id']);
1328
+				}
1329
+			} else {
1330
+				//	remove old meta if exists
1331
+				delete_post_meta($term_id, $field['id']);
1332
+			}
1333
+		}
1334
+
1335
+		/**
1336
+		 * Save File Field.
1337
+		 *
1338
+		 * @param string $term_id The term ID.
1339
+		 * @param string $field
1340
+		 * @param string $old
1341
+		 * @param string $new
1342
+		 * @since 1.0
1343
+		 * @access public
1344
+		 */
1345
+		public function save_field_file($term_id, $field, $old, $new)
1346
+		{
1347
+
1348
+			$name = $field['id'];
1349
+			if (empty($_FILES[$name]))
1350
+				return;
1351
+			$this->fix_file_array($_FILES[$name]);
1352
+			foreach ($_FILES[$name] as $position => $fileitem) {
1353
+
1354
+				$file = wp_handle_upload($fileitem, array('test_form' => false));
1355
+				if (empty($file['file']))
1356
+					continue;
1357
+				$filename = $file['file'];
1358
+
1359
+				$attachment = array(
1360
+					'post_mime_type' => $file['type'],
1361
+					'guid' => $file['url'],
1362
+					'post_parent' => $term_id,
1363
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1364
+					'post_content' => ''
1365
+				);
1366
+
1367
+				$id = wp_insert_attachment($attachment, $filename, $term_id);
1368
+
1369
+				if (!is_wp_error($id)) {
1370
+
1371
+					wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
+					add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1373
+
1374
+				} // End if
1375
+
1376
+			} // End foreach
1377
+
1378
+		}
1379
+
1380
+		/**
1381
+		 * Save repeater File Field.
1382
+		 * @param string $term_id The term ID.
1383
+		 * @param string $field
1384
+		 * @param string $old
1385
+		 * @param string $new
1386
+		 * @since 1.0
1387
+		 * @access public
1388
+		 * @return int|void
1389
+		 */
1390
+		public function save_field_file_repeater($term_id, $field, $old, $new)
1391
+		{
1392
+
1393
+			$name = $field['id'];
1394
+			if (empty($_FILES[$name]))
1395
+				return;
1396
+			$this->fix_file_array($_FILES[$name]);
1397
+			foreach ($_FILES[$name] as $position => $fileitem) {
1398
+
1399
+				$file = wp_handle_upload($fileitem, array('test_form' => false));
1400
+				if (empty($file['file']))
1401
+					continue;
1402
+				$filename = $file['file'];
1403
+
1404
+				$attachment = array(
1405
+					'post_mime_type' => $file['type'],
1406
+					'guid' => $file['url'],
1407
+					'post_parent' => $term_id,
1408
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1409
+					'post_content' => ''
1410
+				);
1411
+
1412
+				$id = wp_insert_attachment($attachment, $filename);
1413
+
1414
+				if (!is_wp_error($id)) {
1415
+
1416
+					wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
+					return $id;    // return file's url in meta fields
1418
+				} // End if
1419
+			} // End foreach
1420
+		}
1421
+
1422
+		/**
1423
+		 * Add missed values for meta box.
1424
+		 *
1425
+		 * @since 1.0
1426
+		 * @access public
1427
+		 */
1428
+		public function add_missed_values()
1429
+		{
1430
+
1431
+			// Default values for meta box
1432
+			$this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1433
+
1434
+			if(is_array($this->_fields)) {
1435
+				// Default values for fields
1436
+				foreach ($this->_fields as &$field) {
1437
+					$multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
1438
+					$std = $multiple ? array() : '';
1439
+					$format = 'date' == $field['type'] ? 'yy-mm-dd' : ('time' == $field['type'] ? 'hh:mm' : '');
1440
+					$field = array_merge(array('multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => ''), $field);
1441
+				} // End foreach
1442
+			}
1443
+		}
1444
+
1445
+		/**
1446
+		 * Check if field with $type exists.
1447
+		 *
1448
+		 * @param string $type
1449
+		 * @since 1.0
1450
+		 * @access public
1451
+		 */
1452
+		public function has_field($type)
1453
+		{
1454
+			if(is_array($this->_fields)) {
1455
+				foreach ($this->_fields as $field) {
1456
+					if ($type == $field['type'])
1457
+						return true;
1458
+				}
1459
+			}
1460
+			return false;
1461
+		}
1462
+
1463
+		/**
1464
+		 * Check if current page is edit page.
1465
+		 *
1466
+		 * @since 1.0
1467
+		 * @access public
1468
+		 */
1469
+		public function is_edit_page()
1470
+		{
1471
+			global $pagenow;
1472
+			return ($pagenow == 'edit-tags.php' || $pagenow == 'term.php');
1473
+		}
1474
+
1475
+		/**
1476
+		 * Fixes the odd indexing of multiple file uploads.
1477
+		 *
1478
+		 * Goes from the format:
1479
+		 * $_FILES['field']['key']['index']
1480
+		 * to
1481
+		 * The More standard and appropriate:
1482
+		 * $_FILES['field']['index']['key']
1483
+		 *
1484
+		 * @param string $files
1485
+		 * @since 1.0
1486
+		 * @access public
1487
+		 */
1488
+		public function fix_file_array(&$files)
1489
+		{
1490
+
1491
+			$output = array();
1492
+
1493
+			foreach ($files as $key => $list) {
1494
+				foreach ($list as $index => $value) {
1495
+					$output[$index][$key] = $value;
1496
+				}
1497
+			}
1498
+
1499
+			return $files = $output;
1500
+
1501
+		}
1502
+
1503
+		/**
1504
+		 * Get proper JQuery UI version.
1505
+		 *
1506
+		 * Used in order to not conflict with WP Admin Scripts.
1507
+		 *
1508
+		 * @since 1.0
1509
+		 * @access public
1510
+		 */
1511
+		public function get_jqueryui_ver()
1512
+		{
1513
+
1514
+			global $wp_version;
1515
+
1516
+			if (version_compare($wp_version, '3.1', '>=')) {
1517
+				return '1.8.10';
1518
+			}
1519
+
1520
+			return '1.7.3';
1521
+
1522
+		}
1523
+
1524
+		/**
1525
+		 *  Add Field to meta box (generic function)
1526
+		 * @author Ohad Raz
1527
+		 * @since 1.0
1528
+		 * @access public
1529
+		 * @param $id string  field id, i.e. the meta key
1530
+		 * @param $args mixed|array
1531
+		 */
1532
+		public function addField($id, $args)
1533
+		{
1534
+			$new_field = array('id' => $id, 'std' => '', 'desc' => '', 'style' => '');
1535
+			$new_field = array_merge($new_field, $args);
1536
+			$this->_fields[] = $new_field;
1537
+		}
1538
+
1539
+
1540
+		/**
1541
+		 *  Add Text Field to meta box
1542
+		 * @author Ohad Raz
1543
+		 * @since 1.0
1544
+		 * @access public
1545
+		 * @param $id string  field id, i.e. the meta key
1546
+		 * @param $args mixed|array
1547
+		 *    'name' => // field name/label string optional
1548
+		 *    'desc' => // field description, string optional
1549
+		 *    'std' => // default value, string optional
1550
+		 *    'style' =>    // custom style for field, string optional
1551
+		 *    'validate_func' => // validate function, string optional
1552
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1553
+		 */
1554
+		public function addText($id, $args, $repeater = false)
1555
+		{
1556
+			$new_field = array('type' => 'text', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1557
+			$new_field = array_merge($new_field, $args);
1558
+			if (false === $repeater) {
1559
+				$this->_fields[] = $new_field;
1560
+			} else {
1561
+				return $new_field;
1562
+			}
1563
+		}
1564
+
1565
+		/**
1566
+		 *  Add Hidden Field to meta box
1567
+		 * @author Ohad Raz
1568
+		 * @since 0.1.3
1569
+		 * @access public
1570
+		 * @param $id string  field id, i.e. the meta key
1571
+		 * @param $args mixed|array
1572
+		 *    'name' => // field name/label string optional
1573
+		 *    'desc' => // field description, string optional
1574
+		 *    'std' => // default value, string optional
1575
+		 *    'style' =>    // custom style for field, string optional
1576
+		 *    'validate_func' => // validate function, string optional
1577
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1578
+		 */
1579
+		public function addHidden($id, $args, $repeater = false)
1580
+		{
1581
+			$new_field = array('type' => 'hidden', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1582
+			$new_field = array_merge($new_field, $args);
1583
+			if (false === $repeater) {
1584
+				$this->_fields[] = $new_field;
1585
+			} else {
1586
+				return $new_field;
1587
+			}
1588
+		}
1589
+
1590
+		/**
1591
+		 *  Add Paragraph to meta box
1592
+		 * @author Ohad Raz
1593
+		 * @since 0.1.3
1594
+		 * @access public
1595
+		 * @param $id string  field id, i.e. the meta key
1596
+		 * @param $value  paragraph html
1597
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1598
+		 */
1599
+		public function addParagraph($id, $args, $repeater = false)
1600
+		{
1601
+			$new_field = array('type' => 'paragraph', 'id' => $id, 'value' => '', 'style' => '');
1602
+			$new_field = array_merge($new_field, $args);
1603
+			if (false === $repeater) {
1604
+				$this->_fields[] = $new_field;
1605
+			} else {
1606
+				return $new_field;
1607
+			}
1608
+		}
1609
+
1610
+		/**
1611
+		 *  Add Checkbox Field to meta box
1612
+		 * @author Ohad Raz
1613
+		 * @since 1.0
1614
+		 * @access public
1615
+		 * @param $id string  field id, i.e. the meta key
1616
+		 * @param $args mixed|array
1617
+		 *    'name' => // field name/label string optional
1618
+		 *    'desc' => // field description, string optional
1619
+		 *    'std' => // default value, string optional
1620
+		 *    'validate_func' => // validate function, string optional
1621
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1622
+		 */
1623
+		public function addCheckbox($id, $args, $repeater = false)
1624
+		{
1625
+			$new_field = array('type' => 'checkbox', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox Field', 'geodirectory'));
1626
+			$new_field = array_merge($new_field, $args);
1627
+			if (false === $repeater) {
1628
+				$this->_fields[] = $new_field;
1629
+			} else {
1630
+				return $new_field;
1631
+			}
1632
+		}
1633
+
1634
+		/**
1635
+		 *  Add CheckboxList Field to meta box
1636
+		 * @author Ohad Raz
1637
+		 * @since 1.0
1638
+		 * @access public
1639
+		 * @param $id string  field id, i.e. the meta key
1640
+		 * @param $options (array)  array of key => value pairs for select options
1641
+		 * @param $args mixed|array
1642
+		 *    'name' => // field name/label string optional
1643
+		 *    'desc' => // field description, string optional
1644
+		 *    'std' => // default value, string optional
1645
+		 *    'validate_func' => // validate function, string optional
1646
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1647
+		 *
1648
+		 * @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
1649
+		 *   which means the last param as false to get the values in an array
1650
+		 */
1651
+		public function addCheckboxList($id, $options, $args, $repeater = false)
1652
+		{
1653
+			$new_field = array('type' => 'checkbox_list', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox List Field', 'geodirectory'));
1654
+			$new_field = array_merge($new_field, $args);
1655
+			if (false === $repeater) {
1656
+				$this->_fields[] = $new_field;
1657
+			} else {
1658
+				return $new_field;
1659
+			}
1660
+		}
1661
+
1662
+		/**
1663
+		 *  Add Textarea Field to meta box
1664
+		 * @author Ohad Raz
1665
+		 * @since 1.0
1666
+		 * @access public
1667
+		 * @param $id string  field id, i.e. the meta key
1668
+		 * @param $args mixed|array
1669
+		 *    'name' => // field name/label string optional
1670
+		 *    'desc' => // field description, string optional
1671
+		 *    'std' => // default value, string optional
1672
+		 *    'style' =>    // custom style for field, string optional
1673
+		 *    'validate_func' => // validate function, string optional
1674
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1675
+		 */
1676
+		public function addTextarea($id, $args, $repeater = false)
1677
+		{
1678
+			$new_field = array('type' => 'textarea', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Textarea Field', 'geodirectory'));
1679
+			$new_field = array_merge($new_field, $args);
1680
+			if (false === $repeater) {
1681
+				$this->_fields[] = $new_field;
1682
+			} else {
1683
+				return $new_field;
1684
+			}
1685
+		}
1686
+
1687
+		/**
1688
+		 *  Add Select Field to meta box
1689
+		 * @author Ohad Raz
1690
+		 * @since 1.0
1691
+		 * @access public
1692
+		 * @param $id string field id, i.e. the meta key
1693
+		 * @param $options (array)  array of key => value pairs for select options
1694
+		 * @param $args mixed|array
1695
+		 *    'name' => // field name/label string optional
1696
+		 *    'desc' => // field description, string optional
1697
+		 *    'std' => // default value, (array) optional
1698
+		 *    'multiple' => // select multiple values, optional. Default is false.
1699
+		 *    'validate_func' => // validate function, string optional
1700
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1701
+		 */
1702
+		public function addSelect($id, $options, $args, $repeater = false)
1703
+		{
1704
+			$new_field = array('type' => 'select', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Select Field', 'geodirectory'), 'multiple' => false, 'options' => $options);
1705
+			$new_field = array_merge($new_field, $args);
1706
+			if (false === $repeater) {
1707
+				$this->_fields[] = $new_field;
1708
+			} else {
1709
+				return $new_field;
1710
+			}
1711
+		}
1712
+
1713
+
1714
+		/**
1715
+		 *  Add Radio Field to meta box
1716
+		 * @author Ohad Raz
1717
+		 * @since 1.0
1718
+		 * @access public
1719
+		 * @param $id string field id, i.e. the meta key
1720
+		 * @param $options (array)  array of key => value pairs for radio options
1721
+		 * @param $args mixed|array
1722
+		 *    'name' => // field name/label string optional
1723
+		 *    'desc' => // field description, string optional
1724
+		 *    'std' => // default value, string optional
1725
+		 *    'validate_func' => // validate function, string optional
1726
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1727
+		 */
1728
+		public function addRadio($id, $options, $args, $repeater = false)
1729
+		{
1730
+			$new_field = array('type' => 'radio', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Radio Field', 'geodirectory'), 'options' => $options);
1731
+			$new_field = array_merge($new_field, $args);
1732
+			if (false === $repeater) {
1733
+				$this->_fields[] = $new_field;
1734
+			} else {
1735
+				return $new_field;
1736
+			}
1737
+		}
1738
+
1739
+		/**
1740
+		 *  Add Date Field to meta box
1741
+		 * @author Ohad Raz
1742
+		 * @since 1.0
1743
+		 * @access public
1744
+		 * @param $id string  field id, i.e. the meta key
1745
+		 * @param $args mixed|array
1746
+		 *    'name' => // field name/label string optional
1747
+		 *    'desc' => // field description, string optional
1748
+		 *    'std' => // default value, string optional
1749
+		 *    'validate_func' => // validate function, string optional
1750
+		 *    'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'"  See more formats here: http://goo.gl/Wcwxn
1751
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1752
+		 */
1753
+		public function addDate($id, $args, $repeater = false)
1754
+		{
1755
+			$new_field = array('type' => 'date', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'yy-mm-dd', 'name' => __('Date Field', 'geodirectory'));
1756
+			$new_field = array_merge($new_field, $args);
1757
+			if (false === $repeater) {
1758
+				$this->_fields[] = $new_field;
1759
+			} else {
1760
+				return $new_field;
1761
+			}
1762
+		}
1763
+
1764
+		/**
1765
+		 *  Add Time Field to meta box
1766
+		 * @author Ohad Raz
1767
+		 * @since 1.0
1768
+		 * @access public
1769
+		 * @param $id string- field id, i.e. the meta key
1770
+		 * @param $args mixed|array
1771
+		 *    'name' => // field name/label string optional
1772
+		 *    'desc' => // field description, string optional
1773
+		 *    'std' => // default value, string optional
1774
+		 *    'validate_func' => // validate function, string optional
1775
+		 *    'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
1776
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1777
+		 */
1778
+		public function addTime($id, $args, $repeater = false)
1779
+		{
1780
+			$new_field = array('type' => 'time', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'hh:mm', 'name' => __('Time Field', 'geodirectory'));
1781
+			$new_field = array_merge($new_field, $args);
1782
+			if (false === $repeater) {
1783
+				$this->_fields[] = $new_field;
1784
+			} else {
1785
+				return $new_field;
1786
+			}
1787
+		}
1788
+
1789
+		/**
1790
+		 *  Add Color Field to meta box
1791
+		 * @author Ohad Raz
1792
+		 * @since 1.0
1793
+		 * @access public
1794
+		 * @param $id string  field id, i.e. the meta key
1795
+		 * @param $args mixed|array
1796
+		 *    'name' => // field name/label string optional
1797
+		 *    'desc' => // field description, string optional
1798
+		 *    'std' => // default value, string optional
1799
+		 *    'validate_func' => // validate function, string optional
1800
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1801
+		 */
1802
+		public function addColor($id, $args, $repeater = false)
1803
+		{
1804
+			$new_field = array('type' => 'color', 'id' => $id, 'std' => '', 'desc' => '', 'name' => __('ColorPicker Field', 'geodirectory'));
1805
+			$new_field = array_merge($new_field, $args);
1806
+			if (false === $repeater) {
1807
+				$this->_fields[] = $new_field;
1808
+			} else {
1809
+				return $new_field;
1810
+			}
1811
+		}
1812
+
1813
+		/**
1814
+		 *  Add Image Field to meta box
1815
+		 * @author Ohad Raz
1816
+		 * @since 1.0
1817
+		 * @access public
1818
+		 * @param $id string  field id, i.e. the meta key
1819
+		 * @param $args mixed|array
1820
+		 *    'name' => // field name/label string optional
1821
+		 *    'desc' => // field description, string optional
1822
+		 *    'validate_func' => // validate function, string optional
1823
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1824
+		 */
1825
+		public function addImage($id, $args, $repeater = false)
1826
+		{
1827
+			$new_field = array('type' => 'image', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('Image Field', 'geodirectory'));
1828
+			$new_field = array_merge($new_field, $args);
1829
+
1830
+			if (false === $repeater) {
1831
+				$this->_fields[] = $new_field;
1832
+			} else {
1833
+				return $new_field;
1834
+			}
1835
+		}
1836
+
1837
+		/**
1838
+		 *  Add File Field to meta box
1839
+		 * @author Ohad Raz
1840
+		 * @since 1.0
1841
+		 * @access public
1842
+		 * @param $id string  field id, i.e. the meta key
1843
+		 * @param $args mixed|array
1844
+		 *    'name' => // field name/label string optional
1845
+		 *    'desc' => // field description, string optional
1846
+		 *    'validate_func' => // validate function, string optional
1847
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1848
+		 */
1849
+		public function addFile($id, $args, $repeater = false)
1850
+		{
1851
+			$new_field = array('type' => 'file', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('File Field', 'geodirectory'));
1852
+			$new_field = array_merge($new_field, $args);
1853
+			if (false === $repeater) {
1854
+				$this->_fields[] = $new_field;
1855
+			} else {
1856
+				return $new_field;
1857
+			}
1858
+		}
1859
+
1860
+		/**
1861
+		 *  Add WYSIWYG Field to meta box
1862
+		 * @author Ohad Raz
1863
+		 * @since 1.0
1864
+		 * @access public
1865
+		 * @param $id string  field id, i.e. the meta key
1866
+		 * @param $args mixed|array
1867
+		 *    'name' => // field name/label string optional
1868
+		 *    'desc' => // field description, string optional
1869
+		 *    'std' => // default value, string optional
1870
+		 *    'style' =>    // custom style for field, string optional Default 'width: 300px; height: 400px'
1871
+		 *    'validate_func' => // validate function, string optional
1872
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1873
+		 */
1874
+		public function addWysiwyg($id, $args, $repeater = false)
1875
+		{
1876
+			$new_field = array('type' => 'wysiwyg', 'id' => $id, 'std' => '', 'desc' => '', 'style' => 'width: 300px; height: 400px', 'name' => __('WYSIWYG Editor Field', 'geodirectory'));
1877
+			$new_field = array_merge($new_field, $args);
1878
+			if (false === $repeater) {
1879
+				$this->_fields[] = $new_field;
1880
+			} else {
1881
+				return $new_field;
1882
+			}
1883
+		}
1884
+
1885
+		/**
1886
+		 *  Add Taxonomy Field to meta box
1887
+		 * @author Ohad Raz
1888
+		 * @since 1.0
1889
+		 * @access public
1890
+		 * @param $id string  field id, i.e. the meta key
1891
+		 * @param $options mixed|array options of taxonomy field
1892
+		 *    'taxonomy' =>    // taxonomy name can be category,post_tag or any custom taxonomy default is category
1893
+		 * 'type' =>  // how to show taxonomy? 'select' (default) or 'checkbox_list'
1894
+		 * 'args' =>  // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
1895
+		 * @param $args mixed|array
1896
+		 *    'name' => // field name/label string optional
1897
+		 *    'desc' => // field description, string optional
1898
+		 *    'std' => // default value, string optional
1899
+		 *    'validate_func' => // validate function, string optional
1900
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1901
+		 */
1902
+		public function addTaxonomy($id, $options, $args, $repeater = false)
1903
+		{
1904
+			$q = array('hide_empty' => 0);
1905
+			$tax = 'category';
1906
+			$type = 'select';
1907
+			$temp = array($tax, $type, $q);
1908
+			$options = array_merge($temp, $options);
1909
+			$new_field = array('type' => 'taxonomy', 'id' => $id, 'desc' => '', 'name' => __('Taxonomy Field', 'geodirectory'), 'options' => $options);
1910
+			$new_field = array_merge($new_field, $args);
1911
+			if (false === $repeater) {
1912
+				$this->_fields[] = $new_field;
1913
+			} else {
1914
+				return $new_field;
1915
+			}
1916
+		}
1917
+
1918
+		/**
1919
+		 *  Add posts Field to meta box
1920
+		 * @author Ohad Raz
1921
+		 * @since 1.0
1922
+		 * @access public
1923
+		 * @param $id string  field id, i.e. the meta key
1924
+		 * @param $options mixed|array options of taxonomy field
1925
+		 *    'post_type' =>    // post type name, 'post' (default) 'page' or any custom post type
1926
+		 * 'type' =>  // how to show posts? 'select' (default) or 'checkbox_list'
1927
+		 * 'args' =>  // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1)
1928
+		 * @param $args mixed|array
1929
+		 *    'name' => // field name/label string optional
1930
+		 *    'desc' => // field description, string optional
1931
+		 *    'std' => // default value, string optional
1932
+		 *    'validate_func' => // validate function, string optional
1933
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1934
+		 */
1935
+		public function addPosts($id, $options, $args, $repeater = false)
1936
+		{
1937
+			$q = array('posts_per_page' => -1);
1938
+			$temp = array('post_type' => 'post', 'type' => 'select', 'args' => $q);
1939
+			$options = array_merge($temp, $options);
1940
+			$new_field = array('type' => 'posts', 'id' => $id, 'desc' => '', 'name' => __('Posts Field', 'geodirectory'), 'options' => $options);
1941
+			$new_field = array_merge($new_field, $args);
1942
+			if (false === $repeater) {
1943
+				$this->_fields[] = $new_field;
1944
+			} else {
1945
+				return $new_field;
1946
+			}
1947
+		}
1948
+
1949
+		/**
1950
+		 *  Add repeater Field Block to meta box
1951
+		 * @author Ohad Raz
1952
+		 * @since 1.0
1953
+		 * @access public
1954
+		 * @param $id string  field id, i.e. the meta key
1955
+		 * @param $args mixed|array
1956
+		 *    'name' => // field name/label string optional
1957
+		 *    'desc' => // field description, string optional
1958
+		 *    'std' => // default value, string optional
1959
+		 *    'style' =>    // custom style for field, string optional
1960
+		 *    'validate_func' => // validate function, string optional
1961
+		 *    'fields' => //fields to repeater
1962
+		 */
1963
+		public function addRepeaterBlock($id, $args)
1964
+		{
1965
+			$new_field = array('type' => 'repeater', 'id' => $id, 'name' => __('Reapeater Field', 'geodirectory'), 'fields' => array(), 'inline' => false);
1966
+			$new_field = array_merge($new_field, $args);
1967
+			$this->_fields[] = $new_field;
1968
+		}
1969
+
1970
+
1971
+		/**
1972
+		 * Finish Declaration of Meta Box
1973
+		 * @author Ohad Raz
1974
+		 * @since 1.0
1975
+		 * @access public
1976
+		 */
1977
+		public function Finish()
1978
+		{
1979
+			$this->add_missed_values();
1980
+			$this->check_field_upload();
1981
+			$this->check_field_color();
1982
+			$this->check_field_date();
1983
+			$this->check_field_time();
1984
+		}
1985
+
1986
+		/**
1987
+		 * Helper function to check for empty arrays
1988
+		 * @author Ohad Raz
1989
+		 * @since 1.0
1990
+		 * @access public
1991
+		 * @param $args mixed|array
1992
+		 */
1993
+		public function is_array_empty($array)
1994
+		{
1995
+			if (!is_array($array))
1996
+				return true;
1997
+
1998
+			foreach ($array as $a) {
1999
+				if (is_array($a)) {
2000
+					foreach ($a as $sub_a) {
2001
+						if (!empty($sub_a) && $sub_a != '')
2002
+							return false;
2003
+					}
2004
+				} else {
2005
+					if (!empty($a) && $a != '')
2006
+						return false;
2007
+				}
2008
+			}
2009
+			return true;
2010
+		}
2011
+
2012
+
2013
+		//get term meta field
2014
+		public function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2015
+		{
2016
+
2017
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2018
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2019
+				$post_type = $taxObject->object_type[0];
2020
+			}
2021
+
2022
+			if($post_type=='post'){$post_type='';}
2023
+			if($post_type){$post_type = $post_type.'_';}
2024
+
2025
+			$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026
+
2027
+			$m = get_option('tax_meta_' . $post_type  . $t_id);
2028
+			if (isset($m[$key])) {
2029
+				return $m[$key];
2030
+			} else {
2031
+				return '';
2032
+			}
2033
+		}
2034
+
2035
+		//delete meta
2036
+		public function delete_tax_meta($term_id, $key, $post_type = '')
2037
+		{
2038
+
2039
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2040
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2041
+				$post_type = $taxObject->object_type[0];
2042
+			}
2043
+
2044
+			if($post_type=='post'){$post_type='';}
2045
+			if($post_type){$post_type = $post_type.'_';}
2046
+
2047
+			$m = get_option('tax_meta_' . $post_type  . $term_id);
2048
+
2049
+			if (isset($m[$key])) {
2050
+				unset($m[$key]);
2051
+			}
2052
+			update_option('tax_meta_' . $post_type  . $term_id, $m);
2053
+		}
2054
+
2055
+		//update meta
2056
+		public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057
+		{
2058
+
2059
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2060
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2061
+				$post_type = $taxObject->object_type[0];
2062
+			}
2063
+
2064
+			if($post_type=='post'){$post_type='';}
2065
+			if($post_type){$post_type = $post_type.'_';}
2066
+
2067
+			$m = get_option('tax_meta_' . $post_type  . $term_id);
2068
+
2069
+			$m[$key] = $value;
2070
+			update_option('tax_meta_' . $post_type  . $term_id, $m);
2071
+
2072
+			/**
2073
+			 * Called after the tax meta is updated.
2074
+			 *
2075
+			 * Used to update things after a GD category is saved.
2076
+			 *
2077
+			 * @since 1.0.0
2078
+			 * @param bool $false False.
2079
+			 * @param bool $true True.
2080
+			 * @param int $term_id The term id being updated.
2081
+			 * @param string $post_type The post type of the cat being updated.
2082
+			 */
2083
+			do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2084
+		}
2085
+
2086
+
2087
+	} // End Class
2088 2088
 
2089 2089
 endif; // End Check Class Exists
2090 2090
 
@@ -2094,79 +2094,79 @@  discard block
 block discarded – undo
2094 2094
 
2095 2095
 //get term meta field
2096 2096
 if (!function_exists('geodir_get_tax_meta')) {
2097
-    function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098
-        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099
-            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2097
+	function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098
+		if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099
+			$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2100 2100
             
2101
-            if (!empty($taxObject->object_type)) {
2102
-                $post_type = $taxObject->object_type[0];
2103
-            }
2104
-        }
2105
-
2106
-        if ($post_type == 'post') {
2107
-            $post_type = '';
2108
-        }
2109
-        if ($post_type) {
2110
-            $post_type = $post_type . '_';
2111
-        }
2112
-
2113
-        $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114
-
2115
-        $m = get_option('tax_meta_' . $post_type  . $t_id);
2116
-        if (isset($m[$key])) {
2117
-            return $m[$key];
2118
-        } else {
2119
-            return '';
2120
-        }
2121
-    }
2101
+			if (!empty($taxObject->object_type)) {
2102
+				$post_type = $taxObject->object_type[0];
2103
+			}
2104
+		}
2105
+
2106
+		if ($post_type == 'post') {
2107
+			$post_type = '';
2108
+		}
2109
+		if ($post_type) {
2110
+			$post_type = $post_type . '_';
2111
+		}
2112
+
2113
+		$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114
+
2115
+		$m = get_option('tax_meta_' . $post_type  . $t_id);
2116
+		if (isset($m[$key])) {
2117
+			return $m[$key];
2118
+		} else {
2119
+			return '';
2120
+		}
2121
+	}
2122 2122
 }
2123 2123
 
2124 2124
 //delete meta
2125 2125
 if (!function_exists('geodir_delete_tax_meta')) {
2126
-    function geodir_delete_tax_meta($term_id, $key) {
2127
-        $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2128
-        $post_type = !empty($taxObject->object_type) ? $taxObject->object_type[0] : '';
2129
-
2130
-        if ($post_type == 'post') {
2131
-            $post_type = '';
2132
-        }
2133
-        if ($post_type) {
2134
-            $post_type = $post_type . '_';
2135
-        }
2136
-
2137
-        $m = get_option('tax_meta_' . $post_type . $term_id);
2138
-
2139
-        if (isset($m[$key])) {
2140
-            unset($m[$key]);
2141
-        }
2142
-        update_option('tax_meta_' . $post_type  . $term_id, $m);
2143
-    }
2126
+	function geodir_delete_tax_meta($term_id, $key) {
2127
+		$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2128
+		$post_type = !empty($taxObject->object_type) ? $taxObject->object_type[0] : '';
2129
+
2130
+		if ($post_type == 'post') {
2131
+			$post_type = '';
2132
+		}
2133
+		if ($post_type) {
2134
+			$post_type = $post_type . '_';
2135
+		}
2136
+
2137
+		$m = get_option('tax_meta_' . $post_type . $term_id);
2138
+
2139
+		if (isset($m[$key])) {
2140
+			unset($m[$key]);
2141
+		}
2142
+		update_option('tax_meta_' . $post_type  . $term_id, $m);
2143
+	}
2144 2144
 }
2145 2145
 
2146 2146
 //update meta
2147 2147
 if (!function_exists('geodir_update_tax_meta')) {
2148
-    function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149
-        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150
-            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2148
+	function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149
+		if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150
+			$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2151 2151
             
2152
-            if (!empty($taxObject->object_type)) {
2153
-                $post_type = $taxObject->object_type[0];
2154
-            }
2155
-        }
2156
-
2157
-        if ($post_type == 'post') {
2158
-            $post_type = '';
2159
-        }
2160
-        if ($post_type) {
2161
-            $post_type = $post_type . '_';
2162
-        }
2163
-
2164
-        $m = get_option('tax_meta_' . $post_type  . $term_id);
2165
-
2166
-        $m[$key] = $value;
2167
-        update_option('tax_meta_' . $post_type . $term_id, $m);
2168
-
2169
-        /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170
-        do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2171
-    }
2152
+			if (!empty($taxObject->object_type)) {
2153
+				$post_type = $taxObject->object_type[0];
2154
+			}
2155
+		}
2156
+
2157
+		if ($post_type == 'post') {
2158
+			$post_type = '';
2159
+		}
2160
+		if ($post_type) {
2161
+			$post_type = $post_type . '_';
2162
+		}
2163
+
2164
+		$m = get_option('tax_meta_' . $post_type  . $term_id);
2165
+
2166
+		$m[$key] = $value;
2167
+		update_option('tax_meta_' . $post_type . $term_id, $m);
2168
+
2169
+		/** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170
+		do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2171
+	}
2172 2172
 }
2173 2173
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             $this->add_missed_values();
114 114
             if (isset($meta_box['use_with_theme']))
115 115
                 if ($meta_box['use_with_theme'] === true) {
116
-                    $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
116
+                    $this->SelfPath = get_stylesheet_directory_uri().'/library/cat-meta';
117 117
                 } elseif ($meta_box['use_with_theme'] === false) {
118 118
                     $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119 119
                 } else {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 $li = "<li id='item_{$attachment_id}'>";
263 263
                 $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264 264
                 //$li 	.= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>";
265
-                $li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>";
265
+                $li .= "<a title='".__('Remove this image', 'geodirectory')."' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='".$this->SelfPath."/images/delete-16.png' alt='".__('Remove', 'geodirectory')."' /></a>";
266 266
                 $li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267 267
                 $li .= "</li>";
268 268
                 $html .= $li;
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336 336
             $ok = false;
337 337
             if (strpos($field_id, '[') === false) {
338
-                check_admin_referer("at-delete-mupload_" . urldecode($field_id));
338
+                check_admin_referer("at-delete-mupload_".urldecode($field_id));
339 339
                 if ($term_id > 0)
340 340
                     $this->delete_tax_meta($term_id, $field_id);
341 341
                 //$ok = wp_delete_attachment( $attachment_id );
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
 
424 424
             if ($this->has_field('date') && $this->is_edit_page()) {
425 425
                 // Enqueu JQuery UI, use proper version.
426
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css');
427
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'));
426
+                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/themes/base/jquery-ui.css');
427
+                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/jquery-ui.min.js', array('jquery'));
428 428
             }
429 429
 
430 430
         }
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
             if ($this->has_field('time') && $this->is_edit_page()) {
442 442
 
443 443
                 // Enqueu JQuery UI, use proper version.
444
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true);
445
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true);
444
+                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/themes/base/jquery-ui.css', array(), false, true);
445
+                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/jquery-ui.min.js', array('jquery'), false, true);
446 446
                 wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true);
447 447
 
448 448
             }
@@ -462,13 +462,13 @@  discard block
 block discarded – undo
462 462
             if (!empty($this->_meta_box['pages'])) {
463 463
                 foreach ($this->_meta_box['pages'] as $page) {
464 464
                     //add fields to edit form
465
-                    add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
465
+                    add_action($page.'_edit_form_fields', array(&$this, 'show_edit_form'));
466 466
                     //add fields to add new form
467
-                    add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
467
+                    add_action($page.'_add_form_fields', array(&$this, 'show_new_form'));
468 468
                     // this saves the edit fields
469
-                    add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
469
+                    add_action('edited_'.$page, array(&$this, 'save'), 10, 2);
470 470
                     // this saves the add fields
471
-                    add_action('created_' . $page, array(&$this, 'save'), 10, 2);
471
+                    add_action('created_'.$page, array(&$this, 'save'), 10, 2);
472 472
                 }
473 473
             }
474 474
 
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
                     $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518 518
 
519 519
                 if ($field['validate_func']) {
520
-                    echo '<tr class="form-field form-required ' . $field['style'] . '">';
520
+                    echo '<tr class="form-field form-required '.$field['style'].'">';
521 521
                 } else {
522
-                    echo '<tr class="form-field ' . $field['style'] . '">';
522
+                    echo '<tr class="form-field '.$field['style'].'">';
523 523
                 }
524 524
 
525 525
                 // Call Separated methods for displaying each type of field.
526
-                call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
526
+                call_user_func(array(&$this, 'show_field_'.$field['type']), $field, $meta);
527 527
                 echo '</tr>';
528 528
             }
529 529
             echo '</table>';
@@ -550,14 +550,14 @@  discard block
 block discarded – undo
550 550
                 foreach ($meta as $me) {
551 551
                     //for labling toggles
552 552
                     $mmm = $me[$field['fields'][0]['id']];
553
-                    echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
553
+                    echo '<div class="at-repater-block">'.$mmm.'<br/><table class="repeater-table" style="display: none;">';
554 554
                     if ($field['inline']) {
555 555
                         echo '<tr class="at-inline" VALIGN="top">';
556 556
                     }
557 557
                     foreach ($field['fields'] as $f) {
558 558
                         //reset var $id for repeater
559 559
                         $id = '';
560
-                        $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
560
+                        $id = $field['id'].'['.$c.']['.$f['id'].']';
561 561
                         $m = $me[$f['id']];
562 562
                         $m = ($m !== '') ? $m : $f['std'];
563 563
                         if ('image' != $f['type'] && $f['type'] != 'repeater')
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                         if (!$field['inline']) {
568 568
                             echo '<tr>';
569 569
                         }
570
-                        call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
570
+                        call_user_func(array(&$this, 'show_field_'.$f['type']), $f, $m);
571 571
                         if (!$field['inline']) {
572 572
                             echo '</tr>';
573 573
                         }
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
                     echo '</table>
579 579
 				<span class="at-re-toggle"><img src="';
580 580
                     if ($this->_Local_images) {
581
-                        echo $plugin_path . '/images/edit.png';
581
+                        echo $plugin_path.'/images/edit.png';
582 582
                     } else {
583 583
                         echo 'http://i.imgur.com/ka0E2.png';
584 584
                     }
585 585
                     echo '" alt="Edit" title="Edit"/></span> 
586 586
 				<img src="';
587 587
                     if ($this->_Local_images) {
588
-                        echo $plugin_path . '/images/remove.png';
588
+                        echo $plugin_path.'/images/remove.png';
589 589
                     } else {
590 590
                         echo 'http://i.imgur.com/g8Duj.png';
591 591
                     }
592
-                    echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
592
+                    echo '" alt="'.__('Remove', 'geodirectory').'" title="'.__('Remove', 'geodirectory').'" id="remove-'.$field['id'].'"></div>';
593 593
                     $c = $c + 1;
594 594
 
595 595
                 }
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 
599 599
             echo '<img src="';
600 600
             if ($this->_Local_images) {
601
-                echo $plugin_path . '/images/add.png';
601
+                echo $plugin_path.'/images/add.png';
602 602
             } else {
603 603
                 echo 'http://i.imgur.com/w5Tuc.png';
604 604
             }
605
-            echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
605
+            echo '" alt="'.__('Add', 'geodirectory').'" title="'.__('Add', 'geodirectory').'" id="add-'.$field['id'].'"><br/></div>';
606 606
 
607 607
             //create all fields once more for js function and catch with object buffer
608 608
             ob_start();
@@ -613,12 +613,12 @@  discard block
 block discarded – undo
613 613
             foreach ($field['fields'] as $f) {
614 614
                 //reset var $id for repeater
615 615
                 $id = '';
616
-                $id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
616
+                $id = $field['id'].'[CurrentCounter]['.$f['id'].']';
617 617
                 $f['id'] = $id;
618 618
                 if (!$field['inline']) {
619 619
                     echo '<tr>';
620 620
                 }
621
-                call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
621
+                call_user_func(array(&$this, 'show_field_'.$f['type']), $f, '');
622 622
                 if (!$field['inline']) {
623 623
                     echo '</tr>';
624 624
                 }
@@ -628,24 +628,24 @@  discard block
 block discarded – undo
628 628
             }
629 629
             echo '</table><img src="';
630 630
             if ($this->_Local_images) {
631
-                echo $plugin_path . '/images/remove.png';
631
+                echo $plugin_path.'/images/remove.png';
632 632
             } else {
633 633
                 echo 'http://i.imgur.com/g8Duj.png';
634 634
             }
635
-            echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
-            $counter = 'countadd_' . $field['id'];
635
+            echo '" alt="'.__('Remove', 'geodirectory').'" title="'.__('Remove', 'geodirectory').'" id="remove-'.$field['id'].'"></div>';
636
+            $counter = 'countadd_'.$field['id'];
637 637
             $js_code = ob_get_clean();
638 638
             $js_code = str_replace("'", "\"", $js_code);
639
-            $js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
639
+            $js_code = str_replace("CurrentCounter", "' + ".$counter." + '", $js_code);
640 640
             echo '<script>
641 641
 				jQuery(document).ready(function() {
642
-					var ' . $counter . ' = ' . $c . ';
643
-					jQuery("#add-' . $field['id'] . '").live(\'click\', function() {
644
-						' . $counter . ' = ' . $counter . ' + 1;
645
-						jQuery(this).before(\'' . $js_code . '\');						
642
+					var ' . $counter.' = '.$c.';
643
+					jQuery("#add-' . $field['id'].'").live(\'click\', function() {
644
+						' . $counter.' = '.$counter.' + 1;
645
+						jQuery(this).before(\'' . $js_code.'\');						
646 646
 						update_repeater_fields();
647 647
 					});
648
-        			jQuery("#remove-' . $field['id'] . '").live(\'click\', function() {
648
+        			jQuery("#remove-' . $field['id'].'").live(\'click\', function() {
649 649
             			jQuery(this).parent().remove();
650 650
         			});
651 651
     			});
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
         public function show_field_paragraph($field)
773 773
         {
774 774
             //$this->show_field_begin( $field, $meta );
775
-            echo '<p>' . $field['value'] . '</p>';
775
+            echo '<p>'.$field['value'].'</p>';
776 776
             //$this->show_field_end( $field, $meta );
777 777
         }
778 778
 
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
         {
804 804
 
805 805
             if (!is_array($meta))
806
-                $meta = (array)$meta;
806
+                $meta = (array) $meta;
807 807
 
808 808
             $this->show_field_begin($field, $meta);
809
-            echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
809
+            echo "<select class='at-select' name='{$field['id']}".($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'").">";
810 810
             foreach ($field['options'] as $key => $value) {
811
-                echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
811
+                echo "<option value='{$key}'".selected(in_array($key, $meta), true, false).">{$value}</option>";
812 812
             }
813 813
             echo "</select>";
814 814
             $this->show_field_end($field, $meta);
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
         {
828 828
 
829 829
             if (!is_array($meta))
830
-                $meta = (array)$meta;
830
+                $meta = (array) $meta;
831 831
 
832 832
             $this->show_field_begin($field, $meta);
833 833
             foreach ($field['options'] as $key => $value) {
834
-                echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>";
834
+                echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'".checked(in_array($key, $meta), true, false)." /> <span class='at-radio-label'>{$value}</span>";
835 835
             }
836 836
             $this->show_field_end($field, $meta);
837 837
         }
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
         {
849 849
 
850 850
             $this->show_field_begin($field, $meta);
851
-            echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}";
851
+            echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'".checked(!empty($meta), true, false)." /> {$field['desc']}";
852 852
             $this->show_field_end($field, $meta);
853 853
         }
854 854
 
@@ -890,18 +890,18 @@  discard block
 block discarded – undo
890 890
             global $post;
891 891
 
892 892
             if (!is_array($meta))
893
-                $meta = (array)$meta;
893
+                $meta = (array) $meta;
894 894
 
895 895
             $this->show_field_begin($field, $meta);
896 896
             echo "{$field['desc']}<br />";
897 897
 
898 898
             if (!empty($meta)) {
899 899
                 $nonce = wp_create_nonce('at_ajax_delete');
900
-                echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
900
+                echo '<div style="margin-bottom: 10px"><strong>'.__('Uploaded files', 'geodirectory').'</strong></div>';
901 901
                 echo '<ol class="at-upload">';
902 902
                 foreach ($meta as $att) {
903 903
                     // if (wp_attachment_is_image($att)) continue; // what's image uploader for?
904
-                    echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>";
904
+                    echo "<li>".wp_get_attachment_link($att, '', false, false, ' ')." (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>".__('Remove', 'geodirectory')."</a>)</li>";
905 905
                 }
906 906
                 echo '</ol>';
907 907
             }
@@ -909,13 +909,13 @@  discard block
 block discarded – undo
909 909
             // show form upload
910 910
 
911 911
             echo "<div class='at-file-upload-label'>";
912
-            echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
912
+            echo "<strong>".__('Upload new files', 'geodirectory')."</strong>";
913 913
             echo "</div>";
914 914
             echo "<div class='new-files'>";
915 915
             echo "<div class='file-input'>";
916 916
             echo "<input type='file' name='{$field['id']}[]' />";
917 917
             echo "</div><!-- End .file-input -->";
918
-            echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
918
+            echo "<a class='at-add-file button' href='#'>".__('Add more files', 'geodirectory')."</a>";
919 919
             echo "</div><!-- End .new-files -->";
920 920
             echo "</td>";
921 921
             $this->show_field_end($field, $meta);
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
         public function show_field_image($field, $meta)
933 933
         {
934 934
             $this->show_field_begin($field, $meta);
935
-            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
935
+            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_".$field['id'], false, false);
936 936
             if (is_array($meta)) {
937 937
                 if (isset($meta[0]) && is_array($meta[0]))
938 938
                     $meta = $meta[0];
@@ -958,19 +958,19 @@  discard block
 block discarded – undo
958 958
                 }
959 959
                 $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
960 960
 
961
-                $uploads_url = $uploads_baseurl . $sub_dir;
961
+                $uploads_url = $uploads_baseurl.$sub_dir;
962 962
 
963
-                $meta['src'] = $uploads_url . '/' . $file_name;
963
+                $meta['src'] = $uploads_url.'/'.$file_name;
964 964
 
965
-                $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
-                $html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
-                $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
965
+                $html .= "<span class='mupload_img_holder'><img src='".$meta['src']."' style='max-height: 150px;max-width: 150px;' /></span>";
966
+                $html .= "<input type='hidden' name='".$field['id']."[id]' id='".$field['id']."[id]' value='".$meta['id']."' />";
967
+                $html .= "<input type='hidden' class='".$field['id']."[src]' name='".$field['id']."[src]' id='".$field['id']."[src]' value='".$meta['src']."' />";
968
+                $html .= "<input class='at-delete_image_button' type='button' rel='".$field['id']."' value='".__('Remove Image', 'geodirectory')."' />";
969 969
             } else {
970 970
                 $html .= "<span class='mupload_img_holder'></span>";
971
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
-                $html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
-                $html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
971
+                $html .= "<input type='hidden' name='".$field['id']."[id]' id='".$field['id']."[id]' value='' />";
972
+                $html .= "<input class='".$field['id']."[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='".$field['id']."[src]' id='".$field['id']."[src]' value='' />";
973
+                $html .= "<input class='at-upload_image_button' type='button' rel='".$field['id']."' value='".__('Upload Image', 'geodirectory')."' />";
974 974
             }
975 975
             echo $html;
976 976
             $this->show_field_end($field, $meta);
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 
995 995
             echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996 996
             //	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
-            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
997
+            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='".__('Select a color', 'geodirectory')."'/>";
998 998
             echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999 999
             $this->show_field_end($field, $meta);
1000 1000
 
@@ -1012,14 +1012,14 @@  discard block
 block discarded – undo
1012 1012
         {
1013 1013
 
1014 1014
             if (!is_array($meta))
1015
-                $meta = (array)$meta;
1015
+                $meta = (array) $meta;
1016 1016
 
1017 1017
             $this->show_field_begin($field, $meta);
1018 1018
 
1019 1019
             $html = array();
1020 1020
 
1021 1021
             foreach ($field['options'] as $key => $value) {
1022
-                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1022
+                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'".checked(in_array($key, $meta), true, false)." /> {$value}";
1023 1023
             }
1024 1024
 
1025 1025
             echo implode('<br />', $html);
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
         {
1073 1073
             global $post;
1074 1074
 
1075
-            if (!is_array($meta)) $meta = (array)$meta;
1075
+            if (!is_array($meta)) $meta = (array) $meta;
1076 1076
             $this->show_field_begin($field, $meta);
1077 1077
             $options = $field['options'];
1078 1078
             $posts = get_posts($options['args']);
@@ -1080,13 +1080,13 @@  discard block
 block discarded – undo
1080 1080
             // checkbox_list
1081 1081
             if ('checkbox_list' == $options['type']) {
1082 1082
                 foreach ($posts as $p) {
1083
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1083
+                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'".checked(in_array($p->ID, $meta), true, false)." /> $p->post_title<br/>";
1084 1084
                 }
1085 1085
             } // select
1086 1086
             else {
1087
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1087
+                echo "<select name='{$field['id']}".($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'").">";
1088 1088
                 foreach ($posts as $p) {
1089
-                    echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1089
+                    echo "<option value='$p->ID'".selected(in_array($p->ID, $meta), true, false).">$p->post_title</option>";
1090 1090
                 }
1091 1091
                 echo "</select>";
1092 1092
             }
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
         {
1111 1111
             global $post;
1112 1112
 
1113
-            if (!is_array($meta)) $meta = (array)$meta;
1113
+            if (!is_array($meta)) $meta = (array) $meta;
1114 1114
             $this->show_field_begin($field, $meta);
1115 1115
             $options = $field['options'];
1116 1116
             $terms = get_terms($options['taxonomy'], $options['args']);
@@ -1118,13 +1118,13 @@  discard block
 block discarded – undo
1118 1118
             // checkbox_list
1119 1119
             if ('checkbox_list' == $options['type']) {
1120 1120
                 foreach ($terms as $term) {
1121
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1121
+                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'".checked(in_array($term->slug, $meta), true, false)." /> $term->name<br/>";
1122 1122
                 }
1123 1123
             } // select
1124 1124
             else {
1125
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1125
+                echo "<select name='{$field['id']}".($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'").">";
1126 1126
                 foreach ($terms as $term) {
1127
-                    echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1127
+                    echo "<option value='$term->slug'".selected(in_array($term->slug, $meta), true, false).">$term->name</option>";
1128 1128
                 }
1129 1129
                 echo "</select>";
1130 1130
             }
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
                     //$old_filename = $upload_dir['path'].'/'.$old_filename;
1182 1182
 
1183
-                    $new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1183
+                    $new_filename = $upload_dir['path'].'/'.'cat_icon_'.$term_id.'.png';
1184 1184
 
1185 1185
                     /*rename($old_filename, $new_filename);
1186 1186
 				
@@ -1222,9 +1222,9 @@  discard block
 block discarded – undo
1222 1222
                 if ($type != "paragraph") {
1223 1223
 
1224 1224
                     // Call defined method to save meta value, if there's no methods, call common one.
1225
-                    $save_func = 'save_field_' . $type;
1225
+                    $save_func = 'save_field_'.$type;
1226 1226
                     if (method_exists($this, $save_func)) {
1227
-                        call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1227
+                        call_user_func(array(&$this, 'save_field_'.$type), $term_id, $field, $old, $new);
1228 1228
                     } else {
1229 1229
                         $this->save_field($term_id, $field, $old, $new);
1230 1230
                     }
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
                 if (!is_wp_error($id)) {
1370 1370
 
1371 1371
                     wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
-                    add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1372
+                    add_post_meta($term_id, $name, $id, false); // save file's url in meta fields
1373 1373
 
1374 1374
                 } // End if
1375 1375
 
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
                 if (!is_wp_error($id)) {
1415 1415
 
1416 1416
                     wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
-                    return $id;    // return file's url in meta fields
1417
+                    return $id; // return file's url in meta fields
1418 1418
                 } // End if
1419 1419
             } // End foreach
1420 1420
         }
@@ -1429,9 +1429,9 @@  discard block
 block discarded – undo
1429 1429
         {
1430 1430
 
1431 1431
             // Default values for meta box
1432
-            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1432
+            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array) $this->_meta_box);
1433 1433
 
1434
-            if(is_array($this->_fields)) {
1434
+            if (is_array($this->_fields)) {
1435 1435
                 // Default values for fields
1436 1436
                 foreach ($this->_fields as &$field) {
1437 1437
                     $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
          */
1452 1452
         public function has_field($type)
1453 1453
         {
1454
-            if(is_array($this->_fields)) {
1454
+            if (is_array($this->_fields)) {
1455 1455
                 foreach ($this->_fields as $field) {
1456 1456
                     if ($type == $field['type'])
1457 1457
                         return true;
@@ -2019,12 +2019,12 @@  discard block
 block discarded – undo
2019 2019
                 $post_type = $taxObject->object_type[0];
2020 2020
             }
2021 2021
 
2022
-            if($post_type=='post'){$post_type='';}
2023
-            if($post_type){$post_type = $post_type.'_';}
2022
+            if ($post_type == 'post') {$post_type = ''; }
2023
+            if ($post_type) {$post_type = $post_type.'_'; }
2024 2024
 
2025 2025
             $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026 2026
 
2027
-            $m = get_option('tax_meta_' . $post_type  . $t_id);
2027
+            $m = get_option('tax_meta_'.$post_type.$t_id);
2028 2028
             if (isset($m[$key])) {
2029 2029
                 return $m[$key];
2030 2030
             } else {
@@ -2041,15 +2041,15 @@  discard block
 block discarded – undo
2041 2041
                 $post_type = $taxObject->object_type[0];
2042 2042
             }
2043 2043
 
2044
-            if($post_type=='post'){$post_type='';}
2045
-            if($post_type){$post_type = $post_type.'_';}
2044
+            if ($post_type == 'post') {$post_type = ''; }
2045
+            if ($post_type) {$post_type = $post_type.'_'; }
2046 2046
 
2047
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2047
+            $m = get_option('tax_meta_'.$post_type.$term_id);
2048 2048
 
2049 2049
             if (isset($m[$key])) {
2050 2050
                 unset($m[$key]);
2051 2051
             }
2052
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2052
+            update_option('tax_meta_'.$post_type.$term_id, $m);
2053 2053
         }
2054 2054
 
2055 2055
         //update meta
@@ -2061,13 +2061,13 @@  discard block
 block discarded – undo
2061 2061
                 $post_type = $taxObject->object_type[0];
2062 2062
             }
2063 2063
 
2064
-            if($post_type=='post'){$post_type='';}
2065
-            if($post_type){$post_type = $post_type.'_';}
2064
+            if ($post_type == 'post') {$post_type = ''; }
2065
+            if ($post_type) {$post_type = $post_type.'_'; }
2066 2066
 
2067
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2067
+            $m = get_option('tax_meta_'.$post_type.$term_id);
2068 2068
 
2069 2069
             $m[$key] = $value;
2070
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2070
+            update_option('tax_meta_'.$post_type.$term_id, $m);
2071 2071
 
2072 2072
             /**
2073 2073
              * Called after the tax meta is updated.
@@ -2107,12 +2107,12 @@  discard block
 block discarded – undo
2107 2107
             $post_type = '';
2108 2108
         }
2109 2109
         if ($post_type) {
2110
-            $post_type = $post_type . '_';
2110
+            $post_type = $post_type.'_';
2111 2111
         }
2112 2112
 
2113 2113
         $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114 2114
 
2115
-        $m = get_option('tax_meta_' . $post_type  . $t_id);
2115
+        $m = get_option('tax_meta_'.$post_type.$t_id);
2116 2116
         if (isset($m[$key])) {
2117 2117
             return $m[$key];
2118 2118
         } else {
@@ -2131,15 +2131,15 @@  discard block
 block discarded – undo
2131 2131
             $post_type = '';
2132 2132
         }
2133 2133
         if ($post_type) {
2134
-            $post_type = $post_type . '_';
2134
+            $post_type = $post_type.'_';
2135 2135
         }
2136 2136
 
2137
-        $m = get_option('tax_meta_' . $post_type . $term_id);
2137
+        $m = get_option('tax_meta_'.$post_type.$term_id);
2138 2138
 
2139 2139
         if (isset($m[$key])) {
2140 2140
             unset($m[$key]);
2141 2141
         }
2142
-        update_option('tax_meta_' . $post_type  . $term_id, $m);
2142
+        update_option('tax_meta_'.$post_type.$term_id, $m);
2143 2143
     }
2144 2144
 }
2145 2145
 
@@ -2158,13 +2158,13 @@  discard block
 block discarded – undo
2158 2158
             $post_type = '';
2159 2159
         }
2160 2160
         if ($post_type) {
2161
-            $post_type = $post_type . '_';
2161
+            $post_type = $post_type.'_';
2162 2162
         }
2163 2163
 
2164
-        $m = get_option('tax_meta_' . $post_type  . $term_id);
2164
+        $m = get_option('tax_meta_'.$post_type.$term_id);
2165 2165
 
2166 2166
         $m[$key] = $value;
2167
-        update_option('tax_meta_' . $post_type . $term_id, $m);
2167
+        update_option('tax_meta_'.$post_type.$term_id, $m);
2168 2168
 
2169 2169
         /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170 2170
         do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
Please login to merge, or discard this patch.
Doc Comments   +18 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
          * @author Ohad Raz
1690 1690
          * @since 1.0
1691 1691
          * @access public
1692
-         * @param $id string field id, i.e. the meta key
1692
+         * @param string $id string field id, i.e. the meta key
1693 1693
          * @param $options (array)  array of key => value pairs for select options
1694 1694
          * @param $args mixed|array
1695 1695
          *    'name' => // field name/label string optional
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
          * @author Ohad Raz
1816 1816
          * @since 1.0
1817 1817
          * @access public
1818
-         * @param $id string  field id, i.e. the meta key
1818
+         * @param string $id string  field id, i.e. the meta key
1819 1819
          * @param $args mixed|array
1820 1820
          *    'name' => // field name/label string optional
1821 1821
          *    'desc' => // field description, string optional
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
          * @author Ohad Raz
1863 1863
          * @since 1.0
1864 1864
          * @access public
1865
-         * @param $id string  field id, i.e. the meta key
1865
+         * @param string $id string  field id, i.e. the meta key
1866 1866
          * @param $args mixed|array
1867 1867
          *    'name' => // field name/label string optional
1868 1868
          *    'desc' => // field description, string optional
@@ -2053,6 +2053,11 @@  discard block
 block discarded – undo
2053 2053
         }
2054 2054
 
2055 2055
         //update meta
2056
+
2057
+        /**
2058
+         * @param string $term_id
2059
+         * @param string $key
2060
+         */
2056 2061
         public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057 2062
         {
2058 2063
 
@@ -2094,6 +2099,12 @@  discard block
 block discarded – undo
2094 2099
 
2095 2100
 //get term meta field
2096 2101
 if (!function_exists('geodir_get_tax_meta')) {
2102
+
2103
+    /**
2104
+     * @param string $key
2105
+     *
2106
+     * @return string
2107
+     */
2097 2108
     function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098 2109
         if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099 2110
             $taxObject = get_taxonomy($_REQUEST['taxonomy']);
@@ -2145,6 +2156,10 @@  discard block
 block discarded – undo
2145 2156
 
2146 2157
 //update meta
2147 2158
 if (!function_exists('geodir_update_tax_meta')) {
2159
+
2160
+    /**
2161
+     * @param string $key
2162
+     */
2148 2163
     function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149 2164
         if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150 2165
             $taxObject = get_taxonomy($_REQUEST['taxonomy']);
Please login to merge, or discard this patch.
geodirectory_template_actions.php 3 patches
Braces   +31 added lines, -24 removed lines patch added patch discarded remove patch
@@ -715,8 +715,9 @@  discard block
 block discarded – undo
715 715
 
716 716
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717 717
                             if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
718
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
719
+                                                                    $term_icon = $term_icon_url['src'];
720
+                                }
720 721
                                 break;
721 722
                             }
722 723
                         }
@@ -1265,8 +1266,9 @@  discard block
 block discarded – undo
1265 1266
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266 1267
     }
1267 1268
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1269
+    if (isset($taxonomies[$post_type . '_tags'])) {
1270
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1271
+    }
1270 1272
 
1271 1273
     ?>
1272 1274
     </p><?php
@@ -1634,23 +1636,21 @@  discard block
 block discarded – undo
1634 1636
     if(geodir_is_page('pt')){
1635 1637
         $gd_page = 'pt';
1636 1638
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
-    }
1638
-    elseif(geodir_is_page('listing')){
1639
+    } elseif(geodir_is_page('listing')){
1639 1640
         $gd_page = 'listing';
1640 1641
         global $wp_query;
1641 1642
         $current_term = $wp_query->get_queried_object();
1642 1643
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1643 1644
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1645
+        } else{
1645 1646
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646 1647
         }
1647 1648
 
1648
-    }
1649
-    elseif(geodir_is_page('author')){
1649
+    } elseif(geodir_is_page('author')){
1650 1650
         $gd_page = 'author';
1651 1651
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652 1652
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1653
+        } else{
1654 1654
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655 1655
         }
1656 1656
 
@@ -2074,8 +2074,9 @@  discard block
 block discarded – undo
2074 2074
  */
2075 2075
 function geodir_action_add_listing_page_title()
2076 2076
 {
2077
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2077
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2078
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
+    }
2079 2080
     /** This action is documented in geodirectory_template_actions.php */
2080 2081
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081 2082
     /** This action is documented in geodirectory_template_actions.php */
@@ -2087,7 +2088,7 @@  discard block
 block discarded – undo
2087 2088
         $gd_page = 'add-listing';
2088 2089
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089 2090
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2091
+        } elseif(isset($listing_type)){
2091 2092
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092 2093
         }
2093 2094
 
@@ -2406,8 +2407,9 @@  discard block
 block discarded – undo
2406 2407
         $totImg = 0;
2407 2408
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408 2409
             $post = (object)$gd_session->get('listing');
2409
-            if (isset($post->post_images))
2410
-                $curImages = trim($post->post_images, ",");
2410
+            if (isset($post->post_images)) {
2411
+                            $curImages = trim($post->post_images, ",");
2412
+            }
2411 2413
 
2412 2414
 
2413 2415
             if ($curImages != '') {
@@ -2435,10 +2437,13 @@  discard block
 block discarded – undo
2435 2437
             $totImg = count((array)$thumb_img_arr);
2436 2438
         }
2437 2439
 
2438
-        if ($curImages != '')
2439
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
-        else
2441
-            $svalue = '';
2440
+        if ($curImages != '') {
2441
+                    $svalue = $curImages;
2442
+        }
2443
+        // this will be initial value of the above form field. Image urls.
2444
+        else {
2445
+                    $svalue = '';
2446
+        }
2442 2447
 
2443 2448
         $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444 2449
         $show_image_input_box = ($image_limit != '0');
@@ -2650,8 +2655,9 @@  discard block
 block discarded – undo
2650 2655
     </script><?php
2651 2656
 
2652 2657
     global $errors;
2653
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
-        $errors->add('claim_login', LOGIN_CLAIM);
2658
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2659
+            $errors->add('claim_login', LOGIN_CLAIM);
2660
+    }
2655 2661
 
2656 2662
     if (!empty($errors)) {
2657 2663
         foreach ($errors as $errorsObj) {
@@ -2758,8 +2764,9 @@  discard block
 block discarded – undo
2758 2764
 
2759 2765
     if (!empty($term)) {
2760 2766
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
-        if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2767
+        if (!empty($current_term)) {
2768
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2769
+        }
2763 2770
     }
2764 2771
 
2765 2772
 
@@ -2777,7 +2784,7 @@  discard block
 block discarded – undo
2777 2784
         $gd_page = 'author';
2778 2785
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779 2786
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2787
+        } else{
2781 2788
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782 2789
         }
2783 2790
 
Please login to merge, or discard this patch.
Indentation   +1852 added lines, -1852 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function gd_compat_styles()
19 19
 {
20
-    $tc = get_option('theme_compatibility_setting');
21
-    echo "<style id='gd-compat-styles' type='text/css'>";
22
-    echo $tc['geodir_theme_compat_css'];
23
-    echo "</style>";
20
+	$tc = get_option('theme_compatibility_setting');
21
+	echo "<style id='gd-compat-styles' type='text/css'>";
22
+	echo $tc['geodir_theme_compat_css'];
23
+	echo "</style>";
24 24
 }
25 25
 
26 26
 /**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function gd_compat_script()
33 33
 {
34
-    $tc = get_option('theme_compatibility_setting');
35
-    echo "<script>";
36
-    echo $tc['geodir_theme_compat_js'];
37
-    echo " </script>";
34
+	$tc = get_option('theme_compatibility_setting');
35
+	echo "<script>";
36
+	echo $tc['geodir_theme_compat_js'];
37
+	echo " </script>";
38 38
 }
39 39
 
40 40
 /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_top_content_add_dynamic()
49 49
 {
50
-    $tc = get_option('theme_compatibility_setting');
51
-    echo $tc['geodir_top_content_add'];
50
+	$tc = get_option('theme_compatibility_setting');
51
+	echo $tc['geodir_top_content_add'];
52 52
 }
53 53
 
54 54
 /**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function geodir_before_main_content_add_dynamic()
63 63
 {
64
-    $tc = get_option('theme_compatibility_setting');
65
-    echo $tc['geodir_before_main_content_add'];
64
+	$tc = get_option('theme_compatibility_setting');
65
+	echo $tc['geodir_before_main_content_add'];
66 66
 }
67 67
 
68 68
 /**
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function geodir_full_page_class_dynamic()
77 77
 {
78
-    $tc = get_option('theme_compatibility_setting');
79
-    return $tc['geodir_full_page_class_filter'];
78
+	$tc = get_option('theme_compatibility_setting');
79
+	return $tc['geodir_full_page_class_filter'];
80 80
 }
81 81
 
82 82
 /**
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function geodir_before_widget_dynamic()
91 91
 {
92
-    $tc = get_option('theme_compatibility_setting');
93
-    return $tc['geodir_before_widget_filter'];
92
+	$tc = get_option('theme_compatibility_setting');
93
+	return $tc['geodir_before_widget_filter'];
94 94
 }
95 95
 
96 96
 /**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function geodir_after_widget_dynamic()
105 105
 {
106
-    $tc = get_option('theme_compatibility_setting');
107
-    return $tc['geodir_after_widget_filter'];
106
+	$tc = get_option('theme_compatibility_setting');
107
+	return $tc['geodir_after_widget_filter'];
108 108
 }
109 109
 
110 110
 /**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
  */
118 118
 function geodir_before_title_dynamic()
119 119
 {
120
-    $tc = get_option('theme_compatibility_setting');
121
-    return $tc['geodir_before_title_filter'];
120
+	$tc = get_option('theme_compatibility_setting');
121
+	return $tc['geodir_before_title_filter'];
122 122
 }
123 123
 
124 124
 /**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function geodir_after_title_dynamic()
133 133
 {
134
-    $tc = get_option('theme_compatibility_setting');
135
-    return $tc['geodir_after_title_filter'];
134
+	$tc = get_option('theme_compatibility_setting');
135
+	return $tc['geodir_after_title_filter'];
136 136
 }
137 137
 
138 138
 /**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function geodir_menu_li_class_dynamic()
147 147
 {
148
-    $tc = get_option('theme_compatibility_setting');
149
-    return $tc['geodir_menu_li_class_filter'];
148
+	$tc = get_option('theme_compatibility_setting');
149
+	return $tc['geodir_menu_li_class_filter'];
150 150
 }
151 151
 
152 152
 /**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function geodir_sub_menu_ul_class_dynamic()
161 161
 {
162
-    $tc = get_option('theme_compatibility_setting');
163
-    return $tc['geodir_sub_menu_ul_class_filter'];
162
+	$tc = get_option('theme_compatibility_setting');
163
+	return $tc['geodir_sub_menu_ul_class_filter'];
164 164
 }
165 165
 
166 166
 /**
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function geodir_sub_menu_li_class_dynamic()
175 175
 {
176
-    $tc = get_option('theme_compatibility_setting');
177
-    return $tc['geodir_sub_menu_li_class_filter'];
176
+	$tc = get_option('theme_compatibility_setting');
177
+	return $tc['geodir_sub_menu_li_class_filter'];
178 178
 }
179 179
 
180 180
 /**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function geodir_menu_a_class_dynamic()
189 189
 {
190
-    $tc = get_option('theme_compatibility_setting');
191
-    return $tc['geodir_menu_a_class_filter'];
190
+	$tc = get_option('theme_compatibility_setting');
191
+	return $tc['geodir_menu_a_class_filter'];
192 192
 }
193 193
 
194 194
 /**
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
  */
202 202
 function geodir_sub_menu_a_class_dynamic()
203 203
 {
204
-    $tc = get_option('theme_compatibility_setting');
205
-    return $tc['geodir_sub_menu_a_class_filter'];
204
+	$tc = get_option('theme_compatibility_setting');
205
+	return $tc['geodir_sub_menu_a_class_filter'];
206 206
 }
207 207
 
208 208
 /**
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_location_switcher_menu_li_class_dynamic()
217 217
 {
218
-    $tc = get_option('theme_compatibility_setting');
219
-    return $tc['geodir_location_switcher_menu_li_class_filter'];
218
+	$tc = get_option('theme_compatibility_setting');
219
+	return $tc['geodir_location_switcher_menu_li_class_filter'];
220 220
 }
221 221
 
222 222
 /**
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_location_switcher_menu_a_class_dynamic()
231 231
 {
232
-    $tc = get_option('theme_compatibility_setting');
233
-    return $tc['geodir_location_switcher_menu_a_class_filter'];
232
+	$tc = get_option('theme_compatibility_setting');
233
+	return $tc['geodir_location_switcher_menu_a_class_filter'];
234 234
 }
235 235
 
236 236
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  */
244 244
 function geodir_location_switcher_menu_sub_ul_class_dynamic()
245 245
 {
246
-    $tc = get_option('theme_compatibility_setting');
247
-    return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
246
+	$tc = get_option('theme_compatibility_setting');
247
+	return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
248 248
 }
249 249
 
250 250
 /**
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
  */
258 258
 function geodir_location_switcher_menu_sub_li_class_dynamic()
259 259
 {
260
-    $tc = get_option('theme_compatibility_setting');
261
-    return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
260
+	$tc = get_option('theme_compatibility_setting');
261
+	return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
262 262
 }
263 263
 
264 264
 
@@ -275,107 +275,107 @@  discard block
 block discarded – undo
275 275
 function geodir_content_actions_dynamic()
276 276
 {
277 277
 
278
-    $tc = get_option('theme_compatibility_setting');
278
+	$tc = get_option('theme_compatibility_setting');
279 279
 //print_r($tc);
280
-    if (empty($tc)) {
281
-        return;
282
-    }
283
-
284
-    //php
285
-    if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
-    }
288
-
289
-    //geodir_full_page_class
290
-    if (!empty($tc['geodir_full_page_class_filter'])) {
291
-        add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
-    }
293
-
294
-    //widget before filter
295
-    if (!empty($tc['geodir_before_widget_filter'])) {
296
-        add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
-    }
298
-
299
-    //widget after filter
300
-    if (!empty($tc['geodir_after_widget_filter'])) {
301
-        add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
-    }
303
-
304
-    //widget before title filter
305
-    if (!empty($tc['geodir_before_title_filter'])) {
306
-        add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
-    }
308
-
309
-    //widget before title filter
310
-    if (!empty($tc['geodir_after_title_filter'])) {
311
-        add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
-    }
313
-
314
-    //menu li class
315
-    if (!empty($tc['geodir_menu_li_class_filter'])) {
316
-        add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
-    }
318
-
319
-    //menu ul class
320
-    if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
-        add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
-    }
323
-
324
-    //menu sub li class
325
-    if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
-        add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
-    }
328
-
329
-    //menu a class
330
-    if (!empty($tc['geodir_menu_a_class_filter'])) {
331
-        add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
-    }
333
-
334
-    //menu sub a class
335
-    if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
-        add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
-    }
338
-
339
-    //location menu li class
340
-    if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
-        add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
-    }
343
-
344
-    //location menu sub ul class
345
-    if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
-        add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
-    }
348
-
349
-    //location menu sub li class
350
-    if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
-        add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
-    }
353
-
354
-    //location menu a class
355
-    if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
-        add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
-    }
358
-
359
-    // compat styles
360
-    if (!empty($tc['geodir_theme_compat_css'])) {
361
-        add_action('wp_head', 'gd_compat_styles');
362
-    }
363
-
364
-    // compat js
365
-    if (!empty($tc['geodir_theme_compat_js'])) {
366
-        add_action('wp_footer', 'gd_compat_script');
367
-    }
368
-
369
-
370
-    // geodir_top_content_add
371
-    if (!empty($tc['geodir_top_content_add'])) {
372
-        add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
-    }
374
-
375
-    // geodir_before_main_content_add
376
-    if (!empty($tc['geodir_before_main_content_add'])) {
377
-        add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
-    }
280
+	if (empty($tc)) {
281
+		return;
282
+	}
283
+
284
+	//php
285
+	if (!empty($tc['geodir_theme_compat_code'])) {
286
+		include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
+	}
288
+
289
+	//geodir_full_page_class
290
+	if (!empty($tc['geodir_full_page_class_filter'])) {
291
+		add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
+	}
293
+
294
+	//widget before filter
295
+	if (!empty($tc['geodir_before_widget_filter'])) {
296
+		add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
+	}
298
+
299
+	//widget after filter
300
+	if (!empty($tc['geodir_after_widget_filter'])) {
301
+		add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
+	}
303
+
304
+	//widget before title filter
305
+	if (!empty($tc['geodir_before_title_filter'])) {
306
+		add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
+	}
308
+
309
+	//widget before title filter
310
+	if (!empty($tc['geodir_after_title_filter'])) {
311
+		add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
+	}
313
+
314
+	//menu li class
315
+	if (!empty($tc['geodir_menu_li_class_filter'])) {
316
+		add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
+	}
318
+
319
+	//menu ul class
320
+	if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
+		add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
+	}
323
+
324
+	//menu sub li class
325
+	if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
+		add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
+	}
328
+
329
+	//menu a class
330
+	if (!empty($tc['geodir_menu_a_class_filter'])) {
331
+		add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
+	}
333
+
334
+	//menu sub a class
335
+	if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
+		add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
+	}
338
+
339
+	//location menu li class
340
+	if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
+		add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
+	}
343
+
344
+	//location menu sub ul class
345
+	if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
+		add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
+	}
348
+
349
+	//location menu sub li class
350
+	if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
+		add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
+	}
353
+
354
+	//location menu a class
355
+	if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
+		add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
+	}
358
+
359
+	// compat styles
360
+	if (!empty($tc['geodir_theme_compat_css'])) {
361
+		add_action('wp_head', 'gd_compat_styles');
362
+	}
363
+
364
+	// compat js
365
+	if (!empty($tc['geodir_theme_compat_js'])) {
366
+		add_action('wp_footer', 'gd_compat_script');
367
+	}
368
+
369
+
370
+	// geodir_top_content_add
371
+	if (!empty($tc['geodir_top_content_add'])) {
372
+		add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
+	}
374
+
375
+	// geodir_before_main_content_add
376
+	if (!empty($tc['geodir_before_main_content_add'])) {
377
+		add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
+	}
379 379
 
380 380
 
381 381
 }
@@ -398,23 +398,23 @@  discard block
 block discarded – undo
398 398
  */
399 399
 function geodir_action_wrapper_open($type = '', $id = '', $class = '')
400 400
 {
401
-    $tc = get_option('theme_compatibility_setting');
402
-    if (!empty($tc['geodir_wrapper_open_replace'])) {
403
-        $text = $tc['geodir_wrapper_open_replace'];
404
-    } else {
405
-        $text = '<div id="[id]" class="[class]">';
406
-    }
401
+	$tc = get_option('theme_compatibility_setting');
402
+	if (!empty($tc['geodir_wrapper_open_replace'])) {
403
+		$text = $tc['geodir_wrapper_open_replace'];
404
+	} else {
405
+		$text = '<div id="[id]" class="[class]">';
406
+	}
407 407
 
408
-    if (!empty($tc['geodir_wrapper_open_id'])) {
409
-        $id = $tc['geodir_wrapper_open_id'];
410
-    }
411
-    if (!empty($tc['geodir_wrapper_open_class'])) {
412
-        $class = $tc['geodir_wrapper_open_class'];
413
-    }
408
+	if (!empty($tc['geodir_wrapper_open_id'])) {
409
+		$id = $tc['geodir_wrapper_open_id'];
410
+	}
411
+	if (!empty($tc['geodir_wrapper_open_class'])) {
412
+		$class = $tc['geodir_wrapper_open_class'];
413
+	}
414 414
 
415
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
415
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
416 416
 
417
-    echo $text;
417
+	echo $text;
418 418
 }
419 419
 
420 420
 // action for adding the wrapperdiv closing tag
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function geodir_action_wrapper_close($type = '')
431 431
 {
432
-    $tc = get_option('theme_compatibility_setting');
433
-    if (!empty($tc['geodir_wrapper_close_replace'])) {
434
-        $text = $tc['geodir_wrapper_close_replace'];
435
-    } else {
436
-        $text = '</div><!-- wrapper ends here-->';
437
-    }
432
+	$tc = get_option('theme_compatibility_setting');
433
+	if (!empty($tc['geodir_wrapper_close_replace'])) {
434
+		$text = $tc['geodir_wrapper_close_replace'];
435
+	} else {
436
+		$text = '</div><!-- wrapper ends here-->';
437
+	}
438 438
 
439
-    echo $text;
439
+	echo $text;
440 440
 }
441 441
 
442 442
 // action for adding the content div opening tag
@@ -452,35 +452,35 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
457
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
459
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
461
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
463
-    } else {
464
-        $width_css = '';
465
-    }
466
-
467
-    $tc = get_option('theme_compatibility_setting');
468
-    if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
-        $text = $tc['geodir_wrapper_content_open_replace'];
470
-    } else {
471
-        $text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
-    }
473
-
474
-    if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
-        $id = $tc['geodir_wrapper_content_open_id'];
476
-    }
477
-    if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
-        $class = $tc['geodir_wrapper_content_open_class'];
479
-    }
480
-
481
-    $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
-
483
-    echo $text;
455
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
+		$width_css = 'style="width:' . $width . '%;"';
457
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
+		$width_css = 'style="width:' . $width . '%;"';
459
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
+		$width_css = 'style="width:' . $width . '%;"';
461
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
+		$width_css = 'style="width:' . $width . '%;"';
463
+	} else {
464
+		$width_css = '';
465
+	}
466
+
467
+	$tc = get_option('theme_compatibility_setting');
468
+	if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
+		$text = $tc['geodir_wrapper_content_open_replace'];
470
+	} else {
471
+		$text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
+	}
473
+
474
+	if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
+		$id = $tc['geodir_wrapper_content_open_id'];
476
+	}
477
+	if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
+		$class = $tc['geodir_wrapper_content_open_class'];
479
+	}
480
+
481
+	$text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
+
483
+	echo $text;
484 484
 }
485 485
 
486 486
 // action for adding the primary div closing tag
@@ -494,13 +494,13 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_action_wrapper_content_close($type = '')
496 496
 {
497
-    $tc = get_option('theme_compatibility_setting');
498
-    if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
-        $text = $tc['geodir_wrapper_content_close_replace'];
500
-    } else {
501
-        $text = '</div><!-- content ends here-->';
502
-    }
503
-    echo $text;
497
+	$tc = get_option('theme_compatibility_setting');
498
+	if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
+		$text = $tc['geodir_wrapper_content_close_replace'];
500
+	} else {
501
+		$text = '</div><!-- content ends here-->';
502
+	}
503
+	echo $text;
504 504
 }
505 505
 
506 506
 // action for adding the <article> opening tag
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
  */
519 519
 function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '')
520 520
 {
521
-    $class = implode(" ", $class);
522
-    $tc = get_option('theme_compatibility_setting');
523
-    if (!empty($tc['geodir_article_open_replace'])) {
524
-        $text = $tc['geodir_article_open_replace'];
525
-    } else {
526
-        $text = '<article  id="[id]" class="[class]" >';
527
-    }
521
+	$class = implode(" ", $class);
522
+	$tc = get_option('theme_compatibility_setting');
523
+	if (!empty($tc['geodir_article_open_replace'])) {
524
+		$text = $tc['geodir_article_open_replace'];
525
+	} else {
526
+		$text = '<article  id="[id]" class="[class]" >';
527
+	}
528 528
 
529
-    if (!empty($tc['geodir_article_open_id'])) {
530
-        $id = $tc['geodir_article_open_id'];
531
-    }
532
-    if (!empty($tc['geodir_article_open_class'])) {
533
-        $class = $tc['geodir_article_open_class'];
534
-    }
529
+	if (!empty($tc['geodir_article_open_id'])) {
530
+		$id = $tc['geodir_article_open_id'];
531
+	}
532
+	if (!empty($tc['geodir_article_open_class'])) {
533
+		$class = $tc['geodir_article_open_class'];
534
+	}
535 535
 
536
-    $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
536
+	$text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
537 537
 
538
-    echo $text;
538
+	echo $text;
539 539
 }
540 540
 
541 541
 // action for adding the primary div closing tag
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
  */
550 550
 function geodir_action_article_close($type = '')
551 551
 {
552
-    $tc = get_option('theme_compatibility_setting');
553
-    if (!empty($tc['geodir_article_close_replace'])) {
554
-        $text = $tc['geodir_article_close_replace'];
555
-    } else {
556
-        $text = '</article><!-- article ends here-->';
557
-    }
558
-    echo $text;
552
+	$tc = get_option('theme_compatibility_setting');
553
+	if (!empty($tc['geodir_article_close_replace'])) {
554
+		$text = $tc['geodir_article_close_replace'];
555
+	} else {
556
+		$text = '</article><!-- article ends here-->';
557
+	}
558
+	echo $text;
559 559
 }
560 560
 
561 561
 // action for adding the sidebar opening tag
@@ -572,35 +572,35 @@  discard block
 block discarded – undo
572 572
  */
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
577
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
579
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
581
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
583
-    } else {
584
-        $width_css = '';
585
-    }
586
-
587
-    $tc = get_option('theme_compatibility_setting');
588
-    if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
-        $text = $tc['geodir_sidebar_right_open_replace'];
590
-    } else {
591
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
-    }
593
-
594
-    if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
-        $id = $tc['geodir_sidebar_right_open_id'];
596
-    }
597
-    if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
-        $class = $tc['geodir_sidebar_right_open_class'];
599
-    }
600
-
601
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
-
603
-    echo $text;
575
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
+		$width_css = 'style="width:' . $width . '%;"';
577
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
+		$width_css = 'style="width:' . $width . '%;"';
579
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
+		$width_css = 'style="width:' . $width . '%;"';
581
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
+		$width_css = 'style="width:' . $width . '%;"';
583
+	} else {
584
+		$width_css = '';
585
+	}
586
+
587
+	$tc = get_option('theme_compatibility_setting');
588
+	if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
+		$text = $tc['geodir_sidebar_right_open_replace'];
590
+	} else {
591
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
+	}
593
+
594
+	if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
+		$id = $tc['geodir_sidebar_right_open_id'];
596
+	}
597
+	if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
+		$class = $tc['geodir_sidebar_right_open_class'];
599
+	}
600
+
601
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
+
603
+	echo $text;
604 604
 }
605 605
 
606 606
 // action for adding the primary div closing tag
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_action_sidebar_right_close($type = '')
616 616
 {
617
-    $tc = get_option('theme_compatibility_setting');
618
-    if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
-        $text = $tc['geodir_sidebar_right_close_replace'];
620
-    } else {
621
-        $text = '</aside><!-- sidebar ends here-->';
622
-    }
623
-    echo $text;
617
+	$tc = get_option('theme_compatibility_setting');
618
+	if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
+		$text = $tc['geodir_sidebar_right_close_replace'];
620
+	} else {
621
+		$text = '</aside><!-- sidebar ends here-->';
622
+	}
623
+	echo $text;
624 624
 }
625 625
 
626 626
 
@@ -641,121 +641,121 @@  discard block
 block discarded – undo
641 641
  */
642 642
 function geodir_action_geodir_set_preview_post()
643 643
 {
644
-    global $post, $preview, $gd_session;
645
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
646
-    if (!$preview || $is_backend_preview) {
647
-        return;
648
-    }// bail if not previewing
649
-
650
-    $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
-
652
-    $fields_info = geodir_get_custom_fields_type($listing_type);
653
-
654
-    foreach ($_REQUEST as $pkey => $pval) {
655
-        if ($pkey == 'geodir_video') {
656
-            $tags = '<iframe>';
657
-        } else if ($pkey == 'post_desc') {
658
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
-        } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
-        } else if (is_array($_REQUEST[$pkey])) {
662
-            $tags = 'skip_field';
663
-        } else {
664
-            $tags = '';
665
-        }
666
-        /**
667
-         * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
-         *
669
-         * @since 1.0.0
670
-         * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
671
-         * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
-         */
673
-        $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
-
675
-        if ($tags != 'skip_field') {
676
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
-        }
678
-    }
679
-
680
-    $post = (object)$_REQUEST;
681
-
682
-
683
-    if (isset($post->video)) {
684
-        $post->video = stripslashes($post->video);
685
-    }
686
-
687
-    if (isset($post->Video2)) {
688
-        $post->Video2 = stripslashes($post->Video2);
689
-    }
690
-
691
-    $post_type = $post->listing_type;
692
-    $post_type_info = get_post_type_object($post_type);
693
-
694
-    $listing_label = $post_type_info->labels->singular_name;
695
-
696
-    $term_icon = '';
697
-
698
-    if (!empty($post->post_category)) {
699
-        foreach ($post->post_category as $post_taxonomy => $post_term) {
700
-
701
-            if ($post_term != '' && !is_array($post_term)) {
702
-                $post_term = explode(',', trim($post_term, ','));
703
-            }
644
+	global $post, $preview, $gd_session;
645
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
646
+	if (!$preview || $is_backend_preview) {
647
+		return;
648
+	}// bail if not previewing
649
+
650
+	$listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
+
652
+	$fields_info = geodir_get_custom_fields_type($listing_type);
653
+
654
+	foreach ($_REQUEST as $pkey => $pval) {
655
+		if ($pkey == 'geodir_video') {
656
+			$tags = '<iframe>';
657
+		} else if ($pkey == 'post_desc') {
658
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
+		} else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
+		} else if (is_array($_REQUEST[$pkey])) {
662
+			$tags = 'skip_field';
663
+		} else {
664
+			$tags = '';
665
+		}
666
+		/**
667
+		 * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
+		 *
669
+		 * @since 1.0.0
670
+		 * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
671
+		 * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
+		 */
673
+		$tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
+
675
+		if ($tags != 'skip_field') {
676
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
+		}
678
+	}
679
+
680
+	$post = (object)$_REQUEST;
681
+
682
+
683
+	if (isset($post->video)) {
684
+		$post->video = stripslashes($post->video);
685
+	}
686
+
687
+	if (isset($post->Video2)) {
688
+		$post->Video2 = stripslashes($post->Video2);
689
+	}
690
+
691
+	$post_type = $post->listing_type;
692
+	$post_type_info = get_post_type_object($post_type);
693
+
694
+	$listing_label = $post_type_info->labels->singular_name;
695
+
696
+	$term_icon = '';
697
+
698
+	if (!empty($post->post_category)) {
699
+		foreach ($post->post_category as $post_taxonomy => $post_term) {
700
+
701
+			if ($post_term != '' && !is_array($post_term)) {
702
+				$post_term = explode(',', trim($post_term, ','));
703
+			}
704 704
 
705
-            if (is_array($post_term)) {
706
-                $post_term = array_unique($post_term);
707
-            }
705
+			if (is_array($post_term)) {
706
+				$post_term = array_unique($post_term);
707
+			}
708 708
 
709
-            if (!empty($post_term)) {
710
-                foreach ($post_term as $cat_id) {
711
-                    $cat_id = trim($cat_id);
712
-
713
-                    if ($cat_id != '') {
714
-                        $term_icon = get_option('geodir_default_marker_icon');
715
-
716
-                        if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
-                            if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
720
-                                break;
721
-                            }
722
-                        }
723
-                    }
724
-                }
725
-            }
726
-        }
727
-    }
709
+			if (!empty($post_term)) {
710
+				foreach ($post_term as $cat_id) {
711
+					$cat_id = trim($cat_id);
712
+
713
+					if ($cat_id != '') {
714
+						$term_icon = get_option('geodir_default_marker_icon');
715
+
716
+						if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
+							if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
+								if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
+									$term_icon = $term_icon_url['src'];
720
+								break;
721
+							}
722
+						}
723
+					}
724
+				}
725
+			}
726
+		}
727
+	}
728 728
 
729
-    $post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
-    $post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
729
+	$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
+	$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
731 731
 
732
-    $srcharr = array("'", "/", "-", '"', '\\');
733
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
732
+	$srcharr = array("'", "/", "-", '"', '\\');
733
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
734 734
 
735
-    $json_title = str_replace($srcharr, $replarr, $post->post_title);
735
+	$json_title = str_replace($srcharr, $replarr, $post->post_title);
736 736
 
737
-    $json = '{';
738
-    $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
743
-    $json .= '}';
737
+	$json = '{';
738
+	$json .= '"post_preview": "1",';
739
+	$json .= '"t": "' . $json_title . '",';
740
+	$json .= '"lt": "' . $post_latitude . '",';
741
+	$json .= '"ln": "' . $post_longitude . '",';
742
+	$json .= '"i":"' . $term_icon . '"';
743
+	$json .= '}';
744 744
 
745
-    $post->marker_json = $json;
745
+	$post->marker_json = $json;
746 746
 
747
-    $gd_session->set('listing', $_REQUEST);
747
+	$gd_session->set('listing', $_REQUEST);
748 748
 
749
-    // we need to define a few things to trick the setup_postdata
750
-    if (!isset($post->ID)) {
751
-        $post->ID = '';
752
-        $post->post_author = '';
753
-        $post->post_date = '';
754
-        $post->post_content = '';
755
-        $post->default_category = '';
756
-        $post->post_type = '';
757
-    }
758
-    setup_postdata($post);
749
+	// we need to define a few things to trick the setup_postdata
750
+	if (!isset($post->ID)) {
751
+		$post->ID = '';
752
+		$post->post_author = '';
753
+		$post->post_date = '';
754
+		$post->post_content = '';
755
+		$post->default_category = '';
756
+		$post->post_type = '';
757
+	}
758
+	setup_postdata($post);
759 759
 }
760 760
 
761 761
 /**
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
  */
768 768
 function geodir_action_geodir_preview_code()
769 769
 {
770
-    global $preview;
770
+	global $preview;
771 771
 
772
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
772
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
773 773
 
774
-    if (!$preview || $is_backend_preview) {
775
-        return;
776
-    }// bail if not previewing
774
+	if (!$preview || $is_backend_preview) {
775
+		return;
776
+	}// bail if not previewing
777 777
 
778
-    geodir_get_template_part('preview', 'buttons');
778
+	geodir_get_template_part('preview', 'buttons');
779 779
 }
780 780
 
781 781
 // action for adding the details page top widget area
@@ -791,20 +791,20 @@  discard block
 block discarded – undo
791 791
  */
792 792
 function geodir_action_geodir_sidebar_detail_top($class = '')
793 793
 {
794
-    if (get_option('geodir_show_detail_top_section')) { ?>
794
+	if (get_option('geodir_show_detail_top_section')) { ?>
795 795
         <div
796 796
             class="<?php
797
-            /**
798
-             * Filter the div class for the wrapper of the full width widget areas.
799
-             *
800
-             * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
801
-             *
802
-             * @since 1.0.0
803
-             * @param string $class The class of the div.
804
-             * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
805
-             *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
-             */
807
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
797
+			/**
798
+			 * Filter the div class for the wrapper of the full width widget areas.
799
+			 *
800
+			 * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
801
+			 *
802
+			 * @since 1.0.0
803
+			 * @param string $class The class of the div.
804
+			 * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
805
+			 *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
+			 */
807
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
808 808
             <?php dynamic_sidebar('geodir_detail_top'); ?>
809 809
         </div>
810 810
     <?php }
@@ -828,11 +828,11 @@  discard block
 block discarded – undo
828 828
  */
829 829
 function geodir_action_geodir_sidebar_detail_bottom_section($class = '')
830 830
 {
831
-    if (get_option('geodir_show_detail_bottom_section')) { ?>
831
+	if (get_option('geodir_show_detail_bottom_section')) { ?>
832 832
         <div
833 833
             class="<?php
834
-            /** This action is documented in geodirectory_template_actions.php */
835
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
834
+			/** This action is documented in geodirectory_template_actions.php */
835
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
836 836
             <?php dynamic_sidebar('geodir_detail_bottom'); ?>
837 837
         </div><!-- clearfix ends here-->
838 838
     <?php }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
  */
847 847
 function geodir_details_sidebar_widget_area()
848 848
 {
849
-    dynamic_sidebar('geodir_detail_sidebar');
849
+	dynamic_sidebar('geodir_detail_sidebar');
850 850
 }
851 851
 
852 852
 /**
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
  */
858 858
 function geodir_details_sidebar_place_details()
859 859
 {
860
-    /**
861
-     * Used to add items to the details page sidebar.
862
-     *
863
-     * @since 1.0.0
864
-     */
865
-    do_action('geodir_detail_page_sidebar');
860
+	/**
861
+	 * Used to add items to the details page sidebar.
862
+	 *
863
+	 * @since 1.0.0
864
+	 */
865
+	do_action('geodir_detail_page_sidebar');
866 866
 }
867 867
 
868 868
 add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
@@ -877,68 +877,68 @@  discard block
 block discarded – undo
877 877
  */
878 878
 function geodir_action_details_sidebar()
879 879
 {
880
-    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
-    if (get_option('geodir_detail_sidebar_left_section')) {
882
-        /**
883
-         * Called before the details page left sidebar is opened.
884
-         *
885
-         * This is used to add opening wrapper HTML to the details page left sidebar.
886
-         *
887
-         * @since 1.0.0
888
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
-         */
893
-        do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
-        ?>
880
+	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
+	if (get_option('geodir_detail_sidebar_left_section')) {
882
+		/**
883
+		 * Called before the details page left sidebar is opened.
884
+		 *
885
+		 * This is used to add opening wrapper HTML to the details page left sidebar.
886
+		 *
887
+		 * @since 1.0.0
888
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
+		 */
893
+		do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
+		?>
895 895
         <div class="geodir-content-left geodir-sidebar-wrap"><?php
896
-        /**
897
-         * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
-         *
899
-         * This is used to add all info to the details page sidebars.
900
-         *
901
-         * @since 1.0.0
902
-         */
903
-        do_action('geodir_detail_sidebar_inside');
904
-        ?></div><!-- end geodir-content-left --><?php
905
-        /**
906
-         * Called after the details page left sidebar.
907
-         *
908
-         * This is used to add closing wrapper HTML to the details page left sidebar.
909
-         *
910
-         * @since 1.0.0
911
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
-         */
913
-        do_action('geodir_sidebar_left_close', 'details-page');
914
-    } else {
915
-        /**
916
-         * Called before the details page right sidebar is opened.
917
-         *
918
-         * This is used to add opening wrapper HTML to the details page right sidebar.
919
-         *
920
-         * @since 1.0.0
921
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
-         */
926
-        do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
-        ?>
896
+		/**
897
+		 * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
+		 *
899
+		 * This is used to add all info to the details page sidebars.
900
+		 *
901
+		 * @since 1.0.0
902
+		 */
903
+		do_action('geodir_detail_sidebar_inside');
904
+		?></div><!-- end geodir-content-left --><?php
905
+		/**
906
+		 * Called after the details page left sidebar.
907
+		 *
908
+		 * This is used to add closing wrapper HTML to the details page left sidebar.
909
+		 *
910
+		 * @since 1.0.0
911
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
+		 */
913
+		do_action('geodir_sidebar_left_close', 'details-page');
914
+	} else {
915
+		/**
916
+		 * Called before the details page right sidebar is opened.
917
+		 *
918
+		 * This is used to add opening wrapper HTML to the details page right sidebar.
919
+		 *
920
+		 * @since 1.0.0
921
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
+		 */
926
+		do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
+		?>
928 928
         <div class="geodir-content-right geodir-sidebar-wrap"><?php
929
-        /** This action is documented in geodirectory_template_actions.php */
930
-        do_action('geodir_detail_sidebar_inside');
931
-        ?></div><!-- end geodir-content-right --><?php
932
-        /**
933
-         * Called after the details page right sidebar.
934
-         *
935
-         * This is used to add closing wrapper HTML to the details page right sidebar.
936
-         *
937
-         * @since 1.0.0
938
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
-         */
940
-        do_action('geodir_sidebar_right_close', 'details-page');
941
-    }
929
+		/** This action is documented in geodirectory_template_actions.php */
930
+		do_action('geodir_detail_sidebar_inside');
931
+		?></div><!-- end geodir-content-right --><?php
932
+		/**
933
+		 * Called after the details page right sidebar.
934
+		 *
935
+		 * This is used to add closing wrapper HTML to the details page right sidebar.
936
+		 *
937
+		 * @since 1.0.0
938
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
+		 */
940
+		do_action('geodir_sidebar_right_close', 'details-page');
941
+	}
942 942
 }
943 943
 
944 944
 add_action('geodir_page_title', 'geodir_action_page_title', 10);
@@ -952,21 +952,21 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function geodir_action_page_title()
954 954
 {
955
-    /**
956
-     * Filter the page title HTML h1 class.
957
-     *
958
-     * @since 1.0.0
959
-     * @param string $class The class to use. Default is 'entry-title fn'.
960
-     */
961
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
-    /**
963
-     * Filter the page title HTML header wrapper class.
964
-     *
965
-     * @since 1.0.0
966
-     * @param string $class The class to use. Default is 'entry-header'.
967
-     */
968
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
955
+	/**
956
+	 * Filter the page title HTML h1 class.
957
+	 *
958
+	 * @since 1.0.0
959
+	 * @param string $class The class to use. Default is 'entry-title fn'.
960
+	 */
961
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
+	/**
963
+	 * Filter the page title HTML header wrapper class.
964
+	 *
965
+	 * @since 1.0.0
966
+	 * @param string $class The class to use. Default is 'entry-header'.
967
+	 */
968
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -983,106 +983,106 @@  discard block
 block discarded – undo
983 983
  */
984 984
 function geodir_action_details_slider()
985 985
 {
986
-    global $preview, $post;
986
+	global $preview, $post;
987 987
 
988
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
988
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
989 989
 
990
-    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
-        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
990
+	if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
+		$preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
992 992
 
993
-        $preview_post_images = array();
994
-        if ($preview_get_images) {
995
-            foreach ($preview_get_images as $row) {
996
-                $preview_post_images[] = $row->src;
997
-            }
998
-        }
999
-        if (!empty($preview_post_images)) {
1000
-            $post->post_images = implode(',', $preview_post_images);
1001
-        }
1002
-    }
993
+		$preview_post_images = array();
994
+		if ($preview_get_images) {
995
+			foreach ($preview_get_images as $row) {
996
+				$preview_post_images[] = $row->src;
997
+			}
998
+		}
999
+		if (!empty($preview_post_images)) {
1000
+			$post->post_images = implode(',', $preview_post_images);
1001
+		}
1002
+	}
1003 1003
     
1004
-    $package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1005
-    $image_limit = '';
1006
-    if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1007
-        $image_limit = (int)$package_info->image_limit;
1008
-    }
1009
-
1010
-    if ($preview) {
1011
-        $post_images = array();
1012
-        if (isset($post->post_images) && !empty($post->post_images)) {
1013
-            $post->post_images = trim($post->post_images, ",");
1014
-            $post_images = explode(",", $post->post_images);
1015
-        }
1016
-
1017
-        $main_slides = '';
1018
-        $nav_slides = '';
1019
-        $slides = 0;
1020
-
1021
-        if (!empty($post_images)) {
1022
-            foreach ($post_images as $image) {
1023
-                if ($image_limit !== '' && ($slides+1) > $image_limit) {
1024
-                     break;
1025
-                }
1026
-                if (!empty($image)) {
1027
-                    $sizes = getimagesize(trim($image));
1028
-                    $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1029
-                    $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1030
-
1031
-                    if ($image && $width && $height) {
1032
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1033
-                    }
1034
-
1035
-                    if (isset($image->src)) {
1036
-                        if ($image->height >= 400) {
1037
-                            $spacer_height = 0;
1038
-                        } else {
1039
-                            $spacer_height = ((400 - $image->height) / 2);
1040
-                        }
1041
-
1042
-                        $image_title = isset($image->title) ? $image->title : '';
1043
-
1044
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1045
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1046
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1047
-                        $slides++;
1048
-                    }
1049
-                }
1050
-            }// endfore
1051
-        } //end if
1052
-    } else {
1053
-        $main_slides = '';
1054
-        $nav_slides = '';
1055
-        /**
1056
-         * Filter if default images should show on the details page.
1057
-         *
1058
-         * @param bool $use_default_image Default false.
1059
-         * @since 1.6.16
1060
-         */
1061
-        $use_default_image = apply_filters('geodir_details_default_image_show', false);
1062
-        $post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1063
-        $slides = 0;
1064
-
1065
-        if (!empty($post_images)) {
1066
-            foreach ($post_images as $image) {
1067
-                if ($image_limit !== '' && ($slides+1) > $image_limit) {
1068
-                     break;
1069
-                }
1070
-                if ($image->height >= 400) {
1071
-                    $spacer_height = 0;
1072
-                } else {
1073
-                    $spacer_height = ((400 - $image->height) / 2);
1074
-                }
1075
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1076
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1077
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1078
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1079
-                $slides++;
1080
-            }
1081
-        }// endfore
1082
-    }
1004
+	$package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1005
+	$image_limit = '';
1006
+	if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1007
+		$image_limit = (int)$package_info->image_limit;
1008
+	}
1009
+
1010
+	if ($preview) {
1011
+		$post_images = array();
1012
+		if (isset($post->post_images) && !empty($post->post_images)) {
1013
+			$post->post_images = trim($post->post_images, ",");
1014
+			$post_images = explode(",", $post->post_images);
1015
+		}
1016
+
1017
+		$main_slides = '';
1018
+		$nav_slides = '';
1019
+		$slides = 0;
1020
+
1021
+		if (!empty($post_images)) {
1022
+			foreach ($post_images as $image) {
1023
+				if ($image_limit !== '' && ($slides+1) > $image_limit) {
1024
+					 break;
1025
+				}
1026
+				if (!empty($image)) {
1027
+					$sizes = getimagesize(trim($image));
1028
+					$width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1029
+					$height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1030
+
1031
+					if ($image && $width && $height) {
1032
+						$image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1033
+					}
1034
+
1035
+					if (isset($image->src)) {
1036
+						if ($image->height >= 400) {
1037
+							$spacer_height = 0;
1038
+						} else {
1039
+							$spacer_height = ((400 - $image->height) / 2);
1040
+						}
1041
+
1042
+						$image_title = isset($image->title) ? $image->title : '';
1043
+
1044
+						$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1045
+						$main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1046
+						$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1047
+						$slides++;
1048
+					}
1049
+				}
1050
+			}// endfore
1051
+		} //end if
1052
+	} else {
1053
+		$main_slides = '';
1054
+		$nav_slides = '';
1055
+		/**
1056
+		 * Filter if default images should show on the details page.
1057
+		 *
1058
+		 * @param bool $use_default_image Default false.
1059
+		 * @since 1.6.16
1060
+		 */
1061
+		$use_default_image = apply_filters('geodir_details_default_image_show', false);
1062
+		$post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1063
+		$slides = 0;
1064
+
1065
+		if (!empty($post_images)) {
1066
+			foreach ($post_images as $image) {
1067
+				if ($image_limit !== '' && ($slides+1) > $image_limit) {
1068
+					 break;
1069
+				}
1070
+				if ($image->height >= 400) {
1071
+					$spacer_height = 0;
1072
+				} else {
1073
+					$spacer_height = ((400 - $image->height) / 2);
1074
+				}
1075
+				$caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1076
+				$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1077
+				$main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1078
+				$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1079
+				$slides++;
1080
+			}
1081
+		}// endfore
1082
+	}
1083 1083
 
1084
-    if (!empty($post_images)) {
1085
-        ?>
1084
+	if (!empty($post_images)) {
1085
+		?>
1086 1086
         <div class="geodir_flex-container">
1087 1087
             <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
1088 1088
             <div id="geodir_slider" class="geodir_flexslider ">
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
             <?php } ?>
1096 1096
         </div>
1097 1097
     <?php
1098
-    }
1098
+	}
1099 1099
 }
1100 1100
 
1101 1101
 add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
@@ -1110,177 +1110,177 @@  discard block
 block discarded – undo
1110 1110
  */
1111 1111
 function geodir_action_details_taxonomies()
1112 1112
 {
1113
-    global $preview, $post;?>
1113
+	global $preview, $post;?>
1114 1114
     <p class="geodir_post_taxomomies clearfix">
1115 1115
     <?php
1116
-    $taxonomies = array();
1117
-
1118
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1119
-
1120
-    if ($preview && !$is_backend_preview) {
1121
-        $post_type = $post->listing_type;
1122
-        $post_taxonomy = $post_type . 'category';
1123
-        $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1124
-    } else {
1125
-        $post_type = $post->post_type;
1126
-        $post_taxonomy = $post_type . 'category';
1127
-    }
1116
+	$taxonomies = array();
1117
+
1118
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1119
+
1120
+	if ($preview && !$is_backend_preview) {
1121
+		$post_type = $post->listing_type;
1122
+		$post_taxonomy = $post_type . 'category';
1123
+		$post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1124
+	} else {
1125
+		$post_type = $post->post_type;
1126
+		$post_taxonomy = $post_type . 'category';
1127
+	}
1128 1128
 //{	
1129
-    $post_type_info = get_post_type_object($post_type);
1130
-    $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1131
-
1132
-    if (!empty($post->post_tags)) {
1133
-
1134
-        if (taxonomy_exists($post_type . '_tags')):
1135
-            $links = array();
1136
-            $terms = array();
1137
-            // to limit post tags
1138
-            $post_tags = trim($post->post_tags, ",");
1139
-            $post_id = isset($post->ID) ? $post->ID : '';
1140
-            /**
1141
-             * Filter the post tags.
1142
-             *
1143
-             * Allows you to filter the post tags output on the details page of a post.
1144
-             *
1145
-             * @since 1.0.0
1146
-             * @param string $post_tags A comma seperated list of tags.
1147
-             * @param int $post_id The current post id.
1148
-             */
1149
-            $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1150
-
1151
-            $post->post_tags = $post_tags;
1152
-            $post_tags = explode(",", trim($post->post_tags, ","));
1153
-
1154
-
1155
-            foreach ($post_tags as $post_term) {
1156
-
1157
-                // fix slug creation order for tags & location
1158
-                $post_term = trim($post_term);
1159
-
1160
-                $priority_location = false;
1161
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1162
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1163
-                } else {
1164
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1165
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1166
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1167
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1168
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1169
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1170
-                    if ($match_country || $match_region || $match_city) {
1171
-                        $priority_location = true;
1172
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1173
-                    } else {
1174
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1175
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1176
-                    }
1177
-                }
1178
-
1179
-                if (!is_wp_error($term) && is_object($term)) {
1180
-
1181
-                    // fix tag link on detail page
1182
-                    if ($priority_location) {
1183
-
1184
-                        $tag_link = "<a href=''>$post_term</a>";
1185
-                        /**
1186
-                         * Filter the tag name on the details page.
1187
-                         *
1188
-                         * @since 1.5.6
1189
-                         * @param string $tag_link The tag link html.
1190
-                         * @param object $term The tag term object.
1191
-                         */
1192
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1193
-                        $links[] = $tag_link;
1194
-                    } else {
1195
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1196
-                        /** This action is documented in geodirectory-template_actions.php */
1197
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1198
-                        $links[] = $tag_link;
1199
-                    }
1200
-                    $terms[] = $term;
1201
-                }
1202
-                //
1203
-            }
1204
-            if (!isset($listing_label)) {
1205
-                $listing_label = '';
1206
-            }
1207
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1208
-        endif;
1209
-
1210
-    }
1211
-
1212
-    if (!empty($post->{$post_taxonomy})) {
1213
-        $links = array();
1214
-        $terms = array();
1215
-        $termsOrdered = array();
1216
-        if (!is_array($post->{$post_taxonomy})) {
1217
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1218
-        } else {
1219
-            $post_term = $post->{$post_taxonomy};
1129
+	$post_type_info = get_post_type_object($post_type);
1130
+	$listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1131
+
1132
+	if (!empty($post->post_tags)) {
1133
+
1134
+		if (taxonomy_exists($post_type . '_tags')):
1135
+			$links = array();
1136
+			$terms = array();
1137
+			// to limit post tags
1138
+			$post_tags = trim($post->post_tags, ",");
1139
+			$post_id = isset($post->ID) ? $post->ID : '';
1140
+			/**
1141
+			 * Filter the post tags.
1142
+			 *
1143
+			 * Allows you to filter the post tags output on the details page of a post.
1144
+			 *
1145
+			 * @since 1.0.0
1146
+			 * @param string $post_tags A comma seperated list of tags.
1147
+			 * @param int $post_id The current post id.
1148
+			 */
1149
+			$post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1150
+
1151
+			$post->post_tags = $post_tags;
1152
+			$post_tags = explode(",", trim($post->post_tags, ","));
1153
+
1154
+
1155
+			foreach ($post_tags as $post_term) {
1156
+
1157
+				// fix slug creation order for tags & location
1158
+				$post_term = trim($post_term);
1159
+
1160
+				$priority_location = false;
1161
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1162
+					$term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1163
+				} else {
1164
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1165
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1166
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1167
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1168
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1169
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1170
+					if ($match_country || $match_region || $match_city) {
1171
+						$priority_location = true;
1172
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1173
+					} else {
1174
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1175
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1176
+					}
1177
+				}
1178
+
1179
+				if (!is_wp_error($term) && is_object($term)) {
1180
+
1181
+					// fix tag link on detail page
1182
+					if ($priority_location) {
1183
+
1184
+						$tag_link = "<a href=''>$post_term</a>";
1185
+						/**
1186
+						 * Filter the tag name on the details page.
1187
+						 *
1188
+						 * @since 1.5.6
1189
+						 * @param string $tag_link The tag link html.
1190
+						 * @param object $term The tag term object.
1191
+						 */
1192
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1193
+						$links[] = $tag_link;
1194
+					} else {
1195
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1196
+						/** This action is documented in geodirectory-template_actions.php */
1197
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1198
+						$links[] = $tag_link;
1199
+					}
1200
+					$terms[] = $term;
1201
+				}
1202
+				//
1203
+			}
1204
+			if (!isset($listing_label)) {
1205
+				$listing_label = '';
1206
+			}
1207
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1208
+		endif;
1209
+
1210
+	}
1211
+
1212
+	if (!empty($post->{$post_taxonomy})) {
1213
+		$links = array();
1214
+		$terms = array();
1215
+		$termsOrdered = array();
1216
+		if (!is_array($post->{$post_taxonomy})) {
1217
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1218
+		} else {
1219
+			$post_term = $post->{$post_taxonomy};
1220 1220
 			
1221 1221
 			if ($preview && !$is_backend_preview) {
1222 1222
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1223 1223
 			}
1224
-        }
1225
-
1226
-        $post_term = array_unique($post_term);
1227
-        if (!empty($post_term)) {
1228
-            foreach ($post_term as $post_term) {
1229
-                $post_term = trim($post_term);
1230
-
1231
-                if ($post_term != ''):
1232
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1233
-
1234
-                    if (is_object($term)) {
1235
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1236
-                        /**
1237
-                         * Filter the category name on the details page.
1238
-                         *
1239
-                         * @since 1.5.6
1240
-                         * @param string $term_link The link html to the category.
1241
-                         * @param object $term The category term object.
1242
-                         */
1243
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1244
-                        $links[] = $term_link;
1245
-                        $terms[] = $term;
1246
-                    }
1247
-                endif;
1248
-            }
1249
-            // order alphabetically
1250
-            asort($links);
1251
-            foreach (array_keys($links) as $key) {
1252
-                $termsOrdered[$key] = $terms[$key];
1253
-            }
1254
-            $terms = $termsOrdered;
1224
+		}
1225
+
1226
+		$post_term = array_unique($post_term);
1227
+		if (!empty($post_term)) {
1228
+			foreach ($post_term as $post_term) {
1229
+				$post_term = trim($post_term);
1230
+
1231
+				if ($post_term != ''):
1232
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1233
+
1234
+					if (is_object($term)) {
1235
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1236
+						/**
1237
+						 * Filter the category name on the details page.
1238
+						 *
1239
+						 * @since 1.5.6
1240
+						 * @param string $term_link The link html to the category.
1241
+						 * @param object $term The category term object.
1242
+						 */
1243
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1244
+						$links[] = $term_link;
1245
+						$terms[] = $term;
1246
+					}
1247
+				endif;
1248
+			}
1249
+			// order alphabetically
1250
+			asort($links);
1251
+			foreach (array_keys($links) as $key) {
1252
+				$termsOrdered[$key] = $terms[$key];
1253
+			}
1254
+			$terms = $termsOrdered;
1255 1255
 
1256
-        }
1256
+		}
1257 1257
 
1258
-        if (!isset($listing_label)) {
1259
-            $listing_label = '';
1260
-        }
1261
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1258
+		if (!isset($listing_label)) {
1259
+			$listing_label = '';
1260
+		}
1261
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1262 1262
 
1263
-    }
1263
+	}
1264 1264
 
1265
-    /**
1266
-     * Filter the taxonomies array before output.
1267
-     *
1268
-     * @since 1.5.9
1269
-     * @param array $taxonomies The array of cats and tags.
1270
-     * @param string $post_type The post type being output.
1271
-     * @param string $listing_label The post type label.
1272
-     * @param string $listing_label The post type label with ucwords function.
1273
-     */
1274
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1265
+	/**
1266
+	 * Filter the taxonomies array before output.
1267
+	 *
1268
+	 * @since 1.5.9
1269
+	 * @param array $taxonomies The array of cats and tags.
1270
+	 * @param string $post_type The post type being output.
1271
+	 * @param string $listing_label The post type label.
1272
+	 * @param string $listing_label The post type label with ucwords function.
1273
+	 */
1274
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1275 1275
 
1276
-    if (isset($taxonomies[$post_taxonomy])) {
1277
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1278
-    }
1276
+	if (isset($taxonomies[$post_taxonomy])) {
1277
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1278
+	}
1279 1279
 
1280
-    if (isset($taxonomies[$post_type . '_tags']))
1281
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1280
+	if (isset($taxonomies[$post_type . '_tags']))
1281
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1282 1282
 
1283
-    ?>
1283
+	?>
1284 1284
     </p><?php
1285 1285
 }
1286 1286
 
@@ -1302,144 +1302,144 @@  discard block
 block discarded – undo
1302 1302
 function geodir_action_details_micordata($post='')
1303 1303
 {
1304 1304
 
1305
-    global $preview;
1306
-    if(empty($post)){global $post;}
1307
-    if ($preview || !geodir_is_page('detail')) {
1308
-        return;
1309
-    }
1310
-
1311
-    // url
1312
-    $c_url = geodir_curPageURL();
1313
-
1314
-    // post reviews
1315
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1316
-    if (empty($post_reviews)) {
1317
-        $reviews = '';
1318
-    } else {
1319
-        foreach ($post_reviews as $review) {
1320
-
1321
-            if($rating_value = geodir_get_commentoverall($review->comment_ID)){
1322
-                $reviews[] = array(
1323
-                    "@type" => "Review",
1324
-                    "author" => $review->comment_author,
1325
-                    "datePublished" => $review->comment_date,
1326
-                    "description" => $review->comment_content,
1327
-                    "reviewRating" => array(
1328
-                        "@type" => "Rating",
1329
-                        "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1330
-                        "ratingValue" => $rating_value,
1331
-                        "worstRating" => "1"
1332
-                    )
1333
-                );
1334
-            }
1335
-
1336
-        }
1337
-
1338
-    }
1339
-
1340
-    // post images
1341
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1342
-    if (empty($post_images)) {
1343
-        $images = '';
1344
-    } else {
1345
-        $i_arr = array();
1346
-        foreach ($post_images as $img) {
1347
-            $i_arr[] = $img->src;
1348
-        }
1349
-
1350
-        if (count($i_arr) == 1) {
1351
-            $images = $i_arr[0];
1352
-        } else {
1353
-            $images = $i_arr;
1354
-        }
1305
+	global $preview;
1306
+	if(empty($post)){global $post;}
1307
+	if ($preview || !geodir_is_page('detail')) {
1308
+		return;
1309
+	}
1310
+
1311
+	// url
1312
+	$c_url = geodir_curPageURL();
1313
+
1314
+	// post reviews
1315
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1316
+	if (empty($post_reviews)) {
1317
+		$reviews = '';
1318
+	} else {
1319
+		foreach ($post_reviews as $review) {
1320
+
1321
+			if($rating_value = geodir_get_commentoverall($review->comment_ID)){
1322
+				$reviews[] = array(
1323
+					"@type" => "Review",
1324
+					"author" => $review->comment_author,
1325
+					"datePublished" => $review->comment_date,
1326
+					"description" => $review->comment_content,
1327
+					"reviewRating" => array(
1328
+						"@type" => "Rating",
1329
+						"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1330
+						"ratingValue" => $rating_value,
1331
+						"worstRating" => "1"
1332
+					)
1333
+				);
1334
+			}
1355 1335
 
1356
-    }
1357
-    //print_r($post);
1358
-    // external links
1359
-    $external_links =  array();
1360
-    $external_links[] = $post->geodir_website;
1361
-    $external_links[] = $post->geodir_twitter;
1362
-    $external_links[] = $post->geodir_facebook;
1363
-    $external_links = array_filter($external_links);
1364
-
1365
-    if(!empty($external_links)){
1366
-        $external_links = array_values($external_links);
1367
-    }
1368
-
1369
-    // reviews
1370
-    $comment_count = geodir_get_review_count_total($post->ID);
1371
-    $post_avgratings = geodir_get_post_rating($post->ID);
1372
-
1373
-    // schema type
1374
-    $schema_type = 'LocalBusiness';
1375
-    if(isset($post->default_category) && $post->default_category){
1376
-        $cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1377
-        if($cat_schema){$schema_type = $cat_schema;}
1378
-        if(!$cat_schema && $schema_type=='LocalBusiness' && $post->post_type=='gd_event'){$schema_type = 'Event';}
1379
-    }
1380
-
1381
-    $schema = array();
1382
-    $schema['@context'] = "https://schema.org";
1383
-    $schema['@type'] = $schema_type;
1384
-    $schema['name'] = $post->post_title;
1385
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1386
-    $schema['telephone'] = $post->geodir_contact;
1387
-    $schema['url'] = $c_url;
1388
-    $schema['sameAs'] = $external_links;
1389
-    $schema['image'] = $images;
1390
-    $schema['address'] = array(
1391
-        "@type" => "PostalAddress",
1392
-        "streetAddress" => $post->post_address,
1393
-        "addressLocality" => $post->post_city,
1394
-        "addressRegion" => $post->post_region,
1395
-        "addressCountry" => $post->post_country,
1396
-        "postalCode" => $post->post_zip
1397
-    );
1398
-
1399
-    if($post->post_latitude && $post->post_longitude) {
1400
-        $schema['geo'] = array(
1401
-            "@type" => "GeoCoordinates",
1402
-            "latitude" => $post->post_latitude,
1403
-            "longitude" => $post->post_longitude
1404
-        );
1405
-    }
1406
-
1407
-    if($post_avgratings) {
1408
-        $schema['aggregateRating'] = array(
1409
-            "@type" => "AggregateRating",
1410
-            "ratingValue" => $post_avgratings,
1411
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1412
-            "worstRating" => "1",
1413
-            "ratingCount" => $comment_count
1414
-        );
1415
-    }
1416
-    $schema['review'] = $reviews;
1417
-
1418
-    /**
1419
-     * Allow the schema JSON-LD info to be filtered.
1420
-     *
1421
-     * @since 1.5.4
1422
-     * @since 1.5.7 Added $post variable.
1423
-     * @param array $schema The array of schema data to be filtered.
1424
-     * @param object $post The post object.
1425
-     */
1426
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1427
-
1428
-
1429
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1430
-
1431
-
1432
-    $uploads = wp_upload_dir();
1433
-    $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1434
-
1435
-    /**
1436
-     * Show facebook open graph meta info
1437
-     *
1438
-     * @since 1.6.6
1439
-     * @param string $facebook_og The open graph html to be filtered.
1440
-     * @param object $post The post object.
1441
-     */
1442
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1336
+		}
1337
+
1338
+	}
1339
+
1340
+	// post images
1341
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1342
+	if (empty($post_images)) {
1343
+		$images = '';
1344
+	} else {
1345
+		$i_arr = array();
1346
+		foreach ($post_images as $img) {
1347
+			$i_arr[] = $img->src;
1348
+		}
1349
+
1350
+		if (count($i_arr) == 1) {
1351
+			$images = $i_arr[0];
1352
+		} else {
1353
+			$images = $i_arr;
1354
+		}
1355
+
1356
+	}
1357
+	//print_r($post);
1358
+	// external links
1359
+	$external_links =  array();
1360
+	$external_links[] = $post->geodir_website;
1361
+	$external_links[] = $post->geodir_twitter;
1362
+	$external_links[] = $post->geodir_facebook;
1363
+	$external_links = array_filter($external_links);
1364
+
1365
+	if(!empty($external_links)){
1366
+		$external_links = array_values($external_links);
1367
+	}
1368
+
1369
+	// reviews
1370
+	$comment_count = geodir_get_review_count_total($post->ID);
1371
+	$post_avgratings = geodir_get_post_rating($post->ID);
1372
+
1373
+	// schema type
1374
+	$schema_type = 'LocalBusiness';
1375
+	if(isset($post->default_category) && $post->default_category){
1376
+		$cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1377
+		if($cat_schema){$schema_type = $cat_schema;}
1378
+		if(!$cat_schema && $schema_type=='LocalBusiness' && $post->post_type=='gd_event'){$schema_type = 'Event';}
1379
+	}
1380
+
1381
+	$schema = array();
1382
+	$schema['@context'] = "https://schema.org";
1383
+	$schema['@type'] = $schema_type;
1384
+	$schema['name'] = $post->post_title;
1385
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1386
+	$schema['telephone'] = $post->geodir_contact;
1387
+	$schema['url'] = $c_url;
1388
+	$schema['sameAs'] = $external_links;
1389
+	$schema['image'] = $images;
1390
+	$schema['address'] = array(
1391
+		"@type" => "PostalAddress",
1392
+		"streetAddress" => $post->post_address,
1393
+		"addressLocality" => $post->post_city,
1394
+		"addressRegion" => $post->post_region,
1395
+		"addressCountry" => $post->post_country,
1396
+		"postalCode" => $post->post_zip
1397
+	);
1398
+
1399
+	if($post->post_latitude && $post->post_longitude) {
1400
+		$schema['geo'] = array(
1401
+			"@type" => "GeoCoordinates",
1402
+			"latitude" => $post->post_latitude,
1403
+			"longitude" => $post->post_longitude
1404
+		);
1405
+	}
1406
+
1407
+	if($post_avgratings) {
1408
+		$schema['aggregateRating'] = array(
1409
+			"@type" => "AggregateRating",
1410
+			"ratingValue" => $post_avgratings,
1411
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1412
+			"worstRating" => "1",
1413
+			"ratingCount" => $comment_count
1414
+		);
1415
+	}
1416
+	$schema['review'] = $reviews;
1417
+
1418
+	/**
1419
+	 * Allow the schema JSON-LD info to be filtered.
1420
+	 *
1421
+	 * @since 1.5.4
1422
+	 * @since 1.5.7 Added $post variable.
1423
+	 * @param array $schema The array of schema data to be filtered.
1424
+	 * @param object $post The post object.
1425
+	 */
1426
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1427
+
1428
+
1429
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1430
+
1431
+
1432
+	$uploads = wp_upload_dir();
1433
+	$facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1434
+
1435
+	/**
1436
+	 * Show facebook open graph meta info
1437
+	 *
1438
+	 * @since 1.6.6
1439
+	 * @param string $facebook_og The open graph html to be filtered.
1440
+	 * @param object $post The post object.
1441
+	 */
1442
+	echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1443 1443
 
1444 1444
 
1445 1445
 
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
  */
1460 1460
 function geodir_action_details_next_prev()
1461 1461
 {
1462
-    ?>
1462
+	?>
1463 1463
     <div class="geodir-pos_navigation clearfix">
1464 1464
     <div
1465 1465
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1477,15 +1477,15 @@  discard block
 block discarded – undo
1477 1477
  */
1478 1478
 function geodir_action_before_single_post()
1479 1479
 {
1480
-    global $post;
1481
-    /**
1482
-     * Called at the very start of the details page output, before the title section.
1483
-     *
1484
-     * @since 1.0.0
1485
-     * @param object $post The current post object.
1486
-     * @global WP_Post|null $post The current post, if available.
1487
-     */
1488
-    do_action('geodir_before_single_post', $post); // extra action	
1480
+	global $post;
1481
+	/**
1482
+	 * Called at the very start of the details page output, before the title section.
1483
+	 *
1484
+	 * @since 1.0.0
1485
+	 * @param object $post The current post object.
1486
+	 * @global WP_Post|null $post The current post, if available.
1487
+	 */
1488
+	do_action('geodir_before_single_post', $post); // extra action	
1489 1489
 }
1490 1490
 
1491 1491
 /**
@@ -1496,13 +1496,13 @@  discard block
 block discarded – undo
1496 1496
  */
1497 1497
 function geodir_action_after_single_post($post)
1498 1498
 {
1499
-    /**
1500
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1501
-     *
1502
-     * @since 1.0.0
1503
-     * @param object $post The current post object.
1504
-     */
1505
-    do_action('geodir_after_single_post', $post); // extra action	
1499
+	/**
1500
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1501
+	 *
1502
+	 * @since 1.0.0
1503
+	 * @param object $post The current post object.
1504
+	 */
1505
+	do_action('geodir_after_single_post', $post); // extra action	
1506 1506
 }
1507 1507
 
1508 1508
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1528,168 +1528,168 @@  discard block
 block discarded – undo
1528 1528
  */
1529 1529
 function geodir_action_listings_title()
1530 1530
 {
1531
-    global $wp, $term;
1532
-
1533
-    $gd_post_type = geodir_get_current_posttype();
1534
-    $post_type_info = get_post_type_object($gd_post_type);
1531
+	global $wp, $term;
1535 1532
 
1536
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1537
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1538
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1539
-    }
1533
+	$gd_post_type = geodir_get_current_posttype();
1534
+	$post_type_info = get_post_type_object($gd_post_type);
1540 1535
 
1541
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1542
-    $single_name = $post_type_info->labels->singular_name;
1536
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1537
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1538
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1539
+	}
1543 1540
 
1544
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1541
+	$list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1542
+	$single_name = $post_type_info->labels->singular_name;
1545 1543
 
1546
-    $gd_country = get_query_var('gd_country');
1547
-    $gd_region = get_query_var('gd_region');
1548
-    $gd_city = get_query_var('gd_city');
1544
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1549 1545
 
1550
-    if (!empty($term)) {
1551
-        $location_name = '';
1552
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1553
-            if ($gd_country != '') {
1554
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1555
-            }
1546
+	$gd_country = get_query_var('gd_country');
1547
+	$gd_region = get_query_var('gd_region');
1548
+	$gd_city = get_query_var('gd_city');
1556 1549
 
1557
-            if ($gd_region != '') {
1558
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1559
-            }
1560
-
1561
-            if ($gd_city != '') {
1562
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1563
-            }
1564
-        }
1565
-
1566
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1567
-        if (!empty($current_term)) {
1568
-            $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1569
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1570
-                $location_last_char = substr($location_name, -1);
1571
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1572
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1573
-            } else {
1574
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1575
-            }
1576
-        } else {
1577
-            if (count($taxonomy) > 1) {
1578
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1579
-
1580
-                if (!empty($current_term)) {
1581
-                    $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1582
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1583
-                        $location_last_char = substr($location_name, -1);
1584
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1585
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1586
-                    } else {
1587
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1588
-                    }
1589
-                }
1590
-            }
1591
-        }
1592
-
1593
-    } else {
1594
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1595
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1596
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1597
-
1598
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1599
-
1600
-        if (function_exists('get_actual_location_name')) {
1601
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1602
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1603
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1604
-        }
1605
-
1606
-        if ($gd_city != '') {
1607
-            if ($gd_city_actual != '') {
1608
-                $gd_city = $gd_city_actual;
1609
-            } else {
1610
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1611
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1612
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1613
-            }
1614
-
1615
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1616
-        } else if ($gd_region != '') {
1617
-            if ($gd_region_actual != '') {
1618
-                $gd_region = $gd_region_actual;
1619
-            } else {
1620
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1621
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1622
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1623
-            }
1624
-
1625
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1626
-        } else if ($gd_country != '') {
1627
-            if ($gd_country_actual != '') {
1628
-                $gd_country = $gd_country_actual;
1629
-            } else {
1630
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1631
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1632
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1633
-            }
1634
-
1635
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1636
-        }
1637
-    }
1638
-
1639
-    if (is_search()) {
1640
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1641
-    }
1642
-    /** This action is documented in geodirectory_template_actions.php */
1643
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1644
-    /** This action is documented in geodirectory_template_actions.php */
1645
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1646
-
1647
-
1648
-    $title = $list_title;
1649
-    $gd_page = '';
1650
-    if(geodir_is_page('pt')){
1651
-        $gd_page = 'pt';
1652
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1653
-    }
1654
-    elseif(geodir_is_page('listing')){
1655
-        $gd_page = 'listing';
1656
-        global $wp_query;
1657
-        $current_term = $wp_query->get_queried_object();
1658
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1659
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1660
-        }else{
1661
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1662
-        }
1550
+	if (!empty($term)) {
1551
+		$location_name = '';
1552
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1553
+			if ($gd_country != '') {
1554
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1555
+			}
1663 1556
 
1664
-    }
1665
-    elseif(geodir_is_page('author')){
1666
-        $gd_page = 'author';
1667
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1668
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1669
-        }else{
1670
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1671
-        }
1557
+			if ($gd_region != '') {
1558
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1559
+			}
1672 1560
 
1673
-    }
1561
+			if ($gd_city != '') {
1562
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1563
+			}
1564
+		}
1565
+
1566
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1567
+		if (!empty($current_term)) {
1568
+			$current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1569
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1570
+				$location_last_char = substr($location_name, -1);
1571
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1572
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1573
+			} else {
1574
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1575
+			}
1576
+		} else {
1577
+			if (count($taxonomy) > 1) {
1578
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1579
+
1580
+				if (!empty($current_term)) {
1581
+					$current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1582
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1583
+						$location_last_char = substr($location_name, -1);
1584
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1585
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1586
+					} else {
1587
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1588
+					}
1589
+				}
1590
+			}
1591
+		}
1592
+
1593
+	} else {
1594
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1595
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1596
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1597
+
1598
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1599
+
1600
+		if (function_exists('get_actual_location_name')) {
1601
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1602
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1603
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1604
+		}
1605
+
1606
+		if ($gd_city != '') {
1607
+			if ($gd_city_actual != '') {
1608
+				$gd_city = $gd_city_actual;
1609
+			} else {
1610
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1611
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1612
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1613
+			}
1674 1614
 
1615
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1616
+		} else if ($gd_region != '') {
1617
+			if ($gd_region_actual != '') {
1618
+				$gd_region = $gd_region_actual;
1619
+			} else {
1620
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1621
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1622
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1623
+			}
1675 1624
 
1676
-    /**
1677
-     * Filter page title to replace variables.
1678
-     *
1679
-     * @since 1.5.4
1680
-     * @param string $title The page title including variables.
1681
-     * @param string $gd_page The GeoDirectory page type if any.
1682
-     */
1683
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1625
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1626
+		} else if ($gd_country != '') {
1627
+			if ($gd_country_actual != '') {
1628
+				$gd_country = $gd_country_actual;
1629
+			} else {
1630
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1631
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1632
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1633
+			}
1684 1634
 
1685
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1686
-        /**
1687
-         * Filter the listing page title.
1688
-         *
1689
-         * @since 1.0.0
1690
-         * @param string $list_title The title for the category page.
1691
-         */
1692
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1635
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1636
+		}
1637
+	}
1638
+
1639
+	if (is_search()) {
1640
+		$list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1641
+	}
1642
+	/** This action is documented in geodirectory_template_actions.php */
1643
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1644
+	/** This action is documented in geodirectory_template_actions.php */
1645
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1646
+
1647
+
1648
+	$title = $list_title;
1649
+	$gd_page = '';
1650
+	if(geodir_is_page('pt')){
1651
+		$gd_page = 'pt';
1652
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1653
+	}
1654
+	elseif(geodir_is_page('listing')){
1655
+		$gd_page = 'listing';
1656
+		global $wp_query;
1657
+		$current_term = $wp_query->get_queried_object();
1658
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1659
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1660
+		}else{
1661
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1662
+		}
1663
+
1664
+	}
1665
+	elseif(geodir_is_page('author')){
1666
+		$gd_page = 'author';
1667
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1668
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1669
+		}else{
1670
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1671
+		}
1672
+
1673
+	}
1674
+
1675
+
1676
+	/**
1677
+	 * Filter page title to replace variables.
1678
+	 *
1679
+	 * @since 1.5.4
1680
+	 * @param string $title The page title including variables.
1681
+	 * @param string $gd_page The GeoDirectory page type if any.
1682
+	 */
1683
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1684
+
1685
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1686
+		/**
1687
+		 * Filter the listing page title.
1688
+		 *
1689
+		 * @since 1.0.0
1690
+		 * @param string $list_title The title for the category page.
1691
+		 */
1692
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1693 1693
 }
1694 1694
 
1695 1695
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1702,46 +1702,46 @@  discard block
 block discarded – undo
1702 1702
  */
1703 1703
 function geodir_action_listings_description()
1704 1704
 {
1705
-    global $wp_query;
1706
-    $current_term = $wp_query->get_queried_object();
1705
+	global $wp_query;
1706
+	$current_term = $wp_query->get_queried_object();
1707 1707
 
1708
-    $gd_post_type = geodir_get_current_posttype();
1709
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1708
+	$gd_post_type = geodir_get_current_posttype();
1709
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1710 1710
 
1711
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1712
-        $saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1713
-        if ($term_desc && !$saved_data) {
1714
-            $saved_data = $term_desc;
1715
-        }
1711
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1712
+		$saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1713
+		if ($term_desc && !$saved_data) {
1714
+			$saved_data = $term_desc;
1715
+		}
1716 1716
 
1717
-        // stop payment manager filtering content length
1718
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1719
-        if ( false !== $filter_priority ) {
1720
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1721
-        }
1717
+		// stop payment manager filtering content length
1718
+		$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1719
+		if ( false !== $filter_priority ) {
1720
+			remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1721
+		}
1722 1722
 
1723
-        /**
1724
-         * Apply the core filter `the_content` filter to the variable string.
1725
-         *
1726
-         * This is a WordPress core filter that does many things.
1727
-         *
1728
-         * @since 1.0.0
1729
-         * @param string $var The string to apply the filter to.
1730
-         */
1731
-        $cat_description = apply_filters('the_content', $saved_data);
1723
+		/**
1724
+		 * Apply the core filter `the_content` filter to the variable string.
1725
+		 *
1726
+		 * This is a WordPress core filter that does many things.
1727
+		 *
1728
+		 * @since 1.0.0
1729
+		 * @param string $var The string to apply the filter to.
1730
+		 */
1731
+		$cat_description = apply_filters('the_content', $saved_data);
1732 1732
 
1733 1733
 
1734
-        if ( false !== $filter_priority ) {
1735
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1736
-        }
1734
+		if ( false !== $filter_priority ) {
1735
+			add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1736
+		}
1737 1737
 
1738
-        if ($cat_description) {
1739
-            ?>
1738
+		if ($cat_description) {
1739
+			?>
1740 1740
 
1741 1741
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1742
-        }
1742
+		}
1743 1743
 
1744
-    }
1744
+	}
1745 1745
 }
1746 1746
 
1747 1747
 // action for adding the listings page top widget area
@@ -1760,11 +1760,11 @@  discard block
 block discarded – undo
1760 1760
  */
1761 1761
 function geodir_action_geodir_sidebar_listings_top()
1762 1762
 {
1763
-    if (get_option('geodir_show_listing_top_section')) { ?>
1763
+	if (get_option('geodir_show_listing_top_section')) { ?>
1764 1764
         <div
1765 1765
             class="<?php
1766
-            /** This action is documented in geodirectory_template_actions.php */
1767
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1766
+			/** This action is documented in geodirectory_template_actions.php */
1767
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1768 1768
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1769 1769
         </div><!-- clearfix ends here-->
1770 1770
     <?php }
@@ -1787,35 +1787,35 @@  discard block
 block discarded – undo
1787 1787
  */
1788 1788
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1789 1789
 {
1790
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1791
-        $width_css = 'style="width:' . $width . '%;"';
1792
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1793
-        $width_css = 'style="width:' . $width . '%;"';
1794
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1795
-        $width_css = 'style="width:' . $width . '%;"';
1796
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1797
-        $width_css = 'style="width:' . $width . '%;"';
1798
-    } else {
1799
-        $width_css = '';
1800
-    }
1801
-
1802
-    $tc = get_option('theme_compatibility_setting');
1803
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1804
-        $text = $tc['geodir_sidebar_left_open_replace'];
1805
-    } else {
1806
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1807
-    }
1808
-
1809
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1810
-        $id = $tc['geodir_sidebar_left_open_id'];
1811
-    }
1812
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1813
-        $class = $tc['geodir_sidebar_left_open_class'];
1814
-    }
1815
-
1816
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1817
-
1818
-    echo $text;
1790
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1791
+		$width_css = 'style="width:' . $width . '%;"';
1792
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1793
+		$width_css = 'style="width:' . $width . '%;"';
1794
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1795
+		$width_css = 'style="width:' . $width . '%;"';
1796
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1797
+		$width_css = 'style="width:' . $width . '%;"';
1798
+	} else {
1799
+		$width_css = '';
1800
+	}
1801
+
1802
+	$tc = get_option('theme_compatibility_setting');
1803
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1804
+		$text = $tc['geodir_sidebar_left_open_replace'];
1805
+	} else {
1806
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1807
+	}
1808
+
1809
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1810
+		$id = $tc['geodir_sidebar_left_open_id'];
1811
+	}
1812
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1813
+		$class = $tc['geodir_sidebar_left_open_class'];
1814
+	}
1815
+
1816
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1817
+
1818
+	echo $text;
1819 1819
 }
1820 1820
 
1821 1821
 // action for adding the primary div closing tag
@@ -1831,13 +1831,13 @@  discard block
 block discarded – undo
1831 1831
  */
1832 1832
 function geodir_action_sidebar_left_close($type = '')
1833 1833
 {
1834
-    $tc = get_option('theme_compatibility_setting');
1835
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1836
-        $text = $tc['geodir_sidebar_left_close_replace'];
1837
-    } else {
1838
-        $text = '</aside><!-- sidebar ends here-->';
1839
-    }
1840
-    echo $text;
1834
+	$tc = get_option('theme_compatibility_setting');
1835
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1836
+		$text = $tc['geodir_sidebar_left_close_replace'];
1837
+	} else {
1838
+		$text = '</aside><!-- sidebar ends here-->';
1839
+	}
1840
+	echo $text;
1841 1841
 }
1842 1842
 
1843 1843
 /**
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
  */
1851 1851
 function geodir_listing_left_section()
1852 1852
 {
1853
-    if (get_option('geodir_show_listing_left_section')) { ?>
1853
+	if (get_option('geodir_show_listing_left_section')) { ?>
1854 1854
         <div class="geodir-content-left geodir-sidebar-wrap">
1855 1855
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1856 1856
         </div><!-- end geodir-content-left -->
@@ -1868,20 +1868,20 @@  discard block
 block discarded – undo
1868 1868
  */
1869 1869
 function geodir_action_listings_sidebar_left()
1870 1870
 {
1871
-    if (get_option('geodir_show_listing_left_section')) {
1872
-        /** This action is documented in geodirectory_template_actions.php */
1873
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1874
-        /**
1875
-         * Calls the listings page (category) left sidebar content.
1876
-         *
1877
-         * All the content for the listings page left sidebar is added via this hook.
1878
-         *
1879
-         * @since 1.0.0
1880
-         */
1881
-        do_action('geodir_listings_sidebar_left_inside');
1882
-        /** This action is documented in geodirectory_template_actions.php */
1883
-        do_action('geodir_sidebar_left_close', 'listings-page');
1884
-    }
1871
+	if (get_option('geodir_show_listing_left_section')) {
1872
+		/** This action is documented in geodirectory_template_actions.php */
1873
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1874
+		/**
1875
+		 * Calls the listings page (category) left sidebar content.
1876
+		 *
1877
+		 * All the content for the listings page left sidebar is added via this hook.
1878
+		 *
1879
+		 * @since 1.0.0
1880
+		 */
1881
+		do_action('geodir_listings_sidebar_left_inside');
1882
+		/** This action is documented in geodirectory_template_actions.php */
1883
+		do_action('geodir_sidebar_left_close', 'listings-page');
1884
+	}
1885 1885
 }
1886 1886
 
1887 1887
 /**
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
  */
1895 1895
 function geodir_listing_right_section()
1896 1896
 {
1897
-    if (get_option('geodir_show_listing_right_section')) { ?>
1897
+	if (get_option('geodir_show_listing_right_section')) { ?>
1898 1898
         <div class="geodir-content-right geodir-sidebar-wrap">
1899 1899
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1900 1900
         </div><!-- end geodir-content-right -->
@@ -1912,20 +1912,20 @@  discard block
 block discarded – undo
1912 1912
  */
1913 1913
 function geodir_action_listings_sidebar_right()
1914 1914
 {
1915
-    if (get_option('geodir_show_listing_right_section')) {
1916
-        /** This action is documented in geodirectory_template_actions.php */
1917
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1918
-        /**
1919
-         * Calls the listings page (category) right sidebar content.
1920
-         *
1921
-         * All the content for the listings page right sidebar is added via this hook.
1922
-         *
1923
-         * @since 1.0.0
1924
-         */
1925
-        do_action('geodir_listings_sidebar_right_inside');
1926
-        /** This action is documented in geodirectory_template_actions.php */
1927
-        do_action('geodir_sidebar_right_close', 'listings-page');
1928
-    }
1915
+	if (get_option('geodir_show_listing_right_section')) {
1916
+		/** This action is documented in geodirectory_template_actions.php */
1917
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1918
+		/**
1919
+		 * Calls the listings page (category) right sidebar content.
1920
+		 *
1921
+		 * All the content for the listings page right sidebar is added via this hook.
1922
+		 *
1923
+		 * @since 1.0.0
1924
+		 */
1925
+		do_action('geodir_listings_sidebar_right_inside');
1926
+		/** This action is documented in geodirectory_template_actions.php */
1927
+		do_action('geodir_sidebar_right_close', 'listings-page');
1928
+	}
1929 1929
 }
1930 1930
 
1931 1931
 
@@ -1942,23 +1942,23 @@  discard block
 block discarded – undo
1942 1942
  */
1943 1943
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1944 1944
 {
1945
-    $tc = get_option('theme_compatibility_setting');
1946
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1947
-        $text = $tc['geodir_main_content_open_replace'];
1948
-    } else {
1949
-        $text = '<main id="[id]" class="[class]" role="main">';
1950
-    }
1945
+	$tc = get_option('theme_compatibility_setting');
1946
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1947
+		$text = $tc['geodir_main_content_open_replace'];
1948
+	} else {
1949
+		$text = '<main id="[id]" class="[class]" role="main">';
1950
+	}
1951 1951
 
1952
-    if (!empty($tc['geodir_main_content_open_id'])) {
1953
-        $id = $tc['geodir_main_content_open_id'];
1954
-    }
1955
-    if (!empty($tc['geodir_main_content_open_class'])) {
1956
-        $class = $tc['geodir_main_content_open_class'];
1957
-    }
1952
+	if (!empty($tc['geodir_main_content_open_id'])) {
1953
+		$id = $tc['geodir_main_content_open_id'];
1954
+	}
1955
+	if (!empty($tc['geodir_main_content_open_class'])) {
1956
+		$class = $tc['geodir_main_content_open_class'];
1957
+	}
1958 1958
 
1959
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1959
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1960 1960
 
1961
-    echo $text;
1961
+	echo $text;
1962 1962
 }
1963 1963
 
1964 1964
 // action for adding the primary div closing tag
@@ -1971,13 +1971,13 @@  discard block
 block discarded – undo
1971 1971
  */
1972 1972
 function geodir_action_main_content_close()
1973 1973
 {
1974
-    $tc = get_option('theme_compatibility_setting');
1975
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1976
-        $text = $tc['geodir_main_content_close_replace'];
1977
-    } else {
1978
-        $text = '</main><!-- main ends here-->';
1979
-    }
1980
-    echo $text;
1974
+	$tc = get_option('theme_compatibility_setting');
1975
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1976
+		$text = $tc['geodir_main_content_close_replace'];
1977
+	} else {
1978
+		$text = '</main><!-- main ends here-->';
1979
+	}
1980
+	echo $text;
1981 1981
 }
1982 1982
 
1983 1983
 /**
@@ -1989,14 +1989,14 @@  discard block
 block discarded – undo
1989 1989
  */
1990 1990
 function geodir_action_listings_content_inside()
1991 1991
 {
1992
-    global $gridview_columns;
1993
-    $listing_view = get_option('geodir_listing_view');
1994
-    if (strstr($listing_view, 'gridview')) {
1995
-        $gridview_columns = $listing_view;
1996
-        $listing_view_exp = explode('_', $listing_view);
1997
-        $listing_view = $listing_view_exp[0];
1998
-    }
1999
-    geodir_get_template_part('listing', 'listview');
1992
+	global $gridview_columns;
1993
+	$listing_view = get_option('geodir_listing_view');
1994
+	if (strstr($listing_view, 'gridview')) {
1995
+		$gridview_columns = $listing_view;
1996
+		$listing_view_exp = explode('_', $listing_view);
1997
+		$listing_view = $listing_view_exp[0];
1998
+	}
1999
+	geodir_get_template_part('listing', 'listview');
2000 2000
 }
2001 2001
 
2002 2002
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -2012,47 +2012,47 @@  discard block
 block discarded – undo
2012 2012
  */
2013 2013
 function geodir_action_listings_content()
2014 2014
 {
2015
-    /**
2016
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2017
-     *
2018
-     * @since 1.0.0
2019
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2020
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
2021
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2022
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2023
-     */
2024
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2025
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2026
-    echo '<div class="clearfix '.$extra_class.'">';
2027
-    /**
2028
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2029
-     *
2030
-     * @since 1.0.0
2031
-     */
2032
-    do_action('geodir_before_listing');
2033
-    echo '</div>';
2034
-
2035
-    /**
2036
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
2037
-     *
2038
-     * @since 1.0.0
2039
-     */
2040
-    do_action('geodir_listings_content_inside');
2041
-
2042
-    /**
2043
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2044
-     *
2045
-     * @since 1.0.0
2046
-     */
2047
-    do_action('geodir_after_listing');
2048
-
2049
-    /**
2050
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2051
-     *
2052
-     * @since 1.0.0
2053
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2054
-     */
2055
-    do_action('geodir_main_content_close', 'listings-page');
2015
+	/**
2016
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2017
+	 *
2018
+	 * @since 1.0.0
2019
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2020
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
2021
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2022
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2023
+	 */
2024
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2025
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2026
+	echo '<div class="clearfix '.$extra_class.'">';
2027
+	/**
2028
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2029
+	 *
2030
+	 * @since 1.0.0
2031
+	 */
2032
+	do_action('geodir_before_listing');
2033
+	echo '</div>';
2034
+
2035
+	/**
2036
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
2037
+	 *
2038
+	 * @since 1.0.0
2039
+	 */
2040
+	do_action('geodir_listings_content_inside');
2041
+
2042
+	/**
2043
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2044
+	 *
2045
+	 * @since 1.0.0
2046
+	 */
2047
+	do_action('geodir_after_listing');
2048
+
2049
+	/**
2050
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2051
+	 *
2052
+	 * @since 1.0.0
2053
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2054
+	 */
2055
+	do_action('geodir_main_content_close', 'listings-page');
2056 2056
 }
2057 2057
 
2058 2058
 
@@ -2067,10 +2067,10 @@  discard block
 block discarded – undo
2067 2067
  */
2068 2068
 function geodir_action_sidebar_listings_bottom_section()
2069 2069
 {
2070
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2070
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2071 2071
         <div class="<?php
2072
-            /** This action is documented in geodirectory_template_actions.php */
2073
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2072
+			/** This action is documented in geodirectory_template_actions.php */
2073
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2074 2074
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2075 2075
         </div><!-- clearfix ends here-->
2076 2076
     <?php }
@@ -2090,38 +2090,38 @@  discard block
 block discarded – undo
2090 2090
  */
2091 2091
 function geodir_action_add_listing_page_title()
2092 2092
 {
2093
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2094
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2095
-    /** This action is documented in geodirectory_template_actions.php */
2096
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2097
-    /** This action is documented in geodirectory_template_actions.php */
2098
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2099
-
2100
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2101
-
2102
-    if(geodir_is_page('add-listing')){
2103
-        $gd_page = 'add-listing';
2104
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2105
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2106
-        }elseif(isset($listing_type)){
2107
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2108
-        }
2093
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2094
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2095
+	/** This action is documented in geodirectory_template_actions.php */
2096
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2097
+	/** This action is documented in geodirectory_template_actions.php */
2098
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2099
+
2100
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2101
+
2102
+	if(geodir_is_page('add-listing')){
2103
+		$gd_page = 'add-listing';
2104
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2105
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2106
+		}elseif(isset($listing_type)){
2107
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2108
+		}
2109 2109
 
2110
-    }
2110
+	}
2111 2111
 
2112 2112
 
2113
-    /**
2114
-     * Filter page title to replace variables.
2115
-     *
2116
-     * @since 1.5.4
2117
-     * @param string $title The page title including variables.
2118
-     * @param string $gd_page The GeoDirectory page type if any.
2119
-     */
2120
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2113
+	/**
2114
+	 * Filter page title to replace variables.
2115
+	 *
2116
+	 * @since 1.5.4
2117
+	 * @param string $title The page title including variables.
2118
+	 * @param string $gd_page The GeoDirectory page type if any.
2119
+	 */
2120
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2121 2121
 
2122
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2123
-    echo $title;
2124
-    echo '</h1></header>';
2122
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2123
+	echo $title;
2124
+	echo '</h1></header>';
2125 2125
 }
2126 2126
 
2127 2127
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2152,61 +2152,61 @@  discard block
 block discarded – undo
2152 2152
  */
2153 2153
 function geodir_action_add_listing_form()
2154 2154
 {
2155
-    global $cat_display, $post_cat, $current_user, $gd_session;
2156
-    $page_id = get_the_ID();
2157
-    $post = '';
2158
-    $title = '';
2159
-    $desc = '';
2160
-    $kw_tags = '';
2161
-    $required_msg = '';
2162
-    $submit_button = '';
2163
-
2164
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2165
-
2166
-    $thumb_img_arr = array();
2167
-    $curImages = '';
2168
-
2169
-    if (isset($_REQUEST['backandedit'])) {
2170
-        global $post;
2171
-        $post = (object)$gd_session->get('listing');
2172
-        $listing_type = $post->listing_type;
2173
-        $title = $post->post_title;
2174
-        $desc = $post->post_desc;
2175
-        $post_cat = isset($post->post_category) ? $post->post_category : '';
2176
-
2177
-        $kw_tags = $post->post_tags;
2178
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2179
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2180
-        global $post, $post_images;
2181
-
2182
-        $post = geodir_get_post_info($_REQUEST['pid']);
2183
-        $thumb_img_arr = geodir_get_images($post->ID);
2184
-        if ($thumb_img_arr) {
2185
-            foreach ($thumb_img_arr as $post_img) {
2186
-                $curImages .= $post_img->src . ',';
2187
-            }
2188
-        }
2155
+	global $cat_display, $post_cat, $current_user, $gd_session;
2156
+	$page_id = get_the_ID();
2157
+	$post = '';
2158
+	$title = '';
2159
+	$desc = '';
2160
+	$kw_tags = '';
2161
+	$required_msg = '';
2162
+	$submit_button = '';
2163
+
2164
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2165
+
2166
+	$thumb_img_arr = array();
2167
+	$curImages = '';
2168
+
2169
+	if (isset($_REQUEST['backandedit'])) {
2170
+		global $post;
2171
+		$post = (object)$gd_session->get('listing');
2172
+		$listing_type = $post->listing_type;
2173
+		$title = $post->post_title;
2174
+		$desc = $post->post_desc;
2175
+		$post_cat = isset($post->post_category) ? $post->post_category : '';
2176
+
2177
+		$kw_tags = $post->post_tags;
2178
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2179
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2180
+		global $post, $post_images;
2181
+
2182
+		$post = geodir_get_post_info($_REQUEST['pid']);
2183
+		$thumb_img_arr = geodir_get_images($post->ID);
2184
+		if ($thumb_img_arr) {
2185
+			foreach ($thumb_img_arr as $post_img) {
2186
+				$curImages .= $post_img->src . ',';
2187
+			}
2188
+		}
2189 2189
 
2190
-        $listing_type = $post->post_type;
2191
-        $title = $post->post_title;
2192
-        $desc = $post->post_content;
2193
-        $kw_tags = $post->post_tags;
2194
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2195
-    } else {
2196
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2197
-    }
2190
+		$listing_type = $post->post_type;
2191
+		$title = $post->post_title;
2192
+		$desc = $post->post_content;
2193
+		$kw_tags = $post->post_tags;
2194
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2195
+	} else {
2196
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2197
+	}
2198 2198
 
2199
-    if ($current_user->ID != '0') {
2200
-        $user_login = true;
2201
-    }
2199
+	if ($current_user->ID != '0') {
2200
+		$user_login = true;
2201
+	}
2202 2202
 
2203
-    $post_type_info = geodir_get_posttype_info($listing_type);
2203
+	$post_type_info = geodir_get_posttype_info($listing_type);
2204 2204
 
2205
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2205
+	$cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2206 2206
     
2207
-    $package_info = array();
2208
-    $package_info = geodir_post_package_info($package_info, $post);
2209
-    ?>
2207
+	$package_info = array();
2208
+	$package_info = geodir_post_package_info($package_info, $post);
2209
+	?>
2210 2210
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2211 2211
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2212 2212
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2217,114 +2217,114 @@  discard block
 block discarded – undo
2217 2217
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2218 2218
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2219 2219
         <?php
2220
-        } 
2221
-        /**
2222
-         * Called at the very top of the add listing page form for frontend.
2223
-         *
2224
-         * This is called just before the "Enter Listing Details" text.
2225
-         *
2226
-         * @since 1.0.0
2227
-         */
2228
-        do_action('geodir_before_detail_fields');
2229
-        ?>
2220
+		} 
2221
+		/**
2222
+		 * Called at the very top of the add listing page form for frontend.
2223
+		 *
2224
+		 * This is called just before the "Enter Listing Details" text.
2225
+		 *
2226
+		 * @since 1.0.0
2227
+		 */
2228
+		do_action('geodir_before_detail_fields');
2229
+		?>
2230 2230
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2231 2231
         <?php
2232
-        /**
2233
-         * Called at the top of the add listing page form for frontend.
2234
-         *
2235
-         * This is called after the "Enter Listing Details" text.
2236
-         *
2237
-         * @since 1.0.0
2238
-         */
2239
-        do_action('geodir_before_main_form_fields');
2240
-        ?>
2232
+		/**
2233
+		 * Called at the top of the add listing page form for frontend.
2234
+		 *
2235
+		 * This is called after the "Enter Listing Details" text.
2236
+		 *
2237
+		 * @since 1.0.0
2238
+		 */
2239
+		do_action('geodir_before_main_form_fields');
2240
+		?>
2241 2241
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2242 2242
             <label><?php
2243
-                /**
2244
-                 * Filter the add listing page title input label.
2245
-                 *
2246
-                 * @since 1.6.11
2247
-                 * @param string $title The title to be output.
2248
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2249
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2250
-                 */
2251
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2243
+				/**
2244
+				 * Filter the add listing page title input label.
2245
+				 *
2246
+				 * @since 1.6.11
2247
+				 * @param string $title The title to be output.
2248
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2249
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2250
+				 */
2251
+				echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2252 2252
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2253 2253
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2254 2254
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2255 2255
         </div>
2256 2256
         <?php
2257
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2258
-        $show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2259
-        /**
2260
-         * Filter whether to show or don't show the editor.
2261
-         *
2262
-         * @since 1.6.16
2263
-         * @param bool $show_editor If true the editor will be available for description field.
2264
-         * @param object $package_info The listing package.
2265
-         * @param string $listing_type The current post type.
2266
-         * @param object $post The current post object.
2267
-         */
2268
-        $show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2269
-
2270
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2271
-        $desc_limit = '';
2272
-        /**
2273
-         * Filter the add listing description field character limit number.
2274
-         *
2275
-         * @since 1.0.0
2276
-         * @param int $desc_limit The amount of characters to limit the description to.
2277
-         */
2278
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2279
-        /**
2280
-         * Filter the add listing description field text.
2281
-         *
2282
-         * @since 1.0.0
2283
-         * @param string $desc The text for the description field.
2284
-         * @param int $desc_limit The character limit number if any.
2285
-         */
2286
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2287
-        $desc_limit_msg = '';
2288
-        /**
2289
-         * Filter the add listing description limit message.
2290
-         *
2291
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2292
-         *
2293
-         * @since 1.0.0
2294
-         * @param string $desc_limit_msg The limit message string if any.
2295
-         * @param int $desc_limit The character limit numer if any.
2296
-         */
2297
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2257
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2258
+		$show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2259
+		/**
2260
+		 * Filter whether to show or don't show the editor.
2261
+		 *
2262
+		 * @since 1.6.16
2263
+		 * @param bool $show_editor If true the editor will be available for description field.
2264
+		 * @param object $package_info The listing package.
2265
+		 * @param string $listing_type The current post type.
2266
+		 * @param object $post The current post object.
2267
+		 */
2268
+		$show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2269
+
2270
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2271
+		$desc_limit = '';
2272
+		/**
2273
+		 * Filter the add listing description field character limit number.
2274
+		 *
2275
+		 * @since 1.0.0
2276
+		 * @param int $desc_limit The amount of characters to limit the description to.
2277
+		 */
2278
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2279
+		/**
2280
+		 * Filter the add listing description field text.
2281
+		 *
2282
+		 * @since 1.0.0
2283
+		 * @param string $desc The text for the description field.
2284
+		 * @param int $desc_limit The character limit number if any.
2285
+		 */
2286
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2287
+		$desc_limit_msg = '';
2288
+		/**
2289
+		 * Filter the add listing description limit message.
2290
+		 *
2291
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2292
+		 *
2293
+		 * @since 1.0.0
2294
+		 * @param string $desc_limit_msg The limit message string if any.
2295
+		 * @param int $desc_limit The character limit numer if any.
2296
+		 */
2297
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2298 2298
         
2299
-        $desc_class = '';
2300
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2301
-            /**
2302
-             * Called on the add listing page form for frontend just before the description field.
2303
-             *
2304
-             * @since 1.0.0
2305
-             */
2306
-            do_action('geodir_before_description_field');
2299
+		$desc_class = '';
2300
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2301
+			/**
2302
+			 * Called on the add listing page form for frontend just before the description field.
2303
+			 *
2304
+			 * @since 1.0.0
2305
+			 */
2306
+			do_action('geodir_before_description_field');
2307 2307
             
2308
-            $desc_class = ' required_field';
2309
-        } else {
2310
-            $desc_class = ' hidden';
2311
-        }
2312
-        ?>
2308
+			$desc_class = ' required_field';
2309
+		} else {
2310
+			$desc_class = ' hidden';
2311
+		}
2312
+		?>
2313 2313
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2314 2314
             <label><?php
2315
-                /**
2316
-                 * Filter the add listing page description input label.
2317
-                 *
2318
-                 * @since 1.6.11
2319
-                 * @param string $title The title to be output.
2320
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2321
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2322
-                 */
2323
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2315
+				/**
2316
+				 * Filter the add listing page description input label.
2317
+				 *
2318
+				 * @since 1.6.11
2319
+				 * @param string $title The title to be output.
2320
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2321
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2322
+				 */
2323
+				echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2324 2324
             <?php
2325
-            if ($show_editor) {
2326
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2327
-            ?>
2325
+			if ($show_editor) {
2326
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2327
+			?>
2328 2328
                 <div class="editor" field_id="post_desc" field_type="editor">
2329 2329
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2330 2330
                 </div>
@@ -2338,56 +2338,56 @@  discard block
 block discarded – undo
2338 2338
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2339 2339
         </div>
2340 2340
         <?php
2341
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2342
-            /**
2343
-             * Called on the add listing page form for frontend just after the description field.
2344
-             *
2345
-             * @since 1.0.0
2346
-             */
2347
-            do_action('geodir_after_description_field');
2348
-        }
2341
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2342
+			/**
2343
+			 * Called on the add listing page form for frontend just after the description field.
2344
+			 *
2345
+			 * @since 1.0.0
2346
+			 */
2347
+			do_action('geodir_after_description_field');
2348
+		}
2349 2349
         
2350
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2351
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2352
-        $kw_tags_msg = TAGKW_MSG;
2353
-        /**
2354
-         * Filter the add listing tags character limit.
2355
-         *
2356
-         * @since 1.0.0
2357
-         * @param int $kw_tags_count The character count limit if any.
2358
-         */
2359
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2360
-        /**
2361
-         * Filter the add listing tags field value.
2362
-         *
2363
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2364
-         *
2365
-         * @since 1.0.0
2366
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2367
-         * @param int $kw_tags_count The character count limit if any.
2368
-         */
2369
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2370
-        /**
2371
-         * Filter the add listing tags field message text.
2372
-         *
2373
-         * @since 1.0.0
2374
-         * @param string $kw_tags_msg The message shown under the field.
2375
-         * @param int $kw_tags_count The character count limit if any.
2376
-         */
2377
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2350
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2351
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2352
+		$kw_tags_msg = TAGKW_MSG;
2353
+		/**
2354
+		 * Filter the add listing tags character limit.
2355
+		 *
2356
+		 * @since 1.0.0
2357
+		 * @param int $kw_tags_count The character count limit if any.
2358
+		 */
2359
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2360
+		/**
2361
+		 * Filter the add listing tags field value.
2362
+		 *
2363
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2364
+		 *
2365
+		 * @since 1.0.0
2366
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2367
+		 * @param int $kw_tags_count The character count limit if any.
2368
+		 */
2369
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2370
+		/**
2371
+		 * Filter the add listing tags field message text.
2372
+		 *
2373
+		 * @since 1.0.0
2374
+		 * @param string $kw_tags_msg The message shown under the field.
2375
+		 * @param int $kw_tags_count The character count limit if any.
2376
+		 */
2377
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2378 2378
         
2379
-        $tags_class = '';
2380
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2381
-            /**
2382
-             * Called on the add listing page form for frontend just before the tags field.
2383
-             *
2384
-             * @since 1.0.0
2385
-             */
2386
-            do_action('geodir_before_listing_tags_field');
2387
-        } else {
2388
-            $tags_class = ' hidden';
2389
-        }
2390
-        ?>
2379
+		$tags_class = '';
2380
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2381
+			/**
2382
+			 * Called on the add listing page form for frontend just before the tags field.
2383
+			 *
2384
+			 * @since 1.0.0
2385
+			 */
2386
+			do_action('geodir_before_listing_tags_field');
2387
+		} else {
2388
+			$tags_class = ' hidden';
2389
+		}
2390
+		?>
2391 2391
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2392 2392
             <label><?php echo TAGKW_TEXT; ?></label>
2393 2393
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2395,90 +2395,90 @@  discard block
 block discarded – undo
2395 2395
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2396 2396
         </div>
2397 2397
         <?php
2398
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2399
-            /**
2400
-             * Called on the add listing page form for frontend just after the tags field.
2401
-             *
2402
-             * @since 1.0.0
2403
-             */
2404
-            do_action('geodir_after_listing_tags_field');
2405
-        }
2398
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2399
+			/**
2400
+			 * Called on the add listing page form for frontend just after the tags field.
2401
+			 *
2402
+			 * @since 1.0.0
2403
+			 */
2404
+			do_action('geodir_after_listing_tags_field');
2405
+		}
2406 2406
         
2407
-        $package_info = array();
2408
-        $package_info = geodir_post_package_info($package_info, $post);
2407
+		$package_info = array();
2408
+		$package_info = geodir_post_package_info($package_info, $post);
2409 2409
         
2410
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2410
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2411 2411
         
2412
-        // adjust values here
2413
-        $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2412
+		// adjust values here
2413
+		$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2414 2414
 
2415
-        $multiple = true; // allow multiple files upload
2415
+		$multiple = true; // allow multiple files upload
2416 2416
 
2417
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2417
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2418 2418
 
2419
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2419
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2420 2420
 
2421
-        $thumb_img_arr = array();
2422
-        $totImg = 0;
2423
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2424
-            $post = (object)$gd_session->get('listing');
2425
-            if (isset($post->post_images))
2426
-                $curImages = trim($post->post_images, ",");
2421
+		$thumb_img_arr = array();
2422
+		$totImg = 0;
2423
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2424
+			$post = (object)$gd_session->get('listing');
2425
+			if (isset($post->post_images))
2426
+				$curImages = trim($post->post_images, ",");
2427 2427
 
2428 2428
 
2429
-            if ($curImages != '') {
2430
-                $curImages_array = explode(',', $curImages);
2431
-                $totImg = count($curImages_array);
2432
-            }
2429
+			if ($curImages != '') {
2430
+				$curImages_array = explode(',', $curImages);
2431
+				$totImg = count($curImages_array);
2432
+			}
2433 2433
 
2434
-            $listing_type = $post->listing_type;
2434
+			$listing_type = $post->listing_type;
2435 2435
 
2436
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2437
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2438
-            $listing_type = $post->post_type;
2439
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2436
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2437
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2438
+			$listing_type = $post->post_type;
2439
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2440 2440
 
2441
-        } else {
2442
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2443
-        }
2441
+		} else {
2442
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2443
+		}
2444 2444
 
2445 2445
 
2446
-        if (!empty($thumb_img_arr)) {
2447
-            foreach ($thumb_img_arr as $img) {
2448
-                //$curImages = $img->src.",";
2449
-            }
2450
-
2451
-            $totImg = count((array)$thumb_img_arr);
2452
-        }
2446
+		if (!empty($thumb_img_arr)) {
2447
+			foreach ($thumb_img_arr as $img) {
2448
+				//$curImages = $img->src.",";
2449
+			}
2453 2450
 
2454
-        if ($curImages != '')
2455
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2456
-        else
2457
-            $svalue = '';
2458
-
2459
-        $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2460
-        $show_image_input_box = ($image_limit != '0');
2461
-        /**
2462
-         * Filter to be able to show/hide the image upload section of the add listing form.
2463
-         *
2464
-         * @since 1.0.0
2465
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2466
-         * @param string $listing_type The custom post type slug.
2467
-         */
2468
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2469
-        if ($show_image_input_box) {
2470
-            ?>
2451
+			$totImg = count((array)$thumb_img_arr);
2452
+		}
2453
+
2454
+		if ($curImages != '')
2455
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2456
+		else
2457
+			$svalue = '';
2458
+
2459
+		$image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2460
+		$show_image_input_box = ($image_limit != '0');
2461
+		/**
2462
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2463
+		 *
2464
+		 * @since 1.0.0
2465
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2466
+		 * @param string $listing_type The custom post type slug.
2467
+		 */
2468
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2469
+		if ($show_image_input_box) {
2470
+			?>
2471 2471
 
2472 2472
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2473 2473
                 <?php if ($image_limit == 1) {
2474
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2475
-                } ?>
2474
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2475
+				} ?>
2476 2476
                 <?php if ($image_limit > 1) {
2477
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2478
-                } ?>
2477
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2478
+				} ?>
2479 2479
                 <?php if ($image_limit == '') {
2480
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2481
-                } ?>
2480
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2481
+				} ?>
2482 2482
             </h5>
2483 2483
 
2484 2484
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2516,12 +2516,12 @@  discard block
 block discarded – undo
2516 2516
         <?php } ?>
2517 2517
 
2518 2518
         <?php
2519
-        /**
2520
-         * Called on the add listing page form for frontend just after the image upload field.
2521
-         *
2522
-         * @since 1.0.0
2523
-         */
2524
-        do_action('geodir_after_main_form_fields');?>
2519
+		/**
2520
+		 * Called on the add listing page form for frontend just after the image upload field.
2521
+		 *
2522
+		 * @since 1.0.0
2523
+		 */
2524
+		do_action('geodir_after_main_form_fields');?>
2525 2525
 
2526 2526
 
2527 2527
         <!-- add captcha code -->
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
 
2551 2551
     </form>
2552 2552
     <?php
2553
-    wp_reset_query();
2553
+	wp_reset_query();
2554 2554
 }
2555 2555
 
2556 2556
 /**
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
  */
2562 2562
 function geodir_add_listing_sidebar_widget_area()
2563 2563
 {
2564
-    dynamic_sidebar('geodir_add_listing_sidebar');
2564
+	dynamic_sidebar('geodir_add_listing_sidebar');
2565 2565
 }
2566 2566
 
2567 2567
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2576,16 +2576,16 @@  discard block
 block discarded – undo
2576 2576
  */
2577 2577
 function geodir_action_add_listing_sidebar()
2578 2578
 {
2579
-    /** This action is documented in geodirectory_template_actions.php */
2580
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2581
-    /**
2582
-     * This is used to add the content to the add listing page sidebar.
2583
-     *
2584
-     * @since 1.0.0
2585
-     */
2586
-    do_action('geodir_add_listing_sidebar_inside');
2587
-    /** This action is documented in geodirectory_template_actions.php */
2588
-    do_action('geodir_sidebar_right_close', 'details-page');
2579
+	/** This action is documented in geodirectory_template_actions.php */
2580
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2581
+	/**
2582
+	 * This is used to add the content to the add listing page sidebar.
2583
+	 *
2584
+	 * @since 1.0.0
2585
+	 */
2586
+	do_action('geodir_add_listing_sidebar_inside');
2587
+	/** This action is documented in geodirectory_template_actions.php */
2588
+	do_action('geodir_sidebar_right_close', 'details-page');
2589 2589
 }
2590 2590
 
2591 2591
 ###############################################
@@ -2602,11 +2602,11 @@  discard block
 block discarded – undo
2602 2602
  */
2603 2603
 function geodir_action_geodir_sidebar_signup_top()
2604 2604
 {
2605
-    ?>
2605
+	?>
2606 2606
     <div
2607 2607
         class="<?php
2608
-        /** This action is documented in geodirectory_template_actions.php */
2609
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2608
+		/** This action is documented in geodirectory_template_actions.php */
2609
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2610 2610
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2611 2611
     </div><!-- clearfix ends here-->
2612 2612
 <?php
@@ -2625,11 +2625,11 @@  discard block
 block discarded – undo
2625 2625
 function geodir_action_signup_forms()
2626 2626
 {
2627 2627
 
2628
-    global $user_login;
2628
+	global $user_login;
2629 2629
     
2630
-    $is_enable_signup = get_option( 'users_can_register' );
2630
+	$is_enable_signup = get_option( 'users_can_register' );
2631 2631
     
2632
-    ?>
2632
+	?>
2633 2633
     <script type="text/javascript">
2634 2634
         <?php if ( $user_login ) { ?>
2635 2635
         setTimeout(function () {
@@ -2665,67 +2665,67 @@  discard block
 block discarded – undo
2665 2665
         <?php } ?>
2666 2666
     </script><?php
2667 2667
 
2668
-    global $errors;
2669
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2670
-        $errors->add('claim_login', LOGIN_CLAIM);
2671
-
2672
-    if (!empty($errors)) {
2673
-        foreach ($errors as $errorsObj) {
2674
-            foreach ($errorsObj as $key => $val) {
2675
-                for ($i = 0; $i < count($val); $i++) {
2676
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2677
-                    $registration_error_msg = 1;
2678
-                }
2679
-            }
2680
-        }
2681
-    }
2668
+	global $errors;
2669
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2670
+		$errors->add('claim_login', LOGIN_CLAIM);
2671
+
2672
+	if (!empty($errors)) {
2673
+		foreach ($errors as $errorsObj) {
2674
+			foreach ($errorsObj as $key => $val) {
2675
+				for ($i = 0; $i < count($val); $i++) {
2676
+					echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2677
+					$registration_error_msg = 1;
2678
+				}
2679
+			}
2680
+		}
2681
+	}
2682 2682
 
2683
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2684
-        ?>
2683
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2684
+		?>
2685 2685
 
2686 2686
         <div class="login_form">
2687 2687
             <?php
2688
-            /**
2689
-             * Contains login form template.
2690
-             *
2691
-             * @since 1.0.0
2692
-             */
2693
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2688
+			/**
2689
+			 * Contains login form template.
2690
+			 *
2691
+			 * @since 1.0.0
2692
+			 */
2693
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2694 2694
         </div>
2695 2695
 
2696 2696
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2697 2697
 
2698 2698
         <div class="registration_form">
2699 2699
             <?php
2700
-            /**
2701
-             * Contains registration form template.
2702
-             *
2703
-             * @since 1.0.0
2704
-             */
2705
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2700
+			/**
2701
+			 * Contains registration form template.
2702
+			 *
2703
+			 * @since 1.0.0
2704
+			 */
2705
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2706 2706
         </div>
2707 2707
 
2708 2708
     <?php } else { ?>
2709 2709
 
2710 2710
         <div class="login_form_l">
2711 2711
             <?php
2712
-            /**
2713
-             * Contains login form template.
2714
-             *
2715
-             * @since 1.0.0
2716
-             */
2717
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2712
+			/**
2713
+			 * Contains login form template.
2714
+			 *
2715
+			 * @since 1.0.0
2716
+			 */
2717
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2718 2718
         </div>
2719 2719
         
2720 2720
         <?php if ( $is_enable_signup ) { ?>
2721 2721
             <div class="registration_form_r">
2722 2722
                 <?php
2723
-                /**
2724
-                 * Contains registration form template.
2725
-                 *
2726
-                 * @since 1.0.0
2727
-                 */
2728
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2723
+				/**
2724
+				 * Contains registration form template.
2725
+				 *
2726
+				 * @since 1.0.0
2727
+				 */
2728
+				include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2729 2729
             </div>
2730 2730
         <?php } ?>
2731 2731
 
@@ -2757,66 +2757,66 @@  discard block
 block discarded – undo
2757 2757
  */
2758 2758
 function geodir_action_author_page_title()
2759 2759
 {
2760
-    global $term;
2760
+	global $term;
2761 2761
 
2762
-    $gd_post_type = geodir_get_current_posttype();
2763
-    $post_type_info = get_post_type_object($gd_post_type);
2762
+	$gd_post_type = geodir_get_current_posttype();
2763
+	$post_type_info = get_post_type_object($gd_post_type);
2764 2764
 
2765
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2766
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2767
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2768
-    }
2765
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2766
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2767
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2768
+	}
2769 2769
 
2770
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2771
-    $single_name = $post_type_info->labels->singular_name;
2770
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2771
+	$single_name = $post_type_info->labels->singular_name;
2772 2772
 
2773
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2773
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2774 2774
 
2775
-    if (!empty($term)) {
2776
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2777
-        if (!empty($current_term))
2778
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2779
-    }
2775
+	if (!empty($term)) {
2776
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2777
+		if (!empty($current_term))
2778
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2779
+	}
2780 2780
 
2781 2781
 
2782
-    if (is_search()) {
2783
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2782
+	if (is_search()) {
2783
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2784 2784
 
2785
-    }
2786
-    /** This action is documented in geodirectory_template_actions.php */
2787
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2788
-    /** This action is documented in geodirectory_template_actions.php */
2789
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2785
+	}
2786
+	/** This action is documented in geodirectory_template_actions.php */
2787
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2788
+	/** This action is documented in geodirectory_template_actions.php */
2789
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2790 2790
 
2791
-    $title = $list_title;
2792
-    if(geodir_is_page('author')){
2793
-        $gd_page = 'author';
2794
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2795
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2796
-        }else{
2797
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2798
-        }
2791
+	$title = $list_title;
2792
+	if(geodir_is_page('author')){
2793
+		$gd_page = 'author';
2794
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2795
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2796
+		}else{
2797
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2798
+		}
2799 2799
 
2800
-    }
2800
+	}
2801 2801
 
2802 2802
 
2803
-    /**
2804
-     * Filter page title to replace variables.
2805
-     *
2806
-     * @since 1.5.4
2807
-     * @param string $title The page title including variables.
2808
-     * @param string $gd_page The GeoDirectory page type if any.
2809
-     */
2810
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2803
+	/**
2804
+	 * Filter page title to replace variables.
2805
+	 *
2806
+	 * @since 1.5.4
2807
+	 * @param string $title The page title including variables.
2808
+	 * @param string $gd_page The GeoDirectory page type if any.
2809
+	 */
2810
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2811 2811
 
2812
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2813
-        /**
2814
-         * Filter the author page title text.
2815
-         *
2816
-         * @since 1.0.0
2817
-         * @param string $list_title The title for the page.
2818
-         */
2819
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2812
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2813
+		/**
2814
+		 * Filter the author page title text.
2815
+		 *
2816
+		 * @since 1.0.0
2817
+		 * @param string $list_title The title for the page.
2818
+		 */
2819
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2820 2820
 }
2821 2821
 
2822 2822
 
@@ -2834,11 +2834,11 @@  discard block
 block discarded – undo
2834 2834
  */
2835 2835
 function geodir_action_geodir_sidebar_author_top()
2836 2836
 {
2837
-    if (get_option('geodir_show_author_top_section')) { ?>
2837
+	if (get_option('geodir_show_author_top_section')) { ?>
2838 2838
         <div
2839 2839
             class="<?php
2840
-            /** This action is documented in geodirectory_template_actions.php */
2841
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2840
+			/** This action is documented in geodirectory_template_actions.php */
2841
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2842 2842
             <?php dynamic_sidebar('geodir_author_top'); ?>
2843 2843
         </div><!-- clearfix ends here-->
2844 2844
     <?php }
@@ -2854,7 +2854,7 @@  discard block
 block discarded – undo
2854 2854
  */
2855 2855
 function geodir_author_left_section()
2856 2856
 {
2857
-    if (get_option('geodir_show_author_left_section')) { ?>
2857
+	if (get_option('geodir_show_author_left_section')) { ?>
2858 2858
         <div class="geodir-content-left geodir-sidebar-wrap">
2859 2859
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2860 2860
         </div><!-- end geodir-content-left -->
@@ -2875,19 +2875,19 @@  discard block
 block discarded – undo
2875 2875
  */
2876 2876
 function geodir_action_author_sidebar_left()
2877 2877
 {
2878
-    if (get_option('geodir_show_author_left_section')) {
2878
+	if (get_option('geodir_show_author_left_section')) {
2879 2879
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2880
-        /** This action is documented in geodirectory_template_actions.php */
2881
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2882
-        /**
2883
-         * This is used to add the content to the author page left sidebar (if active).
2884
-         *
2885
-         * @since 1.0.0
2886
-         */
2887
-        do_action('geodir_author_sidebar_left_inside');
2888
-        /** This action is documented in geodirectory_template_actions.php */
2889
-        do_action('geodir_sidebar_left_close', 'author-page');
2890
-    }
2880
+		/** This action is documented in geodirectory_template_actions.php */
2881
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2882
+		/**
2883
+		 * This is used to add the content to the author page left sidebar (if active).
2884
+		 *
2885
+		 * @since 1.0.0
2886
+		 */
2887
+		do_action('geodir_author_sidebar_left_inside');
2888
+		/** This action is documented in geodirectory_template_actions.php */
2889
+		do_action('geodir_sidebar_left_close', 'author-page');
2890
+	}
2891 2891
 }
2892 2892
 
2893 2893
 /**
@@ -2900,7 +2900,7 @@  discard block
 block discarded – undo
2900 2900
  */
2901 2901
 function geodir_author_right_section()
2902 2902
 {
2903
-    if (get_option('geodir_show_author_right_section')) { ?>
2903
+	if (get_option('geodir_show_author_right_section')) { ?>
2904 2904
         <div class="geodir-content-right geodir-sidebar-wrap">
2905 2905
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2906 2906
         </div><!-- end geodir-content-right -->
@@ -2920,18 +2920,18 @@  discard block
 block discarded – undo
2920 2920
  */
2921 2921
 function geodir_action_author_sidebar_right()
2922 2922
 {
2923
-    if (get_option('geodir_show_author_right_section')) {
2924
-        /** This action is documented in geodirectory_template_actions.php */
2925
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2926
-        /**
2927
-         * This is used to add the content to the author page right sidebar (if active).
2928
-         *
2929
-         * @since 1.0.0
2930
-         */
2931
-        do_action('geodir_author_sidebar_right_inside');
2932
-        /** This action is documented in geodirectory_template_actions.php */
2933
-        do_action('geodir_sidebar_right_close', 'author-page');
2934
-    }
2923
+	if (get_option('geodir_show_author_right_section')) {
2924
+		/** This action is documented in geodirectory_template_actions.php */
2925
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2926
+		/**
2927
+		 * This is used to add the content to the author page right sidebar (if active).
2928
+		 *
2929
+		 * @since 1.0.0
2930
+		 */
2931
+		do_action('geodir_author_sidebar_right_inside');
2932
+		/** This action is documented in geodirectory_template_actions.php */
2933
+		do_action('geodir_sidebar_right_close', 'author-page');
2934
+	}
2935 2935
 }
2936 2936
 
2937 2937
 /**
@@ -2943,14 +2943,14 @@  discard block
 block discarded – undo
2943 2943
  */
2944 2944
 function geodir_action_author_content_inside()
2945 2945
 {
2946
-    global $gridview_columns;
2947
-    $listing_view = get_option('geodir_author_view');
2948
-    if (strstr($listing_view, 'gridview')) {
2949
-        $gridview_columns = $listing_view;
2950
-        $listing_view_exp = explode('_', $listing_view);
2951
-        $listing_view = $listing_view_exp[0];
2952
-    }
2953
-    geodir_get_template_part('listing', 'listview');
2946
+	global $gridview_columns;
2947
+	$listing_view = get_option('geodir_author_view');
2948
+	if (strstr($listing_view, 'gridview')) {
2949
+		$gridview_columns = $listing_view;
2950
+		$listing_view_exp = explode('_', $listing_view);
2951
+		$listing_view = $listing_view_exp[0];
2952
+	}
2953
+	geodir_get_template_part('listing', 'listview');
2954 2954
 }
2955 2955
 
2956 2956
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2965,22 +2965,22 @@  discard block
 block discarded – undo
2965 2965
  */
2966 2966
 function geodir_action_author_content()
2967 2967
 {
2968
-    /** This action is documented in geodirectory_template_actions.php */
2969
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2970
-    echo '<div class="clearfix">';
2971
-    /** This action is documented in geodirectory_template_actions.php */
2972
-    do_action('geodir_before_listing');
2973
-    echo '</div>';
2974
-    /**
2975
-     * This is used to add the content to the author page main content.
2976
-     *
2977
-     * @since 1.0.0
2978
-     */
2979
-    do_action('geodir_author_content_inside');
2980
-    /** This action is documented in geodirectory_template_actions.php */
2981
-    do_action('geodir_after_listing');
2982
-    /** This action is documented in geodirectory_template_actions.php */
2983
-    do_action('geodir_main_content_close', 'author-page');
2968
+	/** This action is documented in geodirectory_template_actions.php */
2969
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2970
+	echo '<div class="clearfix">';
2971
+	/** This action is documented in geodirectory_template_actions.php */
2972
+	do_action('geodir_before_listing');
2973
+	echo '</div>';
2974
+	/**
2975
+	 * This is used to add the content to the author page main content.
2976
+	 *
2977
+	 * @since 1.0.0
2978
+	 */
2979
+	do_action('geodir_author_content_inside');
2980
+	/** This action is documented in geodirectory_template_actions.php */
2981
+	do_action('geodir_after_listing');
2982
+	/** This action is documented in geodirectory_template_actions.php */
2983
+	do_action('geodir_main_content_close', 'author-page');
2984 2984
 }
2985 2985
 
2986 2986
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2994,11 +2994,11 @@  discard block
 block discarded – undo
2994 2994
  */
2995 2995
 function geodir_action_sidebar_author_bottom_section()
2996 2996
 {
2997
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2997
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2998 2998
         <div
2999 2999
             class="<?php
3000
-            /** This action is documented in geodirectory_template_actions.php */
3001
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
3000
+			/** This action is documented in geodirectory_template_actions.php */
3001
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
3002 3002
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
3003 3003
         </div><!-- clearfix ends here-->
3004 3004
     <?php }
@@ -3017,23 +3017,23 @@  discard block
 block discarded – undo
3017 3017
  */
3018 3018
 function geodir_action_search_page_title()
3019 3019
 {
3020
-    $gd_post_type = geodir_get_current_posttype();
3021
-    $post_type_info = get_post_type_object($gd_post_type);
3020
+	$gd_post_type = geodir_get_current_posttype();
3021
+	$post_type_info = get_post_type_object($gd_post_type);
3022 3022
 
3023
-    $pt_name = '';
3024
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3023
+	$pt_name = '';
3024
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3025 3025
 
3026
-    if (is_search()) {
3027
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3026
+	if (is_search()) {
3027
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3028 3028
 
3029
-    }
3030
-    /** This action is documented in geodirectory_template_actions.php */
3031
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3032
-    /** This action is documented in geodirectory_template_actions.php */
3033
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3034
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3035
-        /** This action is documented in geodirectory_template_actions.php */
3036
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3029
+	}
3030
+	/** This action is documented in geodirectory_template_actions.php */
3031
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
3032
+	/** This action is documented in geodirectory_template_actions.php */
3033
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3034
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3035
+		/** This action is documented in geodirectory_template_actions.php */
3036
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3037 3037
 }
3038 3038
 
3039 3039
 // action for adding the listings page top widget area
@@ -3049,11 +3049,11 @@  discard block
 block discarded – undo
3049 3049
  */
3050 3050
 function geodir_action_geodir_sidebar_search_top()
3051 3051
 {
3052
-    if (get_option('geodir_show_search_top_section')) { ?>
3052
+	if (get_option('geodir_show_search_top_section')) { ?>
3053 3053
         <div
3054 3054
             class="<?php
3055
-            /** This action is documented in geodirectory_template_actions.php */
3056
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3055
+			/** This action is documented in geodirectory_template_actions.php */
3056
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3057 3057
             <?php dynamic_sidebar('geodir_search_top'); ?>
3058 3058
         </div><!-- clearfix ends here-->
3059 3059
     <?php }
@@ -3069,7 +3069,7 @@  discard block
 block discarded – undo
3069 3069
  */
3070 3070
 function geodir_search_left_section()
3071 3071
 {
3072
-    if (get_option('geodir_show_search_left_section')) { ?>
3072
+	if (get_option('geodir_show_search_left_section')) { ?>
3073 3073
         <div class="geodir-content-left geodir-sidebar-wrap">
3074 3074
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
3075 3075
         </div><!-- end geodir-content-left -->
@@ -3089,19 +3089,19 @@  discard block
 block discarded – undo
3089 3089
  */
3090 3090
 function geodir_action_search_sidebar_left()
3091 3091
 {
3092
-    if (get_option('geodir_show_search_left_section')) {
3092
+	if (get_option('geodir_show_search_left_section')) {
3093 3093
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3094
-        /** This action is documented in geodirectory_template_actions.php */
3095
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3096
-        /**
3097
-         * This is used to add the content to the search page left sidebar (if active).
3098
-         *
3099
-         * @since 1.0.0
3100
-         */
3101
-        do_action('geodir_search_sidebar_left_inside');
3102
-        /** This action is documented in geodirectory_template_actions.php */
3103
-        do_action('geodir_sidebar_left_close', 'search-page');
3104
-    }
3094
+		/** This action is documented in geodirectory_template_actions.php */
3095
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3096
+		/**
3097
+		 * This is used to add the content to the search page left sidebar (if active).
3098
+		 *
3099
+		 * @since 1.0.0
3100
+		 */
3101
+		do_action('geodir_search_sidebar_left_inside');
3102
+		/** This action is documented in geodirectory_template_actions.php */
3103
+		do_action('geodir_sidebar_left_close', 'search-page');
3104
+	}
3105 3105
 }
3106 3106
 
3107 3107
 /**
@@ -3114,7 +3114,7 @@  discard block
 block discarded – undo
3114 3114
  */
3115 3115
 function geodir_search_right_section()
3116 3116
 {
3117
-    if (get_option('geodir_show_search_right_section')) { ?>
3117
+	if (get_option('geodir_show_search_right_section')) { ?>
3118 3118
         <div class="geodir-content-right geodir-sidebar-wrap">
3119 3119
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3120 3120
         </div><!-- end geodir-content-right -->
@@ -3134,18 +3134,18 @@  discard block
 block discarded – undo
3134 3134
  */
3135 3135
 function geodir_action_search_sidebar_right()
3136 3136
 {
3137
-    if (get_option('geodir_show_search_right_section')) {
3138
-        /** This action is documented in geodirectory_template_actions.php */
3139
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3140
-        /**
3141
-         * This is used to add the content to the search page right sidebar (if active).
3142
-         *
3143
-         * @since 1.0.0
3144
-         */
3145
-        do_action('geodir_search_sidebar_right_inside');
3146
-        /** This action is documented in geodirectory_template_actions.php */
3147
-        do_action('geodir_sidebar_right_close', 'search-page');
3148
-    }
3137
+	if (get_option('geodir_show_search_right_section')) {
3138
+		/** This action is documented in geodirectory_template_actions.php */
3139
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3140
+		/**
3141
+		 * This is used to add the content to the search page right sidebar (if active).
3142
+		 *
3143
+		 * @since 1.0.0
3144
+		 */
3145
+		do_action('geodir_search_sidebar_right_inside');
3146
+		/** This action is documented in geodirectory_template_actions.php */
3147
+		do_action('geodir_sidebar_right_close', 'search-page');
3148
+	}
3149 3149
 }
3150 3150
 
3151 3151
 
@@ -3160,11 +3160,11 @@  discard block
 block discarded – undo
3160 3160
  */
3161 3161
 function geodir_action_sidebar_search_bottom_section()
3162 3162
 {
3163
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3163
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3164 3164
         <div
3165 3165
             class="<?php
3166
-            /** This action is documented in geodirectory_template_actions.php */
3167
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3166
+			/** This action is documented in geodirectory_template_actions.php */
3167
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3168 3168
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3169 3169
         </div><!-- clearfix ends here-->
3170 3170
     <?php }
@@ -3179,14 +3179,14 @@  discard block
 block discarded – undo
3179 3179
  */
3180 3180
 function geodir_action_search_content_inside()
3181 3181
 {
3182
-    global $gridview_columns;
3183
-    $listing_view = get_option('geodir_search_view');
3184
-    if (strstr($listing_view, 'gridview')) {
3185
-        $gridview_columns = $listing_view;
3186
-        $listing_view_exp = explode('_', $listing_view);
3187
-        $listing_view = $listing_view_exp[0];
3188
-    }
3189
-    geodir_get_template_part('listing', 'listview');
3182
+	global $gridview_columns;
3183
+	$listing_view = get_option('geodir_search_view');
3184
+	if (strstr($listing_view, 'gridview')) {
3185
+		$gridview_columns = $listing_view;
3186
+		$listing_view_exp = explode('_', $listing_view);
3187
+		$listing_view = $listing_view_exp[0];
3188
+	}
3189
+	geodir_get_template_part('listing', 'listview');
3190 3190
 }
3191 3191
 
3192 3192
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3202,22 +3202,22 @@  discard block
 block discarded – undo
3202 3202
  */
3203 3203
 function geodir_action_search_content()
3204 3204
 {
3205
-    /** This action is documented in geodirectory_template_actions.php */
3206
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3207
-    echo '<div class="clearfix">';
3208
-    /** This action is documented in geodirectory_template_actions.php */
3209
-    do_action('geodir_before_listing');
3210
-    echo '</div>';
3211
-    /**
3212
-     * This is used to add the content to the search page main content.
3213
-     *
3214
-     * @since 1.0.0
3215
-     */
3216
-    do_action('geodir_search_content_inside');
3217
-    /** This action is documented in geodirectory_template_actions.php */
3218
-    do_action('geodir_after_listing');
3219
-    /** This action is documented in geodirectory_template_actions.php */
3220
-    do_action('geodir_main_content_close', 'search-page');
3205
+	/** This action is documented in geodirectory_template_actions.php */
3206
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3207
+	echo '<div class="clearfix">';
3208
+	/** This action is documented in geodirectory_template_actions.php */
3209
+	do_action('geodir_before_listing');
3210
+	echo '</div>';
3211
+	/**
3212
+	 * This is used to add the content to the search page main content.
3213
+	 *
3214
+	 * @since 1.0.0
3215
+	 */
3216
+	do_action('geodir_search_content_inside');
3217
+	/** This action is documented in geodirectory_template_actions.php */
3218
+	do_action('geodir_after_listing');
3219
+	/** This action is documented in geodirectory_template_actions.php */
3220
+	do_action('geodir_main_content_close', 'search-page');
3221 3221
 }
3222 3222
 
3223 3223
 ###############################################
@@ -3240,11 +3240,11 @@  discard block
 block discarded – undo
3240 3240
  */
3241 3241
 function geodir_action_geodir_sidebar_home_top()
3242 3242
 {
3243
-    if (get_option('geodir_show_home_top_section')) { ?>
3243
+	if (get_option('geodir_show_home_top_section')) { ?>
3244 3244
         <div
3245 3245
             class="<?php
3246
-            /** This action is documented in geodirectory_template_actions.php */
3247
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3246
+			/** This action is documented in geodirectory_template_actions.php */
3247
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3248 3248
             <?php dynamic_sidebar('geodir_home_top'); ?>
3249 3249
         </div><!-- clearfix ends here-->
3250 3250
     <?php }
@@ -3260,7 +3260,7 @@  discard block
 block discarded – undo
3260 3260
  */
3261 3261
 function geodir_home_left_section()
3262 3262
 {
3263
-    if (get_option('geodir_show_home_left_section')) { ?>
3263
+	if (get_option('geodir_show_home_left_section')) { ?>
3264 3264
         <div class="geodir-content-left geodir-sidebar-wrap">
3265 3265
             <?php dynamic_sidebar('geodir_home_left'); ?>
3266 3266
         </div><!-- end geodir-content-left -->
@@ -3282,19 +3282,19 @@  discard block
 block discarded – undo
3282 3282
  */
3283 3283
 function geodir_action_home_sidebar_left()
3284 3284
 {
3285
-    if (get_option('geodir_show_home_left_section')) {
3285
+	if (get_option('geodir_show_home_left_section')) {
3286 3286
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3287
-        /** This action is documented in geodirectory_template_actions.php */
3288
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3289
-        /**
3290
-         * This is used to add the content to the home page left sidebar (if active).
3291
-         *
3292
-         * @since 1.0.0
3293
-         */
3294
-        do_action('geodir_home_sidebar_left_inside');
3295
-        /** This action is documented in geodirectory_template_actions.php */
3296
-        do_action('geodir_sidebar_left_close', 'home-page');
3297
-    }
3287
+		/** This action is documented in geodirectory_template_actions.php */
3288
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3289
+		/**
3290
+		 * This is used to add the content to the home page left sidebar (if active).
3291
+		 *
3292
+		 * @since 1.0.0
3293
+		 */
3294
+		do_action('geodir_home_sidebar_left_inside');
3295
+		/** This action is documented in geodirectory_template_actions.php */
3296
+		do_action('geodir_sidebar_left_close', 'home-page');
3297
+	}
3298 3298
 }
3299 3299
 
3300 3300
 /**
@@ -3307,7 +3307,7 @@  discard block
 block discarded – undo
3307 3307
  */
3308 3308
 function geodir_home_right_section()
3309 3309
 {
3310
-    if (get_option('geodir_show_home_right_section')) { ?>
3310
+	if (get_option('geodir_show_home_right_section')) { ?>
3311 3311
         <div class="geodir-content-right geodir-sidebar-wrap">
3312 3312
             <?php dynamic_sidebar('geodir_home_right'); ?>
3313 3313
         </div><!-- end geodir-content-right -->
@@ -3328,18 +3328,18 @@  discard block
 block discarded – undo
3328 3328
  */
3329 3329
 function geodir_action_home_sidebar_right()
3330 3330
 {
3331
-    if (get_option('geodir_show_home_right_section')) {
3332
-        /** This action is documented in geodirectory_template_actions.php */
3333
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3334
-        /**
3335
-         * This is used to add the content to the home page right sidebar (if active).
3336
-         *
3337
-         * @since 1.0.0
3338
-         */
3339
-        do_action('geodir_home_sidebar_right_inside');
3340
-        /** This action is documented in geodirectory_template_actions.php */
3341
-        do_action('geodir_sidebar_right_close', 'home-page');
3342
-    }
3331
+	if (get_option('geodir_show_home_right_section')) {
3332
+		/** This action is documented in geodirectory_template_actions.php */
3333
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3334
+		/**
3335
+		 * This is used to add the content to the home page right sidebar (if active).
3336
+		 *
3337
+		 * @since 1.0.0
3338
+		 */
3339
+		do_action('geodir_home_sidebar_right_inside');
3340
+		/** This action is documented in geodirectory_template_actions.php */
3341
+		do_action('geodir_sidebar_right_close', 'home-page');
3342
+	}
3343 3343
 }
3344 3344
 
3345 3345
 /**
@@ -3350,7 +3350,7 @@  discard block
 block discarded – undo
3350 3350
  */
3351 3351
 function geodir_action_home_content_inside()
3352 3352
 {
3353
-    dynamic_sidebar('geodir_home_content');
3353
+	dynamic_sidebar('geodir_home_content');
3354 3354
 }
3355 3355
 
3356 3356
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3365,28 +3365,28 @@  discard block
 block discarded – undo
3365 3365
  */
3366 3366
 function geodir_action_home_content()
3367 3367
 {
3368
-    /** This action is documented in geodirectory_template_actions.php */
3369
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3370
-    /**
3371
-     * This called before the home page main content.
3372
-     *
3373
-     * @since 1.0.0
3374
-     */
3375
-    do_action('geodir_before_home_content');
3376
-    /**
3377
-     * This is used to add the content to the home page main content.
3378
-     *
3379
-     * @since 1.0.0
3380
-     */
3381
-    do_action('geodir_home_content_inside');
3382
-    /**
3383
-     * This is called after the homepage main content.
3384
-     *
3385
-     * @since 1.0.0
3386
-     */
3387
-    do_action('geodir_after_home_content');
3388
-    /** This action is documented in geodirectory_template_actions.php */
3389
-    do_action('geodir_main_content_close', 'home-page');
3368
+	/** This action is documented in geodirectory_template_actions.php */
3369
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3370
+	/**
3371
+	 * This called before the home page main content.
3372
+	 *
3373
+	 * @since 1.0.0
3374
+	 */
3375
+	do_action('geodir_before_home_content');
3376
+	/**
3377
+	 * This is used to add the content to the home page main content.
3378
+	 *
3379
+	 * @since 1.0.0
3380
+	 */
3381
+	do_action('geodir_home_content_inside');
3382
+	/**
3383
+	 * This is called after the homepage main content.
3384
+	 *
3385
+	 * @since 1.0.0
3386
+	 */
3387
+	do_action('geodir_after_home_content');
3388
+	/** This action is documented in geodirectory_template_actions.php */
3389
+	do_action('geodir_main_content_close', 'home-page');
3390 3390
 }
3391 3391
 
3392 3392
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3401,11 +3401,11 @@  discard block
 block discarded – undo
3401 3401
  */
3402 3402
 function geodir_action_sidebar_home_bottom_section()
3403 3403
 {
3404
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3404
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3405 3405
         <div
3406 3406
             class="<?php
3407
-            /** This action is documented in geodirectory_template_actions.php */
3408
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3407
+			/** This action is documented in geodirectory_template_actions.php */
3408
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3409 3409
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3410 3410
         </div><!-- clearfix ends here-->
3411 3411
     <?php }
@@ -3433,13 +3433,13 @@  discard block
 block discarded – undo
3433 3433
  */
3434 3434
 function geodir_filter_listing_page_title($list_title)
3435 3435
 {
3436
-    if (is_search() && trim(get_search_query()) == '') {
3437
-        $gd_post_type = geodir_get_current_posttype();
3438
-        $post_type_info = get_post_type_object($gd_post_type);
3436
+	if (is_search() && trim(get_search_query()) == '') {
3437
+		$gd_post_type = geodir_get_current_posttype();
3438
+		$post_type_info = get_post_type_object($gd_post_type);
3439 3439
 
3440
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3441
-    }
3442
-    return $list_title;
3440
+		$list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3441
+	}
3442
+	return $list_title;
3443 3443
 }
3444 3444
 
3445 3445
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
@@ -3454,62 +3454,62 @@  discard block
 block discarded – undo
3454 3454
  * @param string $gd_page The geodirectory page type. Default null.
3455 3455
  */
3456 3456
 function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3457
-    global $post;
3458
-
3459
-    $gd_page_id = NULL;
3460
-    if ($gd_page == 'home-page' && geodir_is_page('home')) {
3461
-        $gd_page_id = geodir_home_page_id();
3462
-    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3463
-        $gd_page_id = geodir_preview_page_id();
3464
-    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3465
-        $gd_page_id = geodir_add_listing_page_id();
3466
-    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3467
-        $gd_page_id = geodir_success_page_id();
3468
-    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3469
-        $gd_page_id = geodir_location_page_id();
3470
-    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3471
-        $gd_page_id = geodir_info_page_id();
3472
-    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3473
-        $gd_page_id = geodir_login_page_id();
3474
-    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3475
-        $gd_page_id = geodir_payment_checkout_page_id();
3476
-    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3477
-        $gd_page_id = geodir_payment_invoices_page_id();
3478
-    }
3479
-
3480
-    if (!$gd_page_id > 0) {
3481
-        return;
3482
-    }
3457
+	global $post;
3458
+
3459
+	$gd_page_id = NULL;
3460
+	if ($gd_page == 'home-page' && geodir_is_page('home')) {
3461
+		$gd_page_id = geodir_home_page_id();
3462
+	} else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3463
+		$gd_page_id = geodir_preview_page_id();
3464
+	} else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3465
+		$gd_page_id = geodir_add_listing_page_id();
3466
+	} else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3467
+		$gd_page_id = geodir_success_page_id();
3468
+	} else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3469
+		$gd_page_id = geodir_location_page_id();
3470
+	} else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3471
+		$gd_page_id = geodir_info_page_id();
3472
+	} else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3473
+		$gd_page_id = geodir_login_page_id();
3474
+	} else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3475
+		$gd_page_id = geodir_payment_checkout_page_id();
3476
+	} else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3477
+		$gd_page_id = geodir_payment_invoices_page_id();
3478
+	}
3479
+
3480
+	if (!$gd_page_id > 0) {
3481
+		return;
3482
+	}
3483 3483
     
3484
-    $display = 'before';
3485
-    /**
3486
-     * Filter the position to display the page content.
3487
-     *
3488
-     * @since 1.6.3
3489
-     *
3490
-     * @param string $display Position to add the post content.
3491
-     * @param string $gd_page The geodirectory page type.
3492
-     */
3493
-    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3494
-
3495
-    if ($position !== $display) {
3496
-        return;
3497
-    }
3498
-
3499
-    $gd_post = $post;
3484
+	$display = 'before';
3485
+	/**
3486
+	 * Filter the position to display the page content.
3487
+	 *
3488
+	 * @since 1.6.3
3489
+	 *
3490
+	 * @param string $display Position to add the post content.
3491
+	 * @param string $gd_page The geodirectory page type.
3492
+	 */
3493
+	$display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3494
+
3495
+	if ($position !== $display) {
3496
+		return;
3497
+	}
3498
+
3499
+	$gd_post = $post;
3500 3500
     
3501
-    setup_postdata(get_post($gd_page_id));
3501
+	setup_postdata(get_post($gd_page_id));
3502 3502
 
3503
-    if (get_the_content()) {
3504
-        ?>
3503
+	if (get_the_content()) {
3504
+		?>
3505 3505
         <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section>
3506 3506
         <?php
3507
-    }
3507
+	}
3508 3508
 
3509
-    $post = $gd_post;
3510
-    if (!empty($gd_post) && is_object($gd_post)) {
3511
-        setup_postdata($gd_post);
3512
-    }
3509
+	$post = $gd_post;
3510
+	if (!empty($gd_post) && is_object($gd_post)) {
3511
+		setup_postdata($gd_post);
3512
+	}
3513 3513
 
3514 3514
 }
3515 3515
 add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
@@ -3530,13 +3530,13 @@  discard block
 block discarded – undo
3530 3530
  * @return string Filtered SQL JOIN clause.
3531 3531
  */
3532 3532
 function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3533
-    global $plugin_prefix;
3533
+	global $plugin_prefix;
3534 3534
 
3535
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3536
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3537
-    }
3535
+	if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3536
+		$join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3537
+	}
3538 3538
     
3539
-    return $join;
3539
+	return $join;
3540 3540
 }
3541 3541
 add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3542 3542
 add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
@@ -3558,31 +3558,31 @@  discard block
 block discarded – undo
3558 3558
  * @return string Filtered SQL WHERE clause.
3559 3559
  */
3560 3560
 function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3561
-    global $wpdb, $plugin_prefix;
3561
+	global $wpdb, $plugin_prefix;
3562 3562
 
3563
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3564
-        $post_locations = '';
3565
-        $post_locations_var = array();
3563
+	if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3564
+		$post_locations = '';
3565
+		$post_locations_var = array();
3566 3566
         
3567
-        if ( !empty( $post->country_slug ) ) {
3568
-            $post_locations .= " AND post_locations LIKE %s";
3569
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3570
-        }
3571
-
3572
-        if ( !empty( $post->region_slug ) ) {
3573
-            $post_locations .= " AND post_locations LIKE %s";
3574
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3575
-        }
3576
-
3577
-        if ( !empty( $post->city_slug ) ) {
3578
-            $post_locations .= " AND post_locations LIKE %s";
3579
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3580
-        }
3567
+		if ( !empty( $post->country_slug ) ) {
3568
+			$post_locations .= " AND post_locations LIKE %s";
3569
+			$post_locations_var[] = "%,[" . $post->country_slug . "]";
3570
+		}
3571
+
3572
+		if ( !empty( $post->region_slug ) ) {
3573
+			$post_locations .= " AND post_locations LIKE %s";
3574
+			$post_locations_var[] = "%,[" . $post->region_slug . "],%";
3575
+		}
3576
+
3577
+		if ( !empty( $post->city_slug ) ) {
3578
+			$post_locations .= " AND post_locations LIKE %s";
3579
+			$post_locations_var[] = "[" . $post->city_slug . "],%";
3580
+		}
3581 3581
         
3582
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3583
-    }
3582
+		$where .= $wpdb->prepare( $post_locations, $post_locations_var );
3583
+	}
3584 3584
     
3585
-    return $where;
3585
+	return $where;
3586 3586
 }
3587 3587
 add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3588 3588
 add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3589 3589
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
     //php
285 285
     if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
+        include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
287 287
     }
288 288
 
289 289
     //geodir_full_page_class
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455 455
     if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
456
+        $width_css = 'style="width:'.$width.'%;"';
457 457
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
458
+        $width_css = 'style="width:'.$width.'%;"';
459 459
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
460
+        $width_css = 'style="width:'.$width.'%;"';
461 461
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
462
+        $width_css = 'style="width:'.$width.'%;"';
463 463
     } else {
464 464
         $width_css = '';
465 465
     }
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575 575
     if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
576
+        $width_css = 'style="width:'.$width.'%;"';
577 577
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
578
+        $width_css = 'style="width:'.$width.'%;"';
579 579
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
580
+        $width_css = 'style="width:'.$width.'%;"';
581 581
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
582
+        $width_css = 'style="width:'.$width.'%;"';
583 583
     } else {
584 584
         $width_css = '';
585 585
     }
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         }
678 678
     }
679 679
 
680
-    $post = (object)$_REQUEST;
680
+    $post = (object) $_REQUEST;
681 681
 
682 682
 
683 683
     if (isset($post->video)) {
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 
737 737
     $json = '{';
738 738
     $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
739
+    $json .= '"t": "'.$json_title.'",';
740
+    $json .= '"lt": "'.$post_latitude.'",';
741
+    $json .= '"ln": "'.$post_longitude.'",';
742
+    $json .= '"i":"'.$term_icon.'"';
743 743
     $json .= '}';
744 744
 
745 745
     $post->marker_json = $json;
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
      * @param string $class The class to use. Default is 'entry-header'.
967 967
      */
968 968
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
969
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
     $package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1005 1005
     $image_limit = '';
1006 1006
     if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1007
-        $image_limit = (int)$package_info->image_limit;
1007
+        $image_limit = (int) $package_info->image_limit;
1008 1008
     }
1009 1009
 
1010 1010
     if ($preview) {
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 
1021 1021
         if (!empty($post_images)) {
1022 1022
             foreach ($post_images as $image) {
1023
-                if ($image_limit !== '' && ($slides+1) > $image_limit) {
1023
+                if ($image_limit !== '' && ($slides + 1) > $image_limit) {
1024 1024
                      break;
1025 1025
                 }
1026 1026
                 if (!empty($image)) {
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1030 1030
 
1031 1031
                     if ($image && $width && $height) {
1032
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1032
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1033 1033
                     }
1034 1034
 
1035 1035
                     if (isset($image->src)) {
@@ -1041,9 +1041,9 @@  discard block
 block discarded – undo
1041 1041
 
1042 1042
                         $image_title = isset($image->title) ? $image->title : '';
1043 1043
 
1044
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1045
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1046
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1044
+                        $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1045
+                        $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>';
1046
+                        $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>';
1047 1047
                         $slides++;
1048 1048
                     }
1049 1049
                 }
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
         if (!empty($post_images)) {
1066 1066
             foreach ($post_images as $image) {
1067
-                if ($image_limit !== '' && ($slides+1) > $image_limit) {
1067
+                if ($image_limit !== '' && ($slides + 1) > $image_limit) {
1068 1068
                      break;
1069 1069
                 }
1070 1070
                 if ($image->height >= 400) {
@@ -1072,10 +1072,10 @@  discard block
 block discarded – undo
1072 1072
                 } else {
1073 1073
                     $spacer_height = ((400 - $image->height) / 2);
1074 1074
                 }
1075
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1076
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1077
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1078
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1075
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1076
+                $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1077
+                $main_slides .= '<img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1078
+                $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
1079 1079
                 $slides++;
1080 1080
             }
1081 1081
         }// endfore
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
  */
1111 1111
 function geodir_action_details_taxonomies()
1112 1112
 {
1113
-    global $preview, $post;?>
1113
+    global $preview, $post; ?>
1114 1114
     <p class="geodir_post_taxomomies clearfix">
1115 1115
     <?php
1116 1116
     $taxonomies = array();
@@ -1119,11 +1119,11 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
     if ($preview && !$is_backend_preview) {
1121 1121
         $post_type = $post->listing_type;
1122
-        $post_taxonomy = $post_type . 'category';
1122
+        $post_taxonomy = $post_type.'category';
1123 1123
         $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1124 1124
     } else {
1125 1125
         $post_type = $post->post_type;
1126
-        $post_taxonomy = $post_type . 'category';
1126
+        $post_taxonomy = $post_type.'category';
1127 1127
     }
1128 1128
 //{	
1129 1129
     $post_type_info = get_post_type_object($post_type);
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 
1132 1132
     if (!empty($post->post_tags)) {
1133 1133
 
1134
-        if (taxonomy_exists($post_type . '_tags')):
1134
+        if (taxonomy_exists($post_type.'_tags')):
1135 1135
             $links = array();
1136 1136
             $terms = array();
1137 1137
             // to limit post tags
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
                 $post_term = trim($post_term);
1159 1159
 
1160 1160
                 $priority_location = false;
1161
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1162
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1161
+                if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
1162
+                    $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
1163 1163
                 } else {
1164 1164
                     $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1165 1165
                     $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
@@ -1169,10 +1169,10 @@  discard block
 block discarded – undo
1169 1169
                     $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1170 1170
                     if ($match_country || $match_region || $match_city) {
1171 1171
                         $priority_location = true;
1172
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1172
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1173 1173
                     } else {
1174
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1175
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1174
+                        $insert_term = wp_insert_term($post_term, $post_type.'_tags');
1175
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1176 1176
                     }
1177 1177
                 }
1178 1178
 
@@ -1189,12 +1189,12 @@  discard block
 block discarded – undo
1189 1189
                          * @param string $tag_link The tag link html.
1190 1190
                          * @param object $term The tag term object.
1191 1191
                          */
1192
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1192
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1193 1193
                         $links[] = $tag_link;
1194 1194
                     } else {
1195
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1195
+                        $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>";
1196 1196
                         /** This action is documented in geodirectory-template_actions.php */
1197
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1197
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1198 1198
                         $links[] = $tag_link;
1199 1199
                     }
1200 1200
                     $terms[] = $term;
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
             if (!isset($listing_label)) {
1205 1205
                 $listing_label = '';
1206 1206
             }
1207
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1207
+            $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1208 1208
         endif;
1209 1209
 
1210 1210
     }
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
                     $term = get_term_by('id', $post_term, $post_taxonomy);
1233 1233
 
1234 1234
                     if (is_object($term)) {
1235
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1235
+                        $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>";
1236 1236
                         /**
1237 1237
                          * Filter the category name on the details page.
1238 1238
                          *
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
                          * @param string $term_link The link html to the category.
1241 1241
                          * @param object $term The category term object.
1242 1242
                          */
1243
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1243
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1244 1244
                         $links[] = $term_link;
1245 1245
                         $terms[] = $term;
1246 1246
                     }
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
         if (!isset($listing_label)) {
1259 1259
             $listing_label = '';
1260 1260
         }
1261
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1261
+        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1262 1262
 
1263 1263
     }
1264 1264
 
@@ -1271,14 +1271,14 @@  discard block
 block discarded – undo
1271 1271
      * @param string $listing_label The post type label.
1272 1272
      * @param string $listing_label The post type label with ucwords function.
1273 1273
      */
1274
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1274
+    $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
1275 1275
 
1276 1276
     if (isset($taxonomies[$post_taxonomy])) {
1277
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1277
+        echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>';
1278 1278
     }
1279 1279
 
1280
-    if (isset($taxonomies[$post_type . '_tags']))
1281
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1280
+    if (isset($taxonomies[$post_type.'_tags']))
1281
+        echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>';
1282 1282
 
1283 1283
     ?>
1284 1284
     </p><?php
@@ -1299,11 +1299,11 @@  discard block
 block discarded – undo
1299 1299
  * @param object $post Optional. The post object or blank.
1300 1300
  * @package GeoDirectory
1301 1301
  */
1302
-function geodir_action_details_micordata($post='')
1302
+function geodir_action_details_micordata($post = '')
1303 1303
 {
1304 1304
 
1305 1305
     global $preview;
1306
-    if(empty($post)){global $post;}
1306
+    if (empty($post)) {global $post; }
1307 1307
     if ($preview || !geodir_is_page('detail')) {
1308 1308
         return;
1309 1309
     }
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
     } else {
1319 1319
         foreach ($post_reviews as $review) {
1320 1320
 
1321
-            if($rating_value = geodir_get_commentoverall($review->comment_ID)){
1321
+            if ($rating_value = geodir_get_commentoverall($review->comment_ID)) {
1322 1322
                 $reviews[] = array(
1323 1323
                     "@type" => "Review",
1324 1324
                     "author" => $review->comment_author,
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
                     "description" => $review->comment_content,
1327 1327
                     "reviewRating" => array(
1328 1328
                         "@type" => "Rating",
1329
-                        "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1329
+                        "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1330 1330
                         "ratingValue" => $rating_value,
1331 1331
                         "worstRating" => "1"
1332 1332
                     )
@@ -1356,13 +1356,13 @@  discard block
 block discarded – undo
1356 1356
     }
1357 1357
     //print_r($post);
1358 1358
     // external links
1359
-    $external_links =  array();
1359
+    $external_links = array();
1360 1360
     $external_links[] = $post->geodir_website;
1361 1361
     $external_links[] = $post->geodir_twitter;
1362 1362
     $external_links[] = $post->geodir_facebook;
1363 1363
     $external_links = array_filter($external_links);
1364 1364
 
1365
-    if(!empty($external_links)){
1365
+    if (!empty($external_links)) {
1366 1366
         $external_links = array_values($external_links);
1367 1367
     }
1368 1368
 
@@ -1372,17 +1372,17 @@  discard block
 block discarded – undo
1372 1372
 
1373 1373
     // schema type
1374 1374
     $schema_type = 'LocalBusiness';
1375
-    if(isset($post->default_category) && $post->default_category){
1375
+    if (isset($post->default_category) && $post->default_category) {
1376 1376
         $cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1377
-        if($cat_schema){$schema_type = $cat_schema;}
1378
-        if(!$cat_schema && $schema_type=='LocalBusiness' && $post->post_type=='gd_event'){$schema_type = 'Event';}
1377
+        if ($cat_schema) {$schema_type = $cat_schema; }
1378
+        if (!$cat_schema && $schema_type == 'LocalBusiness' && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1379 1379
     }
1380 1380
 
1381 1381
     $schema = array();
1382 1382
     $schema['@context'] = "https://schema.org";
1383 1383
     $schema['@type'] = $schema_type;
1384 1384
     $schema['name'] = $post->post_title;
1385
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1385
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1386 1386
     $schema['telephone'] = $post->geodir_contact;
1387 1387
     $schema['url'] = $c_url;
1388 1388
     $schema['sameAs'] = $external_links;
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
         "postalCode" => $post->post_zip
1397 1397
     );
1398 1398
 
1399
-    if($post->post_latitude && $post->post_longitude) {
1399
+    if ($post->post_latitude && $post->post_longitude) {
1400 1400
         $schema['geo'] = array(
1401 1401
             "@type" => "GeoCoordinates",
1402 1402
             "latitude" => $post->post_latitude,
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
         );
1405 1405
     }
1406 1406
 
1407
-    if($post_avgratings) {
1407
+    if ($post_avgratings) {
1408 1408
         $schema['aggregateRating'] = array(
1409 1409
             "@type" => "AggregateRating",
1410 1410
             "ratingValue" => $post_avgratings,
@@ -1423,10 +1423,10 @@  discard block
 block discarded – undo
1423 1423
      * @param array $schema The array of schema data to be filtered.
1424 1424
      * @param object $post The post object.
1425 1425
      */
1426
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1426
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1427 1427
 
1428 1428
 
1429
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1429
+    echo '<script type="application/ld+json">'.json_encode($schema).'</script>';
1430 1430
 
1431 1431
 
1432 1432
     $uploads = wp_upload_dir();
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
      * @param string $facebook_og The open graph html to be filtered.
1440 1440
      * @param object $post The post object.
1441 1441
      */
1442
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1442
+    echo apply_filters('geodir_details_facebook_og', $facebook_og, $post);
1443 1443
 
1444 1444
 
1445 1445
 
@@ -1462,9 +1462,9 @@  discard block
 block discarded – undo
1462 1462
     ?>
1463 1463
     <div class="geodir-pos_navigation clearfix">
1464 1464
     <div
1465
-        class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
1465
+        class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
1466 1466
     <div
1467
-        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
1467
+        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
1468 1468
     </div><?php
1469 1469
 }
1470 1470
 
@@ -1533,12 +1533,12 @@  discard block
 block discarded – undo
1533 1533
     $gd_post_type = geodir_get_current_posttype();
1534 1534
     $post_type_info = get_post_type_object($gd_post_type);
1535 1535
 
1536
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1536
+    $add_string_in_title = __('All', 'geodirectory').' ';
1537 1537
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1538
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1538
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
1539 1539
     }
1540 1540
 
1541
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1541
+    $list_title = $add_string_in_title.__($post_type_info->labels->name, 'geodirectory');
1542 1542
     $single_name = $post_type_info->labels->singular_name;
1543 1543
 
1544 1544
     $taxonomy = geodir_get_taxonomies($gd_post_type, true);
@@ -1566,12 +1566,12 @@  discard block
 block discarded – undo
1566 1566
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
1567 1567
         if (!empty($current_term)) {
1568 1568
             $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1569
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1569
+            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1570 1570
                 $location_last_char = substr($location_name, -1);
1571 1571
                 $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1572
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1572
+                $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1573 1573
             } else {
1574
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1574
+                $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1575 1575
             }
1576 1576
         } else {
1577 1577
             if (count($taxonomy) > 1) {
@@ -1579,12 +1579,12 @@  discard block
 block discarded – undo
1579 1579
 
1580 1580
                 if (!empty($current_term)) {
1581 1581
                     $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1582
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1582
+                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1583 1583
                         $location_last_char = substr($location_name, -1);
1584 1584
                         $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1585
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1585
+                        $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1586 1586
                     } else {
1587
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1587
+                        $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1588 1588
                     }
1589 1589
                 }
1590 1590
             }
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
                 $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1613 1613
             }
1614 1614
 
1615
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1615
+            $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
1616 1616
         } else if ($gd_region != '') {
1617 1617
             if ($gd_region_actual != '') {
1618 1618
                 $gd_region = $gd_region_actual;
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
                 $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1623 1623
             }
1624 1624
 
1625
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1625
+            $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
1626 1626
         } else if ($gd_country != '') {
1627 1627
             if ($gd_country_actual != '') {
1628 1628
                 $gd_country = $gd_country_actual;
@@ -1632,12 +1632,12 @@  discard block
 block discarded – undo
1632 1632
                 $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1633 1633
             }
1634 1634
 
1635
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1635
+            $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
1636 1636
         }
1637 1637
     }
1638 1638
 
1639 1639
     if (is_search()) {
1640
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1640
+        $list_title = __('Search', 'geodirectory').' '.__(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
1641 1641
     }
1642 1642
     /** This action is documented in geodirectory_template_actions.php */
1643 1643
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
@@ -1647,26 +1647,26 @@  discard block
 block discarded – undo
1647 1647
 
1648 1648
     $title = $list_title;
1649 1649
     $gd_page = '';
1650
-    if(geodir_is_page('pt')){
1650
+    if (geodir_is_page('pt')) {
1651 1651
         $gd_page = 'pt';
1652
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1652
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1653 1653
     }
1654
-    elseif(geodir_is_page('listing')){
1654
+    elseif (geodir_is_page('listing')) {
1655 1655
         $gd_page = 'listing';
1656 1656
         global $wp_query;
1657 1657
         $current_term = $wp_query->get_queried_object();
1658
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1658
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1659 1659
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1660
-        }else{
1660
+        } else {
1661 1661
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1662 1662
         }
1663 1663
 
1664 1664
     }
1665
-    elseif(geodir_is_page('author')){
1665
+    elseif (geodir_is_page('author')) {
1666 1666
         $gd_page = 'author';
1667
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1667
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1668 1668
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1669
-        }else{
1669
+        } else {
1670 1670
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1671 1671
         }
1672 1672
 
@@ -1680,16 +1680,16 @@  discard block
 block discarded – undo
1680 1680
      * @param string $title The page title including variables.
1681 1681
      * @param string $gd_page The GeoDirectory page type if any.
1682 1682
      */
1683
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1683
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1684 1684
 
1685
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1685
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
1686 1686
         /**
1687 1687
          * Filter the listing page title.
1688 1688
          *
1689 1689
          * @since 1.0.0
1690 1690
          * @param string $list_title The title for the category page.
1691 1691
          */
1692
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1692
+        apply_filters('geodir_listing_page_title', $title).'</h1></header>';
1693 1693
 }
1694 1694
 
1695 1695
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1708,16 +1708,16 @@  discard block
 block discarded – undo
1708 1708
     $gd_post_type = geodir_get_current_posttype();
1709 1709
     if (isset($current_term->term_id) && $current_term->term_id != '') {
1710 1710
 
1711
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1711
+        $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags');
1712 1712
         $saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1713 1713
         if ($term_desc && !$saved_data) {
1714 1714
             $saved_data = $term_desc;
1715 1715
         }
1716 1716
 
1717 1717
         // stop payment manager filtering content length
1718
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1719
-        if ( false !== $filter_priority ) {
1720
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1718
+        $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1719
+        if (false !== $filter_priority) {
1720
+            remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1721 1721
         }
1722 1722
 
1723 1723
         /**
@@ -1731,14 +1731,14 @@  discard block
 block discarded – undo
1731 1731
         $cat_description = apply_filters('the_content', $saved_data);
1732 1732
 
1733 1733
 
1734
-        if ( false !== $filter_priority ) {
1735
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1734
+        if (false !== $filter_priority) {
1735
+            add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1736 1736
         }
1737 1737
 
1738 1738
         if ($cat_description) {
1739 1739
             ?>
1740 1740
 
1741
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1741
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1742 1742
         }
1743 1743
 
1744 1744
     }
@@ -1788,13 +1788,13 @@  discard block
 block discarded – undo
1788 1788
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1789 1789
 {
1790 1790
     if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1791
-        $width_css = 'style="width:' . $width . '%;"';
1791
+        $width_css = 'style="width:'.$width.'%;"';
1792 1792
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1793
-        $width_css = 'style="width:' . $width . '%;"';
1793
+        $width_css = 'style="width:'.$width.'%;"';
1794 1794
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1795
-        $width_css = 'style="width:' . $width . '%;"';
1795
+        $width_css = 'style="width:'.$width.'%;"';
1796 1796
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1797
-        $width_css = 'style="width:' . $width . '%;"';
1797
+        $width_css = 'style="width:'.$width.'%;"';
1798 1798
     } else {
1799 1799
         $width_css = '';
1800 1800
     }
@@ -2099,11 +2099,11 @@  discard block
 block discarded – undo
2099 2099
 
2100 2100
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2101 2101
 
2102
-    if(geodir_is_page('add-listing')){
2102
+    if (geodir_is_page('add-listing')) {
2103 2103
         $gd_page = 'add-listing';
2104
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2104
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2105 2105
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2106
-        }elseif(isset($listing_type)){
2106
+        }elseif (isset($listing_type)) {
2107 2107
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2108 2108
         }
2109 2109
 
@@ -2117,9 +2117,9 @@  discard block
 block discarded – undo
2117 2117
      * @param string $title The page title including variables.
2118 2118
      * @param string $gd_page The GeoDirectory page type if any.
2119 2119
      */
2120
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2120
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2121 2121
 
2122
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2122
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">';
2123 2123
     echo $title;
2124 2124
     echo '</h1></header>';
2125 2125
 }
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
  */
2134 2134
 function geodir_action_add_listing_page_mandatory()
2135 2135
 {?>
2136
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2136
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2137 2137
 <?php
2138 2138
 }
2139 2139
 
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
 
2169 2169
     if (isset($_REQUEST['backandedit'])) {
2170 2170
         global $post;
2171
-        $post = (object)$gd_session->get('listing');
2171
+        $post = (object) $gd_session->get('listing');
2172 2172
         $listing_type = $post->listing_type;
2173 2173
         $title = $post->post_title;
2174 2174
         $desc = $post->post_desc;
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
         $thumb_img_arr = geodir_get_images($post->ID);
2184 2184
         if ($thumb_img_arr) {
2185 2185
             foreach ($thumb_img_arr as $post_img) {
2186
-                $curImages .= $post_img->src . ',';
2186
+                $curImages .= $post_img->src.',';
2187 2187
             }
2188 2188
         }
2189 2189
 
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
         $title = $post->post_title;
2192 2192
         $desc = $post->post_content;
2193 2193
         $kw_tags = $post->post_tags;
2194
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2194
+        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
2195 2195
     } else {
2196 2196
         $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2197 2197
     }
@@ -2202,20 +2202,20 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
     $post_type_info = geodir_get_posttype_info($listing_type);
2204 2204
 
2205
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2205
+    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing', 'geodirectory');
2206 2206
     
2207 2207
     $package_info = array();
2208 2208
     $package_info = geodir_post_package_info($package_info, $post);
2209 2209
     ?>
2210
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2211
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2212
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2210
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2211
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2212
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2213 2213
         <?php if ($page_id) { ?>
2214
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2214
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2215 2215
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2216
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2216
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2217 2217
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2218
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2218
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2219 2219
         <?php
2220 2220
         } 
2221 2221
         /**
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
          */
2228 2228
         do_action('geodir_before_detail_fields');
2229 2229
         ?>
2230
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2230
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2231 2231
         <?php
2232 2232
         /**
2233 2233
          * Called at the top of the add listing page form for frontend.
@@ -2248,10 +2248,10 @@  discard block
 block discarded – undo
2248 2248
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2249 2249
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2250 2250
                  */
2251
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2251
+                echo apply_filters('geodir_add_listing_title_label', sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span>*</span> </label>
2252 2252
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2253 2253
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2254
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2254
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2255 2255
         </div>
2256 2256
         <?php
2257 2257
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2298 2298
         
2299 2299
         $desc_class = '';
2300
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2300
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2301 2301
             /**
2302 2302
              * Called on the add listing page form for frontend just before the description field.
2303 2303
              *
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
             $desc_class = ' hidden';
2311 2311
         }
2312 2312
         ?>
2313
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2313
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2314 2314
             <label><?php
2315 2315
                 /**
2316 2316
                  * Filter the add listing page description input label.
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2321 2321
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2322 2322
                  */
2323
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2323
+                echo apply_filters('geodir_add_listing_description_label', sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2324 2324
             <?php
2325 2325
             if ($show_editor) {
2326 2326
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2329,16 +2329,16 @@  discard block
 block discarded – undo
2329 2329
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2330 2330
                 </div>
2331 2331
             <?php if ($desc_limit != '') { ?>
2332
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2332
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2333 2333
             <?php } } else { ?>
2334 2334
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2335 2335
             <?php } if ($desc_limit_msg != '') { ?>
2336 2336
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2337 2337
             <?php } ?>
2338
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2338
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2339 2339
         </div>
2340 2340
         <?php
2341
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2341
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2342 2342
             /**
2343 2343
              * Called on the add listing page form for frontend just after the description field.
2344 2344
              *
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2378 2378
         
2379 2379
         $tags_class = '';
2380
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2380
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2381 2381
             /**
2382 2382
              * Called on the add listing page form for frontend just before the tags field.
2383 2383
              *
@@ -2388,14 +2388,14 @@  discard block
 block discarded – undo
2388 2388
             $tags_class = ' hidden';
2389 2389
         }
2390 2390
         ?>
2391
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2391
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2392 2392
             <label><?php echo TAGKW_TEXT; ?></label>
2393 2393
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2394
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2395
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2394
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2395
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2396 2396
         </div>
2397 2397
         <?php
2398
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2398
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2399 2399
             /**
2400 2400
              * Called on the add listing page form for frontend just after the tags field.
2401 2401
              *
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
         $thumb_img_arr = array();
2422 2422
         $totImg = 0;
2423 2423
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2424
-            $post = (object)$gd_session->get('listing');
2424
+            $post = (object) $gd_session->get('listing');
2425 2425
             if (isset($post->post_images))
2426 2426
                 $curImages = trim($post->post_images, ",");
2427 2427
 
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
             $listing_type = $post->listing_type;
2435 2435
 
2436 2436
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2437
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2437
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2438 2438
             $listing_type = $post->post_type;
2439 2439
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2440 2440
 
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
                 //$curImages = $img->src.",";
2449 2449
             }
2450 2450
 
2451
-            $totImg = count((array)$thumb_img_arr);
2451
+            $totImg = count((array) $thumb_img_arr);
2452 2452
         }
2453 2453
 
2454 2454
         if ($curImages != '')
@@ -2469,15 +2469,15 @@  discard block
 block discarded – undo
2469 2469
         if ($show_image_input_box) {
2470 2470
             ?>
2471 2471
 
2472
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2472
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2473 2473
                 <?php if ($image_limit == 1) {
2474
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2474
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2475 2475
                 } ?>
2476 2476
                 <?php if ($image_limit > 1) {
2477
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2477
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2478 2478
                 } ?>
2479 2479
                 <?php if ($image_limit == '') {
2480
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2480
+                    echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2481 2481
                 } ?>
2482 2482
             </h5>
2483 2483
 
@@ -2492,11 +2492,11 @@  discard block
 block discarded – undo
2492 2492
                 <div
2493 2493
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2494 2494
                     id="<?php echo $id; ?>plupload-upload-ui">
2495
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2495
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2496 2496
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2497 2497
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2498 2498
                     <span class="ajaxnonceplu"
2499
-                          id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2499
+                          id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2500 2500
                     <?php if ($width && $height): ?>
2501 2501
                         <span class="plupload-resize"></span>
2502 2502
                         <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2509,7 +2509,7 @@  discard block
 block discarded – undo
2509 2509
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2510 2510
                 </div>
2511 2511
                 <span
2512
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2512
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2513 2513
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2514 2514
             </div>
2515 2515
 
@@ -2521,7 +2521,7 @@  discard block
 block discarded – undo
2521 2521
          *
2522 2522
          * @since 1.0.0
2523 2523
          */
2524
-        do_action('geodir_after_main_form_fields');?>
2524
+        do_action('geodir_after_main_form_fields'); ?>
2525 2525
 
2526 2526
 
2527 2527
         <!-- add captcha code -->
@@ -2532,7 +2532,7 @@  discard block
 block discarded – undo
2532 2532
         </script>
2533 2533
         <noscript>
2534 2534
             <div>
2535
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2535
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2536 2536
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2537 2537
             </div>
2538 2538
         </noscript>
@@ -2542,10 +2542,10 @@  discard block
 block discarded – undo
2542 2542
         <!-- end captcha code -->
2543 2543
 
2544 2544
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2545
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2546
-                   class="geodir_button" <?php echo $submit_button;?>/>
2545
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2546
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2547 2547
             <span class="geodir_message_note"
2548
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2548
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2549 2549
         </div>
2550 2550
 
2551 2551
     </form>
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
         class="<?php
2608 2608
         /** This action is documented in geodirectory_template_actions.php */
2609 2609
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2610
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2610
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2611 2611
     </div><!-- clearfix ends here-->
2612 2612
 <?php
2613 2613
 }
@@ -2627,11 +2627,11 @@  discard block
 block discarded – undo
2627 2627
 
2628 2628
     global $user_login;
2629 2629
     
2630
-    $is_enable_signup = get_option( 'users_can_register' );
2630
+    $is_enable_signup = get_option('users_can_register');
2631 2631
     
2632 2632
     ?>
2633 2633
     <script type="text/javascript">
2634
-        <?php if ( $user_login ) { ?>
2634
+        <?php if ($user_login) { ?>
2635 2635
         setTimeout(function () {
2636 2636
             try {
2637 2637
                 d = document.getElementById('user_pass');
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
         <?php } ?>
2649 2649
     </script>
2650 2650
     <script type="text/javascript">
2651
-        <?php if ( $user_login ) { ?>
2651
+        <?php if ($user_login) { ?>
2652 2652
         setTimeout(function () {
2653 2653
             try {
2654 2654
                 d = document.getElementById('user_pass');
@@ -2673,7 +2673,7 @@  discard block
 block discarded – undo
2673 2673
         foreach ($errors as $errorsObj) {
2674 2674
             foreach ($errorsObj as $key => $val) {
2675 2675
                 for ($i = 0; $i < count($val); $i++) {
2676
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2676
+                    echo "<div class=error_msg_fix>".$val[$i].'</div>';
2677 2677
                     $registration_error_msg = 1;
2678 2678
                 }
2679 2679
             }
@@ -2690,10 +2690,10 @@  discard block
 block discarded – undo
2690 2690
              *
2691 2691
              * @since 1.0.0
2692 2692
              */
2693
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2693
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2694 2694
         </div>
2695 2695
 
2696
-    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2696
+    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup) { ?>
2697 2697
 
2698 2698
         <div class="registration_form">
2699 2699
             <?php
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
              *
2703 2703
              * @since 1.0.0
2704 2704
              */
2705
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2705
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2706 2706
         </div>
2707 2707
 
2708 2708
     <?php } else { ?>
@@ -2714,10 +2714,10 @@  discard block
 block discarded – undo
2714 2714
              *
2715 2715
              * @since 1.0.0
2716 2716
              */
2717
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2717
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2718 2718
         </div>
2719 2719
         
2720
-        <?php if ( $is_enable_signup ) { ?>
2720
+        <?php if ($is_enable_signup) { ?>
2721 2721
             <div class="registration_form_r">
2722 2722
                 <?php
2723 2723
                 /**
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
                  *
2726 2726
                  * @since 1.0.0
2727 2727
                  */
2728
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2728
+                include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2729 2729
             </div>
2730 2730
         <?php } ?>
2731 2731
 
@@ -2762,12 +2762,12 @@  discard block
 block discarded – undo
2762 2762
     $gd_post_type = geodir_get_current_posttype();
2763 2763
     $post_type_info = get_post_type_object($gd_post_type);
2764 2764
 
2765
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2765
+    $add_string_in_title = __('All', 'geodirectory').' ';
2766 2766
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2767
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2767
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
2768 2768
     }
2769 2769
 
2770
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2770
+    $list_title = $add_string_in_title.$post_type_info->labels->name;
2771 2771
     $single_name = $post_type_info->labels->singular_name;
2772 2772
 
2773 2773
     $taxonomy = geodir_get_taxonomies($gd_post_type);
@@ -2775,12 +2775,12 @@  discard block
 block discarded – undo
2775 2775
     if (!empty($term)) {
2776 2776
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2777 2777
         if (!empty($current_term))
2778
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2778
+            $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
2779 2779
     }
2780 2780
 
2781 2781
 
2782 2782
     if (is_search()) {
2783
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2783
+        $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2784 2784
 
2785 2785
     }
2786 2786
     /** This action is documented in geodirectory_template_actions.php */
@@ -2789,11 +2789,11 @@  discard block
 block discarded – undo
2789 2789
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2790 2790
 
2791 2791
     $title = $list_title;
2792
-    if(geodir_is_page('author')){
2792
+    if (geodir_is_page('author')) {
2793 2793
         $gd_page = 'author';
2794
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2794
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2795 2795
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2796
-        }else{
2796
+        } else {
2797 2797
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2798 2798
         }
2799 2799
 
@@ -2807,16 +2807,16 @@  discard block
 block discarded – undo
2807 2807
      * @param string $title The page title including variables.
2808 2808
      * @param string $gd_page The GeoDirectory page type if any.
2809 2809
      */
2810
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2810
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2811 2811
 
2812
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2812
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2813 2813
         /**
2814 2814
          * Filter the author page title text.
2815 2815
          *
2816 2816
          * @since 1.0.0
2817 2817
          * @param string $list_title The title for the page.
2818 2818
          */
2819
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2819
+        apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
2820 2820
 }
2821 2821
 
2822 2822
 
@@ -3021,19 +3021,19 @@  discard block
 block discarded – undo
3021 3021
     $post_type_info = get_post_type_object($gd_post_type);
3022 3022
 
3023 3023
     $pt_name = '';
3024
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3024
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
3025 3025
 
3026 3026
     if (is_search()) {
3027
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3027
+        $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
3028 3028
 
3029 3029
     }
3030 3030
     /** This action is documented in geodirectory_template_actions.php */
3031 3031
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3032 3032
     /** This action is documented in geodirectory_template_actions.php */
3033 3033
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3034
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3034
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
3035 3035
         /** This action is documented in geodirectory_template_actions.php */
3036
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3036
+        apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
3037 3037
 }
3038 3038
 
3039 3039
 // action for adding the listings page top widget area
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
         $gd_post_type = geodir_get_current_posttype();
3438 3438
         $post_type_info = get_post_type_object($gd_post_type);
3439 3439
 
3440
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3440
+        $list_title = __('Search', 'geodirectory').' '.__(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
3441 3441
     }
3442 3442
     return $list_title;
3443 3443
 }
@@ -3453,7 +3453,7 @@  discard block
 block discarded – undo
3453 3453
  * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'.
3454 3454
  * @param string $gd_page The geodirectory page type. Default null.
3455 3455
  */
3456
-function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3456
+function geodir_add_page_content($position = 'before', $gd_page = '') {
3457 3457
     global $post;
3458 3458
 
3459 3459
     $gd_page_id = NULL;
@@ -3529,17 +3529,17 @@  discard block
 block discarded – undo
3529 3529
  * @param WP_Post $post           WP_Post object.
3530 3530
  * @return string Filtered SQL JOIN clause.
3531 3531
  */
3532
-function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3532
+function geodir_previous_next_post_join($join, $in_same_term, $excluded_terms, $taxonomy, $post) {
3533 3533
     global $plugin_prefix;
3534 3534
 
3535
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3536
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3535
+    if (!empty($post->post_type) && in_array($post->post_type, geodir_get_posttypes())) {
3536
+        $join .= " INNER JOIN ".$plugin_prefix.$post->post_type."_detail AS gd ON gd.post_id = p.ID";
3537 3537
     }
3538 3538
     
3539 3539
     return $join;
3540 3540
 }
3541
-add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3542
-add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
3541
+add_filter('get_previous_post_join', 'geodir_previous_next_post_join', 10, 5);
3542
+add_filter('get_next_post_join', 'geodir_previous_next_post_join', 10, 5);
3543 3543
 
3544 3544
 /**
3545 3545
  * Filters the WHERE clause in the SQL for an adjacent post query.
@@ -3557,32 +3557,32 @@  discard block
 block discarded – undo
3557 3557
  * @param WP_Post $post          WP_Post object.
3558 3558
  * @return string Filtered SQL WHERE clause.
3559 3559
  */
3560
-function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3560
+function geodir_previous_next_post_where($where, $in_same_term, $excluded_terms, $taxonomy, $post) {
3561 3561
     global $wpdb, $plugin_prefix;
3562 3562
 
3563
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3563
+    if (!empty($post->post_type) && (!empty($post->country_slug) || !empty($post->region_slug) || !empty($post->city_slug)) && in_array($post->post_type, geodir_get_posttypes())) {
3564 3564
         $post_locations = '';
3565 3565
         $post_locations_var = array();
3566 3566
         
3567
-        if ( !empty( $post->country_slug ) ) {
3567
+        if (!empty($post->country_slug)) {
3568 3568
             $post_locations .= " AND post_locations LIKE %s";
3569
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3569
+            $post_locations_var[] = "%,[".$post->country_slug."]";
3570 3570
         }
3571 3571
 
3572
-        if ( !empty( $post->region_slug ) ) {
3572
+        if (!empty($post->region_slug)) {
3573 3573
             $post_locations .= " AND post_locations LIKE %s";
3574
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3574
+            $post_locations_var[] = "%,[".$post->region_slug."],%";
3575 3575
         }
3576 3576
 
3577
-        if ( !empty( $post->city_slug ) ) {
3577
+        if (!empty($post->city_slug)) {
3578 3578
             $post_locations .= " AND post_locations LIKE %s";
3579
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3579
+            $post_locations_var[] = "[".$post->city_slug."],%";
3580 3580
         }
3581 3581
         
3582
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3582
+        $where .= $wpdb->prepare($post_locations, $post_locations_var);
3583 3583
     }
3584 3584
     
3585 3585
     return $where;
3586 3586
 }
3587
-add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3588
-add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3589 3587
\ No newline at end of file
3588
+add_filter('get_previous_post_where', 'geodir_previous_next_post_where', 10, 5);
3589
+add_filter('get_next_post_where', 'geodir_previous_next_post_where', 10, 5);
3590 3590
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/cat_meta.php 3 patches
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -203,8 +203,9 @@  discard block
 block discarded – undo
203 203
 #############################################################
204 204
 function manage_category_custom_fields($deprecated, $column_name, $term_id)
205 205
 {
206
-    if ($column_name == 'cat_ID_num')
207
-        echo $term_id;
206
+    if ($column_name == 'cat_ID_num') {
207
+            echo $term_id;
208
+    }
208 209
 
209 210
     if ($column_name == 'cat_icon') {
210 211
         $term_icon_url = geodir_get_tax_meta($term_id, 'ct_cat_icon');
@@ -240,8 +241,9 @@  discard block
 block discarded – undo
240 241
 
241 242
     if ($column_name == 'cat_default_img') {
242 243
         $cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
243
-        if ($cat_default_img != '')
244
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
244
+        if ($cat_default_img != '') {
245
+                    echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
246
+        }
245 247
 
246 248
     }
247 249
 }
@@ -249,11 +251,12 @@  discard block
 block discarded – undo
249 251
 function geodir_get_default_catimage($term_id, $post_type = 'gd_place')
250 252
 {
251 253
 
252
-    if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
253
-        return $cat_default_img;
254
-    else
255
-        return false;
256
-}
254
+    if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) {
255
+            return $cat_default_img;
256
+    } else {
257
+            return false;
258
+    }
259
+    }
257 260
 
258 261
 //Clear custom fields
259 262
 add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field');
Please login to merge, or discard this patch.
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -11,146 +11,146 @@  discard block
 block discarded – undo
11 11
 //include the main class file
12 12
 require_once("Tax-meta-class.php");
13 13
 function geodir_set_tax_meta_fields() {
14
-    /*
14
+	/*
15 15
      * prefix of meta keys, optional
16 16
      * use underscore (_) at the beginning to make keys hidden, for example $prefix = '_ba_';
17 17
      *  you also can make prefix empty to disable it
18 18
      *
19 19
      */
20 20
 
21
-    $prefix = 'ct_';
22
-    /*
21
+	$prefix = 'ct_';
22
+	/*
23 23
      * configure your meta box
24 24
      */
25 25
 
26
-    $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
-        'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
-    );
26
+	$config = array(
27
+		'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
+		'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
+		'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
+		'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
+		'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
+		'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
+		'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
+	);
35 35
 
36 36
 
37
-    /*
37
+	/*
38 38
      * Initiate your meta box
39 39
      */
40
-    $my_meta = new Geodir_Tax_Meta_Class($config);
41
-    $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
-    $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
-    $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
-    /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
40
+	$my_meta = new Geodir_Tax_Meta_Class($config);
41
+	$my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
+	$my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
+	$my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
+	/*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45 45
 
46
-    $my_meta->addSelect($prefix . 'cat_schema',
47
-    /*
46
+	$my_meta->addSelect($prefix . 'cat_schema',
47
+	/*
48 48
      * Allows you to add/filter the cat schema types.
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-    apply_filters('geodir_cat_schemas',array(
53
-        '' => __('Default (LocalBusiness)', 'geodirectory'),
54
-        'AccountingService' => 'AccountingService',
55
-        'Attorney' => 'Attorney',
56
-        'AutoBodyShop' => 'AutoBodyShop',
57
-        'AutoDealer' => 'AutoDealer',
58
-        'AutoPartsStore' => 'AutoPartsStore',
59
-        'AutoRental' => 'AutoRental',
60
-        'AutoRepair' => 'AutoRepair',
61
-        'AutoWash' => 'AutoWash',
62
-        'Bakery' => 'Bakery',
63
-        'BarOrPub' => 'BarOrPub',
64
-        'BeautySalon' => 'BeautySalon',
65
-        'BedAndBreakfast' => 'BedAndBreakfast',
66
-        'BikeStore' => 'BikeStore',
67
-        'BookStore' => 'BookStore',
68
-        'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
-        'Campground' => 'Campground',
70
-        'ChildCare' => 'ChildCare',
71
-        'ClothingStore' => 'ClothingStore',
72
-        'ComputerStore' => 'ComputerStore',
73
-        'DaySpa' => 'DaySpa',
74
-        'Dentist' => 'Dentist',
75
-        'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
76
-        'Electrician' => 'Electrician',
77
-        'ElectronicsStore' => 'ElectronicsStore',
78
-        'EmergencyService' => 'EmergencyService',
79
-        'EntertainmentBusiness' => 'EntertainmentBusiness',
80
-        'Event' => 'Event',
81
-        'EventVenue' => 'EventVenue',
82
-        'ExerciseGym' => 'ExerciseGym',
83
-        'FinancialService' => 'FinancialService',
84
-        'Florist' => 'Florist',
85
-        'FoodEstablishment' => 'FoodEstablishment',
86
-        'FurnitureStore' => 'FurnitureStore',
87
-        'GardenStore' => 'GardenStore',
88
-        'GeneralContractor' => 'GeneralContractor',
89
-        'GolfCourse' => 'GolfCourse',
90
-        'HairSalon' => 'HairSalon',
91
-        'HardwareStore' => 'HardwareStore',
92
-        'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
93
-        'HobbyShop' => 'HobbyShop',
94
-        'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
95
-        'HomeGoodsStore' => 'HomeGoodsStore',
96
-        'Hospital' => 'Hospital',
97
-        'Hostel' => 'Hostel',
98
-        'Hotel' => 'Hotel',
99
-        'HousePainter' => 'HousePainter',
100
-        'HVACBusiness' => 'HVACBusiness',
101
-        'InsuranceAgency' => 'InsuranceAgency',
102
-        'JewelryStore' => 'JewelryStore',
103
-        'LiquorStore' => 'LiquorStore',
104
-        'Locksmith' => 'Locksmith',
105
-        'LodgingBusiness' => 'LodgingBusiness',
106
-        'MedicalClinic' => 'MedicalClinic',
107
-        'MensClothingStore' => 'MensClothingStore',
108
-        'MobilePhoneStore' => 'MobilePhoneStore',
109
-        'Motel' => 'Motel',
110
-        'MotorcycleDealer' => 'MotorcycleDealer',
111
-        'MotorcycleRepair' => 'MotorcycleRepair',
112
-        'MovingCompany' => 'MovingCompany',
113
-        'MusicStore' => 'MusicStore',
114
-        'NailSalon' => 'NailSalon',
115
-        'NightClub' => 'NightClub',
116
-        'Notary' => 'Notary',
117
-        'OfficeEquipmentStore' => 'OfficeEquipmentStore',
118
-        'Optician' => 'Optician',
119
-        'PetStore' => 'PetStore',
120
-        'Physician' => 'Physician',
121
-        'Plumber' => 'Plumber',
122
-        'ProfessionalService' => 'ProfessionalService',
123
-        'RealEstateAgent' => 'RealEstateAgent',
124
-        'Residence' => 'Residence',
125
-        'Restaurant' => 'Restaurant',
126
-        'RoofingContractor' => 'RoofingContractor',
127
-        'RVPark' => 'RVPark',
128
-        'School' => 'School',
129
-        'SelfStorage' => 'SelfStorage',
130
-        'ShoeStore' => 'ShoeStore',
131
-        'SkiResort' => 'SkiResort',
132
-        'SportingGoodsStore' => 'SportingGoodsStore',
133
-        'SportsClub' => 'SportsClub',
134
-        'Store' => 'Store',
135
-        'TattooParlor' => 'TattooParlor',
136
-        'Taxi' => 'Taxi',
137
-        'TennisComplex' => 'TennisComplex',
138
-        'TireShop' => 'TireShop',
139
-        'TouristAttraction' => 'TouristAttraction',
140
-        'ToyStore' => 'ToyStore',
141
-        'TravelAgency' => 'TravelAgency',
142
-        //'VacationRentals' => 'VacationRentals', // Not recognised by google yet
143
-        'VeterinaryCare' => 'VeterinaryCare',
144
-        'WholesaleStore' => 'WholesaleStore',
145
-        'Winery' => 'Winery'
146
-    )),
147
-    array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
52
+	apply_filters('geodir_cat_schemas',array(
53
+		'' => __('Default (LocalBusiness)', 'geodirectory'),
54
+		'AccountingService' => 'AccountingService',
55
+		'Attorney' => 'Attorney',
56
+		'AutoBodyShop' => 'AutoBodyShop',
57
+		'AutoDealer' => 'AutoDealer',
58
+		'AutoPartsStore' => 'AutoPartsStore',
59
+		'AutoRental' => 'AutoRental',
60
+		'AutoRepair' => 'AutoRepair',
61
+		'AutoWash' => 'AutoWash',
62
+		'Bakery' => 'Bakery',
63
+		'BarOrPub' => 'BarOrPub',
64
+		'BeautySalon' => 'BeautySalon',
65
+		'BedAndBreakfast' => 'BedAndBreakfast',
66
+		'BikeStore' => 'BikeStore',
67
+		'BookStore' => 'BookStore',
68
+		'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
+		'Campground' => 'Campground',
70
+		'ChildCare' => 'ChildCare',
71
+		'ClothingStore' => 'ClothingStore',
72
+		'ComputerStore' => 'ComputerStore',
73
+		'DaySpa' => 'DaySpa',
74
+		'Dentist' => 'Dentist',
75
+		'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
76
+		'Electrician' => 'Electrician',
77
+		'ElectronicsStore' => 'ElectronicsStore',
78
+		'EmergencyService' => 'EmergencyService',
79
+		'EntertainmentBusiness' => 'EntertainmentBusiness',
80
+		'Event' => 'Event',
81
+		'EventVenue' => 'EventVenue',
82
+		'ExerciseGym' => 'ExerciseGym',
83
+		'FinancialService' => 'FinancialService',
84
+		'Florist' => 'Florist',
85
+		'FoodEstablishment' => 'FoodEstablishment',
86
+		'FurnitureStore' => 'FurnitureStore',
87
+		'GardenStore' => 'GardenStore',
88
+		'GeneralContractor' => 'GeneralContractor',
89
+		'GolfCourse' => 'GolfCourse',
90
+		'HairSalon' => 'HairSalon',
91
+		'HardwareStore' => 'HardwareStore',
92
+		'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
93
+		'HobbyShop' => 'HobbyShop',
94
+		'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
95
+		'HomeGoodsStore' => 'HomeGoodsStore',
96
+		'Hospital' => 'Hospital',
97
+		'Hostel' => 'Hostel',
98
+		'Hotel' => 'Hotel',
99
+		'HousePainter' => 'HousePainter',
100
+		'HVACBusiness' => 'HVACBusiness',
101
+		'InsuranceAgency' => 'InsuranceAgency',
102
+		'JewelryStore' => 'JewelryStore',
103
+		'LiquorStore' => 'LiquorStore',
104
+		'Locksmith' => 'Locksmith',
105
+		'LodgingBusiness' => 'LodgingBusiness',
106
+		'MedicalClinic' => 'MedicalClinic',
107
+		'MensClothingStore' => 'MensClothingStore',
108
+		'MobilePhoneStore' => 'MobilePhoneStore',
109
+		'Motel' => 'Motel',
110
+		'MotorcycleDealer' => 'MotorcycleDealer',
111
+		'MotorcycleRepair' => 'MotorcycleRepair',
112
+		'MovingCompany' => 'MovingCompany',
113
+		'MusicStore' => 'MusicStore',
114
+		'NailSalon' => 'NailSalon',
115
+		'NightClub' => 'NightClub',
116
+		'Notary' => 'Notary',
117
+		'OfficeEquipmentStore' => 'OfficeEquipmentStore',
118
+		'Optician' => 'Optician',
119
+		'PetStore' => 'PetStore',
120
+		'Physician' => 'Physician',
121
+		'Plumber' => 'Plumber',
122
+		'ProfessionalService' => 'ProfessionalService',
123
+		'RealEstateAgent' => 'RealEstateAgent',
124
+		'Residence' => 'Residence',
125
+		'Restaurant' => 'Restaurant',
126
+		'RoofingContractor' => 'RoofingContractor',
127
+		'RVPark' => 'RVPark',
128
+		'School' => 'School',
129
+		'SelfStorage' => 'SelfStorage',
130
+		'ShoeStore' => 'ShoeStore',
131
+		'SkiResort' => 'SkiResort',
132
+		'SportingGoodsStore' => 'SportingGoodsStore',
133
+		'SportsClub' => 'SportsClub',
134
+		'Store' => 'Store',
135
+		'TattooParlor' => 'TattooParlor',
136
+		'Taxi' => 'Taxi',
137
+		'TennisComplex' => 'TennisComplex',
138
+		'TireShop' => 'TireShop',
139
+		'TouristAttraction' => 'TouristAttraction',
140
+		'ToyStore' => 'ToyStore',
141
+		'TravelAgency' => 'TravelAgency',
142
+		//'VacationRentals' => 'VacationRentals', // Not recognised by google yet
143
+		'VeterinaryCare' => 'VeterinaryCare',
144
+		'WholesaleStore' => 'WholesaleStore',
145
+		'Winery' => 'Winery'
146
+	)),
147
+	array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
148 148
 
149
-    // Finish Meta Box Declaration
150
-    $my_meta->Finish();
149
+	// Finish Meta Box Declaration
150
+	$my_meta->Finish();
151 151
 }
152 152
 if ( is_admin() ) {
153
-    add_action( 'init', 'geodir_set_tax_meta_fields', 10 );
153
+	add_action( 'init', 'geodir_set_tax_meta_fields', 10 );
154 154
 }
155 155
 
156 156
 
@@ -159,86 +159,86 @@  discard block
 block discarded – undo
159 159
 ##############################################################
160 160
 $gd_taxonomies = geodir_get_taxonomies();
161 161
 if (!empty($gd_taxonomies)) {
162
-    foreach ($gd_taxonomies as $gd_taxonomy) {
162
+	foreach ($gd_taxonomies as $gd_taxonomy) {
163 163
 
164
-        add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
165
-        add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
164
+		add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
165
+		add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
166 166
 
167
-    }
167
+	}
168 168
 }
169 169
 
170 170
 function addCat_column($columns)
171 171
 {
172
-    if (isset($columns['description']) && $posts = $columns['description']) {
173
-        unset($columns['description']);
174
-    }
172
+	if (isset($columns['description']) && $posts = $columns['description']) {
173
+		unset($columns['description']);
174
+	}
175 175
 
176
-    $columns['cat_icon'] = 'Icon';
177
-    $columns['cat_default_img'] = __('Default Image', 'geodirectory');
178
-    $columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
179
-    return $columns;
176
+	$columns['cat_icon'] = 'Icon';
177
+	$columns['cat_default_img'] = __('Default Image', 'geodirectory');
178
+	$columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
179
+	return $columns;
180 180
 }
181 181
 
182 182
 #############################################################
183 183
 function manage_category_custom_fields($deprecated, $column_name, $term_id)
184 184
 {
185
-    if ($column_name == 'cat_ID_num')
186
-        echo $term_id;
185
+	if ($column_name == 'cat_ID_num')
186
+		echo $term_id;
187 187
 
188
-    if ($column_name == 'cat_icon') {
189
-        $term_icon_url = geodir_get_tax_meta($term_id, 'ct_cat_icon');
188
+	if ($column_name == 'cat_icon') {
189
+		$term_icon_url = geodir_get_tax_meta($term_id, 'ct_cat_icon');
190 190
 
191
-        if ($term_icon_url != '') {
192
-            $file_info = pathinfo($term_icon_url['src']);
191
+		if ($term_icon_url != '') {
192
+			$file_info = pathinfo($term_icon_url['src']);
193 193
 
194
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
195
-                $sub_dir = $file_info['dirname'];
196
-            } else {
197
-                $sub_dir = '';
198
-            }
194
+			if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
195
+				$sub_dir = $file_info['dirname'];
196
+			} else {
197
+				$sub_dir = '';
198
+			}
199 199
 
200
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
201
-            $uploads_baseurl = $uploads['baseurl'];
202
-            $uploads_path = $uploads['path'];
200
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
201
+			$uploads_baseurl = $uploads['baseurl'];
202
+			$uploads_path = $uploads['path'];
203 203
 
204
-            $file_name = $file_info['basename'];
204
+			$file_name = $file_info['basename'];
205 205
 
206
-            if (strpos($sub_dir, 'https://') !== false) {
207
-                $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
208
-            } else {
209
-                $uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
210
-            }
211
-            $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
206
+			if (strpos($sub_dir, 'https://') !== false) {
207
+				$uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
208
+			} else {
209
+				$uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
210
+			}
211
+			$sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
212 212
 
213
-            $uploads_url = $uploads_baseurl . $sub_dir;
213
+			$uploads_url = $uploads_baseurl . $sub_dir;
214 214
 
215
-            $term_icon_url['src'] = $uploads_url . '/' . $file_name;
216
-            echo '<img src="' . $term_icon_url['src'] . '" />';
217
-        }
218
-    }
215
+			$term_icon_url['src'] = $uploads_url . '/' . $file_name;
216
+			echo '<img src="' . $term_icon_url['src'] . '" />';
217
+		}
218
+	}
219 219
 
220
-    if ($column_name == 'cat_default_img') {
221
-        $cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
222
-        if ($cat_default_img != '')
223
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
220
+	if ($column_name == 'cat_default_img') {
221
+		$cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
222
+		if ($cat_default_img != '')
223
+			echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
224 224
 
225
-    }
225
+	}
226 226
 }
227 227
 
228 228
 function geodir_get_default_catimage($term_id, $post_type = 'gd_place')
229 229
 {
230 230
 
231
-    if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
232
-        return $cat_default_img;
233
-    else
234
-        return false;
231
+	if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
232
+		return $cat_default_img;
233
+	else
234
+		return false;
235 235
 }
236 236
 
237 237
 //Clear custom fields
238 238
 add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field');
239 239
 function geodir_tax_meta_clear_custom_field() {
240
-    if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
241
-        ?>
240
+	if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
241
+		?>
242 242
         <script type="text/javascript">
243 243
             jQuery(document).ready(function () {
244 244
                 jQuery('#addtag #submit').click(function () {
@@ -267,5 +267,5 @@  discard block
 block discarded – undo
267 267
             });
268 268
         </script>
269 269
     <?php
270
-    endif;
270
+	endif;
271 271
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
      */
25 25
 
26 26
     $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
27
+        'id' => 'demo_meta_box', // meta box id, unique per meta box
28
+        'title' => __('Demo Meta Box', 'geodirectory'), // meta box title
29
+        'pages' => geodir_get_taxonomies(), // taxonomy name, accept categories, post_tag and custom taxonomies
30
+        'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
31
+        'fields' => array(), // list of meta fields (can be added by field arrays)
32
+        'local_images' => false, // Use local or hosted images (meta box images for add/remove)
33 33
         'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34 34
     );
35 35
 
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
      * Initiate your meta box
39 39
      */
40 40
     $my_meta = new Geodir_Tax_Meta_Class($config);
41
-    $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
-    $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
-    $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
41
+    $my_meta->addWysiwyg($prefix.'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
+    $my_meta->addImage($prefix.'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
+    $my_meta->addImage($prefix.'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44 44
     /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45 45
 
46
-    $my_meta->addSelect($prefix . 'cat_schema',
46
+    $my_meta->addSelect($prefix.'cat_schema',
47 47
     /*
48 48
      * Allows you to add/filter the cat schema types.
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-    apply_filters('geodir_cat_schemas',array(
52
+    apply_filters('geodir_cat_schemas', array(
53 53
         '' => __('Default (LocalBusiness)', 'geodirectory'),
54 54
         'AccountingService' => 'AccountingService',
55 55
         'Attorney' => 'Attorney',
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
         'WholesaleStore' => 'WholesaleStore',
145 145
         'Winery' => 'Winery'
146 146
     )),
147
-    array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
147
+    array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory')."", 'std' => array('selectkey2')));
148 148
 
149 149
     // Finish Meta Box Declaration
150 150
     $my_meta->Finish();
151 151
 }
152
-if ( is_admin() ) {
153
-    add_action( 'init', 'geodir_set_tax_meta_fields', 10 );
152
+if (is_admin()) {
153
+    add_action('init', 'geodir_set_tax_meta_fields', 10);
154 154
 }
155 155
 
156 156
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 if (!empty($gd_taxonomies)) {
162 162
     foreach ($gd_taxonomies as $gd_taxonomy) {
163 163
 
164
-        add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
165
-        add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
164
+        add_filter('manage_edit-'.$gd_taxonomy.'_columns', 'addCat_column', 10, 2);
165
+        add_action('manage_'.$gd_taxonomy.'_custom_column', 'manage_category_custom_fields', 10, 3);
166 166
 
167 167
     }
168 168
 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         if ($term_icon_url != '') {
192 192
             $file_info = pathinfo($term_icon_url['src']);
193 193
 
194
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
194
+            if (isset($file_info['dirname']) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
195 195
                 $sub_dir = $file_info['dirname'];
196 196
             } else {
197 197
                 $sub_dir = '';
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
             }
211 211
             $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
212 212
 
213
-            $uploads_url = $uploads_baseurl . $sub_dir;
213
+            $uploads_url = $uploads_baseurl.$sub_dir;
214 214
 
215
-            $term_icon_url['src'] = $uploads_url . '/' . $file_name;
216
-            echo '<img src="' . $term_icon_url['src'] . '" />';
215
+            $term_icon_url['src'] = $uploads_url.'/'.$file_name;
216
+            echo '<img src="'.$term_icon_url['src'].'" />';
217 217
         }
218 218
     }
219 219
 
220 220
     if ($column_name == 'cat_default_img') {
221 221
         $cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
222 222
         if ($cat_default_img != '')
223
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
223
+            echo '<img src="'.$cat_default_img['src'].'" style="max-height:60px;max-width:60px;"/>';
224 224
 
225 225
     }
226 226
 }
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
                             jQuery("#addtag iframe").contents().find("body").html('');
259 259
                             jQuery('#addtag [rel="ct_cat_default_img"]').removeClass('at-delete_image_button').addClass('at-upload_image_button');
260 260
                             jQuery('#addtag [rel="ct_cat_icon"]').removeClass('at-delete_image_button').addClass('at-upload_image_button');
261
-                            jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image','geodirectory');?>');
262
-                            jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image','geodirectory');?>');
261
+                            jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image', 'geodirectory'); ?>');
262
+                            jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image', 'geodirectory'); ?>');
263 263
                         }
264 264
                     }, 1000);
265 265
 
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Kleo.php 3 patches
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
 
11 11
 // Page titles translatable CPT names
12 12
 function geodir_kelo_title_translation( $args) {
13
-    if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
-        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
16
-        $args['title'] = __($args['title'],'geodirectory');
17
-    }
13
+	if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
+		$args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
+	}elseif(function_exists('geodir_is_geodir_page')){
16
+		$args['title'] = __($args['title'],'geodirectory');
17
+	}
18 18
 
19
-    return $args;
19
+	return $args;
20 20
 }
21 21
 add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 );
22 22
 
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
  * @return object Modified query object.
32 32
  */
33 33
 function geodir_kleo_search_filter( $query ) {
34
-    if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) {
35
-        $query->set( 'post_type', 'any' );
36
-    }
37
-    return $query;
34
+	if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) {
35
+		$query->set( 'post_type', 'any' );
36
+	}
37
+	return $query;
38 38
 }
39 39
 if ( !is_admin() ) {
40
-    add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 );
40
+	add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 );
41 41
 }
42 42
 
43 43
 if( ! function_exists( 'kleo_title' ) ){
44
-    function kleo_title(){ return geodir_kleo_custom_the_title();}
44
+	function kleo_title(){ return geodir_kleo_custom_the_title();}
45 45
 }
46 46
 
47 47
 /**
@@ -53,109 +53,109 @@  discard block
 block discarded – undo
53 53
 function geodir_kleo_custom_the_title()
54 54
 {
55 55
 
56
-    $output = '';
57
-    if (is_tag()) {
58
-        $output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false);
59
-    }
60
-    elseif(is_tax()) {
61
-        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
62
-        $output = $term->name;
63
-    }
64
-    elseif ( is_category() ) {
65
-        $output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false);
66
-    }
67
-    elseif (is_day())
68
-    {
69
-        $output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y');
70
-    }
71
-    elseif (is_month())
72
-    {
73
-        $output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y');
74
-    }
75
-    elseif (is_year())
76
-    {
77
-        $output = __('Archive for year:','kleo_framework')." ".get_the_time('Y');
78
-    }
79
-    elseif (is_author())  {
80
-        $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
81
-        $output = __('Author Archive','kleo_framework')." ";
82
-
83
-        if( isset( $curauth->nickname ) ) {
84
-            $output .= __('for:','kleo_framework')." ".$curauth->nickname;
85
-        }
86
-    }
87
-    elseif ( is_archive() )  {
88
-        $output = post_type_archive_title( '', false );
89
-    }
90
-    elseif (is_search())
91
-    {
92
-        global $wp_query;
93
-        if(!empty($wp_query->found_posts))
94
-        {
95
-            if($wp_query->found_posts > 1)
96
-            {
97
-                $output =  $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() );
98
-            }
99
-            else
100
-            {
101
-                $output =  $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() );
102
-            }
103
-        }
104
-        else
105
-        {
106
-            if(!empty($_GET['s']))
107
-            {
108
-                $output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() );
109
-            }
110
-            else
111
-            {
112
-                $output = __('To search the site please enter a valid term','kleo_framework');
113
-            }
114
-        }
115
-
116
-    }
117
-    elseif ( is_front_page() && !is_home() ) {
118
-        $output = get_the_title(get_option('page_on_front'));
119
-
120
-    } elseif ( is_home() ) {
121
-        if (get_option('page_for_posts')) {
122
-            $output = get_the_title(get_option('page_for_posts'));
123
-        } else {
124
-            $output = __( 'Blog', 'kleo_framework' );
125
-        }
126
-
127
-    } elseif ( is_404() ) {
128
-        $output = __('Error 404 - Page not found','kleo_framework');
129
-    }
130
-    else {
131
-        $output = get_the_title();
132
-    }
133
-
134
-    if (isset($_GET['paged']) && !empty($_GET['paged']))
135
-    {
136
-        $output .= " (".__('Page','kleo_framework')." ".$_GET['paged'].")";
137
-    }
138
-
139
-
140
-    $gd_page = '';
141
-    if(geodir_is_page('pt')){
142
-        $gd_page = 'pt';
143
-        $output = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : '';
144
-    }
145
-    elseif(geodir_is_page('listing')){
146
-        $gd_page = 'listing';
147
-        $output = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : '';
148
-    }
149
-
150
-
151
-
152
-    /**
153
-     * Filter page meta title to replace variables.
154
-     *
155
-     * @since 1.5.4
156
-     * @param string $title The page title including variables.
157
-     * @param string $gd_page The GeoDirectory page type if any.
158
-     */
159
-    return apply_filters('geodir_seo_meta_title', __($output, 'geodirectory'), $gd_page);
56
+	$output = '';
57
+	if (is_tag()) {
58
+		$output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false);
59
+	}
60
+	elseif(is_tax()) {
61
+		$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
62
+		$output = $term->name;
63
+	}
64
+	elseif ( is_category() ) {
65
+		$output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false);
66
+	}
67
+	elseif (is_day())
68
+	{
69
+		$output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y');
70
+	}
71
+	elseif (is_month())
72
+	{
73
+		$output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y');
74
+	}
75
+	elseif (is_year())
76
+	{
77
+		$output = __('Archive for year:','kleo_framework')." ".get_the_time('Y');
78
+	}
79
+	elseif (is_author())  {
80
+		$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
81
+		$output = __('Author Archive','kleo_framework')." ";
82
+
83
+		if( isset( $curauth->nickname ) ) {
84
+			$output .= __('for:','kleo_framework')." ".$curauth->nickname;
85
+		}
86
+	}
87
+	elseif ( is_archive() )  {
88
+		$output = post_type_archive_title( '', false );
89
+	}
90
+	elseif (is_search())
91
+	{
92
+		global $wp_query;
93
+		if(!empty($wp_query->found_posts))
94
+		{
95
+			if($wp_query->found_posts > 1)
96
+			{
97
+				$output =  $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() );
98
+			}
99
+			else
100
+			{
101
+				$output =  $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() );
102
+			}
103
+		}
104
+		else
105
+		{
106
+			if(!empty($_GET['s']))
107
+			{
108
+				$output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() );
109
+			}
110
+			else
111
+			{
112
+				$output = __('To search the site please enter a valid term','kleo_framework');
113
+			}
114
+		}
115
+
116
+	}
117
+	elseif ( is_front_page() && !is_home() ) {
118
+		$output = get_the_title(get_option('page_on_front'));
119
+
120
+	} elseif ( is_home() ) {
121
+		if (get_option('page_for_posts')) {
122
+			$output = get_the_title(get_option('page_for_posts'));
123
+		} else {
124
+			$output = __( 'Blog', 'kleo_framework' );
125
+		}
126
+
127
+	} elseif ( is_404() ) {
128
+		$output = __('Error 404 - Page not found','kleo_framework');
129
+	}
130
+	else {
131
+		$output = get_the_title();
132
+	}
133
+
134
+	if (isset($_GET['paged']) && !empty($_GET['paged']))
135
+	{
136
+		$output .= " (".__('Page','kleo_framework')." ".$_GET['paged'].")";
137
+	}
138
+
139
+
140
+	$gd_page = '';
141
+	if(geodir_is_page('pt')){
142
+		$gd_page = 'pt';
143
+		$output = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : '';
144
+	}
145
+	elseif(geodir_is_page('listing')){
146
+		$gd_page = 'listing';
147
+		$output = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : '';
148
+	}
149
+
150
+
151
+
152
+	/**
153
+	 * Filter page meta title to replace variables.
154
+	 *
155
+	 * @since 1.5.4
156
+	 * @param string $title The page title including variables.
157
+	 * @param string $gd_page The GeoDirectory page type if any.
158
+	 */
159
+	return apply_filters('geodir_seo_meta_title', __($output, 'geodirectory'), $gd_page);
160 160
 
161 161
 }
162 162
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Page titles translatable CPT names
12
-function geodir_kelo_title_translation( $args) {
13
-    if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
-        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
16
-        $args['title'] = __($args['title'],'geodirectory');
12
+function geodir_kelo_title_translation($args) {
13
+    if (function_exists('geodir_is_geodir_page') && geodir_is_page('preview')) {
14
+        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])), 'geodirectory');
15
+    }elseif (function_exists('geodir_is_geodir_page')) {
16
+        $args['title'] = __($args['title'], 'geodirectory');
17 17
     }
18 18
 
19 19
     return $args;
20 20
 }
21
-add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 );
21
+add_filter('kleo_title_args', 'geodir_kelo_title_translation', 10, 1);
22 22
 
23 23
 /**
24 24
  * Fix search returns all the posts for Kleo theme.
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
  * @param object $query Current query object.
31 31
  * @return object Modified query object.
32 32
  */
33
-function geodir_kleo_search_filter( $query ) {
34
-    if ( !empty( $query->is_search ) && geodir_is_page('search') && is_search() ) {
35
-        $query->set( 'post_type', 'any' );
33
+function geodir_kleo_search_filter($query) {
34
+    if (!empty($query->is_search) && geodir_is_page('search') && is_search()) {
35
+        $query->set('post_type', 'any');
36 36
     }
37 37
     return $query;
38 38
 }
39
-if ( !is_admin() ) {
40
-    add_filter( 'pre_get_posts', 'geodir_kleo_search_filter', 11 );
39
+if (!is_admin()) {
40
+    add_filter('pre_get_posts', 'geodir_kleo_search_filter', 11);
41 41
 }
42 42
 
43
-if( ! function_exists( 'kleo_title' ) ){
44
-    function kleo_title(){ return geodir_kleo_custom_the_title();}
43
+if (!function_exists('kleo_title')) {
44
+    function kleo_title() { return geodir_kleo_custom_the_title(); }
45 45
 }
46 46
 
47 47
 /**
@@ -55,77 +55,77 @@  discard block
 block discarded – undo
55 55
 
56 56
     $output = '';
57 57
     if (is_tag()) {
58
-        $output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false);
58
+        $output = __('Tag Archive for:', 'kleo_framework')." ".single_tag_title('', false);
59 59
     }
60
-    elseif(is_tax()) {
60
+    elseif (is_tax()) {
61 61
         $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
62 62
         $output = $term->name;
63 63
     }
64
-    elseif ( is_category() ) {
65
-        $output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false);
64
+    elseif (is_category()) {
65
+        $output = __('Archive for category:', 'kleo_framework')." ".single_cat_title('', false);
66 66
     }
67 67
     elseif (is_day())
68 68
     {
69
-        $output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y');
69
+        $output = __('Archive for date:', 'kleo_framework')." ".get_the_time('F jS, Y');
70 70
     }
71 71
     elseif (is_month())
72 72
     {
73
-        $output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y');
73
+        $output = __('Archive for month:', 'kleo_framework')." ".get_the_time('F, Y');
74 74
     }
75 75
     elseif (is_year())
76 76
     {
77
-        $output = __('Archive for year:','kleo_framework')." ".get_the_time('Y');
77
+        $output = __('Archive for year:', 'kleo_framework')." ".get_the_time('Y');
78 78
     }
79
-    elseif (is_author())  {
79
+    elseif (is_author()) {
80 80
         $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
81
-        $output = __('Author Archive','kleo_framework')." ";
81
+        $output = __('Author Archive', 'kleo_framework')." ";
82 82
 
83
-        if( isset( $curauth->nickname ) ) {
84
-            $output .= __('for:','kleo_framework')." ".$curauth->nickname;
83
+        if (isset($curauth->nickname)) {
84
+            $output .= __('for:', 'kleo_framework')." ".$curauth->nickname;
85 85
         }
86 86
     }
87
-    elseif ( is_archive() )  {
88
-        $output = post_type_archive_title( '', false );
87
+    elseif (is_archive()) {
88
+        $output = post_type_archive_title('', false);
89 89
     }
90 90
     elseif (is_search())
91 91
     {
92 92
         global $wp_query;
93
-        if(!empty($wp_query->found_posts))
93
+        if (!empty($wp_query->found_posts))
94 94
         {
95
-            if($wp_query->found_posts > 1)
95
+            if ($wp_query->found_posts > 1)
96 96
             {
97
-                $output =  $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() );
97
+                $output = $wp_query->found_posts." ".__('search results for:', 'kleo_framework')." ".esc_attr(get_search_query());
98 98
             }
99 99
             else
100 100
             {
101
-                $output =  $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() );
101
+                $output = $wp_query->found_posts." ".__('search result for:', 'kleo_framework')." ".esc_attr(get_search_query());
102 102
             }
103 103
         }
104 104
         else
105 105
         {
106
-            if(!empty($_GET['s']))
106
+            if (!empty($_GET['s']))
107 107
             {
108
-                $output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() );
108
+                $output = __('Search results for:', 'kleo_framework')." ".esc_attr(get_search_query());
109 109
             }
110 110
             else
111 111
             {
112
-                $output = __('To search the site please enter a valid term','kleo_framework');
112
+                $output = __('To search the site please enter a valid term', 'kleo_framework');
113 113
             }
114 114
         }
115 115
 
116 116
     }
117
-    elseif ( is_front_page() && !is_home() ) {
117
+    elseif (is_front_page() && !is_home()) {
118 118
         $output = get_the_title(get_option('page_on_front'));
119 119
 
120
-    } elseif ( is_home() ) {
120
+    } elseif (is_home()) {
121 121
         if (get_option('page_for_posts')) {
122 122
             $output = get_the_title(get_option('page_for_posts'));
123 123
         } else {
124
-            $output = __( 'Blog', 'kleo_framework' );
124
+            $output = __('Blog', 'kleo_framework');
125 125
         }
126 126
 
127
-    } elseif ( is_404() ) {
128
-        $output = __('Error 404 - Page not found','kleo_framework');
127
+    } elseif (is_404()) {
128
+        $output = __('Error 404 - Page not found', 'kleo_framework');
129 129
     }
130 130
     else {
131 131
         $output = get_the_title();
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
 
134 134
     if (isset($_GET['paged']) && !empty($_GET['paged']))
135 135
     {
136
-        $output .= " (".__('Page','kleo_framework')." ".$_GET['paged'].")";
136
+        $output .= " (".__('Page', 'kleo_framework')." ".$_GET['paged'].")";
137 137
     }
138 138
 
139 139
 
140 140
     $gd_page = '';
141
-    if(geodir_is_page('pt')){
141
+    if (geodir_is_page('pt')) {
142 142
         $gd_page = 'pt';
143 143
         $output = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : '';
144 144
     }
145
-    elseif(geodir_is_page('listing')){
145
+    elseif (geodir_is_page('listing')) {
146 146
         $gd_page = 'listing';
147 147
         $output = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : '';
148 148
     }
Please login to merge, or discard this patch.
Braces   +15 added lines, -29 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function geodir_kelo_title_translation( $args) {
13 13
     if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14 14
         $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
15
+    } elseif(function_exists('geodir_is_geodir_page')){
16 16
         $args['title'] = __($args['title'],'geodirectory');
17 17
     }
18 18
 
@@ -56,38 +56,30 @@  discard block
 block discarded – undo
56 56
     $output = '';
57 57
     if (is_tag()) {
58 58
         $output = __('Tag Archive for:','kleo_framework')." ".single_tag_title('',false);
59
-    }
60
-    elseif(is_tax()) {
59
+    } elseif(is_tax()) {
61 60
         $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
62 61
         $output = $term->name;
63
-    }
64
-    elseif ( is_category() ) {
62
+    } elseif ( is_category() ) {
65 63
         $output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false);
66
-    }
67
-    elseif (is_day())
64
+    } elseif (is_day())
68 65
     {
69 66
         $output = __('Archive for date:','kleo_framework')." ".get_the_time('F jS, Y');
70
-    }
71
-    elseif (is_month())
67
+    } elseif (is_month())
72 68
     {
73 69
         $output = __('Archive for month:','kleo_framework')." ".get_the_time('F, Y');
74
-    }
75
-    elseif (is_year())
70
+    } elseif (is_year())
76 71
     {
77 72
         $output = __('Archive for year:','kleo_framework')." ".get_the_time('Y');
78
-    }
79
-    elseif (is_author())  {
73
+    } elseif (is_author())  {
80 74
         $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
81 75
         $output = __('Author Archive','kleo_framework')." ";
82 76
 
83 77
         if( isset( $curauth->nickname ) ) {
84 78
             $output .= __('for:','kleo_framework')." ".$curauth->nickname;
85 79
         }
86
-    }
87
-    elseif ( is_archive() )  {
80
+    } elseif ( is_archive() )  {
88 81
         $output = post_type_archive_title( '', false );
89
-    }
90
-    elseif (is_search())
82
+    } elseif (is_search())
91 83
     {
92 84
         global $wp_query;
93 85
         if(!empty($wp_query->found_posts))
@@ -95,26 +87,22 @@  discard block
 block discarded – undo
95 87
             if($wp_query->found_posts > 1)
96 88
             {
97 89
                 $output =  $wp_query->found_posts ." ". __('search results for:','kleo_framework')." ".esc_attr( get_search_query() );
98
-            }
99
-            else
90
+            } else
100 91
             {
101 92
                 $output =  $wp_query->found_posts ." ". __('search result for:','kleo_framework')." ".esc_attr( get_search_query() );
102 93
             }
103
-        }
104
-        else
94
+        } else
105 95
         {
106 96
             if(!empty($_GET['s']))
107 97
             {
108 98
                 $output = __('Search results for:','kleo_framework')." ".esc_attr( get_search_query() );
109
-            }
110
-            else
99
+            } else
111 100
             {
112 101
                 $output = __('To search the site please enter a valid term','kleo_framework');
113 102
             }
114 103
         }
115 104
 
116
-    }
117
-    elseif ( is_front_page() && !is_home() ) {
105
+    } elseif ( is_front_page() && !is_home() ) {
118 106
         $output = get_the_title(get_option('page_on_front'));
119 107
 
120 108
     } elseif ( is_home() ) {
@@ -126,8 +114,7 @@  discard block
 block discarded – undo
126 114
 
127 115
     } elseif ( is_404() ) {
128 116
         $output = __('Error 404 - Page not found','kleo_framework');
129
-    }
130
-    else {
117
+    } else {
131 118
         $output = get_the_title();
132 119
     }
133 120
 
@@ -141,8 +128,7 @@  discard block
 block discarded – undo
141 128
     if(geodir_is_page('pt')){
142 129
         $gd_page = 'pt';
143 130
         $output = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : '';
144
-    }
145
-    elseif(geodir_is_page('listing')){
131
+    } elseif(geodir_is_page('listing')){
146 132
         $gd_page = 'listing';
147 133
         $output = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : '';
148 134
     }
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_output_functions.php 3 patches
Braces   +26 added lines, -39 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
27 26
 
28 27
     if(!is_array($cf) && $cf!=''){
29 28
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -77,8 +76,10 @@  discard block
 block discarded – undo
77 76
 
78 77
             if ( $post->{$html_var} == '1' ):
79 78
                 $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
79
+            else {
80
+            	:
81 81
                 $html_val = __( 'No', 'geodirectory' );
82
+            }
82 83
             endif;
83 84
 
84 85
             $field_icon = geodir_field_icon_proccess($cf);
@@ -116,8 +117,7 @@  discard block
 block discarded – undo
116 117
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 118
 
118 119
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
120
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
121 121
 
122 122
     if(!is_array($cf) && $cf!=''){
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -197,8 +197,7 @@  discard block
 block discarded – undo
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
202 201
 
203 202
     if(!is_array($cf) && $cf!=''){
204 203
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -313,8 +312,7 @@  discard block
 block discarded – undo
313 312
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 313
 
315 314
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
315
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
318 316
 
319 317
     if(!is_array($cf) && $cf!=''){
320 318
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -403,8 +401,7 @@  discard block
 block discarded – undo
403 401
 function geodir_cf_time($html,$location,$cf,$p=''){
404 402
 
405 403
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
404
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
408 405
 
409 406
     if(!is_array($cf) && $cf!=''){
410 407
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -457,9 +454,10 @@  discard block
 block discarded – undo
457 454
         if ($post->{$cf['htmlvar_name']}):
458 455
 
459 456
             $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
457
+            if ($post->{$cf['htmlvar_name']} != '') {
458
+                            //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462 459
                 $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
460
+            }
463 461
 
464 462
             $field_icon = geodir_field_icon_proccess($cf);
465 463
             if (strpos($field_icon, 'http') !== false) {
@@ -498,8 +496,7 @@  discard block
 block discarded – undo
498 496
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499 497
     global $preview;
500 498
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
499
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
503 500
 
504 501
     if(!is_array($cf) && $cf!=''){
505 502
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -566,7 +563,7 @@  discard block
 block discarded – undo
566 563
                 $date_format = str_replace($search, $replace, $date_format);
567 564
 
568 565
                 $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
566
+            } else{
570 567
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 568
             }
572 569
 
@@ -575,7 +572,7 @@  discard block
 block discarded – undo
575 572
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 573
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 574
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
575
+            } else{
579 576
                 return '';
580 577
             }
581 578
 
@@ -618,8 +615,7 @@  discard block
 block discarded – undo
618 615
 function geodir_cf_text($html,$location,$cf,$p=''){
619 616
 
620 617
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
618
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
623 619
 
624 620
     if(!is_array($cf) && $cf!=''){
625 621
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -725,8 +721,7 @@  discard block
 block discarded – undo
725 721
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 722
 
727 723
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
724
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
730 725
 
731 726
     if(!is_array($cf) && $cf!=''){
732 727
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -834,8 +829,7 @@  discard block
 block discarded – undo
834 829
 function geodir_cf_select($html,$location,$cf,$p=''){
835 830
 
836 831
     // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
832
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
839 833
 
840 834
     if(!is_array($cf) && $cf!=''){
841 835
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -936,8 +930,7 @@  discard block
 block discarded – undo
936 930
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
937 931
 
938 932
     // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
933
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
941 934
 
942 935
     if(!is_array($cf) && $cf!=''){
943 936
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1063,8 +1056,7 @@  discard block
 block discarded – undo
1063 1056
 function geodir_cf_email($html,$location,$cf,$p=''){
1064 1057
 
1065 1058
     // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1059
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1068 1060
 
1069 1061
     if(!is_array($cf) && $cf!=''){
1070 1062
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1200,7 +1192,7 @@  discard block
 block discarded – undo
1200 1192
                      */
1201 1193
                     $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202 1194
                     $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
-                }else{
1195
+                } else{
1204 1196
                     $html .=  $email;
1205 1197
                 }
1206 1198
                 $html .= '</span></div>';
@@ -1228,8 +1220,7 @@  discard block
 block discarded – undo
1228 1220
 function geodir_cf_file($html,$location,$cf,$p=''){
1229 1221
 
1230 1222
     // check we have the post value
1231
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1232
-    else{ global $post;}
1223
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1233 1224
 
1234 1225
     if(!is_array($cf) && $cf!=''){
1235 1226
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1322,7 +1313,7 @@  discard block
 block discarded – undo
1322 1313
                             $file_paths .= '</a>';
1323 1314
                             //$file_paths .= '<img src="'.$file.'"  />';	
1324 1315
                             $file_paths .= '</div>';
1325
-                        }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1316
+                        } elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1326 1317
                             $ext_path = '_' . $html_var . '_';
1327 1318
                             $filename = explode($ext_path, $filename);
1328 1319
                             $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
@@ -1375,8 +1366,7 @@  discard block
 block discarded – undo
1375 1366
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1376 1367
 
1377 1368
     // check we have the post value
1378
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1379
-    else{ global $post;}
1369
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1380 1370
 
1381 1371
     if(!is_array($cf) && $cf!=''){
1382 1372
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1466,8 +1456,7 @@  discard block
 block discarded – undo
1466 1456
 function geodir_cf_html($html,$location,$cf,$p=''){
1467 1457
 
1468 1458
     // check we have the post value
1469
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1470
-    else{ global $post;}
1459
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1471 1460
 
1472 1461
     if(!is_array($cf) && $cf!=''){
1473 1462
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1556,8 +1545,7 @@  discard block
 block discarded – undo
1556 1545
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1557 1546
 
1558 1547
     // check we have the post value
1559
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1560
-    else{ global $post;}
1548
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1561 1549
 
1562 1550
     if(!is_array($cf) && $cf!=''){
1563 1551
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1679,8 +1667,7 @@  discard block
 block discarded – undo
1679 1667
 function geodir_cf_address($html,$location,$cf,$p=''){
1680 1668
 
1681 1669
     // check we have the post value
1682
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1683
-    else{ global $post;}
1670
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1684 1671
 
1685 1672
     if(!is_array($cf) && $cf!=''){
1686 1673
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
Please login to merge, or discard this patch.
Indentation   +1565 added lines, -1565 removed lines patch added patch discarded remove patch
@@ -21,84 +21,84 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24
-    // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
27
-
28
-    if(!is_array($cf) && $cf!=''){
29
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
31
-    }
32
-
33
-    $html_var = $cf['htmlvar_name'];
34
-
35
-    // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
-        /**
38
-         * Filter the checkbox html by location.
39
-         *
40
-         * @param string $html The html to filter.
41
-         * @param array $cf The custom field array.
42
-         * @since 1.6.6
43
-         */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
-        /**
50
-         * Filter the checkbox html by individual custom field.
51
-         *
52
-         * @param string $html The html to filter.
53
-         * @param string $location The location to output the html.
54
-         * @param array $cf The custom field array.
55
-         * @since 1.6.6
56
-         */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
-        /**
63
-         * Filter the checkbox html by field type key.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param string $location The location to output the html.
67
-         * @param array $cf The custom field array.
68
-         * @since 1.6.6
69
-         */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
-    }
72
-
73
-    // If not html then we run the standard output.
74
-    if(empty($html)){
75
-
76
-        if ( (int) $post->{$html_var} == 1 ):
77
-
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
81
-                $html_val = __( 'No', 'geodirectory' );
82
-            endif;
83
-
84
-            $field_icon = geodir_field_icon_proccess($cf);
85
-            if (strpos($field_icon, 'http') !== false) {
86
-                $field_icon_af = '';
87
-            } elseif ($field_icon == '') {
88
-                $field_icon_af = '';
89
-            } else {
90
-                $field_icon_af = $field_icon;
91
-                $field_icon = '';
92
-            }
93
-
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
97
-        endif;
98
-
99
-    }
100
-
101
-    return $html;
24
+	// check we have the post value
25
+	if(is_int($p)){$post = geodir_get_post_info($p);}
26
+	else{ global $post;}
27
+
28
+	if(!is_array($cf) && $cf!=''){
29
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
+		if(!$cf){return NULL;}
31
+	}
32
+
33
+	$html_var = $cf['htmlvar_name'];
34
+
35
+	// Check if there is a location specific filter.
36
+	if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
+		/**
38
+		 * Filter the checkbox html by location.
39
+		 *
40
+		 * @param string $html The html to filter.
41
+		 * @param array $cf The custom field array.
42
+		 * @since 1.6.6
43
+		 */
44
+		$html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
+		/**
50
+		 * Filter the checkbox html by individual custom field.
51
+		 *
52
+		 * @param string $html The html to filter.
53
+		 * @param string $location The location to output the html.
54
+		 * @param array $cf The custom field array.
55
+		 * @since 1.6.6
56
+		 */
57
+		$html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field key specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
+		/**
63
+		 * Filter the checkbox html by field type key.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param string $location The location to output the html.
67
+		 * @param array $cf The custom field array.
68
+		 * @since 1.6.6
69
+		 */
70
+		$html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
+	}
72
+
73
+	// If not html then we run the standard output.
74
+	if(empty($html)){
75
+
76
+		if ( (int) $post->{$html_var} == 1 ):
77
+
78
+			if ( $post->{$html_var} == '1' ):
79
+				$html_val = __( 'Yes', 'geodirectory' );
80
+			else:
81
+				$html_val = __( 'No', 'geodirectory' );
82
+			endif;
83
+
84
+			$field_icon = geodir_field_icon_proccess($cf);
85
+			if (strpos($field_icon, 'http') !== false) {
86
+				$field_icon_af = '';
87
+			} elseif ($field_icon == '') {
88
+				$field_icon_af = '';
89
+			} else {
90
+				$field_icon_af = $field_icon;
91
+				$field_icon = '';
92
+			}
93
+
94
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
+			$html .= '</span>' . $html_val . '</div>';
97
+		endif;
98
+
99
+	}
100
+
101
+	return $html;
102 102
 }
103 103
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
104 104
 
@@ -115,71 +115,71 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 117
 
118
-    // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
121
-
122
-    if(!is_array($cf) && $cf!=''){
123
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
125
-    }
126
-
127
-    $html_var = $cf['htmlvar_name'];
128
-
129
-    // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
-        /**
132
-         * Filter the fieldset html by location.
133
-         *
134
-         * @param string $html The html to filter.
135
-         * @param array $cf The custom field array.
136
-         * @since 1.6.6
137
-         */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
-    }
140
-
141
-    // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
-        /**
144
-         * Filter the fieldset html by individual custom field.
145
-         *
146
-         * @param string $html The html to filter.
147
-         * @param string $location The location to output the html.
148
-         * @param array $cf The custom field array.
149
-         * @since 1.6.6
150
-         */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
-    }
153
-
154
-    // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
-        /**
157
-         * Filter the fieldset html by field type key.
158
-         *
159
-         * @param string $html The html to filter.
160
-         * @param string $location The location to output the html.
161
-         * @param array $cf The custom field array.
162
-         * @since 1.6.6
163
-         */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
-    }
166
-
167
-    // If not html then we run the standard output.
168
-    if(empty($html)){
169
-
170
-        global $field_set_start;
171
-        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
-
173
-        if ($field_set_start == 1) {
174
-            $html = '';
175
-        } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
-            //$field_set_start = 1;
178
-        }
179
-
180
-    }
181
-
182
-    return $html;
118
+	// check we have the post value
119
+	if(is_int($p)){$post = geodir_get_post_info($p);}
120
+	else{ global $post;}
121
+
122
+	if(!is_array($cf) && $cf!=''){
123
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
+		if(!$cf){return NULL;}
125
+	}
126
+
127
+	$html_var = $cf['htmlvar_name'];
128
+
129
+	// Check if there is a location specific filter.
130
+	if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
+		/**
132
+		 * Filter the fieldset html by location.
133
+		 *
134
+		 * @param string $html The html to filter.
135
+		 * @param array $cf The custom field array.
136
+		 * @since 1.6.6
137
+		 */
138
+		$html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
+	}
140
+
141
+	// Check if there is a custom field specific filter.
142
+	if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
+		/**
144
+		 * Filter the fieldset html by individual custom field.
145
+		 *
146
+		 * @param string $html The html to filter.
147
+		 * @param string $location The location to output the html.
148
+		 * @param array $cf The custom field array.
149
+		 * @since 1.6.6
150
+		 */
151
+		$html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
+	}
153
+
154
+	// Check if there is a custom field key specific filter.
155
+	if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
+		/**
157
+		 * Filter the fieldset html by field type key.
158
+		 *
159
+		 * @param string $html The html to filter.
160
+		 * @param string $location The location to output the html.
161
+		 * @param array $cf The custom field array.
162
+		 * @since 1.6.6
163
+		 */
164
+		$html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
+	}
166
+
167
+	// If not html then we run the standard output.
168
+	if(empty($html)){
169
+
170
+		global $field_set_start;
171
+		$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
+
173
+		if ($field_set_start == 1) {
174
+			$html = '';
175
+		} else {
176
+			$html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
+			//$field_set_start = 1;
178
+		}
179
+
180
+	}
181
+
182
+	return $html;
183 183
 }
184 184
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
185 185
 
@@ -196,106 +196,106 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199
-    // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
202
-
203
-    if(!is_array($cf) && $cf!=''){
204
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
206
-    }
207
-
208
-    $html_var = $cf['htmlvar_name'];
209
-
210
-    // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
-        /**
213
-         * Filter the url html by location.
214
-         *
215
-         * @param string $html The html to filter.
216
-         * @param array $cf The custom field array.
217
-         * @since 1.6.6
218
-         */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
-    }
221
-
222
-    // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
-        /**
225
-         * Filter the url html by individual custom field.
226
-         *
227
-         * @param string $html The html to filter.
228
-         * @param string $location The location to output the html.
229
-         * @param array $cf The custom field array.
230
-         * @since 1.6.6
231
-         */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
-    }
234
-
235
-    // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
-        /**
238
-         * Filter the url html by field type key.
239
-         *
240
-         * @param string $html The html to filter.
241
-         * @param string $location The location to output the html.
242
-         * @param array $cf The custom field array.
243
-         * @since 1.6.6
244
-         */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
-    }
247
-
248
-    // If not html then we run the standard output.
249
-    if(empty($html)){
250
-
251
-        if ($post->{$cf['htmlvar_name']}):
252
-
253
-            $field_icon = geodir_field_icon_proccess($cf);
254
-            if (strpos($field_icon, 'http') !== false) {
255
-                $field_icon_af = '';
256
-            } elseif ($field_icon == '') {
257
-
258
-                if ($cf['name'] == 'geodir_facebook') {
259
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
-                } elseif ($cf['name'] == 'geodir_twitter') {
261
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
-                } else {
263
-                    $field_icon_af = '<i class="fa fa-link"></i>';
264
-                }
265
-
266
-            } else {
267
-                $field_icon_af = $field_icon;
268
-                $field_icon = '';
269
-            }
270
-
271
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
-
273
-
274
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
275
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
-
279
-
280
-
281
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
-            /**
284
-             * Filter custom field website name.
285
-             *
286
-             * @since 1.0.0
287
-             *
288
-             * @param string $title Website Title.
289
-             * @param string $website Website URL.
290
-             * @param int $post->ID Post ID.
291
-             */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
-
294
-        endif;
295
-
296
-    }
297
-
298
-    return $html;
199
+	// check we have the post value
200
+	if(is_int($p)){$post = geodir_get_post_info($p);}
201
+	else{ global $post;}
202
+
203
+	if(!is_array($cf) && $cf!=''){
204
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
+		if(!$cf){return NULL;}
206
+	}
207
+
208
+	$html_var = $cf['htmlvar_name'];
209
+
210
+	// Check if there is a location specific filter.
211
+	if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
+		/**
213
+		 * Filter the url html by location.
214
+		 *
215
+		 * @param string $html The html to filter.
216
+		 * @param array $cf The custom field array.
217
+		 * @since 1.6.6
218
+		 */
219
+		$html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
+	}
221
+
222
+	// Check if there is a custom field specific filter.
223
+	if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
+		/**
225
+		 * Filter the url html by individual custom field.
226
+		 *
227
+		 * @param string $html The html to filter.
228
+		 * @param string $location The location to output the html.
229
+		 * @param array $cf The custom field array.
230
+		 * @since 1.6.6
231
+		 */
232
+		$html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
+	}
234
+
235
+	// Check if there is a custom field key specific filter.
236
+	if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
+		/**
238
+		 * Filter the url html by field type key.
239
+		 *
240
+		 * @param string $html The html to filter.
241
+		 * @param string $location The location to output the html.
242
+		 * @param array $cf The custom field array.
243
+		 * @since 1.6.6
244
+		 */
245
+		$html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
+	}
247
+
248
+	// If not html then we run the standard output.
249
+	if(empty($html)){
250
+
251
+		if ($post->{$cf['htmlvar_name']}):
252
+
253
+			$field_icon = geodir_field_icon_proccess($cf);
254
+			if (strpos($field_icon, 'http') !== false) {
255
+				$field_icon_af = '';
256
+			} elseif ($field_icon == '') {
257
+
258
+				if ($cf['name'] == 'geodir_facebook') {
259
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
+				} elseif ($cf['name'] == 'geodir_twitter') {
261
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
+				} else {
263
+					$field_icon_af = '<i class="fa fa-link"></i>';
264
+				}
265
+
266
+			} else {
267
+				$field_icon_af = $field_icon;
268
+				$field_icon = '';
269
+			}
270
+
271
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
+
273
+
274
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
275
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
+
279
+
280
+
281
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
+			/**
284
+			 * Filter custom field website name.
285
+			 *
286
+			 * @since 1.0.0
287
+			 *
288
+			 * @param string $title Website Title.
289
+			 * @param string $website Website URL.
290
+			 * @param int $post->ID Post ID.
291
+			 */
292
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
+
294
+		endif;
295
+
296
+	}
297
+
298
+	return $html;
299 299
 }
300 300
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
301 301
 
@@ -312,80 +312,80 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 314
 
315
-    // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
318
-
319
-    if(!is_array($cf) && $cf!=''){
320
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
322
-    }
323
-
324
-    $html_var = $cf['htmlvar_name'];
325
-
326
-    // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
-        /**
329
-         * Filter the phone html by location.
330
-         *
331
-         * @param string $html The html to filter.
332
-         * @param array $cf The custom field array.
333
-         * @since 1.6.6
334
-         */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
-    }
337
-
338
-    // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
-        /**
341
-         * Filter the phone html by individual custom field.
342
-         *
343
-         * @param string $html The html to filter.
344
-         * @param string $location The location to output the html.
345
-         * @param array $cf The custom field array.
346
-         * @since 1.6.6
347
-         */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
-    }
350
-
351
-    // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
-        /**
354
-         * Filter the phone html by field type key.
355
-         *
356
-         * @param string $html The html to filter.
357
-         * @param string $location The location to output the html.
358
-         * @param array $cf The custom field array.
359
-         * @since 1.6.6
360
-         */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
-    }
363
-
364
-    // If not html then we run the standard output.
365
-    if(empty($html)){
366
-
367
-        if ($post->{$cf['htmlvar_name']}):
368
-
369
-            $field_icon = geodir_field_icon_proccess($cf);
370
-            if (strpos($field_icon, 'http') !== false) {
371
-                $field_icon_af = '';
372
-            } elseif ($field_icon == '') {
373
-                $field_icon_af = '<i class="fa fa-phone"></i>';
374
-            } else {
375
-                $field_icon_af = $field_icon;
376
-                $field_icon = '';
377
-            }
378
-
379
-
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
-
384
-        endif;
385
-
386
-    }
387
-
388
-    return $html;
315
+	// check we have the post value
316
+	if(is_int($p)){$post = geodir_get_post_info($p);}
317
+	else{ global $post;}
318
+
319
+	if(!is_array($cf) && $cf!=''){
320
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
+		if(!$cf){return NULL;}
322
+	}
323
+
324
+	$html_var = $cf['htmlvar_name'];
325
+
326
+	// Check if there is a location specific filter.
327
+	if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
+		/**
329
+		 * Filter the phone html by location.
330
+		 *
331
+		 * @param string $html The html to filter.
332
+		 * @param array $cf The custom field array.
333
+		 * @since 1.6.6
334
+		 */
335
+		$html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
+	}
337
+
338
+	// Check if there is a custom field specific filter.
339
+	if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
+		/**
341
+		 * Filter the phone html by individual custom field.
342
+		 *
343
+		 * @param string $html The html to filter.
344
+		 * @param string $location The location to output the html.
345
+		 * @param array $cf The custom field array.
346
+		 * @since 1.6.6
347
+		 */
348
+		$html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
+	}
350
+
351
+	// Check if there is a custom field key specific filter.
352
+	if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
+		/**
354
+		 * Filter the phone html by field type key.
355
+		 *
356
+		 * @param string $html The html to filter.
357
+		 * @param string $location The location to output the html.
358
+		 * @param array $cf The custom field array.
359
+		 * @since 1.6.6
360
+		 */
361
+		$html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
+	}
363
+
364
+	// If not html then we run the standard output.
365
+	if(empty($html)){
366
+
367
+		if ($post->{$cf['htmlvar_name']}):
368
+
369
+			$field_icon = geodir_field_icon_proccess($cf);
370
+			if (strpos($field_icon, 'http') !== false) {
371
+				$field_icon_af = '';
372
+			} elseif ($field_icon == '') {
373
+				$field_icon_af = '<i class="fa fa-phone"></i>';
374
+			} else {
375
+				$field_icon_af = $field_icon;
376
+				$field_icon = '';
377
+			}
378
+
379
+
380
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
+
384
+		endif;
385
+
386
+	}
387
+
388
+	return $html;
389 389
 }
390 390
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
391 391
 
@@ -402,85 +402,85 @@  discard block
 block discarded – undo
402 402
  */
403 403
 function geodir_cf_time($html,$location,$cf,$p=''){
404 404
 
405
-    // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
408
-
409
-    if(!is_array($cf) && $cf!=''){
410
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
412
-    }
413
-
414
-    $html_var = $cf['htmlvar_name'];
415
-
416
-    // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
-        /**
419
-         * Filter the time html by location.
420
-         *
421
-         * @param string $html The html to filter.
422
-         * @param array $cf The custom field array.
423
-         * @since 1.6.6
424
-         */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
-    }
427
-
428
-    // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
-        /**
431
-         * Filter the time html by individual custom field.
432
-         *
433
-         * @param string $html The html to filter.
434
-         * @param string $location The location to output the html.
435
-         * @param array $cf The custom field array.
436
-         * @since 1.6.6
437
-         */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
-    }
440
-
441
-    // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
-        /**
444
-         * Filter the time html by field type key.
445
-         *
446
-         * @param string $html The html to filter.
447
-         * @param string $location The location to output the html.
448
-         * @param array $cf The custom field array.
449
-         * @since 1.6.6
450
-         */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
-    }
453
-
454
-    // If not html then we run the standard output.
455
-    if(empty($html)){
456
-
457
-        if ($post->{$cf['htmlvar_name']}):
458
-
459
-            $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
-
464
-            $field_icon = geodir_field_icon_proccess($cf);
465
-            if (strpos($field_icon, 'http') !== false) {
466
-                $field_icon_af = '';
467
-            } elseif ($field_icon == '') {
468
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
469
-            } else {
470
-                $field_icon_af = $field_icon;
471
-                $field_icon = '';
472
-            }
473
-
474
-
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
478
-
479
-        endif;
480
-
481
-    }
482
-
483
-    return $html;
405
+	// check we have the post value
406
+	if(is_int($p)){$post = geodir_get_post_info($p);}
407
+	else{ global $post;}
408
+
409
+	if(!is_array($cf) && $cf!=''){
410
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
+		if(!$cf){return NULL;}
412
+	}
413
+
414
+	$html_var = $cf['htmlvar_name'];
415
+
416
+	// Check if there is a location specific filter.
417
+	if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
+		/**
419
+		 * Filter the time html by location.
420
+		 *
421
+		 * @param string $html The html to filter.
422
+		 * @param array $cf The custom field array.
423
+		 * @since 1.6.6
424
+		 */
425
+		$html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
+	}
427
+
428
+	// Check if there is a custom field specific filter.
429
+	if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
+		/**
431
+		 * Filter the time html by individual custom field.
432
+		 *
433
+		 * @param string $html The html to filter.
434
+		 * @param string $location The location to output the html.
435
+		 * @param array $cf The custom field array.
436
+		 * @since 1.6.6
437
+		 */
438
+		$html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
+	}
440
+
441
+	// Check if there is a custom field key specific filter.
442
+	if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
+		/**
444
+		 * Filter the time html by field type key.
445
+		 *
446
+		 * @param string $html The html to filter.
447
+		 * @param string $location The location to output the html.
448
+		 * @param array $cf The custom field array.
449
+		 * @since 1.6.6
450
+		 */
451
+		$html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
+	}
453
+
454
+	// If not html then we run the standard output.
455
+	if(empty($html)){
456
+
457
+		if ($post->{$cf['htmlvar_name']}):
458
+
459
+			$value = '';
460
+			if ($post->{$cf['htmlvar_name']} != '')
461
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
+
464
+			$field_icon = geodir_field_icon_proccess($cf);
465
+			if (strpos($field_icon, 'http') !== false) {
466
+				$field_icon_af = '';
467
+			} elseif ($field_icon == '') {
468
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
469
+			} else {
470
+				$field_icon_af = $field_icon;
471
+				$field_icon = '';
472
+			}
473
+
474
+
475
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
+			$html .= '</span>' . $value . '</div>';
478
+
479
+		endif;
480
+
481
+	}
482
+
483
+	return $html;
484 484
 }
485 485
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
486 486
 
@@ -496,111 +496,111 @@  discard block
 block discarded – undo
496 496
  * @return string The html to output for the custom field.
497 497
  */
498 498
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499
-    global $preview;
500
-    // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
503
-
504
-    if(!is_array($cf) && $cf!=''){
505
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
507
-    }
508
-
509
-    $html_var = $cf['htmlvar_name'];
510
-
511
-    // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
-        /**
514
-         * Filter the datepicker html by location.
515
-         *
516
-         * @param string $html The html to filter.
517
-         * @param array $cf The custom field array.
518
-         * @since 1.6.6
519
-         */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
-    }
522
-
523
-    // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
-        /**
526
-         * Filter the datepicker html by individual custom field.
527
-         *
528
-         * @param string $html The html to filter.
529
-         * @param string $location The location to output the html.
530
-         * @param array $cf The custom field array.
531
-         * @since 1.6.6
532
-         */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
-    }
535
-
536
-    // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
-        /**
539
-         * Filter the datepicker html by field type key.
540
-         *
541
-         * @param string $html The html to filter.
542
-         * @param string $location The location to output the html.
543
-         * @param array $cf The custom field array.
544
-         * @since 1.6.6
545
-         */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
-    }
548
-
549
-    // If not html then we run the standard output.
550
-    if(empty($html)){
551
-
552
-        if ($post->{$cf['htmlvar_name']}):
553
-
554
-            $date_format = geodir_default_date_format();
555
-            if ($cf['extra_fields'] != '') {
556
-                $date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
-                $date_format = $date_format['date_format'];
558
-            }
559
-            // check if we need to change the format or not
560
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
562
-
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
565
-
566
-                $date_format = str_replace($search, $replace, $date_format);
567
-
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
570
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
-            }
572
-
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
-                $date_format_from = $preview ? $date_format : 'Y-m-d';
575
-                $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
-                //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
-                //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
579
-                return '';
580
-            }
581
-
582
-            $field_icon = geodir_field_icon_proccess($cf);
583
-
584
-            if (strpos($field_icon, 'http') !== false) {
585
-                $field_icon_af = '';
586
-            } elseif ($field_icon == '') {
587
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
588
-            } else {
589
-                $field_icon_af = $field_icon;
590
-                $field_icon = '';
591
-            }
592
-
593
-
594
-
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
598
-
599
-        endif;
600
-
601
-    }
602
-
603
-    return $html;
499
+	global $preview;
500
+	// check we have the post value
501
+	if(is_int($p)){$post = geodir_get_post_info($p);}
502
+	else{ global $post;}
503
+
504
+	if(!is_array($cf) && $cf!=''){
505
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
+		if(!$cf){return NULL;}
507
+	}
508
+
509
+	$html_var = $cf['htmlvar_name'];
510
+
511
+	// Check if there is a location specific filter.
512
+	if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
+		/**
514
+		 * Filter the datepicker html by location.
515
+		 *
516
+		 * @param string $html The html to filter.
517
+		 * @param array $cf The custom field array.
518
+		 * @since 1.6.6
519
+		 */
520
+		$html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
+	}
522
+
523
+	// Check if there is a custom field specific filter.
524
+	if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
+		/**
526
+		 * Filter the datepicker html by individual custom field.
527
+		 *
528
+		 * @param string $html The html to filter.
529
+		 * @param string $location The location to output the html.
530
+		 * @param array $cf The custom field array.
531
+		 * @since 1.6.6
532
+		 */
533
+		$html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
+	}
535
+
536
+	// Check if there is a custom field key specific filter.
537
+	if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
+		/**
539
+		 * Filter the datepicker html by field type key.
540
+		 *
541
+		 * @param string $html The html to filter.
542
+		 * @param string $location The location to output the html.
543
+		 * @param array $cf The custom field array.
544
+		 * @since 1.6.6
545
+		 */
546
+		$html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
+	}
548
+
549
+	// If not html then we run the standard output.
550
+	if(empty($html)){
551
+
552
+		if ($post->{$cf['htmlvar_name']}):
553
+
554
+			$date_format = geodir_default_date_format();
555
+			if ($cf['extra_fields'] != '') {
556
+				$date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
+				$date_format = $date_format['date_format'];
558
+			}
559
+			// check if we need to change the format or not
560
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
561
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
562
+
563
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
565
+
566
+				$date_format = str_replace($search, $replace, $date_format);
567
+
568
+				$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+			}else{
570
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
+			}
572
+
573
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
+				$date_format_from = $preview ? $date_format : 'Y-m-d';
575
+				$value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
+				//$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
+				//$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
+			}else{
579
+				return '';
580
+			}
581
+
582
+			$field_icon = geodir_field_icon_proccess($cf);
583
+
584
+			if (strpos($field_icon, 'http') !== false) {
585
+				$field_icon_af = '';
586
+			} elseif ($field_icon == '') {
587
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
588
+			} else {
589
+				$field_icon_af = $field_icon;
590
+				$field_icon = '';
591
+			}
592
+
593
+
594
+
595
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
+			$html .= '</span>' . $value . '</div>';
598
+
599
+		endif;
600
+
601
+	}
602
+
603
+	return $html;
604 604
 }
605 605
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
606 606
 
@@ -617,97 +617,97 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_cf_text($html,$location,$cf,$p=''){
619 619
 
620
-    // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
623
-
624
-    if(!is_array($cf) && $cf!=''){
625
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
627
-    }
628
-
629
-    $html_var = $cf['htmlvar_name'];
630
-
631
-    // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
-        /**
634
-         * Filter the text html by location.
635
-         *
636
-         * @param string $html The html to filter.
637
-         * @param array $cf The custom field array.
638
-         * @since 1.6.6
639
-         */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
-    }
642
-
643
-    // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
-        /**
646
-         * Filter the text html by individual custom field.
647
-         *
648
-         * @param string $html The html to filter.
649
-         * @param string $location The location to output the html.
650
-         * @param array $cf The custom field array.
651
-         * @since 1.6.6
652
-         */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
-    }
655
-
656
-    // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
-        /**
659
-         * Filter the text html by field type key.
660
-         *
661
-         * @param string $html The html to filter.
662
-         * @param string $location The location to output the html.
663
-         * @param array $cf The custom field array.
664
-         * @since 1.6.6
665
-         */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
-    }
620
+	// check we have the post value
621
+	if(is_int($p)){$post = geodir_get_post_info($p);}
622
+	else{ global $post;}
623
+
624
+	if(!is_array($cf) && $cf!=''){
625
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
+		if(!$cf){return NULL;}
627
+	}
628
+
629
+	$html_var = $cf['htmlvar_name'];
630
+
631
+	// Check if there is a location specific filter.
632
+	if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
+		/**
634
+		 * Filter the text html by location.
635
+		 *
636
+		 * @param string $html The html to filter.
637
+		 * @param array $cf The custom field array.
638
+		 * @since 1.6.6
639
+		 */
640
+		$html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
+	}
642
+
643
+	// Check if there is a custom field specific filter.
644
+	if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
+		/**
646
+		 * Filter the text html by individual custom field.
647
+		 *
648
+		 * @param string $html The html to filter.
649
+		 * @param string $location The location to output the html.
650
+		 * @param array $cf The custom field array.
651
+		 * @since 1.6.6
652
+		 */
653
+		$html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
+	}
655
+
656
+	// Check if there is a custom field key specific filter.
657
+	if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
+		/**
659
+		 * Filter the text html by field type key.
660
+		 *
661
+		 * @param string $html The html to filter.
662
+		 * @param string $location The location to output the html.
663
+		 * @param array $cf The custom field array.
664
+		 * @since 1.6.6
665
+		 */
666
+		$html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
+	}
668 668
 
669 669
     
670 670
 
671
-    // If not html then we run the standard output.
672
-    if(empty($html)){
671
+	// If not html then we run the standard output.
672
+	if(empty($html)){
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
675 675
 
676
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
676
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
678
-            $field_icon = geodir_field_icon_proccess($cf);
679
-            if (strpos($field_icon, 'http') !== false) {
680
-                $field_icon_af = '';
681
-            } elseif ($field_icon == '') {
682
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
-            } else {
684
-                $field_icon_af = $field_icon;
685
-                $field_icon = '';
686
-            }
678
+			$field_icon = geodir_field_icon_proccess($cf);
679
+			if (strpos($field_icon, 'http') !== false) {
680
+				$field_icon_af = '';
681
+			} elseif ($field_icon == '') {
682
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
+			} else {
684
+				$field_icon_af = $field_icon;
685
+				$field_icon = '';
686
+			}
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
-            $html .= '</span>';
689
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
+			$html .= '</span>';
692 692
 
693
-            $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
-                $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
699
-                }
700
-            }
693
+			$value = $post->{$cf['htmlvar_name']};
694
+			if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
+				$extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
+				if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
+					if(!ceil($value) > 0){return '';}// dont output blank prices
698
+					$value = geodir_currency_format_number($value,$cf);
699
+				}
700
+			}
701 701
 
702 702
 
703
-            $html .= $value;
704
-            $html .= '</div>';
703
+			$html .= $value;
704
+			$html .= '</div>';
705 705
 
706
-        endif;
706
+		endif;
707 707
 
708
-    }
708
+	}
709 709
 
710
-    return $html;
710
+	return $html;
711 711
 }
712 712
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
713 713
 
@@ -724,98 +724,98 @@  discard block
 block discarded – undo
724 724
  */
725 725
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 726
 
727
-    // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
730
-
731
-    if(!is_array($cf) && $cf!=''){
732
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
734
-    }
735
-
736
-    $html_var = $cf['htmlvar_name'];
737
-
738
-    // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
-        /**
741
-         * Filter the radio html by location.
742
-         *
743
-         * @param string $html The html to filter.
744
-         * @param array $cf The custom field array.
745
-         * @since 1.6.6
746
-         */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
-    }
749
-
750
-    // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
-        /**
753
-         * Filter the radio html by individual custom field.
754
-         *
755
-         * @param string $html The html to filter.
756
-         * @param string $location The location to output the html.
757
-         * @param array $cf The custom field array.
758
-         * @since 1.6.6
759
-         */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
-    }
762
-
763
-    // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
-        /**
766
-         * Filter the radio html by field type key.
767
-         *
768
-         * @param string $html The html to filter.
769
-         * @param string $location The location to output the html.
770
-         * @param array $cf The custom field array.
771
-         * @since 1.6.6
772
-         */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
-    }
775
-
776
-    // If not html then we run the standard output.
777
-    if(empty($html)){
778
-
779
-        $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
-
782
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
-                $html_val = __('No', 'geodirectory');
784
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
-                $html_val = __('Yes', 'geodirectory');
786
-            } else {
787
-                if (!empty($cf['option_values'])) {
788
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
-
790
-                    if (!empty($cf_option_values)) {
791
-                        foreach ($cf_option_values as $cf_option_value) {
792
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
-                                $html_val = $cf_option_value['label'];
794
-                            }
795
-                        }
796
-                    }
797
-                }
798
-            }
799
-
800
-            $field_icon = geodir_field_icon_proccess($cf);
801
-            if (strpos($field_icon, 'http') !== false) {
802
-                $field_icon_af = '';
803
-            } elseif ($field_icon == '') {
804
-                $field_icon_af = '';
805
-            } else {
806
-                $field_icon_af = $field_icon;
807
-                $field_icon = '';
808
-            }
809
-
810
-
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
814
-        endif;
815
-
816
-    }
817
-
818
-    return $html;
727
+	// check we have the post value
728
+	if(is_int($p)){$post = geodir_get_post_info($p);}
729
+	else{ global $post;}
730
+
731
+	if(!is_array($cf) && $cf!=''){
732
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
+		if(!$cf){return NULL;}
734
+	}
735
+
736
+	$html_var = $cf['htmlvar_name'];
737
+
738
+	// Check if there is a location specific filter.
739
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
+		/**
741
+		 * Filter the radio html by location.
742
+		 *
743
+		 * @param string $html The html to filter.
744
+		 * @param array $cf The custom field array.
745
+		 * @since 1.6.6
746
+		 */
747
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
+	}
749
+
750
+	// Check if there is a custom field specific filter.
751
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
+		/**
753
+		 * Filter the radio html by individual custom field.
754
+		 *
755
+		 * @param string $html The html to filter.
756
+		 * @param string $location The location to output the html.
757
+		 * @param array $cf The custom field array.
758
+		 * @since 1.6.6
759
+		 */
760
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
+	}
762
+
763
+	// Check if there is a custom field key specific filter.
764
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
+		/**
766
+		 * Filter the radio html by field type key.
767
+		 *
768
+		 * @param string $html The html to filter.
769
+		 * @param string $location The location to output the html.
770
+		 * @param array $cf The custom field array.
771
+		 * @since 1.6.6
772
+		 */
773
+		$html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
+	}
775
+
776
+	// If not html then we run the standard output.
777
+	if(empty($html)){
778
+
779
+		$html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
+
782
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
+				$html_val = __('No', 'geodirectory');
784
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
+				$html_val = __('Yes', 'geodirectory');
786
+			} else {
787
+				if (!empty($cf['option_values'])) {
788
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
+
790
+					if (!empty($cf_option_values)) {
791
+						foreach ($cf_option_values as $cf_option_value) {
792
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
+								$html_val = $cf_option_value['label'];
794
+							}
795
+						}
796
+					}
797
+				}
798
+			}
799
+
800
+			$field_icon = geodir_field_icon_proccess($cf);
801
+			if (strpos($field_icon, 'http') !== false) {
802
+				$field_icon_af = '';
803
+			} elseif ($field_icon == '') {
804
+				$field_icon_af = '';
805
+			} else {
806
+				$field_icon_af = $field_icon;
807
+				$field_icon = '';
808
+			}
809
+
810
+
811
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
+			$html .= '</span>' . $html_val . '</div>';
814
+		endif;
815
+
816
+	}
817
+
818
+	return $html;
819 819
 }
820 820
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
821 821
 
@@ -833,92 +833,92 @@  discard block
 block discarded – undo
833 833
  */
834 834
 function geodir_cf_select($html,$location,$cf,$p=''){
835 835
 
836
-    // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
839
-
840
-    if(!is_array($cf) && $cf!=''){
841
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
843
-    }
844
-
845
-    $html_var = $cf['htmlvar_name'];
846
-
847
-    // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
-        /**
850
-         * Filter the select html by location.
851
-         *
852
-         * @param string $html The html to filter.
853
-         * @param array $cf The custom field array.
854
-         * @since 1.6.6
855
-         */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
-    }
858
-
859
-    // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
-        /**
862
-         * Filter the select html by individual custom field.
863
-         *
864
-         * @param string $html The html to filter.
865
-         * @param string $location The location to output the html.
866
-         * @param array $cf The custom field array.
867
-         * @since 1.6.6
868
-         */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
-    }
871
-
872
-    // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
-        /**
875
-         * Filter the select html by field type key.
876
-         *
877
-         * @param string $html The html to filter.
878
-         * @param string $location The location to output the html.
879
-         * @param array $cf The custom field array.
880
-         * @since 1.6.6
881
-         */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
-    }
884
-
885
-    // If not html then we run the standard output.
886
-    if(empty($html)){
887
-
888
-        if ($post->{$cf['htmlvar_name']}):
889
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
-
891
-            if (!empty($cf['option_values'])) {
892
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
-
894
-                if (!empty($cf_option_values)) {
895
-                    foreach ($cf_option_values as $cf_option_value) {
896
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
-                            $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
-                        }
899
-                    }
900
-                }
901
-            }
902
-
903
-            $field_icon = geodir_field_icon_proccess($cf);
904
-            if (strpos($field_icon, 'http') !== false) {
905
-                $field_icon_af = '';
906
-            } elseif ($field_icon == '') {
907
-                $field_icon_af = '';
908
-            } else {
909
-                $field_icon_af = $field_icon;
910
-                $field_icon = '';
911
-            }
912
-
913
-
914
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
917
-        endif;
918
-
919
-    }
920
-
921
-    return $html;
836
+	// check we have the post value
837
+	if(is_int($p)){$post = geodir_get_post_info($p);}
838
+	else{ global $post;}
839
+
840
+	if(!is_array($cf) && $cf!=''){
841
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
+		if(!$cf){return NULL;}
843
+	}
844
+
845
+	$html_var = $cf['htmlvar_name'];
846
+
847
+	// Check if there is a location specific filter.
848
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
+		/**
850
+		 * Filter the select html by location.
851
+		 *
852
+		 * @param string $html The html to filter.
853
+		 * @param array $cf The custom field array.
854
+		 * @since 1.6.6
855
+		 */
856
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
+	}
858
+
859
+	// Check if there is a custom field specific filter.
860
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
+		/**
862
+		 * Filter the select html by individual custom field.
863
+		 *
864
+		 * @param string $html The html to filter.
865
+		 * @param string $location The location to output the html.
866
+		 * @param array $cf The custom field array.
867
+		 * @since 1.6.6
868
+		 */
869
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
+	}
871
+
872
+	// Check if there is a custom field key specific filter.
873
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
+		/**
875
+		 * Filter the select html by field type key.
876
+		 *
877
+		 * @param string $html The html to filter.
878
+		 * @param string $location The location to output the html.
879
+		 * @param array $cf The custom field array.
880
+		 * @since 1.6.6
881
+		 */
882
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
+	}
884
+
885
+	// If not html then we run the standard output.
886
+	if(empty($html)){
887
+
888
+		if ($post->{$cf['htmlvar_name']}):
889
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
+
891
+			if (!empty($cf['option_values'])) {
892
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
+
894
+				if (!empty($cf_option_values)) {
895
+					foreach ($cf_option_values as $cf_option_value) {
896
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
+							$field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
+						}
899
+					}
900
+				}
901
+			}
902
+
903
+			$field_icon = geodir_field_icon_proccess($cf);
904
+			if (strpos($field_icon, 'http') !== false) {
905
+				$field_icon_af = '';
906
+			} elseif ($field_icon == '') {
907
+				$field_icon_af = '';
908
+			} else {
909
+				$field_icon_af = $field_icon;
910
+				$field_icon = '';
911
+			}
912
+
913
+
914
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
+			$html .= '</span>' . $field_value . '</div>';
917
+		endif;
918
+
919
+	}
920
+
921
+	return $html;
922 922
 }
923 923
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
924 924
 
@@ -935,117 +935,117 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
937 937
 
938
-    // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
941
-
942
-    if(!is_array($cf) && $cf!=''){
943
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
945
-    }
946
-
947
-    $html_var = $cf['htmlvar_name'];
948
-
949
-    // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
-        /**
952
-         * Filter the multiselect html by location.
953
-         *
954
-         * @param string $html The html to filter.
955
-         * @param array $cf The custom field array.
956
-         * @since 1.6.6
957
-         */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
-    }
960
-
961
-    // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
-        /**
964
-         * Filter the multiselect html by individual custom field.
965
-         *
966
-         * @param string $html The html to filter.
967
-         * @param string $location The location to output the html.
968
-         * @param array $cf The custom field array.
969
-         * @since 1.6.6
970
-         */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
-    }
973
-
974
-    // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
-        /**
977
-         * Filter the multiselect html by field type key.
978
-         *
979
-         * @param string $html The html to filter.
980
-         * @param string $location The location to output the html.
981
-         * @param array $cf The custom field array.
982
-         * @since 1.6.6
983
-         */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
-    }
986
-
987
-    // If not html then we run the standard output.
988
-    if(empty($html)){
989
-
990
-
991
-        if (!empty($post->{$cf['htmlvar_name']})):
992
-
993
-            if (is_array($post->{$cf['htmlvar_name']})) {
994
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
-            }
996
-
997
-            $field_icon = geodir_field_icon_proccess($cf);
998
-            if (strpos($field_icon, 'http') !== false) {
999
-                $field_icon_af = '';
1000
-            } elseif ($field_icon == '') {
1001
-                $field_icon_af = '';
1002
-            } else {
1003
-                $field_icon_af = $field_icon;
1004
-                $field_icon = '';
1005
-            }
1006
-
1007
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
-
1009
-            if(is_array($field_values)){
1010
-                $field_values = array_map('trim', $field_values);
1011
-            }
1012
-
1013
-            $option_values = array();
1014
-            if (!empty($cf['option_values'])) {
1015
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
-
1017
-                if (!empty($cf_option_values)) {
1018
-                    foreach ($cf_option_values as $cf_option_value) {
1019
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
-                            $option_values[] = $cf_option_value['label'];
1021
-                        }
1022
-                    }
1023
-                }
1024
-            }
1025
-
1026
-
1027
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
-            $html .= '</span>';
1030
-
1031
-            if (count($option_values) > 1) {
1032
-                $html .= '<ul>';
1033
-
1034
-                foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1036
-                }
1037
-
1038
-                $html .= '</ul>';
1039
-            } else {
1040
-                $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
-            }
1042
-
1043
-            $html .= '</div>';
1044
-        endif;
1045
-
1046
-    }
1047
-
1048
-    return $html;
938
+	// check we have the post value
939
+	if(is_int($p)){$post = geodir_get_post_info($p);}
940
+	else{ global $post;}
941
+
942
+	if(!is_array($cf) && $cf!=''){
943
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
+		if(!$cf){return NULL;}
945
+	}
946
+
947
+	$html_var = $cf['htmlvar_name'];
948
+
949
+	// Check if there is a location specific filter.
950
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
+		/**
952
+		 * Filter the multiselect html by location.
953
+		 *
954
+		 * @param string $html The html to filter.
955
+		 * @param array $cf The custom field array.
956
+		 * @since 1.6.6
957
+		 */
958
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
+	}
960
+
961
+	// Check if there is a custom field specific filter.
962
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
+		/**
964
+		 * Filter the multiselect html by individual custom field.
965
+		 *
966
+		 * @param string $html The html to filter.
967
+		 * @param string $location The location to output the html.
968
+		 * @param array $cf The custom field array.
969
+		 * @since 1.6.6
970
+		 */
971
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
+	}
973
+
974
+	// Check if there is a custom field key specific filter.
975
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
+		/**
977
+		 * Filter the multiselect html by field type key.
978
+		 *
979
+		 * @param string $html The html to filter.
980
+		 * @param string $location The location to output the html.
981
+		 * @param array $cf The custom field array.
982
+		 * @since 1.6.6
983
+		 */
984
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
+	}
986
+
987
+	// If not html then we run the standard output.
988
+	if(empty($html)){
989
+
990
+
991
+		if (!empty($post->{$cf['htmlvar_name']})):
992
+
993
+			if (is_array($post->{$cf['htmlvar_name']})) {
994
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
+			}
996
+
997
+			$field_icon = geodir_field_icon_proccess($cf);
998
+			if (strpos($field_icon, 'http') !== false) {
999
+				$field_icon_af = '';
1000
+			} elseif ($field_icon == '') {
1001
+				$field_icon_af = '';
1002
+			} else {
1003
+				$field_icon_af = $field_icon;
1004
+				$field_icon = '';
1005
+			}
1006
+
1007
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
+
1009
+			if(is_array($field_values)){
1010
+				$field_values = array_map('trim', $field_values);
1011
+			}
1012
+
1013
+			$option_values = array();
1014
+			if (!empty($cf['option_values'])) {
1015
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
+
1017
+				if (!empty($cf_option_values)) {
1018
+					foreach ($cf_option_values as $cf_option_value) {
1019
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
+							$option_values[] = $cf_option_value['label'];
1021
+						}
1022
+					}
1023
+				}
1024
+			}
1025
+
1026
+
1027
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
+			$html .= '</span>';
1030
+
1031
+			if (count($option_values) > 1) {
1032
+				$html .= '<ul>';
1033
+
1034
+				foreach ($option_values as $val) {
1035
+					$html .= '<li>' . $val . '</li>';
1036
+				}
1037
+
1038
+				$html .= '</ul>';
1039
+			} else {
1040
+				$html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
+			}
1042
+
1043
+			$html .= '</div>';
1044
+		endif;
1045
+
1046
+	}
1047
+
1048
+	return $html;
1049 1049
 }
1050 1050
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1051 1051
 
@@ -1062,155 +1062,155 @@  discard block
 block discarded – undo
1062 1062
  */
1063 1063
 function geodir_cf_email($html,$location,$cf,$p=''){
1064 1064
 
1065
-    // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1068
-
1069
-    if(!is_array($cf) && $cf!=''){
1070
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1072
-    }
1073
-
1074
-    $html_var = $cf['htmlvar_name'];
1075
-
1076
-    // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
-        /**
1079
-         * Filter the email html by location.
1080
-         *
1081
-         * @param string $html The html to filter.
1082
-         * @param array $cf The custom field array.
1083
-         * @since 1.6.6
1084
-         */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
-    }
1087
-
1088
-    // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
-        /**
1091
-         * Filter the email html by individual custom field.
1092
-         *
1093
-         * @param string $html The html to filter.
1094
-         * @param string $location The location to output the html.
1095
-         * @param array $cf The custom field array.
1096
-         * @since 1.6.6
1097
-         */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
-    }
1100
-
1101
-    // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
-        /**
1104
-         * Filter the email html by field type key.
1105
-         *
1106
-         * @param string $html The html to filter.
1107
-         * @param string $location The location to output the html.
1108
-         * @param array $cf The custom field array.
1109
-         * @since 1.6.6
1110
-         */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
-    }
1113
-
1114
-    // If not html then we run the standard output.
1115
-    if(empty($html)){
1116
-
1117
-        global $preview;
1118
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1120
-        }
1121
-
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
-
1124
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125
-            global $send_to_friend;
1126
-            $send_to_friend = true;
1127
-            $b_send_inquiry = '';
1128
-            $b_sendtofriend = '';
1129
-
1130
-            $html = '';
1131
-            if (!$preview) {
1132
-                $b_send_inquiry = 'b_send_inquiry';
1133
-                $b_sendtofriend = 'b_sendtofriend';
1134
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1135
-            }
1136
-
1137
-            $field_icon = geodir_field_icon_proccess($cf);
1138
-            if (strpos($field_icon, 'http') !== false) {
1139
-                $field_icon_af = '';
1140
-            } elseif ($field_icon == '') {
1141
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1142
-            } else {
1143
-                $field_icon_af = $field_icon;
1144
-                $field_icon = '';
1145
-            }
1146
-
1147
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1148
-            $seperator = '';
1149
-            if ($post->{$cf['htmlvar_name']}) {
1150
-                $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1152
-                $seperator = ' | ';
1153
-            }
1154
-
1155
-            if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156
-                $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
-                $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1158
-            }
1159
-
1160
-            $html .= '</span></div>';
1161
-
1162
-
1163
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1165
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1167
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1169
-            }
1170
-
1171
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1172
-
1173
-        } else {
1174
-
1175
-            if ($post->{$cf['htmlvar_name']}) {
1176
-
1177
-                $field_icon = geodir_field_icon_proccess($cf);
1178
-                if (strpos($field_icon, 'http') !== false) {
1179
-                    $field_icon_af = '';
1180
-                } elseif ($field_icon == '') {
1181
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1182
-                } else {
1183
-                    $field_icon_af = $field_icon;
1184
-                    $field_icon = '';
1185
-                }
1186
-
1187
-
1188
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1190
-                $html .= '</span><span class="geodir-email-address-output">';
1191
-                $email = $post->{$cf['htmlvar_name']} ;
1192
-                if($e_split = explode('@',$email)){
1193
-                    /**
1194
-                     * Filter email custom field name output.
1195
-                     *
1196
-                     * @since 1.5.3
1197
-                     *
1198
-                     * @param string $email The email string being output.
1199
-                     * @param array $cf Custom field variables array.
1200
-                     */
1201
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
-                }else{
1204
-                    $html .=  $email;
1205
-                }
1206
-                $html .= '</span></div>';
1207
-            }
1208
-
1209
-        }
1210
-
1211
-    }
1212
-
1213
-    return $html;
1065
+	// check we have the post value
1066
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1067
+	else{ global $post;}
1068
+
1069
+	if(!is_array($cf) && $cf!=''){
1070
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
+		if(!$cf){return NULL;}
1072
+	}
1073
+
1074
+	$html_var = $cf['htmlvar_name'];
1075
+
1076
+	// Check if there is a location specific filter.
1077
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
+		/**
1079
+		 * Filter the email html by location.
1080
+		 *
1081
+		 * @param string $html The html to filter.
1082
+		 * @param array $cf The custom field array.
1083
+		 * @since 1.6.6
1084
+		 */
1085
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
+	}
1087
+
1088
+	// Check if there is a custom field specific filter.
1089
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
+		/**
1091
+		 * Filter the email html by individual custom field.
1092
+		 *
1093
+		 * @param string $html The html to filter.
1094
+		 * @param string $location The location to output the html.
1095
+		 * @param array $cf The custom field array.
1096
+		 * @since 1.6.6
1097
+		 */
1098
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
+	}
1100
+
1101
+	// Check if there is a custom field key specific filter.
1102
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
+		/**
1104
+		 * Filter the email html by field type key.
1105
+		 *
1106
+		 * @param string $html The html to filter.
1107
+		 * @param string $location The location to output the html.
1108
+		 * @param array $cf The custom field array.
1109
+		 * @since 1.6.6
1110
+		 */
1111
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
+	}
1113
+
1114
+	// If not html then we run the standard output.
1115
+	if(empty($html)){
1116
+
1117
+		global $preview;
1118
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1120
+		}
1121
+
1122
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
+
1124
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125
+			global $send_to_friend;
1126
+			$send_to_friend = true;
1127
+			$b_send_inquiry = '';
1128
+			$b_sendtofriend = '';
1129
+
1130
+			$html = '';
1131
+			if (!$preview) {
1132
+				$b_send_inquiry = 'b_send_inquiry';
1133
+				$b_sendtofriend = 'b_sendtofriend';
1134
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1135
+			}
1136
+
1137
+			$field_icon = geodir_field_icon_proccess($cf);
1138
+			if (strpos($field_icon, 'http') !== false) {
1139
+				$field_icon_af = '';
1140
+			} elseif ($field_icon == '') {
1141
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1142
+			} else {
1143
+				$field_icon_af = $field_icon;
1144
+				$field_icon = '';
1145
+			}
1146
+
1147
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1148
+			$seperator = '';
1149
+			if ($post->{$cf['htmlvar_name']}) {
1150
+				$b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
+				$html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1152
+				$seperator = ' | ';
1153
+			}
1154
+
1155
+			if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156
+				$b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
+				$html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1158
+			}
1159
+
1160
+			$html .= '</span></div>';
1161
+
1162
+
1163
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1165
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1167
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1169
+			}
1170
+
1171
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1172
+
1173
+		} else {
1174
+
1175
+			if ($post->{$cf['htmlvar_name']}) {
1176
+
1177
+				$field_icon = geodir_field_icon_proccess($cf);
1178
+				if (strpos($field_icon, 'http') !== false) {
1179
+					$field_icon_af = '';
1180
+				} elseif ($field_icon == '') {
1181
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1182
+				} else {
1183
+					$field_icon_af = $field_icon;
1184
+					$field_icon = '';
1185
+				}
1186
+
1187
+
1188
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1190
+				$html .= '</span><span class="geodir-email-address-output">';
1191
+				$email = $post->{$cf['htmlvar_name']} ;
1192
+				if($e_split = explode('@',$email)){
1193
+					/**
1194
+					 * Filter email custom field name output.
1195
+					 *
1196
+					 * @since 1.5.3
1197
+					 *
1198
+					 * @param string $email The email string being output.
1199
+					 * @param array $cf Custom field variables array.
1200
+					 */
1201
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
+				}else{
1204
+					$html .=  $email;
1205
+				}
1206
+				$html .= '</span></div>';
1207
+			}
1208
+
1209
+		}
1210
+
1211
+	}
1212
+
1213
+	return $html;
1214 1214
 }
1215 1215
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1216 1216
 
@@ -1227,136 +1227,136 @@  discard block
 block discarded – undo
1227 1227
  */
1228 1228
 function geodir_cf_file($html,$location,$cf,$p=''){
1229 1229
 
1230
-    // check we have the post value
1231
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1232
-    else{ global $post;}
1233
-
1234
-    if(!is_array($cf) && $cf!=''){
1235
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
-        if(!$cf){return NULL;}
1237
-    }
1238
-
1239
-    $html_var = $cf['htmlvar_name'];
1240
-
1241
-    // Check if there is a location specific filter.
1242
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1243
-        /**
1244
-         * Filter the file html by location.
1245
-         *
1246
-         * @param string $html The html to filter.
1247
-         * @param array $cf The custom field array.
1248
-         * @since 1.6.6
1249
-         */
1250
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1251
-    }
1252
-
1253
-    // Check if there is a custom field specific filter.
1254
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1255
-        /**
1256
-         * Filter the file html by individual custom field.
1257
-         *
1258
-         * @param string $html The html to filter.
1259
-         * @param string $location The location to output the html.
1260
-         * @param array $cf The custom field array.
1261
-         * @since 1.6.6
1262
-         */
1263
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1264
-    }
1265
-
1266
-    // Check if there is a custom field key specific filter.
1267
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1268
-        /**
1269
-         * Filter the file html by field type key.
1270
-         *
1271
-         * @param string $html The html to filter.
1272
-         * @param string $location The location to output the html.
1273
-         * @param array $cf The custom field array.
1274
-         * @since 1.6.6
1275
-         */
1276
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1277
-    }
1278
-
1279
-    // If not html then we run the standard output.
1280
-    if(empty($html)){
1281
-
1282
-        if (!empty($post->{$cf['htmlvar_name']})):
1283
-
1284
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1285
-            if (!empty($files)):
1286
-
1287
-                $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
-                $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'] : '';
1289
-
1290
-                $file_paths = '';
1291
-                foreach ($files as $file) {
1292
-                    if (!empty($file)) {
1293
-
1294
-                        // $filetype = wp_check_filetype($file);
1295
-
1296
-                        $image_name_arr = explode('/', $file);
1297
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1298
-                        $filename = end($image_name_arr);
1299
-                        $img_name_arr = explode('.', $filename);
1300
-
1301
-                        $arr_file_type = wp_check_filetype($filename);
1302
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1303
-                            continue;
1304
-                        }
1305
-
1306
-                        $uploaded_file_type = $arr_file_type['type'];
1307
-                        $uploaded_file_ext = $arr_file_type['ext'];
1308
-
1309
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1310
-                            continue; // Invalid file type.
1311
-                        }
1312
-
1313
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1314
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1315
-                        $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
1316
-
1317
-                        // If the uploaded file is image
1318
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1319
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1320
-                            $file_paths .= '<a href="'.$file.'">';
1321
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1322
-                            $file_paths .= '</a>';
1323
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1324
-                            $file_paths .= '</div>';
1325
-                        }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1326
-                            $ext_path = '_' . $html_var . '_';
1327
-                            $filename = explode($ext_path, $filename);
1328
-                            $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
1329
-                            $file_paths .= do_shortcode('[audio src="'.$file.'" ]');
1330
-                        } else {
1331
-                            $ext_path = '_' . $html_var . '_';
1332
-                            $filename = explode($ext_path, $filename);
1333
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1334
-                        }
1335
-                    }
1336
-                }
1337
-
1338
-                $field_icon = geodir_field_icon_proccess($cf);
1339
-                if (strpos($field_icon, 'http') !== false) {
1340
-                    $field_icon_af = '';
1341
-                } elseif ($field_icon == '') {
1342
-                    $field_icon_af = '';
1343
-                } else {
1344
-                    $field_icon_af = $field_icon;
1345
-                    $field_icon = '';
1346
-                }
1347
-
1348
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1349
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1350
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1351
-                $html .= '</span>';
1352
-                $html .= $file_paths . '</div></div>';
1353
-
1354
-            endif;
1355
-        endif;
1356
-
1357
-    }
1358
-
1359
-    return $html;
1230
+	// check we have the post value
1231
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1232
+	else{ global $post;}
1233
+
1234
+	if(!is_array($cf) && $cf!=''){
1235
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
+		if(!$cf){return NULL;}
1237
+	}
1238
+
1239
+	$html_var = $cf['htmlvar_name'];
1240
+
1241
+	// Check if there is a location specific filter.
1242
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1243
+		/**
1244
+		 * Filter the file html by location.
1245
+		 *
1246
+		 * @param string $html The html to filter.
1247
+		 * @param array $cf The custom field array.
1248
+		 * @since 1.6.6
1249
+		 */
1250
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1251
+	}
1252
+
1253
+	// Check if there is a custom field specific filter.
1254
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1255
+		/**
1256
+		 * Filter the file html by individual custom field.
1257
+		 *
1258
+		 * @param string $html The html to filter.
1259
+		 * @param string $location The location to output the html.
1260
+		 * @param array $cf The custom field array.
1261
+		 * @since 1.6.6
1262
+		 */
1263
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1264
+	}
1265
+
1266
+	// Check if there is a custom field key specific filter.
1267
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1268
+		/**
1269
+		 * Filter the file html by field type key.
1270
+		 *
1271
+		 * @param string $html The html to filter.
1272
+		 * @param string $location The location to output the html.
1273
+		 * @param array $cf The custom field array.
1274
+		 * @since 1.6.6
1275
+		 */
1276
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1277
+	}
1278
+
1279
+	// If not html then we run the standard output.
1280
+	if(empty($html)){
1281
+
1282
+		if (!empty($post->{$cf['htmlvar_name']})):
1283
+
1284
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1285
+			if (!empty($files)):
1286
+
1287
+				$extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
+				$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'] : '';
1289
+
1290
+				$file_paths = '';
1291
+				foreach ($files as $file) {
1292
+					if (!empty($file)) {
1293
+
1294
+						// $filetype = wp_check_filetype($file);
1295
+
1296
+						$image_name_arr = explode('/', $file);
1297
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1298
+						$filename = end($image_name_arr);
1299
+						$img_name_arr = explode('.', $filename);
1300
+
1301
+						$arr_file_type = wp_check_filetype($filename);
1302
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1303
+							continue;
1304
+						}
1305
+
1306
+						$uploaded_file_type = $arr_file_type['type'];
1307
+						$uploaded_file_ext = $arr_file_type['ext'];
1308
+
1309
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1310
+							continue; // Invalid file type.
1311
+						}
1312
+
1313
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1314
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1315
+						$audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
1316
+
1317
+						// If the uploaded file is image
1318
+						if (in_array($uploaded_file_type, $image_file_types)) {
1319
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1320
+							$file_paths .= '<a href="'.$file.'">';
1321
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1322
+							$file_paths .= '</a>';
1323
+							//$file_paths .= '<img src="'.$file.'"  />';	
1324
+							$file_paths .= '</div>';
1325
+						}elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1326
+							$ext_path = '_' . $html_var . '_';
1327
+							$filename = explode($ext_path, $filename);
1328
+							$file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
1329
+							$file_paths .= do_shortcode('[audio src="'.$file.'" ]');
1330
+						} else {
1331
+							$ext_path = '_' . $html_var . '_';
1332
+							$filename = explode($ext_path, $filename);
1333
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1334
+						}
1335
+					}
1336
+				}
1337
+
1338
+				$field_icon = geodir_field_icon_proccess($cf);
1339
+				if (strpos($field_icon, 'http') !== false) {
1340
+					$field_icon_af = '';
1341
+				} elseif ($field_icon == '') {
1342
+					$field_icon_af = '';
1343
+				} else {
1344
+					$field_icon_af = $field_icon;
1345
+					$field_icon = '';
1346
+				}
1347
+
1348
+				$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1349
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1350
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1351
+				$html .= '</span>';
1352
+				$html .= $file_paths . '</div></div>';
1353
+
1354
+			endif;
1355
+		endif;
1356
+
1357
+	}
1358
+
1359
+	return $html;
1360 1360
 }
1361 1361
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1362 1362
 
@@ -1374,80 +1374,80 @@  discard block
 block discarded – undo
1374 1374
  */
1375 1375
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1376 1376
 
1377
-    // check we have the post value
1378
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1379
-    else{ global $post;}
1380
-
1381
-    if(!is_array($cf) && $cf!=''){
1382
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1383
-        if(!$cf){return NULL;}
1384
-    }
1385
-
1386
-    $html_var = $cf['htmlvar_name'];
1387
-
1388
-    // Check if there is a location specific filter.
1389
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1390
-        /**
1391
-         * Filter the textarea html by location.
1392
-         *
1393
-         * @param string $html The html to filter.
1394
-         * @param array $cf The custom field array.
1395
-         * @since 1.6.6
1396
-         */
1397
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1398
-    }
1399
-
1400
-    // Check if there is a custom field specific filter.
1401
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1402
-        /**
1403
-         * Filter the textarea html by individual custom field.
1404
-         *
1405
-         * @param string $html The html to filter.
1406
-         * @param string $location The location to output the html.
1407
-         * @param array $cf The custom field array.
1408
-         * @since 1.6.6
1409
-         */
1410
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1411
-    }
1412
-
1413
-    // Check if there is a custom field key specific filter.
1414
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1415
-        /**
1416
-         * Filter the textarea html by field type key.
1417
-         *
1418
-         * @param string $html The html to filter.
1419
-         * @param string $location The location to output the html.
1420
-         * @param array $cf The custom field array.
1421
-         * @since 1.6.6
1422
-         */
1423
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1424
-    }
1425
-
1426
-    // If not html then we run the standard output.
1427
-    if(empty($html)){
1428
-
1429
-        if (!empty($post->{$cf['htmlvar_name']})) {
1430
-
1431
-            $field_icon = geodir_field_icon_proccess($cf);
1432
-            if (strpos($field_icon, 'http') !== false) {
1433
-                $field_icon_af = '';
1434
-            } elseif ($field_icon == '') {
1435
-                $field_icon_af = '';
1436
-            } else {
1437
-                $field_icon_af = $field_icon;
1438
-                $field_icon = '';
1439
-            }
1440
-
1441
-
1442
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1443
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1444
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1445
-
1446
-        }
1447
-
1448
-    }
1449
-
1450
-    return $html;
1377
+	// check we have the post value
1378
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1379
+	else{ global $post;}
1380
+
1381
+	if(!is_array($cf) && $cf!=''){
1382
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1383
+		if(!$cf){return NULL;}
1384
+	}
1385
+
1386
+	$html_var = $cf['htmlvar_name'];
1387
+
1388
+	// Check if there is a location specific filter.
1389
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1390
+		/**
1391
+		 * Filter the textarea html by location.
1392
+		 *
1393
+		 * @param string $html The html to filter.
1394
+		 * @param array $cf The custom field array.
1395
+		 * @since 1.6.6
1396
+		 */
1397
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1398
+	}
1399
+
1400
+	// Check if there is a custom field specific filter.
1401
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1402
+		/**
1403
+		 * Filter the textarea html by individual custom field.
1404
+		 *
1405
+		 * @param string $html The html to filter.
1406
+		 * @param string $location The location to output the html.
1407
+		 * @param array $cf The custom field array.
1408
+		 * @since 1.6.6
1409
+		 */
1410
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1411
+	}
1412
+
1413
+	// Check if there is a custom field key specific filter.
1414
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1415
+		/**
1416
+		 * Filter the textarea html by field type key.
1417
+		 *
1418
+		 * @param string $html The html to filter.
1419
+		 * @param string $location The location to output the html.
1420
+		 * @param array $cf The custom field array.
1421
+		 * @since 1.6.6
1422
+		 */
1423
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1424
+	}
1425
+
1426
+	// If not html then we run the standard output.
1427
+	if(empty($html)){
1428
+
1429
+		if (!empty($post->{$cf['htmlvar_name']})) {
1430
+
1431
+			$field_icon = geodir_field_icon_proccess($cf);
1432
+			if (strpos($field_icon, 'http') !== false) {
1433
+				$field_icon_af = '';
1434
+			} elseif ($field_icon == '') {
1435
+				$field_icon_af = '';
1436
+			} else {
1437
+				$field_icon_af = $field_icon;
1438
+				$field_icon = '';
1439
+			}
1440
+
1441
+
1442
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1443
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1444
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1445
+
1446
+		}
1447
+
1448
+	}
1449
+
1450
+	return $html;
1451 1451
 }
1452 1452
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1453 1453
 
@@ -1465,79 +1465,79 @@  discard block
 block discarded – undo
1465 1465
  */
1466 1466
 function geodir_cf_html($html,$location,$cf,$p=''){
1467 1467
 
1468
-    // check we have the post value
1469
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1470
-    else{ global $post;}
1471
-
1472
-    if(!is_array($cf) && $cf!=''){
1473
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1474
-        if(!$cf){return NULL;}
1475
-    }
1476
-
1477
-    $html_var = $cf['htmlvar_name'];
1478
-
1479
-    // Check if there is a location specific filter.
1480
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1481
-        /**
1482
-         * Filter the html html by location.
1483
-         *
1484
-         * @param string $html The html to filter.
1485
-         * @param array $cf The custom field array.
1486
-         * @since 1.6.6
1487
-         */
1488
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1489
-    }
1490
-
1491
-    // Check if there is a custom field specific filter.
1492
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1493
-        /**
1494
-         * Filter the html html by individual custom field.
1495
-         *
1496
-         * @param string $html The html to filter.
1497
-         * @param string $location The location to output the html.
1498
-         * @param array $cf The custom field array.
1499
-         * @since 1.6.6
1500
-         */
1501
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1502
-    }
1503
-
1504
-    // Check if there is a custom field key specific filter.
1505
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1506
-        /**
1507
-         * Filter the html html by field type key.
1508
-         *
1509
-         * @param string $html The html to filter.
1510
-         * @param string $location The location to output the html.
1511
-         * @param array $cf The custom field array.
1512
-         * @since 1.6.6
1513
-         */
1514
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1515
-    }
1516
-
1517
-    // If not html then we run the standard output.
1518
-    if(empty($html)){
1519
-
1520
-        if (!empty($post->{$cf['htmlvar_name']})) {
1521
-
1522
-            $field_icon = geodir_field_icon_proccess($cf);
1523
-            if (strpos($field_icon, 'http') !== false) {
1524
-                $field_icon_af = '';
1525
-            } elseif ($field_icon == '') {
1526
-                $field_icon_af = '';
1527
-            } else {
1528
-                $field_icon_af = $field_icon;
1529
-                $field_icon = '';
1530
-            }
1531
-
1532
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1533
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1534
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1535
-
1536
-        }
1537
-
1538
-    }
1539
-
1540
-    return $html;
1468
+	// check we have the post value
1469
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1470
+	else{ global $post;}
1471
+
1472
+	if(!is_array($cf) && $cf!=''){
1473
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1474
+		if(!$cf){return NULL;}
1475
+	}
1476
+
1477
+	$html_var = $cf['htmlvar_name'];
1478
+
1479
+	// Check if there is a location specific filter.
1480
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1481
+		/**
1482
+		 * Filter the html html by location.
1483
+		 *
1484
+		 * @param string $html The html to filter.
1485
+		 * @param array $cf The custom field array.
1486
+		 * @since 1.6.6
1487
+		 */
1488
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1489
+	}
1490
+
1491
+	// Check if there is a custom field specific filter.
1492
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1493
+		/**
1494
+		 * Filter the html html by individual custom field.
1495
+		 *
1496
+		 * @param string $html The html to filter.
1497
+		 * @param string $location The location to output the html.
1498
+		 * @param array $cf The custom field array.
1499
+		 * @since 1.6.6
1500
+		 */
1501
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1502
+	}
1503
+
1504
+	// Check if there is a custom field key specific filter.
1505
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1506
+		/**
1507
+		 * Filter the html html by field type key.
1508
+		 *
1509
+		 * @param string $html The html to filter.
1510
+		 * @param string $location The location to output the html.
1511
+		 * @param array $cf The custom field array.
1512
+		 * @since 1.6.6
1513
+		 */
1514
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1515
+	}
1516
+
1517
+	// If not html then we run the standard output.
1518
+	if(empty($html)){
1519
+
1520
+		if (!empty($post->{$cf['htmlvar_name']})) {
1521
+
1522
+			$field_icon = geodir_field_icon_proccess($cf);
1523
+			if (strpos($field_icon, 'http') !== false) {
1524
+				$field_icon_af = '';
1525
+			} elseif ($field_icon == '') {
1526
+				$field_icon_af = '';
1527
+			} else {
1528
+				$field_icon_af = $field_icon;
1529
+				$field_icon = '';
1530
+			}
1531
+
1532
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1533
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1534
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1535
+
1536
+		}
1537
+
1538
+	}
1539
+
1540
+	return $html;
1541 1541
 }
1542 1542
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1543 1543
 
@@ -1555,113 +1555,113 @@  discard block
 block discarded – undo
1555 1555
  */
1556 1556
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1557 1557
 
1558
-    // check we have the post value
1559
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1560
-    else{ global $post;}
1561
-
1562
-    if(!is_array($cf) && $cf!=''){
1563
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1564
-        if(!$cf){return NULL;}
1565
-    }
1566
-
1567
-    $html_var = $cf['htmlvar_name'];
1568
-
1569
-    // Check if there is a location specific filter.
1570
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1571
-        /**
1572
-         * Filter the taxonomy html by location.
1573
-         *
1574
-         * @param string $html The html to filter.
1575
-         * @param array $cf The custom field array.
1576
-         * @since 1.6.6
1577
-         */
1578
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1579
-    }
1580
-
1581
-    // Check if there is a custom field specific filter.
1582
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1583
-        /**
1584
-         * Filter the taxonomy html by individual custom field.
1585
-         *
1586
-         * @param string $html The html to filter.
1587
-         * @param string $location The location to output the html.
1588
-         * @param array $cf The custom field array.
1589
-         * @since 1.6.6
1590
-         */
1591
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1592
-    }
1593
-
1594
-    // Check if there is a custom field key specific filter.
1595
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1596
-        /**
1597
-         * Filter the taxonomy html by field type key.
1598
-         *
1599
-         * @param string $html The html to filter.
1600
-         * @param string $location The location to output the html.
1601
-         * @param array $cf The custom field array.
1602
-         * @since 1.6.6
1603
-         */
1604
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1605
-    }
1606
-
1607
-    // If not html then we run the standard output.
1608
-    if(empty($html)){
1609
-
1610
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1611
-            $post_taxonomy = $post->post_type . 'category';
1612
-            $field_value = $post->{$html_var};
1613
-            $links = array();
1614
-            $terms = array();
1615
-            $termsOrdered = array();
1616
-            if (!is_array($field_value)) {
1617
-                $field_value = explode(",", trim($field_value, ","));
1618
-            }
1619
-
1620
-            $field_value = array_unique($field_value);
1621
-
1622
-            if (!empty($field_value)) {
1623
-                foreach ($field_value as $term) {
1624
-                    $term = trim($term);
1625
-
1626
-                    if ($term != '') {
1627
-                        $term = get_term_by('id', $term, $html_var);
1628
-                        if (is_object($term)) {
1629
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1630
-                            $terms[] = $term;
1631
-                        }
1632
-                    }
1633
-                }
1634
-                if (!empty($links)) {
1635
-                    // order alphabetically
1636
-                    asort($links);
1637
-                    foreach (array_keys($links) as $key) {
1638
-                        $termsOrdered[$key] = $terms[$key];
1639
-                    }
1640
-                    $terms = $termsOrdered;
1641
-                }
1642
-            }
1643
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1644
-
1645
-            if ($html_value != '') {
1646
-                $field_icon = geodir_field_icon_proccess($cf);
1647
-                if (strpos($field_icon, 'http') !== false) {
1648
-                    $field_icon_af = '';
1649
-                } else if ($field_icon == '') {
1650
-                    $field_icon_af = '';
1651
-                } else {
1652
-                    $field_icon_af = $field_icon;
1653
-                    $field_icon = '';
1654
-                }
1655
-
1656
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1657
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1658
-                $html .= '</span> ' . $html_value . '</div>';
1659
-            }
1660
-        }
1661
-
1662
-    }
1663
-
1664
-    return $html;
1558
+	// check we have the post value
1559
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1560
+	else{ global $post;}
1561
+
1562
+	if(!is_array($cf) && $cf!=''){
1563
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1564
+		if(!$cf){return NULL;}
1565
+	}
1566
+
1567
+	$html_var = $cf['htmlvar_name'];
1568
+
1569
+	// Check if there is a location specific filter.
1570
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1571
+		/**
1572
+		 * Filter the taxonomy html by location.
1573
+		 *
1574
+		 * @param string $html The html to filter.
1575
+		 * @param array $cf The custom field array.
1576
+		 * @since 1.6.6
1577
+		 */
1578
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1579
+	}
1580
+
1581
+	// Check if there is a custom field specific filter.
1582
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1583
+		/**
1584
+		 * Filter the taxonomy html by individual custom field.
1585
+		 *
1586
+		 * @param string $html The html to filter.
1587
+		 * @param string $location The location to output the html.
1588
+		 * @param array $cf The custom field array.
1589
+		 * @since 1.6.6
1590
+		 */
1591
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1592
+	}
1593
+
1594
+	// Check if there is a custom field key specific filter.
1595
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1596
+		/**
1597
+		 * Filter the taxonomy html by field type key.
1598
+		 *
1599
+		 * @param string $html The html to filter.
1600
+		 * @param string $location The location to output the html.
1601
+		 * @param array $cf The custom field array.
1602
+		 * @since 1.6.6
1603
+		 */
1604
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1605
+	}
1606
+
1607
+	// If not html then we run the standard output.
1608
+	if(empty($html)){
1609
+
1610
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1611
+			$post_taxonomy = $post->post_type . 'category';
1612
+			$field_value = $post->{$html_var};
1613
+			$links = array();
1614
+			$terms = array();
1615
+			$termsOrdered = array();
1616
+			if (!is_array($field_value)) {
1617
+				$field_value = explode(",", trim($field_value, ","));
1618
+			}
1619
+
1620
+			$field_value = array_unique($field_value);
1621
+
1622
+			if (!empty($field_value)) {
1623
+				foreach ($field_value as $term) {
1624
+					$term = trim($term);
1625
+
1626
+					if ($term != '') {
1627
+						$term = get_term_by('id', $term, $html_var);
1628
+						if (is_object($term)) {
1629
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1630
+							$terms[] = $term;
1631
+						}
1632
+					}
1633
+				}
1634
+				if (!empty($links)) {
1635
+					// order alphabetically
1636
+					asort($links);
1637
+					foreach (array_keys($links) as $key) {
1638
+						$termsOrdered[$key] = $terms[$key];
1639
+					}
1640
+					$terms = $termsOrdered;
1641
+				}
1642
+			}
1643
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1644
+
1645
+			if ($html_value != '') {
1646
+				$field_icon = geodir_field_icon_proccess($cf);
1647
+				if (strpos($field_icon, 'http') !== false) {
1648
+					$field_icon_af = '';
1649
+				} else if ($field_icon == '') {
1650
+					$field_icon_af = '';
1651
+				} else {
1652
+					$field_icon_af = $field_icon;
1653
+					$field_icon = '';
1654
+				}
1655
+
1656
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1657
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1658
+				$html .= '</span> ' . $html_value . '</div>';
1659
+			}
1660
+		}
1661
+
1662
+	}
1663
+
1664
+	return $html;
1665 1665
 }
1666 1666
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1667 1667
 
@@ -1679,176 +1679,176 @@  discard block
 block discarded – undo
1679 1679
  */
1680 1680
 function geodir_cf_address($html,$location,$cf,$p=''){
1681 1681
 
1682
-    // check we have the post value
1683
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1684
-    else{ global $post;}
1685
-
1686
-    if(!is_array($cf) && $cf!=''){
1687
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1688
-        if(!$cf){return NULL;}
1689
-    }
1690
-
1691
-    $html_var = $cf['htmlvar_name'];
1692
-
1693
-    // Check if there is a location specific filter.
1694
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1695
-        /**
1696
-         * Filter the address html by location.
1697
-         *
1698
-         * @param string $html The html to filter.
1699
-         * @param array $cf The custom field array.
1700
-         * @since 1.6.6
1701
-         */
1702
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1703
-    }
1704
-
1705
-    // Check if there is a custom field specific filter.
1706
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1707
-        /**
1708
-         * Filter the address html by individual custom field.
1709
-         *
1710
-         * @param string $html The html to filter.
1711
-         * @param string $location The location to output the html.
1712
-         * @param array $cf The custom field array.
1713
-         * @since 1.6.6
1714
-         */
1715
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1716
-    }
1717
-
1718
-    // Check if there is a custom field key specific filter.
1719
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1720
-        /**
1721
-         * Filter the address html by field type key.
1722
-         *
1723
-         * @param string $html The html to filter.
1724
-         * @param string $location The location to output the html.
1725
-         * @param array $cf The custom field array.
1726
-         * @since 1.6.6
1727
-         */
1728
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1729
-    }
1730
-
1731
-    // If not html then we run the standard output.
1732
-    if(empty($html)){
1733
-
1734
-        global $preview;
1735
-        $html_var = $cf['htmlvar_name'] . '_address';
1736
-
1737
-        if ($cf['extra_fields']) {
1738
-
1739
-            $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1740
-
1741
-            $addition_fields = '';
1742
-
1743
-            if (!empty($extra_fields)) {
1744
-
1745
-                $show_city_in_address = false;
1746
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1747
-                    $show_city_in_address = true;
1748
-                }
1749
-                /**
1750
-                 * Filter "show city in address" value.
1751
-                 *
1752
-                 * @since 1.0.0
1753
-                 */
1754
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1755
-
1756
-
1757
-                $show_region_in_address = false;
1758
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1759
-                    $show_region_in_address = true;
1760
-                }
1761
-                /**
1762
-                 * Filter "show region in address" value.
1763
-                 *
1764
-                 * @since 1.6.6
1765
-                 */
1766
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1767
-
1768
-                $show_country_in_address = false;
1769
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1770
-                    $show_country_in_address = true;
1771
-                }
1772
-                /**
1773
-                 * Filter "show country in address" value.
1774
-                 *
1775
-                 * @since 1.6.6
1776
-                 */
1777
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1778
-
1779
-                $show_zip_in_address = false;
1780
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1781
-                    $show_zip_in_address = true;
1782
-                }
1783
-                /**
1784
-                 * Filter "show zip in address" value.
1785
-                 *
1786
-                 * @since 1.6.6
1787
-                 */
1788
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1789
-
1790
-
1791
-            }
1792
-
1793
-        }
1794
-
1795
-
1796
-        if ($post->{$html_var}) {
1797
-
1798
-            $field_icon = geodir_field_icon_proccess( $cf );
1799
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1800
-                $field_icon_af = '';
1801
-            } elseif ( $field_icon == '' ) {
1802
-                $field_icon_af = '<i class="fa fa-home"></i>';
1803
-            } else {
1804
-                $field_icon_af = $field_icon;
1805
-                $field_icon    = '';
1806
-            }
1682
+	// check we have the post value
1683
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1684
+	else{ global $post;}
1685
+
1686
+	if(!is_array($cf) && $cf!=''){
1687
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1688
+		if(!$cf){return NULL;}
1689
+	}
1690
+
1691
+	$html_var = $cf['htmlvar_name'];
1692
+
1693
+	// Check if there is a location specific filter.
1694
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1695
+		/**
1696
+		 * Filter the address html by location.
1697
+		 *
1698
+		 * @param string $html The html to filter.
1699
+		 * @param array $cf The custom field array.
1700
+		 * @since 1.6.6
1701
+		 */
1702
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1703
+	}
1704
+
1705
+	// Check if there is a custom field specific filter.
1706
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1707
+		/**
1708
+		 * Filter the address html by individual custom field.
1709
+		 *
1710
+		 * @param string $html The html to filter.
1711
+		 * @param string $location The location to output the html.
1712
+		 * @param array $cf The custom field array.
1713
+		 * @since 1.6.6
1714
+		 */
1715
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1716
+	}
1717
+
1718
+	// Check if there is a custom field key specific filter.
1719
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1720
+		/**
1721
+		 * Filter the address html by field type key.
1722
+		 *
1723
+		 * @param string $html The html to filter.
1724
+		 * @param string $location The location to output the html.
1725
+		 * @param array $cf The custom field array.
1726
+		 * @since 1.6.6
1727
+		 */
1728
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1729
+	}
1730
+
1731
+	// If not html then we run the standard output.
1732
+	if(empty($html)){
1733
+
1734
+		global $preview;
1735
+		$html_var = $cf['htmlvar_name'] . '_address';
1736
+
1737
+		if ($cf['extra_fields']) {
1738
+
1739
+			$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1740
+
1741
+			$addition_fields = '';
1742
+
1743
+			if (!empty($extra_fields)) {
1744
+
1745
+				$show_city_in_address = false;
1746
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1747
+					$show_city_in_address = true;
1748
+				}
1749
+				/**
1750
+				 * Filter "show city in address" value.
1751
+				 *
1752
+				 * @since 1.0.0
1753
+				 */
1754
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1755
+
1756
+
1757
+				$show_region_in_address = false;
1758
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1759
+					$show_region_in_address = true;
1760
+				}
1761
+				/**
1762
+				 * Filter "show region in address" value.
1763
+				 *
1764
+				 * @since 1.6.6
1765
+				 */
1766
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1767
+
1768
+				$show_country_in_address = false;
1769
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1770
+					$show_country_in_address = true;
1771
+				}
1772
+				/**
1773
+				 * Filter "show country in address" value.
1774
+				 *
1775
+				 * @since 1.6.6
1776
+				 */
1777
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1778
+
1779
+				$show_zip_in_address = false;
1780
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1781
+					$show_zip_in_address = true;
1782
+				}
1783
+				/**
1784
+				 * Filter "show zip in address" value.
1785
+				 *
1786
+				 * @since 1.6.6
1787
+				 */
1788
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1789
+
1790
+
1791
+			}
1792
+
1793
+		}
1794
+
1795
+
1796
+		if ($post->{$html_var}) {
1797
+
1798
+			$field_icon = geodir_field_icon_proccess( $cf );
1799
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1800
+				$field_icon_af = '';
1801
+			} elseif ( $field_icon == '' ) {
1802
+				$field_icon_af = '<i class="fa fa-home"></i>';
1803
+			} else {
1804
+				$field_icon_af = $field_icon;
1805
+				$field_icon    = '';
1806
+			}
1807 1807
             
1808
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1809
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1810
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1811
-            $html .= '</span>';
1808
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1809
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1810
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1811
+			$html .= '</span>';
1812 1812
             
1813
-            $address_fields = array();
1814
-
1815
-            if ( isset($post->post_address) ) {
1816
-                $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>';
1817
-            }
1818
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1819
-                $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>';
1820
-            }
1821
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1822
-                $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>';
1823
-            }
1824
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1825
-                $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>';
1826
-            }
1827
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1828
-                $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>';
1829
-            }
1813
+			$address_fields = array();
1814
+
1815
+			if ( isset($post->post_address) ) {
1816
+				$address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>';
1817
+			}
1818
+			if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1819
+				$address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>';
1820
+			}
1821
+			if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1822
+				$address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>';
1823
+			}
1824
+			if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1825
+				$address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>';
1826
+			}
1827
+			if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1828
+				$address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>';
1829
+			}
1830 1830
             
1831
-            /**
1832
-             * Filter the address fields array being displayed.
1833
-             *
1834
-             * @param array $address_fields The array of address fields.
1835
-             * @param object $post The current post object.
1836
-             * @param array $cf The custom field array details.
1837
-             * @param string $location The location to output the html.
1838
-             * 
1839
-             * @since 1.6.21
1840
-             */
1841
-            $address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location);
1831
+			/**
1832
+			 * Filter the address fields array being displayed.
1833
+			 *
1834
+			 * @param array $address_fields The array of address fields.
1835
+			 * @param object $post The current post object.
1836
+			 * @param array $cf The custom field array details.
1837
+			 * @param string $location The location to output the html.
1838
+			 * 
1839
+			 * @since 1.6.21
1840
+			 */
1841
+			$address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location);
1842 1842
             
1843
-            if (!empty($address_fields) && is_array($address_fields)) {
1844
-                $address_fields = array_values($address_fields);
1845
-                $html .= implode('<br>', $address_fields);
1846
-            }
1843
+			if (!empty($address_fields) && is_array($address_fields)) {
1844
+				$address_fields = array_values($address_fields);
1845
+				$html .= implode('<br>', $address_fields);
1846
+			}
1847 1847
             
1848
-            $html .= '</div>';
1849
-        }
1850
-    }
1848
+			$html .= '</div>';
1849
+		}
1850
+	}
1851 1851
 
1852
-    return $html;
1852
+	return $html;
1853 1853
 }
1854 1854
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1855 1855
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return string The html to output for the custom field.
21 21
  */
22
-function geodir_cf_checkbox($html,$location,$cf,$p=''){
22
+function geodir_cf_checkbox($html, $location, $cf, $p = '') {
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
26
+    else { global $post; }
27 27
 
28
-    if(!is_array($cf) && $cf!=''){
28
+    if (!is_array($cf) && $cf != '') {
29 29
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
30
+        if (!$cf) {return NULL; }
31 31
     }
32 32
 
33 33
     $html_var = $cf['htmlvar_name'];
34 34
 
35 35
     // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) {
37 37
         /**
38 38
          * Filter the checkbox html by location.
39 39
          *
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          * @param array $cf The custom field array.
42 42
          * @since 1.6.6
43 43
          */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf);
45 45
     }
46 46
 
47 47
     // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) {
49 49
         /**
50 50
          * Filter the checkbox html by individual custom field.
51 51
          *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
          * @param array $cf The custom field array.
55 55
          * @since 1.6.6
56 56
          */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) {
62 62
         /**
63 63
          * Filter the checkbox html by field type key.
64 64
          *
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
          * @param array $cf The custom field array.
68 68
          * @since 1.6.6
69 69
          */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
70
+        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf);
71 71
     }
72 72
 
73 73
     // If not html then we run the standard output.
74
-    if(empty($html)){
74
+    if (empty($html)) {
75 75
 
76
-        if ( (int) $post->{$html_var} == 1 ):
76
+        if ((int) $post->{$html_var} == 1):
77 77
 
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
78
+            if ($post->{$html_var} == '1'):
79
+                $html_val = __('Yes', 'geodirectory');
80 80
             else:
81
-                $html_val = __( 'No', 'geodirectory' );
81
+                $html_val = __('No', 'geodirectory');
82 82
             endif;
83 83
 
84 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
                 $field_icon = '';
92 92
             }
93 93
 
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
94
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
95
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
96
+            $html .= '</span>'.$html_val.'</div>';
97 97
         endif;
98 98
 
99 99
     }
100 100
 
101 101
     return $html;
102 102
 }
103
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
104 104
 
105 105
 
106 106
 /**
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string The html to output for the custom field.
115 115
  */
116
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
116
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
117 117
 
118 118
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
119
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
120
+    else { global $post; }
121 121
 
122
-    if(!is_array($cf) && $cf!=''){
122
+    if (!is_array($cf) && $cf != '') {
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
124
+        if (!$cf) {return NULL; }
125 125
     }
126 126
 
127 127
     $html_var = $cf['htmlvar_name'];
128 128
 
129 129
     // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
130
+    if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) {
131 131
         /**
132 132
          * Filter the fieldset html by location.
133 133
          *
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
          * @param array $cf The custom field array.
136 136
          * @since 1.6.6
137 137
          */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
138
+        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf);
139 139
     }
140 140
 
141 141
     // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
142
+    if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) {
143 143
         /**
144 144
          * Filter the fieldset html by individual custom field.
145 145
          *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
          * @param array $cf The custom field array.
149 149
          * @since 1.6.6
150 150
          */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
151
+        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf);
152 152
     }
153 153
 
154 154
     // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
155
+    if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) {
156 156
         /**
157 157
          * Filter the fieldset html by field type key.
158 158
          *
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
          * @param array $cf The custom field array.
162 162
          * @since 1.6.6
163 163
          */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
164
+        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf);
165 165
     }
166 166
 
167 167
     // If not html then we run the standard output.
168
-    if(empty($html)){
168
+    if (empty($html)) {
169 169
 
170 170
         global $field_set_start;
171 171
         $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         if ($field_set_start == 1) {
174 174
             $html = '';
175 175
         } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
176
+            $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
177 177
             //$field_set_start = 1;
178 178
         }
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     return $html;
183 183
 }
184
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
184
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
185 185
 
186 186
 
187 187
 /**
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return string The html to output for the custom field.
196 196
  */
197
-function geodir_cf_url($html,$location,$cf,$p=''){
197
+function geodir_cf_url($html, $location, $cf, $p = '') {
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
201
+    else { global $post; }
202 202
 
203
-    if(!is_array($cf) && $cf!=''){
203
+    if (!is_array($cf) && $cf != '') {
204 204
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
205
+        if (!$cf) {return NULL; }
206 206
     }
207 207
 
208 208
     $html_var = $cf['htmlvar_name'];
209 209
 
210 210
     // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
211
+    if (has_filter("geodir_custom_field_output_url_loc_{$location}")) {
212 212
         /**
213 213
          * Filter the url html by location.
214 214
          *
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
          * @param array $cf The custom field array.
217 217
          * @since 1.6.6
218 218
          */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
219
+        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf);
220 220
     }
221 221
 
222 222
     // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
223
+    if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) {
224 224
         /**
225 225
          * Filter the url html by individual custom field.
226 226
          *
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
          * @param array $cf The custom field array.
230 230
          * @since 1.6.6
231 231
          */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
232
+        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf);
233 233
     }
234 234
 
235 235
     // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
236
+    if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) {
237 237
         /**
238 238
          * Filter the url html by field type key.
239 239
          *
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
          * @param array $cf The custom field array.
243 243
          * @since 1.6.6
244 244
          */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
245
+        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf);
246 246
     }
247 247
 
248 248
     // If not html then we run the standard output.
249
-    if(empty($html)){
249
+    if (empty($html)) {
250 250
 
251 251
         if ($post->{$cf['htmlvar_name']}):
252 252
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
275 275
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
276
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
277 277
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278 278
 
279 279
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
              * @param string $website Website URL.
290 290
              * @param int $post->ID Post ID.
291 291
              */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
292
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
293 293
 
294 294
         endif;
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     return $html;
299 299
 }
300
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
300
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
301 301
 
302 302
 
303 303
 /**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
  *
311 311
  * @return string The html to output for the custom field.
312 312
  */
313
-function geodir_cf_phone($html,$location,$cf,$p=''){
313
+function geodir_cf_phone($html, $location, $cf, $p = '') {
314 314
 
315 315
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
316
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
317
+    else { global $post; }
318 318
 
319
-    if(!is_array($cf) && $cf!=''){
319
+    if (!is_array($cf) && $cf != '') {
320 320
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
321
+        if (!$cf) {return NULL; }
322 322
     }
323 323
 
324 324
     $html_var = $cf['htmlvar_name'];
325 325
 
326 326
     // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
327
+    if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) {
328 328
         /**
329 329
          * Filter the phone html by location.
330 330
          *
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
          * @param array $cf The custom field array.
333 333
          * @since 1.6.6
334 334
          */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
335
+        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf);
336 336
     }
337 337
 
338 338
     // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
339
+    if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) {
340 340
         /**
341 341
          * Filter the phone html by individual custom field.
342 342
          *
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
          * @param array $cf The custom field array.
346 346
          * @since 1.6.6
347 347
          */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
348
+        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf);
349 349
     }
350 350
 
351 351
     // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
352
+    if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) {
353 353
         /**
354 354
          * Filter the phone html by field type key.
355 355
          *
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
          * @param array $cf The custom field array.
359 359
          * @since 1.6.6
360 360
          */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
361
+        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf);
362 362
     }
363 363
 
364 364
     // If not html then we run the standard output.
365
-    if(empty($html)){
365
+    if (empty($html)) {
366 366
 
367 367
         if ($post->{$cf['htmlvar_name']}):
368 368
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
             }
378 378
 
379 379
 
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
380
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.
381
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
382
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
383 383
 
384 384
         endif;
385 385
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     return $html;
389 389
 }
390
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
390
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
391 391
 
392 392
 
393 393
 /**
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string The html to output for the custom field.
402 402
  */
403
-function geodir_cf_time($html,$location,$cf,$p=''){
403
+function geodir_cf_time($html, $location, $cf, $p = '') {
404 404
 
405 405
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
406
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
407
+    else { global $post; }
408 408
 
409
-    if(!is_array($cf) && $cf!=''){
409
+    if (!is_array($cf) && $cf != '') {
410 410
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
411
+        if (!$cf) {return NULL; }
412 412
     }
413 413
 
414 414
     $html_var = $cf['htmlvar_name'];
415 415
 
416 416
     // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
417
+    if (has_filter("geodir_custom_field_output_time_loc_{$location}")) {
418 418
         /**
419 419
          * Filter the time html by location.
420 420
          *
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
          * @param array $cf The custom field array.
423 423
          * @since 1.6.6
424 424
          */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
425
+        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf);
426 426
     }
427 427
 
428 428
     // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
429
+    if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) {
430 430
         /**
431 431
          * Filter the time html by individual custom field.
432 432
          *
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
          * @param array $cf The custom field array.
436 436
          * @since 1.6.6
437 437
          */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
438
+        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf);
439 439
     }
440 440
 
441 441
     // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
442
+    if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) {
443 443
         /**
444 444
          * Filter the time html by field type key.
445 445
          *
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
          * @param array $cf The custom field array.
449 449
          * @since 1.6.6
450 450
          */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
451
+        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf);
452 452
     }
453 453
 
454 454
     // If not html then we run the standard output.
455
-    if(empty($html)){
455
+    if (empty($html)) {
456 456
 
457 457
         if ($post->{$cf['htmlvar_name']}):
458 458
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
             }
473 473
 
474 474
 
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
475
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
476
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
477
+            $html .= '</span>'.$value.'</div>';
478 478
 
479 479
         endif;
480 480
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
     return $html;
484 484
 }
485
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
485
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
486 486
 
487 487
 
488 488
 /**
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string The html to output for the custom field.
497 497
  */
498
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
498
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
499 499
     global $preview;
500 500
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
501
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
502
+    else { global $post; }
503 503
 
504
-    if(!is_array($cf) && $cf!=''){
504
+    if (!is_array($cf) && $cf != '') {
505 505
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
506
+        if (!$cf) {return NULL; }
507 507
     }
508 508
 
509 509
     $html_var = $cf['htmlvar_name'];
510 510
 
511 511
     // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
512
+    if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) {
513 513
         /**
514 514
          * Filter the datepicker html by location.
515 515
          *
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
          * @param array $cf The custom field array.
518 518
          * @since 1.6.6
519 519
          */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
520
+        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf);
521 521
     }
522 522
 
523 523
     // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
524
+    if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) {
525 525
         /**
526 526
          * Filter the datepicker html by individual custom field.
527 527
          *
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
          * @param array $cf The custom field array.
531 531
          * @since 1.6.6
532 532
          */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
533
+        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf);
534 534
     }
535 535
 
536 536
     // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
537
+    if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) {
538 538
         /**
539 539
          * Filter the datepicker html by field type key.
540 540
          *
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
          * @param array $cf The custom field array.
544 544
          * @since 1.6.6
545 545
          */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
546
+        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf);
547 547
     }
548 548
 
549 549
     // If not html then we run the standard output.
550
-    if(empty($html)){
550
+    if (empty($html)) {
551 551
 
552 552
         if ($post->{$cf['htmlvar_name']}):
553 553
 
@@ -558,24 +558,24 @@  discard block
 block discarded – undo
558 558
             }
559 559
             // check if we need to change the format or not
560 560
             $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
561
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
562 562
 
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
563
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
564
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
565 565
 
566 566
                 $date_format = str_replace($search, $replace, $date_format);
567 567
 
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
568
+                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+            } else {
570 570
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 571
             }
572 572
 
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
573
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
574 574
                 $date_format_from = $preview ? $date_format : 'Y-m-d';
575 575
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 576
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 577
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
578
+            } else {
579 579
                 return '';
580 580
             }
581 581
 
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 
594 594
 
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
595
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
596
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
597
+            $html .= '</span>'.$value.'</div>';
598 598
 
599 599
         endif;
600 600
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
     return $html;
604 604
 }
605
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
605
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
606 606
 
607 607
 
608 608
 /**
@@ -615,21 +615,21 @@  discard block
 block discarded – undo
615 615
  *
616 616
  * @return string The html to output for the custom field.
617 617
  */
618
-function geodir_cf_text($html,$location,$cf,$p=''){
618
+function geodir_cf_text($html, $location, $cf, $p = '') {
619 619
 
620 620
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
621
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
622
+    else { global $post; }
623 623
 
624
-    if(!is_array($cf) && $cf!=''){
624
+    if (!is_array($cf) && $cf != '') {
625 625
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
626
+        if (!$cf) {return NULL; }
627 627
     }
628 628
 
629 629
     $html_var = $cf['htmlvar_name'];
630 630
 
631 631
     // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
632
+    if (has_filter("geodir_custom_field_output_text_loc_{$location}")) {
633 633
         /**
634 634
          * Filter the text html by location.
635 635
          *
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
          * @param array $cf The custom field array.
638 638
          * @since 1.6.6
639 639
          */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
640
+        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf);
641 641
     }
642 642
 
643 643
     // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
644
+    if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) {
645 645
         /**
646 646
          * Filter the text html by individual custom field.
647 647
          *
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
          * @param array $cf The custom field array.
651 651
          * @since 1.6.6
652 652
          */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
653
+        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf);
654 654
     }
655 655
 
656 656
     // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
657
+    if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) {
658 658
         /**
659 659
          * Filter the text html by field type key.
660 660
          *
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
          * @param array $cf The custom field array.
664 664
          * @since 1.6.6
665 665
          */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
666
+        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf);
667 667
     }
668 668
 
669 669
     
670 670
 
671 671
     // If not html then we run the standard output.
672
-    if(empty($html)){
672
+    if (empty($html)) {
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
675 675
 
676 676
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
@@ -686,16 +686,16 @@  discard block
 block discarded – undo
686 686
             }
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af;
690
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
691 691
             $html .= '</span>';
692 692
 
693 693
             $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
694
+            if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) {
695 695
                 $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
696
+                if (isset($extra_fields['is_price']) && $extra_fields['is_price']) {
697
+                    if (!ceil($value) > 0) {return ''; }// dont output blank prices
698
+                    $value = geodir_currency_format_number($value, $cf);
699 699
                 }
700 700
             }
701 701
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
     return $html;
711 711
 }
712
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
712
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
713 713
 
714 714
 
715 715
 /**
@@ -722,21 +722,21 @@  discard block
 block discarded – undo
722 722
  *
723 723
  * @return string The html to output for the custom field.
724 724
  */
725
-function geodir_cf_radio($html,$location,$cf,$p=''){
725
+function geodir_cf_radio($html, $location, $cf, $p = '') {
726 726
 
727 727
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
728
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
729
+    else { global $post; }
730 730
 
731
-    if(!is_array($cf) && $cf!=''){
731
+    if (!is_array($cf) && $cf != '') {
732 732
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
733
+        if (!$cf) {return NULL; }
734 734
     }
735 735
 
736 736
     $html_var = $cf['htmlvar_name'];
737 737
 
738 738
     // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
739
+    if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) {
740 740
         /**
741 741
          * Filter the radio html by location.
742 742
          *
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
          * @param array $cf The custom field array.
745 745
          * @since 1.6.6
746 746
          */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
747
+        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf);
748 748
     }
749 749
 
750 750
     // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
751
+    if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) {
752 752
         /**
753 753
          * Filter the radio html by individual custom field.
754 754
          *
@@ -757,11 +757,11 @@  discard block
 block discarded – undo
757 757
          * @param array $cf The custom field array.
758 758
          * @since 1.6.6
759 759
          */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
760
+        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf);
761 761
     }
762 762
 
763 763
     // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
764
+    if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) {
765 765
         /**
766 766
          * Filter the radio html by field type key.
767 767
          *
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
          * @param array $cf The custom field array.
771 771
          * @since 1.6.6
772 772
          */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
773
+        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf);
774 774
     }
775 775
 
776 776
     // If not html then we run the standard output.
777
-    if(empty($html)){
777
+    if (empty($html)) {
778 778
 
779 779
         $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780 780
         if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
@@ -808,16 +808,16 @@  discard block
 block discarded – undo
808 808
             }
809 809
 
810 810
 
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
811
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;
812
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
813
+            $html .= '</span>'.$html_val.'</div>';
814 814
         endif;
815 815
 
816 816
     }
817 817
 
818 818
     return $html;
819 819
 }
820
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
820
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
821 821
 
822 822
 
823 823
 /**
@@ -831,21 +831,21 @@  discard block
 block discarded – undo
831 831
  *
832 832
  * @return string The html to output for the custom field.
833 833
  */
834
-function geodir_cf_select($html,$location,$cf,$p=''){
834
+function geodir_cf_select($html, $location, $cf, $p = '') {
835 835
 
836 836
     // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
837
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
838
+    else { global $post; }
839 839
 
840
-    if(!is_array($cf) && $cf!=''){
840
+    if (!is_array($cf) && $cf != '') {
841 841
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
842
+        if (!$cf) {return NULL; }
843 843
     }
844 844
 
845 845
     $html_var = $cf['htmlvar_name'];
846 846
 
847 847
     // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
848
+    if (has_filter("geodir_custom_field_output_select_loc_{$location}")) {
849 849
         /**
850 850
          * Filter the select html by location.
851 851
          *
@@ -853,11 +853,11 @@  discard block
 block discarded – undo
853 853
          * @param array $cf The custom field array.
854 854
          * @since 1.6.6
855 855
          */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
856
+        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf);
857 857
     }
858 858
 
859 859
     // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
860
+    if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) {
861 861
         /**
862 862
          * Filter the select html by individual custom field.
863 863
          *
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
          * @param array $cf The custom field array.
867 867
          * @since 1.6.6
868 868
          */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
869
+        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf);
870 870
     }
871 871
 
872 872
     // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
873
+    if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) {
874 874
         /**
875 875
          * Filter the select html by field type key.
876 876
          *
@@ -879,11 +879,11 @@  discard block
 block discarded – undo
879 879
          * @param array $cf The custom field array.
880 880
          * @since 1.6.6
881 881
          */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
882
+        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf);
883 883
     }
884 884
 
885 885
     // If not html then we run the standard output.
886
-    if(empty($html)){
886
+    if (empty($html)) {
887 887
 
888 888
         if ($post->{$cf['htmlvar_name']}):
889 889
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -911,16 +911,16 @@  discard block
 block discarded – undo
911 911
             }
912 912
 
913 913
 
914
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
914
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
915
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
916
+            $html .= '</span>'.$field_value.'</div>';
917 917
         endif;
918 918
 
919 919
     }
920 920
 
921 921
     return $html;
922 922
 }
923
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
923
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
924 924
 
925 925
 
926 926
 /**
@@ -933,21 +933,21 @@  discard block
 block discarded – undo
933 933
  *
934 934
  * @return string The html to output for the custom field.
935 935
  */
936
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
936
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
937 937
 
938 938
     // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
939
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
940
+    else { global $post; }
941 941
 
942
-    if(!is_array($cf) && $cf!=''){
942
+    if (!is_array($cf) && $cf != '') {
943 943
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
944
+        if (!$cf) {return NULL; }
945 945
     }
946 946
 
947 947
     $html_var = $cf['htmlvar_name'];
948 948
 
949 949
     // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
950
+    if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) {
951 951
         /**
952 952
          * Filter the multiselect html by location.
953 953
          *
@@ -955,11 +955,11 @@  discard block
 block discarded – undo
955 955
          * @param array $cf The custom field array.
956 956
          * @since 1.6.6
957 957
          */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
958
+        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf);
959 959
     }
960 960
 
961 961
     // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
962
+    if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) {
963 963
         /**
964 964
          * Filter the multiselect html by individual custom field.
965 965
          *
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
          * @param array $cf The custom field array.
969 969
          * @since 1.6.6
970 970
          */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
971
+        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf);
972 972
     }
973 973
 
974 974
     // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
975
+    if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) {
976 976
         /**
977 977
          * Filter the multiselect html by field type key.
978 978
          *
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
          * @param array $cf The custom field array.
982 982
          * @since 1.6.6
983 983
          */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
984
+        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf);
985 985
     }
986 986
 
987 987
     // If not html then we run the standard output.
988
-    if(empty($html)){
988
+    if (empty($html)) {
989 989
 
990 990
 
991 991
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
             $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008 1008
 
1009
-            if(is_array($field_values)){
1009
+            if (is_array($field_values)) {
1010 1010
                 $field_values = array_map('trim', $field_values);
1011 1011
             }
1012 1012
 
@@ -1024,15 +1024,15 @@  discard block
 block discarded – undo
1024 1024
             }
1025 1025
 
1026 1026
 
1027
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1027
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1028
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1029 1029
             $html .= '</span>';
1030 1030
 
1031 1031
             if (count($option_values) > 1) {
1032 1032
                 $html .= '<ul>';
1033 1033
 
1034 1034
                 foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1035
+                    $html .= '<li>'.$val.'</li>';
1036 1036
                 }
1037 1037
 
1038 1038
                 $html .= '</ul>';
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
     return $html;
1049 1049
 }
1050
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1050
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1051 1051
 
1052 1052
 
1053 1053
 /**
@@ -1060,21 +1060,21 @@  discard block
 block discarded – undo
1060 1060
  *
1061 1061
  * @return string The html to output for the custom field.
1062 1062
  */
1063
-function geodir_cf_email($html,$location,$cf,$p=''){
1063
+function geodir_cf_email($html, $location, $cf, $p = '') {
1064 1064
 
1065 1065
     // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1066
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1067
+    else { global $post; }
1068 1068
 
1069
-    if(!is_array($cf) && $cf!=''){
1069
+    if (!is_array($cf) && $cf != '') {
1070 1070
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1071
+        if (!$cf) {return NULL; }
1072 1072
     }
1073 1073
 
1074 1074
     $html_var = $cf['htmlvar_name'];
1075 1075
 
1076 1076
     // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1077
+    if (has_filter("geodir_custom_field_output_email_loc_{$location}")) {
1078 1078
         /**
1079 1079
          * Filter the email html by location.
1080 1080
          *
@@ -1082,11 +1082,11 @@  discard block
 block discarded – undo
1082 1082
          * @param array $cf The custom field array.
1083 1083
          * @since 1.6.6
1084 1084
          */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1085
+        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf);
1086 1086
     }
1087 1087
 
1088 1088
     // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1089
+    if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) {
1090 1090
         /**
1091 1091
          * Filter the email html by individual custom field.
1092 1092
          *
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
          * @param array $cf The custom field array.
1096 1096
          * @since 1.6.6
1097 1097
          */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1098
+        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf);
1099 1099
     }
1100 1100
 
1101 1101
     // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1102
+    if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) {
1103 1103
         /**
1104 1104
          * Filter the email html by field type key.
1105 1105
          *
@@ -1108,18 +1108,18 @@  discard block
 block discarded – undo
1108 1108
          * @param array $cf The custom field array.
1109 1109
          * @since 1.6.6
1110 1110
          */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1111
+        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf);
1112 1112
     }
1113 1113
 
1114 1114
     // If not html then we run the standard output.
1115
-    if(empty($html)){
1115
+    if (empty($html)) {
1116 1116
 
1117 1117
         global $preview;
1118 1118
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119 1119
             return ''; // Remove Send Enquiry | Send To Friend from listings page
1120 1120
         }
1121 1121
 
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1122
+        $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type);
1123 1123
 
1124 1124
         if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125 1125
             global $send_to_friend;
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
             if (!$preview) {
1132 1132
                 $b_send_inquiry = 'b_send_inquiry';
1133 1133
                 $b_sendtofriend = 'b_sendtofriend';
1134
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1134
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1135 1135
             }
1136 1136
 
1137 1137
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1144,28 +1144,28 @@  discard block
 block discarded – undo
1144 1144
                 $field_icon = '';
1145 1145
             }
1146 1146
 
1147
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1147
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1148 1148
             $seperator = '';
1149 1149
             if ($post->{$cf['htmlvar_name']}) {
1150 1150
                 $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1151
+                $html .= '<a href="'.$b_send_inquiry_url.'" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1152 1152
                 $seperator = ' | ';
1153 1153
             }
1154 1154
 
1155 1155
             if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156 1156
                 $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
-                $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1157
+                $html .= $seperator.'<a href="'.$b_sendtofriend_url.'" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';
1158 1158
             }
1159 1159
 
1160 1160
             $html .= '</span></div>';
1161 1161
 
1162 1162
 
1163 1163
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1164
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1165 1165
             } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1166
+                $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';
1167 1167
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1168
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1169 1169
             }
1170 1170
 
1171 1171
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1185,11 +1185,11 @@  discard block
 block discarded – undo
1185 1185
                 }
1186 1186
 
1187 1187
 
1188
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1188
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1189
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1190 1190
                 $html .= '</span><span class="geodir-email-address-output">';
1191 1191
                 $email = $post->{$cf['htmlvar_name']} ;
1192
-                if($e_split = explode('@',$email)){
1192
+                if ($e_split = explode('@', $email)) {
1193 1193
                     /**
1194 1194
                      * Filter email custom field name output.
1195 1195
                      *
@@ -1198,10 +1198,10 @@  discard block
 block discarded – undo
1198 1198
                      * @param string $email The email string being output.
1199 1199
                      * @param array $cf Custom field variables array.
1200 1200
                      */
1201
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
-                }else{
1204
-                    $html .=  $email;
1201
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1202
+                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
+                } else {
1204
+                    $html .= $email;
1205 1205
                 }
1206 1206
                 $html .= '</span></div>';
1207 1207
             }
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
     return $html;
1214 1214
 }
1215
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1215
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1216 1216
 
1217 1217
 
1218 1218
 /**
@@ -1225,21 +1225,21 @@  discard block
 block discarded – undo
1225 1225
  *
1226 1226
  * @return string The html to output for the custom field.
1227 1227
  */
1228
-function geodir_cf_file($html,$location,$cf,$p=''){
1228
+function geodir_cf_file($html, $location, $cf, $p = '') {
1229 1229
 
1230 1230
     // check we have the post value
1231
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1232
-    else{ global $post;}
1231
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1232
+    else { global $post; }
1233 1233
 
1234
-    if(!is_array($cf) && $cf!=''){
1234
+    if (!is_array($cf) && $cf != '') {
1235 1235
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
-        if(!$cf){return NULL;}
1236
+        if (!$cf) {return NULL; }
1237 1237
     }
1238 1238
 
1239 1239
     $html_var = $cf['htmlvar_name'];
1240 1240
 
1241 1241
     // Check if there is a location specific filter.
1242
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1242
+    if (has_filter("geodir_custom_field_output_file_loc_{$location}")) {
1243 1243
         /**
1244 1244
          * Filter the file html by location.
1245 1245
          *
@@ -1247,11 +1247,11 @@  discard block
 block discarded – undo
1247 1247
          * @param array $cf The custom field array.
1248 1248
          * @since 1.6.6
1249 1249
          */
1250
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1250
+        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf);
1251 1251
     }
1252 1252
 
1253 1253
     // Check if there is a custom field specific filter.
1254
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1254
+    if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) {
1255 1255
         /**
1256 1256
          * Filter the file html by individual custom field.
1257 1257
          *
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
          * @param array $cf The custom field array.
1261 1261
          * @since 1.6.6
1262 1262
          */
1263
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1263
+        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf);
1264 1264
     }
1265 1265
 
1266 1266
     // Check if there is a custom field key specific filter.
1267
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1267
+    if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) {
1268 1268
         /**
1269 1269
          * Filter the file html by field type key.
1270 1270
          *
@@ -1273,11 +1273,11 @@  discard block
 block discarded – undo
1273 1273
          * @param array $cf The custom field array.
1274 1274
          * @since 1.6.6
1275 1275
          */
1276
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1276
+        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf);
1277 1277
     }
1278 1278
 
1279 1279
     // If not html then we run the standard output.
1280
-    if(empty($html)){
1280
+    if (empty($html)) {
1281 1281
 
1282 1282
         if (!empty($post->{$cf['htmlvar_name']})):
1283 1283
 
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
             if (!empty($files)):
1286 1286
 
1287 1287
                 $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
-                $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'] : '';
1288
+                $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'] : '';
1289 1289
 
1290 1290
                 $file_paths = '';
1291 1291
                 foreach ($files as $file) {
@@ -1323,14 +1323,14 @@  discard block
 block discarded – undo
1323 1323
                             //$file_paths .= '<img src="'.$file.'"  />';	
1324 1324
                             $file_paths .= '</div>';
1325 1325
                         }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1326
-                            $ext_path = '_' . $html_var . '_';
1326
+                            $ext_path = '_'.$html_var.'_';
1327 1327
                             $filename = explode($ext_path, $filename);
1328 1328
                             $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
1329 1329
                             $file_paths .= do_shortcode('[audio src="'.$file.'" ]');
1330 1330
                         } else {
1331
-                            $ext_path = '_' . $html_var . '_';
1331
+                            $ext_path = '_'.$html_var.'_';
1332 1332
                             $filename = explode($ext_path, $filename);
1333
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1333
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1334 1334
                         }
1335 1335
                     }
1336 1336
                 }
@@ -1345,11 +1345,11 @@  discard block
 block discarded – undo
1345 1345
                     $field_icon = '';
1346 1346
                 }
1347 1347
 
1348
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1348
+                $html = '<div class="geodir_more_info  '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1349 1349
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1350
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1350
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1351 1351
                 $html .= '</span>';
1352
-                $html .= $file_paths . '</div></div>';
1352
+                $html .= $file_paths.'</div></div>';
1353 1353
 
1354 1354
             endif;
1355 1355
         endif;
@@ -1358,7 +1358,7 @@  discard block
 block discarded – undo
1358 1358
 
1359 1359
     return $html;
1360 1360
 }
1361
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1361
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1362 1362
 
1363 1363
 
1364 1364
 
@@ -1372,21 +1372,21 @@  discard block
 block discarded – undo
1372 1372
  *
1373 1373
  * @return string The html to output for the custom field.
1374 1374
  */
1375
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1375
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1376 1376
 
1377 1377
     // check we have the post value
1378
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1379
-    else{ global $post;}
1378
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1379
+    else { global $post; }
1380 1380
 
1381
-    if(!is_array($cf) && $cf!=''){
1381
+    if (!is_array($cf) && $cf != '') {
1382 1382
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1383
-        if(!$cf){return NULL;}
1383
+        if (!$cf) {return NULL; }
1384 1384
     }
1385 1385
 
1386 1386
     $html_var = $cf['htmlvar_name'];
1387 1387
 
1388 1388
     // Check if there is a location specific filter.
1389
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1389
+    if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) {
1390 1390
         /**
1391 1391
          * Filter the textarea html by location.
1392 1392
          *
@@ -1394,11 +1394,11 @@  discard block
 block discarded – undo
1394 1394
          * @param array $cf The custom field array.
1395 1395
          * @since 1.6.6
1396 1396
          */
1397
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1397
+        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf);
1398 1398
     }
1399 1399
 
1400 1400
     // Check if there is a custom field specific filter.
1401
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1401
+    if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) {
1402 1402
         /**
1403 1403
          * Filter the textarea html by individual custom field.
1404 1404
          *
@@ -1407,11 +1407,11 @@  discard block
 block discarded – undo
1407 1407
          * @param array $cf The custom field array.
1408 1408
          * @since 1.6.6
1409 1409
          */
1410
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1410
+        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf);
1411 1411
     }
1412 1412
 
1413 1413
     // Check if there is a custom field key specific filter.
1414
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1414
+    if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) {
1415 1415
         /**
1416 1416
          * Filter the textarea html by field type key.
1417 1417
          *
@@ -1420,11 +1420,11 @@  discard block
 block discarded – undo
1420 1420
          * @param array $cf The custom field array.
1421 1421
          * @since 1.6.6
1422 1422
          */
1423
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1423
+        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf);
1424 1424
     }
1425 1425
 
1426 1426
     // If not html then we run the standard output.
1427
-    if(empty($html)){
1427
+    if (empty($html)) {
1428 1428
 
1429 1429
         if (!empty($post->{$cf['htmlvar_name']})) {
1430 1430
 
@@ -1439,9 +1439,9 @@  discard block
 block discarded – undo
1439 1439
             }
1440 1440
 
1441 1441
 
1442
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1443
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1444
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1442
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1443
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1444
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1445 1445
 
1446 1446
         }
1447 1447
 
@@ -1449,7 +1449,7 @@  discard block
 block discarded – undo
1449 1449
 
1450 1450
     return $html;
1451 1451
 }
1452
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1452
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1453 1453
 
1454 1454
 
1455 1455
 
@@ -1463,21 +1463,21 @@  discard block
 block discarded – undo
1463 1463
  *
1464 1464
  * @return string The html to output for the custom field.
1465 1465
  */
1466
-function geodir_cf_html($html,$location,$cf,$p=''){
1466
+function geodir_cf_html($html, $location, $cf, $p = '') {
1467 1467
 
1468 1468
     // check we have the post value
1469
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1470
-    else{ global $post;}
1469
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1470
+    else { global $post; }
1471 1471
 
1472
-    if(!is_array($cf) && $cf!=''){
1472
+    if (!is_array($cf) && $cf != '') {
1473 1473
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1474
-        if(!$cf){return NULL;}
1474
+        if (!$cf) {return NULL; }
1475 1475
     }
1476 1476
 
1477 1477
     $html_var = $cf['htmlvar_name'];
1478 1478
 
1479 1479
     // Check if there is a location specific filter.
1480
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1480
+    if (has_filter("geodir_custom_field_output_html_loc_{$location}")) {
1481 1481
         /**
1482 1482
          * Filter the html html by location.
1483 1483
          *
@@ -1485,11 +1485,11 @@  discard block
 block discarded – undo
1485 1485
          * @param array $cf The custom field array.
1486 1486
          * @since 1.6.6
1487 1487
          */
1488
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1488
+        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf);
1489 1489
     }
1490 1490
 
1491 1491
     // Check if there is a custom field specific filter.
1492
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1492
+    if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) {
1493 1493
         /**
1494 1494
          * Filter the html html by individual custom field.
1495 1495
          *
@@ -1498,11 +1498,11 @@  discard block
 block discarded – undo
1498 1498
          * @param array $cf The custom field array.
1499 1499
          * @since 1.6.6
1500 1500
          */
1501
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1501
+        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf);
1502 1502
     }
1503 1503
 
1504 1504
     // Check if there is a custom field key specific filter.
1505
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1505
+    if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) {
1506 1506
         /**
1507 1507
          * Filter the html html by field type key.
1508 1508
          *
@@ -1511,11 +1511,11 @@  discard block
 block discarded – undo
1511 1511
          * @param array $cf The custom field array.
1512 1512
          * @since 1.6.6
1513 1513
          */
1514
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1514
+        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf);
1515 1515
     }
1516 1516
 
1517 1517
     // If not html then we run the standard output.
1518
-    if(empty($html)){
1518
+    if (empty($html)) {
1519 1519
 
1520 1520
         if (!empty($post->{$cf['htmlvar_name']})) {
1521 1521
 
@@ -1529,9 +1529,9 @@  discard block
 block discarded – undo
1529 1529
                 $field_icon = '';
1530 1530
             }
1531 1531
 
1532
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1533
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1534
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1532
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1533
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1534
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1535 1535
 
1536 1536
         }
1537 1537
 
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
 
1540 1540
     return $html;
1541 1541
 }
1542
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1542
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1543 1543
 
1544 1544
 
1545 1545
 
@@ -1553,21 +1553,21 @@  discard block
 block discarded – undo
1553 1553
  *
1554 1554
  * @return string The html to output for the custom field.
1555 1555
  */
1556
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1556
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1557 1557
 
1558 1558
     // check we have the post value
1559
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1560
-    else{ global $post;}
1559
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1560
+    else { global $post; }
1561 1561
 
1562
-    if(!is_array($cf) && $cf!=''){
1562
+    if (!is_array($cf) && $cf != '') {
1563 1563
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1564
-        if(!$cf){return NULL;}
1564
+        if (!$cf) {return NULL; }
1565 1565
     }
1566 1566
 
1567 1567
     $html_var = $cf['htmlvar_name'];
1568 1568
 
1569 1569
     // Check if there is a location specific filter.
1570
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1570
+    if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) {
1571 1571
         /**
1572 1572
          * Filter the taxonomy html by location.
1573 1573
          *
@@ -1575,11 +1575,11 @@  discard block
 block discarded – undo
1575 1575
          * @param array $cf The custom field array.
1576 1576
          * @since 1.6.6
1577 1577
          */
1578
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1578
+        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf);
1579 1579
     }
1580 1580
 
1581 1581
     // Check if there is a custom field specific filter.
1582
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1582
+    if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) {
1583 1583
         /**
1584 1584
          * Filter the taxonomy html by individual custom field.
1585 1585
          *
@@ -1588,11 +1588,11 @@  discard block
 block discarded – undo
1588 1588
          * @param array $cf The custom field array.
1589 1589
          * @since 1.6.6
1590 1590
          */
1591
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1591
+        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf);
1592 1592
     }
1593 1593
 
1594 1594
     // Check if there is a custom field key specific filter.
1595
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1595
+    if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) {
1596 1596
         /**
1597 1597
          * Filter the taxonomy html by field type key.
1598 1598
          *
@@ -1601,14 +1601,14 @@  discard block
 block discarded – undo
1601 1601
          * @param array $cf The custom field array.
1602 1602
          * @since 1.6.6
1603 1603
          */
1604
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1604
+        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf);
1605 1605
     }
1606 1606
 
1607 1607
     // If not html then we run the standard output.
1608
-    if(empty($html)){
1608
+    if (empty($html)) {
1609 1609
 
1610
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1611
-            $post_taxonomy = $post->post_type . 'category';
1610
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1611
+            $post_taxonomy = $post->post_type.'category';
1612 1612
             $field_value = $post->{$html_var};
1613 1613
             $links = array();
1614 1614
             $terms = array();
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
                     if ($term != '') {
1627 1627
                         $term = get_term_by('id', $term, $html_var);
1628 1628
                         if (is_object($term)) {
1629
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1629
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1630 1630
                             $terms[] = $term;
1631 1631
                         }
1632 1632
                     }
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
                     $terms = $termsOrdered;
1641 1641
                 }
1642 1642
             }
1643
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1643
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1644 1644
 
1645 1645
             if ($html_value != '') {
1646 1646
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1653,9 +1653,9 @@  discard block
 block discarded – undo
1653 1653
                     $field_icon = '';
1654 1654
                 }
1655 1655
 
1656
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1657
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1658
-                $html .= '</span> ' . $html_value . '</div>';
1656
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af;
1657
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1658
+                $html .= '</span> '.$html_value.'</div>';
1659 1659
             }
1660 1660
         }
1661 1661
 
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 
1664 1664
     return $html;
1665 1665
 }
1666
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1666
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1667 1667
 
1668 1668
 
1669 1669
 /**
@@ -1677,21 +1677,21 @@  discard block
 block discarded – undo
1677 1677
  *
1678 1678
  * @return string The html to output for the custom field.
1679 1679
  */
1680
-function geodir_cf_address($html,$location,$cf,$p=''){
1680
+function geodir_cf_address($html, $location, $cf, $p = '') {
1681 1681
 
1682 1682
     // check we have the post value
1683
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1684
-    else{ global $post;}
1683
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1684
+    else { global $post; }
1685 1685
 
1686
-    if(!is_array($cf) && $cf!=''){
1686
+    if (!is_array($cf) && $cf != '') {
1687 1687
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1688
-        if(!$cf){return NULL;}
1688
+        if (!$cf) {return NULL; }
1689 1689
     }
1690 1690
 
1691 1691
     $html_var = $cf['htmlvar_name'];
1692 1692
 
1693 1693
     // Check if there is a location specific filter.
1694
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1694
+    if (has_filter("geodir_custom_field_output_address_loc_{$location}")) {
1695 1695
         /**
1696 1696
          * Filter the address html by location.
1697 1697
          *
@@ -1699,11 +1699,11 @@  discard block
 block discarded – undo
1699 1699
          * @param array $cf The custom field array.
1700 1700
          * @since 1.6.6
1701 1701
          */
1702
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1702
+        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf);
1703 1703
     }
1704 1704
 
1705 1705
     // Check if there is a custom field specific filter.
1706
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1706
+    if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) {
1707 1707
         /**
1708 1708
          * Filter the address html by individual custom field.
1709 1709
          *
@@ -1712,11 +1712,11 @@  discard block
 block discarded – undo
1712 1712
          * @param array $cf The custom field array.
1713 1713
          * @since 1.6.6
1714 1714
          */
1715
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1715
+        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf);
1716 1716
     }
1717 1717
 
1718 1718
     // Check if there is a custom field key specific filter.
1719
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1719
+    if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) {
1720 1720
         /**
1721 1721
          * Filter the address html by field type key.
1722 1722
          *
@@ -1725,14 +1725,14 @@  discard block
 block discarded – undo
1725 1725
          * @param array $cf The custom field array.
1726 1726
          * @since 1.6.6
1727 1727
          */
1728
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1728
+        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf);
1729 1729
     }
1730 1730
 
1731 1731
     // If not html then we run the standard output.
1732
-    if(empty($html)){
1732
+    if (empty($html)) {
1733 1733
 
1734 1734
         global $preview;
1735
-        $html_var = $cf['htmlvar_name'] . '_address';
1735
+        $html_var = $cf['htmlvar_name'].'_address';
1736 1736
 
1737 1737
         if ($cf['extra_fields']) {
1738 1738
 
@@ -1795,37 +1795,37 @@  discard block
 block discarded – undo
1795 1795
 
1796 1796
         if ($post->{$html_var}) {
1797 1797
 
1798
-            $field_icon = geodir_field_icon_proccess( $cf );
1799
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1798
+            $field_icon = geodir_field_icon_proccess($cf);
1799
+            if (strpos($field_icon, 'http') !== false) {
1800 1800
                 $field_icon_af = '';
1801
-            } elseif ( $field_icon == '' ) {
1801
+            } elseif ($field_icon == '') {
1802 1802
                 $field_icon_af = '<i class="fa fa-home"></i>';
1803 1803
             } else {
1804 1804
                 $field_icon_af = $field_icon;
1805 1805
                 $field_icon    = '';
1806 1806
             }
1807 1807
             
1808
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1809
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1810
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1808
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1809
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1810
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1811 1811
             $html .= '</span>';
1812 1812
             
1813 1813
             $address_fields = array();
1814 1814
 
1815
-            if ( isset($post->post_address) ) {
1816
-                $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>';
1815
+            if (isset($post->post_address)) {
1816
+                $address_fields['post_address'] = '<span itemprop="streetAddress">'.$post->post_address.'</span>';
1817 1817
             }
1818
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1819
-                $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>';
1818
+            if ($show_city_in_address && isset($post->post_city) && $post->post_city) {
1819
+                $address_fields['post_city'] = '<span itemprop="addressLocality">'.$post->post_city.'</span>';
1820 1820
             }
1821
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1822
-                $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>';
1821
+            if ($show_region_in_address && isset($post->post_region) && $post->post_region) {
1822
+                $address_fields['post_region'] = '<span itemprop="addressRegion">'.$post->post_region.'</span>';
1823 1823
             }
1824
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1825
-                $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>';
1824
+            if ($show_zip_in_address && isset($post->post_zip) && $post->post_zip) {
1825
+                $address_fields['post_zip'] = '<span itemprop="postalCode">'.$post->post_zip.'</span>';
1826 1826
             }
1827
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1828
-                $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>';
1827
+            if ($show_country_in_address && isset($post->post_country) && $post->post_country) {
1828
+                $address_fields['post_country'] = '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span>';
1829 1829
             }
1830 1830
             
1831 1831
             /**
@@ -1851,4 +1851,4 @@  discard block
 block discarded – undo
1851 1851
 
1852 1852
     return $html;
1853 1853
 }
1854
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1855 1854
\ No newline at end of file
1855
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1856 1856
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/wp-cli.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 * @param array $args
22 22
 	 * @param array $assoc_args
23 23
 	 */
24
-	public function count( $args, $assoc_args ) {
24
+	public function count($args, $assoc_args) {
25 25
 		$sessions = WP_Session_Utils::count_sessions();
26 26
 
27
-		\WP_CLI::line( sprintf( '%d sessions currently exist.', absint( $sessions ) ) );
27
+		\WP_CLI::line(sprintf('%d sessions currently exist.', absint($sessions)));
28 28
 	}
29 29
 
30 30
 	/**
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 	 * @param array $args
54 54
 	 * @param array $assoc_args
55 55
 	 */
56
-	public function delete( $args, $assoc_args ) {
57
-		if ( isset( $assoc_args['limit'] ) ) {
58
-			$limit = absint( $assoc_args['limit'] );
56
+	public function delete($args, $assoc_args) {
57
+		if (isset($assoc_args['limit'])) {
58
+			$limit = absint($assoc_args['limit']);
59 59
 
60
-			$count = WP_Session_Utils::delete_old_sessions( $limit );
60
+			$count = WP_Session_Utils::delete_old_sessions($limit);
61 61
 
62
-			if ( $count > 0 ) {
63
-				\WP_CLI::line( sprintf( 'Deleted %d sessions.', $count ) );
62
+			if ($count > 0) {
63
+				\WP_CLI::line(sprintf('Deleted %d sessions.', $count));
64 64
 			}
65 65
 
66 66
 			// Clear memory
@@ -69,32 +69,32 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 
71 71
 		// Determine if we're deleting all sessions or just a subset.
72
-		$all = isset( $assoc_args['all'] );
72
+		$all = isset($assoc_args['all']);
73 73
 
74 74
 		/**
75 75
 		 * Determine the size of each batch for deletion.
76 76
 		 *
77 77
 		 * @param int
78 78
 		 */
79
-		$batch = isset( $assoc_args['batch'] ) ? absint( $assoc_args['batch'] ) : apply_filters( 'wp_session_delete_batch_size', 1000 );
79
+		$batch = isset($assoc_args['batch']) ? absint($assoc_args['batch']) : apply_filters('wp_session_delete_batch_size', 1000);
80 80
 
81
-		switch ( $all ) {
81
+		switch ($all) {
82 82
 			case true:
83 83
 				$count = WP_Session_Utils::delete_all_sessions();
84 84
 
85
-				\WP_CLI::line( sprintf( 'Deleted all %d sessions.', $count ) );
85
+				\WP_CLI::line(sprintf('Deleted all %d sessions.', $count));
86 86
 				break;
87 87
 			case false:
88 88
 				do {
89
-					$count = WP_Session_Utils::delete_old_sessions( $batch );
89
+					$count = WP_Session_Utils::delete_old_sessions($batch);
90 90
 
91
-					if ( $count > 0 ) {
92
-						\WP_CLI::line( sprintf( 'Deleted %d sessions.', $count ) );
91
+					if ($count > 0) {
92
+						\WP_CLI::line(sprintf('Deleted %d sessions.', $count));
93 93
 					}
94 94
 
95 95
 					// Clear memory
96 96
 					self::free_up_memory();
97
-				} while ( $count > 0 );
97
+				} while ($count > 0);
98 98
 				break;
99 99
 		}
100 100
 	}
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 	 * @param array $args
121 121
 	 * @param array $assoc_args
122 122
 	 */
123
-	public function generate( $args, $assoc_args ) {
124
-		$count = absint( $args[0] );
125
-		$date  = isset( $assoc_args['expires'] ) ? $assoc_args['expires'] : null;
123
+	public function generate($args, $assoc_args) {
124
+		$count = absint($args[0]);
125
+		$date  = isset($assoc_args['expires']) ? $assoc_args['expires'] : null;
126 126
 
127
-		$notify = \WP_CLI\Utils\make_progress_bar( 'Generating sessions', $count );
127
+		$notify = \WP_CLI\Utils\make_progress_bar('Generating sessions', $count);
128 128
 
129
-		for ( $i = 0; $i < $count; $i ++ ) {
130
-			WP_Session_Utils::create_dummy_session( $date );
129
+		for ($i = 0; $i < $count; $i++) {
130
+			WP_Session_Utils::create_dummy_session($date);
131 131
 			$notify->tick();
132 132
 		}
133 133
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		global $wp_object_cache, $wpdb;
145 145
 		$wpdb->queries = array();
146 146
 
147
-		if ( ! is_object( $wp_object_cache ) ) {
147
+		if (!is_object($wp_object_cache)) {
148 148
 			return;
149 149
 		}
150 150
 
@@ -155,4 +155,4 @@  discard block
 block discarded – undo
155 155
 	}
156 156
 }
157 157
 
158
-\WP_CLI::add_command( 'session', 'WP_Session_Command' );
159 158
\ No newline at end of file
159
+\WP_CLI::add_command('session', 'WP_Session_Command');
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/class-wp-session-utils.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,11 +99,11 @@
 block discarded – undo
99 99
 
100 100
 		// Delete expired sessions
101 101
 		if ( ! empty( $expired ) ) {
102
-		    $placeholders = array_fill( 0, count( $expired ), '%s' );
103
-		    $format = implode( ', ', $placeholders );
104
-		    $query = "DELETE FROM $wpdb->options WHERE option_name IN ($format)";
102
+			$placeholders = array_fill( 0, count( $expired ), '%s' );
103
+			$format = implode( ', ', $placeholders );
104
+			$query = "DELETE FROM $wpdb->options WHERE option_name IN ($format)";
105 105
 
106
-		    $prepared = $wpdb->prepare( $query, $expired );
106
+			$prepared = $wpdb->prepare( $query, $expired );
107 107
 			$wpdb->query( $prepared );
108 108
 		}
109 109
 
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 		 *
24 24
 		 * @param string $query Database count query
25 25
 		 */
26
-		$query = apply_filters( 'wp_session_count_query', $query );
26
+		$query = apply_filters('wp_session_count_query', $query);
27 27
 
28
-		$sessions = $wpdb->get_var( $query );
28
+		$sessions = $wpdb->get_var($query);
29 29
 
30
-		return absint( $sessions );
30
+		return absint($sessions);
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,33 +35,33 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param null|string $date
37 37
 	 */
38
-	public static function create_dummy_session( $date = null ) {
38
+	public static function create_dummy_session($date = null) {
39 39
 		// Generate our date
40
-		if ( null !== $date ) {
41
-			$time = strtotime( $date );
40
+		if (null !== $date) {
41
+			$time = strtotime($date);
42 42
 
43
-			if ( false === $time ) {
43
+			if (false === $time) {
44 44
 				$date = null;
45 45
 			} else {
46
-				$expires = date( 'U', strtotime( $date ) );
46
+				$expires = date('U', strtotime($date));
47 47
 			}
48 48
 		}
49 49
 
50 50
 		// If null was passed, or if the string parsing failed, fall back on a default
51
-		if ( null === $date ) {
51
+		if (null === $date) {
52 52
 			/**
53 53
 			 * Filter the expiration of the session in the database
54 54
 			 *
55 55
 			 * @param int
56 56
 			 */
57
-			$expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
57
+			$expires = time() + (int) apply_filters('wp_session_expiration', 30 * 60);
58 58
 		}
59 59
 
60 60
 		$session_id = self::generate_id();
61 61
 
62 62
 		// Store the session
63
-		add_option( "_wp_session_{$session_id}", array(), '', 'no' );
64
-		add_option( "_wp_session_expires_{$session_id}", $expires, '', 'no' );
63
+		add_option("_wp_session_{$session_id}", array(), '', 'no');
64
+		add_option("_wp_session_expires_{$session_id}", $expires, '', 'no');
65 65
 	}
66 66
 
67 67
 	/**
@@ -73,22 +73,22 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return int Sessions deleted.
75 75
 	 */
76
-	public static function delete_old_sessions( $limit = 1000 ) {
76
+	public static function delete_old_sessions($limit = 1000) {
77 77
 		global $wpdb;
78 78
 
79
-		$limit = absint( $limit );
80
-		$keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%' ORDER BY option_value ASC LIMIT 0, {$limit}" );
79
+		$limit = absint($limit);
80
+		$keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%' ORDER BY option_value ASC LIMIT 0, {$limit}");
81 81
 
82 82
 		$now = time();
83 83
 		$expired = array();
84 84
 		$count = 0;
85 85
 
86
-		foreach( $keys as $expiration ) {
86
+		foreach ($keys as $expiration) {
87 87
 			$key = $expiration->option_name;
88 88
 			$expires = $expiration->option_value;
89 89
 
90
-			if ( $now > $expires ) {
91
-				$session_id = preg_replace("/[^A-Za-z0-9_]/", '', substr( $key, 20 ) );
90
+			if ($now > $expires) {
91
+				$session_id = preg_replace("/[^A-Za-z0-9_]/", '', substr($key, 20));
92 92
 
93 93
 				$expired[] = $key;
94 94
 				$expired[] = "_wp_session_{$session_id}";
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 		}
99 99
 
100 100
 		// Delete expired sessions
101
-		if ( ! empty( $expired ) ) {
102
-		    $placeholders = array_fill( 0, count( $expired ), '%s' );
103
-		    $format = implode( ', ', $placeholders );
101
+		if (!empty($expired)) {
102
+		    $placeholders = array_fill(0, count($expired), '%s');
103
+		    $format = implode(', ', $placeholders);
104 104
 		    $query = "DELETE FROM $wpdb->options WHERE option_name IN ($format)";
105 105
 
106
-		    $prepared = $wpdb->prepare( $query, $expired );
107
-			$wpdb->query( $prepared );
106
+		    $prepared = $wpdb->prepare($query, $expired);
107
+			$wpdb->query($prepared);
108 108
 		}
109 109
 
110 110
 		return $count;
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	public static function delete_all_sessions() {
121 121
 		global $wpdb;
122 122
 
123
-		$count = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" );
123
+		$count = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'");
124 124
 
125
-		return (int) ( $count / 2 );
125
+		return (int) ($count / 2);
126 126
 	}
127 127
 
128 128
 	/**
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	 * @return string
132 132
 	 */
133 133
 	public static function generate_id() {
134
-		require_once( ABSPATH . 'wp-includes/class-phpass.php' );
135
-		$hash = new PasswordHash( 8, false );
134
+		require_once(ABSPATH.'wp-includes/class-phpass.php');
135
+		$hash = new PasswordHash(8, false);
136 136
 
137
-		return md5( $hash->get_random_bytes( 32 ) );
137
+		return md5($hash->get_random_bytes(32));
138 138
 	}
139 139
 } 
140 140
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/wp-session.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @param string $data
35 35
  */
36
-function wp_session_decode( $data ) {
36
+function wp_session_decode($data) {
37 37
 	$wp_session = WP_Session::get_instance();
38 38
 
39
-	return $wp_session->json_in( $data );
39
+	return $wp_session->json_in($data);
40 40
 }
41 41
 
42 42
 /**
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return bool
59 59
  */
60
-function wp_session_regenerate_id( $delete_old_session = false ) {
60
+function wp_session_regenerate_id($delete_old_session = false) {
61 61
 	$wp_session = WP_Session::get_instance();
62 62
 
63
-	$wp_session->regenerate_id( $delete_old_session );
63
+	$wp_session->regenerate_id($delete_old_session);
64 64
 
65 65
 	return true;
66 66
 }
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
  */
75 75
 function wp_session_start() {
76 76
 	$wp_session = WP_Session::get_instance();
77
-	do_action( 'wp_session_start' );
77
+	do_action('wp_session_start');
78 78
 
79 79
 	return $wp_session->session_started();
80 80
 }
81
-if ( ! defined( 'WP_CLI' ) || false === WP_CLI ) {
82
-	add_action( 'plugins_loaded', 'wp_session_start' );
81
+if (!defined('WP_CLI') || false === WP_CLI) {
82
+	add_action('plugins_loaded', 'wp_session_start');
83 83
 }
84 84
 
85 85
 /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 function wp_session_status() {
91 91
 	$wp_session = WP_Session::get_instance();
92 92
 
93
-	if ( $wp_session->session_started() ) {
93
+	if ($wp_session->session_started()) {
94 94
 		return PHP_SESSION_ACTIVE;
95 95
 	}
96 96
 
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 	$wp_session = WP_Session::get_instance();
114 114
 
115 115
 	$wp_session->write_data();
116
-	do_action( 'wp_session_commit' );
116
+	do_action('wp_session_commit');
117 117
 }
118
-if ( ! defined( 'WP_CLI' ) || false === WP_CLI ) {
119
-	add_action( 'shutdown', 'wp_session_write_close' );
118
+if (!defined('WP_CLI') || false === WP_CLI) {
119
+	add_action('shutdown', 'wp_session_write_close');
120 120
 }
121 121
 
122 122
 /**
@@ -127,33 +127,33 @@  discard block
 block discarded – undo
127 127
  * of a scheduled task or cron job.
128 128
  */
129 129
 function wp_session_cleanup() {
130
-	if ( defined( 'WP_SETUP_CONFIG' ) ) {
130
+	if (defined('WP_SETUP_CONFIG')) {
131 131
 		return;
132 132
 	}
133 133
 
134
-	if ( ! defined( 'WP_INSTALLING' ) ) {
134
+	if (!defined('WP_INSTALLING')) {
135 135
 		/**
136 136
 		 * Determine the size of each batch for deletion.
137 137
 		 *
138 138
 		 * @param int
139 139
 		 */
140
-		$batch_size = apply_filters( 'wp_session_delete_batch_size', 1000 );
140
+		$batch_size = apply_filters('wp_session_delete_batch_size', 1000);
141 141
 
142 142
 		// Delete a batch of old sessions
143
-		WP_Session_Utils::delete_old_sessions( $batch_size );
143
+		WP_Session_Utils::delete_old_sessions($batch_size);
144 144
 	}
145 145
 
146 146
 	// Allow other plugins to hook in to the garbage collection process.
147
-	do_action( 'wp_session_cleanup' );
147
+	do_action('wp_session_cleanup');
148 148
 }
149
-add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' );
149
+add_action('wp_session_garbage_collection', 'wp_session_cleanup');
150 150
 
151 151
 /**
152 152
  * Register the garbage collector as a twice daily event.
153 153
  */
154 154
 function wp_session_register_garbage_collection() {
155
-	if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) {
156
-		wp_schedule_event( time(), 'hourly', 'wp_session_garbage_collection' );
155
+	if (!wp_next_scheduled('wp_session_garbage_collection')) {
156
+		wp_schedule_event(time(), 'hourly', 'wp_session_garbage_collection');
157 157
 	}
158 158
 }
159
-add_action( 'wp', 'wp_session_register_garbage_collection' );
159
+add_action('wp', 'wp_session_register_garbage_collection');
Please login to merge, or discard this patch.