Test Failed
Pull Request — master (#421)
by Kiran
16:02
created
geodirectory-functions/custom_field_html.php 3 patches
Indentation   +333 added lines, -333 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 global $post_type;
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21
-    $post_type = sanitize_text_field($_REQUEST['listing_type']);
21
+	$post_type = sanitize_text_field($_REQUEST['listing_type']);
22 22
 } else
23
-    $post_type = $field_info->post_type;
23
+	$post_type = $field_info->post_type;
24 24
 
25 25
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 26
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+	$field_admin_title = $field_info->admin_title;
52 52
 
53 53
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 54
 
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 //print_r($field_info);
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71
-    $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
71
+	$field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72 72
 }elseif(isset($cf['icon']) && $cf['icon']){
73
-    $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
73
+	$field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74 74
 }else{
75
-    $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
75
+	$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78 78
 if(isset($cf['name']) && $cf['name']){
79
-    $field_type_name = $cf['name'];
79
+	$field_type_name = $cf['name'];
80 80
 }else{
81
-    $field_type_name = $field_type;
81
+	$field_type_name = $field_type;
82 82
 }
83 83
 
84 84
 ?>
@@ -88,45 +88,45 @@  discard block
 block discarded – undo
88 88
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
89 89
         <?php
90 90
 
91
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
92
-        ?>
91
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
92
+		?>
93 93
 
94 94
         <?php if (!$default): ?>
95 95
             <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
96 96
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
97 97
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
98 98
         <?php endif;
99
-        if ($field_type == 'fieldset') {
100
-            ?>
99
+		if ($field_type == 'fieldset') {
100
+			?>
101 101
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
102 102
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
103 103
             <b style="cursor:pointer;"
104 104
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
105 105
         <?php
106
-        } else {echo $field_icon;
107
-            ?>
106
+		} else {echo $field_icon;
107
+			?>
108 108
             <b style="cursor:pointer;"
109 109
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
110 110
         <?php
111
-        }
112
-        ?>
111
+		}
112
+		?>
113 113
     </div>
114 114
 
115 115
     <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
116 116
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
117 117
          style="display:<?php if ($field_ins_upd == 'submit') {
118
-             echo 'block;';
119
-         } else {
120
-             echo 'none;';
121
-         } ?>">
118
+			 echo 'block;';
119
+		 } else {
120
+			 echo 'none;';
121
+		 } ?>">
122 122
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
123 123
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
124 124
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
125 125
         <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/>
126 126
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
127 127
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
128
-            echo $field_info->data_type;
129
-        } ?>"/>
128
+			echo $field_info->data_type;
129
+		} ?>"/>
130 130
         <input type="hidden" name="is_active" id="is_active" value="1"/>
131 131
 
132 132
         <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
@@ -138,37 +138,37 @@  discard block
 block discarded – undo
138 138
 
139 139
             <?php
140 140
 
141
-            // data_type
142
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
141
+			// data_type
142
+			if(has_filter("geodir_cfa_data_type_{$field_type}")){
143 143
 
144
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
144
+				echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
145 145
 
146
-            }else{
147
-                $value = '';
148
-                if (isset($field_info->data_type)) {
149
-                    $value = esc_attr($field_info->data_type);
150
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
151
-                    $value = $cf['defaults']['data_type'];
152
-                }
153
-                ?>
146
+			}else{
147
+				$value = '';
148
+				if (isset($field_info->data_type)) {
149
+					$value = esc_attr($field_info->data_type);
150
+				}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
151
+					$value = $cf['defaults']['data_type'];
152
+				}
153
+				?>
154 154
                 <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
155 155
             <?php
156
-            }
156
+			}
157 157
 
158 158
 
159
-            // admin_title
160
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
159
+			// admin_title
160
+			if(has_filter("geodir_cfa_admin_title_{$field_type}")){
161 161
 
162
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
162
+				echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
163 163
 
164
-            }else{
165
-                $value = '';
166
-                if (isset($field_info->admin_title)) {
167
-                    $value = esc_attr($field_info->admin_title);
168
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
169
-                    $value = $cf['defaults']['admin_title'];
170
-                }
171
-                ?>
164
+			}else{
165
+				$value = '';
166
+				if (isset($field_info->admin_title)) {
167
+					$value = esc_attr($field_info->admin_title);
168
+				}elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
169
+					$value = $cf['defaults']['admin_title'];
170
+				}
171
+				?>
172 172
                 <li>
173 173
                     <label for="admin_title" class="gd-cf-tooltip-wrap">
174 174
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
                     </div>
183 183
                 </li>
184 184
                 <?php
185
-            }
185
+			}
186 186
 
187 187
 
188
-            // site_title
189
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
188
+			// site_title
189
+			if(has_filter("geodir_cfa_site_title_{$field_type}")){
190 190
 
191
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
191
+				echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
192 192
 
193
-            }else{
194
-                $value = '';
195
-                if (isset($field_info->site_title)) {
196
-                    $value = esc_attr($field_info->site_title);
197
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
198
-                    $value = $cf['defaults']['site_title'];
199
-                }
200
-                ?>
193
+			}else{
194
+				$value = '';
195
+				if (isset($field_info->site_title)) {
196
+					$value = esc_attr($field_info->site_title);
197
+				}elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
198
+					$value = $cf['defaults']['site_title'];
199
+				}
200
+				?>
201 201
                 <li>
202 202
                     <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
203 203
                         <div class="gdcf-tooltip">
@@ -210,22 +210,22 @@  discard block
 block discarded – undo
210 210
                     </div>
211 211
                 </li>
212 212
                 <?php
213
-            }
213
+			}
214 214
 
215 215
 
216
-            // admin_desc
217
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
216
+			// admin_desc
217
+			if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
218 218
 
219
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
219
+				echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
220 220
 
221
-            }else{
222
-                $value = '';
223
-                if (isset($field_info->admin_desc)) {
224
-                    $value = esc_attr($field_info->admin_desc);
225
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
226
-                    $value = $cf['defaults']['admin_desc'];
227
-                }
228
-                ?>
221
+			}else{
222
+				$value = '';
223
+				if (isset($field_info->admin_desc)) {
224
+					$value = esc_attr($field_info->admin_desc);
225
+				}elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
226
+					$value = $cf['defaults']['admin_desc'];
227
+				}
228
+				?>
229 229
                 <li>
230 230
                     <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
231 231
                         <div class="gdcf-tooltip">
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
                     </div>
238 238
                 </li>
239 239
                 <?php
240
-            }
240
+			}
241 241
 
242 242
 
243 243
 
244
-            // htmlvar_name
245
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
244
+			// htmlvar_name
245
+			if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
246 246
 
247
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
247
+				echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
248 248
 
249
-            }else{
250
-                $value = '';
251
-                if (isset($field_info->htmlvar_name)) {
252
-                    $value = esc_attr($field_info->htmlvar_name);
253
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
254
-                    $value = $cf['defaults']['htmlvar_name'];
255
-                }
256
-                ?>
249
+			}else{
250
+				$value = '';
251
+				if (isset($field_info->htmlvar_name)) {
252
+					$value = esc_attr($field_info->htmlvar_name);
253
+				}elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
254
+					$value = $cf['defaults']['htmlvar_name'];
255
+				}
256
+				?>
257 257
                 <li>
258 258
                     <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
259 259
                         <div class="gdcf-tooltip">
@@ -263,29 +263,29 @@  discard block
 block discarded – undo
263 263
                     <div class="gd-cf-input-wrap">
264 264
                         <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
265 265
                                value="<?php if ($value) {
266
-                                   echo preg_replace('/geodir_/', '', $value, 1);
267
-                               }?>" <?php if ($default) {
268
-                            echo 'readonly="readonly"';
269
-                        }?> />
266
+								   echo preg_replace('/geodir_/', '', $value, 1);
267
+							   }?>" <?php if ($default) {
268
+							echo 'readonly="readonly"';
269
+						}?> />
270 270
                     </div>
271 271
                 </li>
272 272
                 <?php
273
-            }
273
+			}
274 274
 
275 275
 
276
-            // is_active
277
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
276
+			// is_active
277
+			if(has_filter("geodir_cfa_is_active_{$field_type}")){
278 278
 
279
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
279
+				echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
280 280
 
281
-            }else{
282
-                $value = '';
283
-                if (isset($field_info->is_active)) {
284
-                    $value = esc_attr($field_info->is_active);
285
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
286
-                    $value = $cf['defaults']['is_active'];
287
-                }
288
-                ?>
281
+			}else{
282
+				$value = '';
283
+				if (isset($field_info->is_active)) {
284
+					$value = esc_attr($field_info->is_active);
285
+				}elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
286
+					$value = $cf['defaults']['is_active'];
287
+				}
288
+				?>
289 289
                 <li <?php echo $field_display; ?>>
290 290
                     <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
291 291
                         <div class="gdcf-tooltip">
@@ -296,35 +296,35 @@  discard block
 block discarded – undo
296 296
 
297 297
                         <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
298 298
                             <?php if ($value == '1') {
299
-                                echo 'checked';
300
-                            } ?>/>
299
+								echo 'checked';
300
+							} ?>/>
301 301
                         <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
302 302
 
303 303
                         <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
304 304
                             <?php if ($value == '0' || !$value) {
305
-                                echo 'checked';
306
-                            } ?>/>
305
+								echo 'checked';
306
+							} ?>/>
307 307
                         <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
308 308
 
309 309
                     </div>
310 310
                 </li>
311 311
                 <?php
312
-            }
312
+			}
313 313
 
314 314
 
315
-            // for_admin_use
316
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
315
+			// for_admin_use
316
+			if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
317 317
 
318
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
318
+				echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
319 319
 
320
-            }else{
321
-                $value = '';
322
-                if (isset($field_info->for_admin_use)) {
323
-                    $value = esc_attr($field_info->for_admin_use);
324
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
325
-                    $value = $cf['defaults']['for_admin_use'];
326
-                }
327
-                ?>
320
+			}else{
321
+				$value = '';
322
+				if (isset($field_info->for_admin_use)) {
323
+					$value = esc_attr($field_info->for_admin_use);
324
+				}elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
325
+					$value = $cf['defaults']['for_admin_use'];
326
+				}
327
+				?>
328 328
                 <li>
329 329
                     <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
330 330
                         <div class="gdcf-tooltip">
@@ -335,47 +335,47 @@  discard block
 block discarded – undo
335 335
 
336 336
                         <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
337 337
                             <?php if ($value == '1') {
338
-                                echo 'checked';
339
-                            } ?>/>
338
+								echo 'checked';
339
+							} ?>/>
340 340
                         <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
341 341
 
342 342
                         <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
343 343
                             <?php if ($value == '0' || !$value) {
344
-                                echo 'checked';
345
-                            } ?>/>
344
+								echo 'checked';
345
+							} ?>/>
346 346
                         <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
347 347
 
348 348
                     </div>
349 349
                 </li>
350 350
                 <?php
351
-            }
351
+			}
352 352
 
353 353
 
354
-            // default_value
355
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
354
+			// default_value
355
+			if(has_filter("geodir_cfa_default_value_{$field_type}")){
356 356
 
357
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
357
+				echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
358 358
 
359
-            }else{
360
-                $value = '';
361
-                if (isset($field_info->default_value)) {
362
-                    $value = esc_attr($field_info->default_value);
363
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
364
-                    $value = $cf['defaults']['default_value'];
365
-                }
366
-                ?>
359
+			}else{
360
+				$value = '';
361
+				if (isset($field_info->default_value)) {
362
+					$value = esc_attr($field_info->default_value);
363
+				}elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
364
+					$value = $cf['defaults']['default_value'];
365
+				}
366
+				?>
367 367
                 <li>
368 368
                     <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
369 369
                         <div class="gdcf-tooltip">
370 370
                             <?php
371
-                            if ($field_type == 'checkbox') {
372
-                                _e('Should the checkbox be checked by default?', 'geodirectory');
373
-                            } else if ($field_type == 'email') {
374
-                                _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
375
-                            } else {
376
-                                _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
377
-                            }
378
-                            ?>
371
+							if ($field_type == 'checkbox') {
372
+								_e('Should the checkbox be checked by default?', 'geodirectory');
373
+							} else if ($field_type == 'email') {
374
+								_e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
375
+							} else {
376
+								_e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
377
+							}
378
+							?>
379 379
                         </div>
380 380
                     </label>
381 381
                     <div class="gd-cf-input-wrap">
@@ -392,22 +392,22 @@  discard block
 block discarded – undo
392 392
                     </div>
393 393
                 </li>
394 394
                 <?php
395
-            }
395
+			}
396 396
 
397 397
 
398
-            // show_in
399
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
398
+			// show_in
399
+			if(has_filter("geodir_cfa_show_in_{$field_type}")){
400 400
 
401
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
401
+				echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
402 402
 
403
-            }else{
404
-                $value = '';
405
-                if (isset($field_info->show_in)) {
406
-                    $value = esc_attr($field_info->show_in);
407
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
408
-                    $value = esc_attr($cf['defaults']['show_in']);
409
-                }
410
-                ?>
403
+			}else{
404
+				$value = '';
405
+				if (isset($field_info->show_in)) {
406
+					$value = esc_attr($field_info->show_in);
407
+				}elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
408
+					$value = esc_attr($cf['defaults']['show_in']);
409
+				}
410
+				?>
411 411
                 <li>
412 412
                     <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
413 413
                         <div class="gdcf-tooltip">
@@ -418,41 +418,41 @@  discard block
 block discarded – undo
418 418
 
419 419
                         <?php
420 420
 
421
-                        /*
421
+						/*
422 422
 						 * We wrap the key values in [] so we can search the DB easier with a LIKE query.
423 423
 						 */
424
-                        $show_in_locations = array(
425
-                            "[detail]" => __("Details page sidebar", 'geodirectory'),
426
-                            "[moreinfo]" => __("More info tab", 'geodirectory'),
427
-                            "[listing]" => __("Listings page", 'geodirectory'),
428
-                            "[owntab]" => __("Details page own tab", 'geodirectory'),
429
-                            "[mapbubble]" => __("Map bubble", 'geodirectory'),
430
-                        );
431
-
432
-                        /**
433
-                         * Filter the locations array for where to display custom fields.
434
-                         *
435
-                         * @since 1.6.6
436
-                         * @param array $show_in_locations The array of locations and descriptions.
437
-                         * @param object $field_info The field being displayed info.
438
-                         * @param string $field_info The type of field.
439
-                         */
440
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
441
-
442
-
443
-                        // remove some locations for some field types
444
-
445
-                        // don't show new tab option for some types
446
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
447
-                        }else{
448
-                            unset($show_in_locations['[owntab]']);
449
-                        }
450
-
451
-                        if(!$display_on_listing){
452
-                            unset($show_in_locations['[listings]']);
453
-                        }
454
-
455
-                        ?>
424
+						$show_in_locations = array(
425
+							"[detail]" => __("Details page sidebar", 'geodirectory'),
426
+							"[moreinfo]" => __("More info tab", 'geodirectory'),
427
+							"[listing]" => __("Listings page", 'geodirectory'),
428
+							"[owntab]" => __("Details page own tab", 'geodirectory'),
429
+							"[mapbubble]" => __("Map bubble", 'geodirectory'),
430
+						);
431
+
432
+						/**
433
+						 * Filter the locations array for where to display custom fields.
434
+						 *
435
+						 * @since 1.6.6
436
+						 * @param array $show_in_locations The array of locations and descriptions.
437
+						 * @param object $field_info The field being displayed info.
438
+						 * @param string $field_info The type of field.
439
+						 */
440
+						$show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
441
+
442
+
443
+						// remove some locations for some field types
444
+
445
+						// don't show new tab option for some types
446
+						if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
447
+						}else{
448
+							unset($show_in_locations['[owntab]']);
449
+						}
450
+
451
+						if(!$display_on_listing){
452
+							unset($show_in_locations['[listings]']);
453
+						}
454
+
455
+						?>
456 456
 
457 457
                         <select multiple="multiple" name="show_in[]"
458 458
                                 id="show_in"
@@ -462,38 +462,38 @@  discard block
 block discarded – undo
462 462
                                 option-ajaxchosen="false">
463 463
                             <?php
464 464
 
465
-                            $show_in_values = explode(',',$value);
465
+							$show_in_values = explode(',',$value);
466 466
 
467
-                            foreach( $show_in_locations as $key => $val){
468
-                                $selected = '';
467
+							foreach( $show_in_locations as $key => $val){
468
+								$selected = '';
469 469
 
470
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
471
-                                    $selected = 'selected';
472
-                                }
470
+								if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
471
+									$selected = 'selected';
472
+								}
473 473
 
474
-                                ?>
474
+								?>
475 475
                                 <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
476 476
                                 <?php
477
-                            }
478
-                            ?>
477
+							}
478
+							?>
479 479
                         </select>
480 480
                     </div>
481 481
                 </li>
482 482
                 <?php
483
-            }
483
+			}
484 484
 
485 485
 
486
-            // advanced_editor
487
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
486
+			// advanced_editor
487
+			if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
488 488
 
489
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
489
+				echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
490 490
 
491
-            }
491
+			}
492 492
 
493 493
 
494 494
 
495 495
 
496
-            ?>
496
+			?>
497 497
 
498 498
 
499 499
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
@@ -506,38 +506,38 @@  discard block
 block discarded – undo
506 506
 
507 507
             <?php
508 508
 
509
-            $pricearr = array();
510
-            if (isset($field_info->packages) && $field_info->packages != '') {
511
-                $pricearr = explode(',', trim($field_info->packages, ','));
512
-            } else {
513
-                $package_info = array();
509
+			$pricearr = array();
510
+			if (isset($field_info->packages) && $field_info->packages != '') {
511
+				$pricearr = explode(',', trim($field_info->packages, ','));
512
+			} else {
513
+				$package_info = array();
514 514
 
515
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
516
-                $pricearr[] = $package_info->pid;
517
-            }
515
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
516
+				$pricearr[] = $package_info->pid;
517
+			}
518 518
 
519
-            ob_start()
520
-            ?>
519
+			ob_start()
520
+			?>
521 521
 
522 522
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
523 523
                 <?php
524
-                if (!empty($pricearr)) {
525
-                    foreach ($pricearr as $val) {
526
-                        ?>
524
+				if (!empty($pricearr)) {
525
+					foreach ($pricearr as $val) {
526
+						?>
527 527
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
528
-                    }
529
-                }
530
-                ?>
528
+					}
529
+				}
530
+				?>
531 531
             </select>
532 532
 
533 533
             <?php
534
-            $html = ob_get_clean();
534
+			$html = ob_get_clean();
535 535
 
536 536
 			/**
537 537
 			 * Filter the price packages list.
538 538
 			 *
539 539
 			 * Filter the price packages list in custom field form in admin
540
-             * custom fields settings.
540
+			 * custom fields settings.
541 541
 			 *
542 542
 			 * @since 1.0.0
543 543
 			 *
@@ -546,25 +546,25 @@  discard block
 block discarded – undo
546 546
 			 */
547 547
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
548 548
 
549
-            ?>
549
+			?>
550 550
 
551 551
 
552 552
 
553 553
             <?php
554 554
 
555
-            // is_required
556
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
555
+			// is_required
556
+			if(has_filter("geodir_cfa_is_required_{$field_type}")){
557 557
 
558
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
558
+				echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
559 559
 
560
-            }else{
561
-                $value = '';
562
-                if (isset($field_info->is_required)) {
563
-                    $value = esc_attr($field_info->is_required);
564
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
565
-                    $value = $cf['defaults']['is_required'];
566
-                }
567
-                ?>
560
+			}else{
561
+				$value = '';
562
+				if (isset($field_info->is_required)) {
563
+					$value = esc_attr($field_info->is_required);
564
+				}elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
565
+					$value = $cf['defaults']['is_required'];
566
+				}
567
+				?>
568 568
                 <li>
569 569
                     <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
570 570
                         <div class="gdcf-tooltip">
@@ -576,14 +576,14 @@  discard block
 block discarded – undo
576 576
 
577 577
                         <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
578 578
                             <?php if ($value == '1') {
579
-                                echo 'checked';
580
-                            } ?>/>
579
+								echo 'checked';
580
+							} ?>/>
581 581
                         <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
582 582
 
583 583
                         <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
584 584
                             <?php if ($value == '0' || !$value) {
585
-                                echo 'checked';
586
-                            } ?>/>
585
+								echo 'checked';
586
+							} ?>/>
587 587
                         <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
588 588
 
589 589
                     </div>
@@ -591,21 +591,21 @@  discard block
 block discarded – undo
591 591
                 </li>
592 592
 
593 593
                 <?php
594
-            }
594
+			}
595 595
 
596
-            // required_msg
597
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
596
+			// required_msg
597
+			if(has_filter("geodir_cfa_required_msg_{$field_type}")){
598 598
 
599
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
599
+				echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
600 600
 
601
-            }else{
602
-                $value = '';
603
-                if (isset($field_info->required_msg)) {
604
-                    $value = esc_attr($field_info->required_msg);
605
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
606
-                    $value = $cf['defaults']['required_msg'];
607
-                }
608
-                ?>
601
+			}else{
602
+				$value = '';
603
+				if (isset($field_info->required_msg)) {
604
+					$value = esc_attr($field_info->required_msg);
605
+				}elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
606
+					$value = $cf['defaults']['required_msg'];
607
+				}
608
+				?>
609 609
                 <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
610 610
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
611 611
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
@@ -619,38 +619,38 @@  discard block
 block discarded – undo
619 619
                     </div>
620 620
                 </li>
621 621
                 <?php
622
-            }
622
+			}
623 623
 
624 624
 
625
-            // required_msg
626
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
625
+			// required_msg
626
+			if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
627 627
 
628
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
628
+				echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
629 629
 
630
-            }
630
+			}
631 631
 
632 632
 
633
-            // extra_fields
634
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
633
+			// extra_fields
634
+			if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
635 635
 
636
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
636
+				echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
637 637
 
638
-            }
638
+			}
639 639
 
640 640
 
641
-            // field_icon
642
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
641
+			// field_icon
642
+			if(has_filter("geodir_cfa_field_icon_{$field_type}")){
643 643
 
644
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
644
+				echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
645 645
 
646
-            }else{
647
-                $value = '';
648
-                if (isset($field_info->field_icon)) {
649
-                    $value = esc_attr($field_info->field_icon);
650
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
651
-                    $value = $cf['defaults']['field_icon'];
652
-                }
653
-                ?>
646
+			}else{
647
+				$value = '';
648
+				if (isset($field_info->field_icon)) {
649
+					$value = esc_attr($field_info->field_icon);
650
+				}elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
651
+					$value = $cf['defaults']['field_icon'];
652
+				}
653
+				?>
654 654
                 <li>
655 655
                     <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
656 656
 
@@ -668,22 +668,22 @@  discard block
 block discarded – undo
668 668
 
669 669
                 </li>
670 670
                 <?php
671
-            }
671
+			}
672 672
 
673 673
 
674
-            // css_class
675
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
674
+			// css_class
675
+			if(has_filter("geodir_cfa_css_class_{$field_type}")){
676 676
 
677
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
677
+				echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
678 678
 
679
-            }else{
680
-                $value = '';
681
-                if (isset($field_info->css_class)) {
682
-                    $value = esc_attr($field_info->css_class);
683
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
684
-                    $value = $cf['defaults']['css_class'];
685
-                }
686
-                ?>
679
+			}else{
680
+				$value = '';
681
+				if (isset($field_info->css_class)) {
682
+					$value = esc_attr($field_info->css_class);
683
+				}elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
684
+					$value = $cf['defaults']['css_class'];
685
+				}
686
+				?>
687 687
                 <li>
688 688
 
689 689
                     <label for="css_class" class="gd-cf-tooltip-wrap">
@@ -696,47 +696,47 @@  discard block
 block discarded – undo
696 696
                     <div class="gd-cf-input-wrap">
697 697
                         <input type="text" name="css_class" id="css_class"
698 698
                                value="<?php if (isset($field_info->css_class)) {
699
-                                   echo esc_attr($field_info->css_class);
700
-                               }?>"/>
699
+								   echo esc_attr($field_info->css_class);
700
+							   }?>"/>
701 701
                     </div>
702 702
                 </li>
703 703
                 <?php
704
-            }
704
+			}
705 705
 
706 706
 
707
-            // cat_sort
708
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
707
+			// cat_sort
708
+			if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
709 709
 
710
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
710
+				echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
711 711
 
712
-            }else{
713
-                $value = '';
714
-                $hide_cat_sort  ='';
715
-                if (isset($field_info->cat_sort)) {
716
-                    $value = esc_attr($field_info->cat_sort);
717
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
718
-                    $value = $cf['defaults']['cat_sort'];
719
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
720
-                }
712
+			}else{
713
+				$value = '';
714
+				$hide_cat_sort  ='';
715
+				if (isset($field_info->cat_sort)) {
716
+					$value = esc_attr($field_info->cat_sort);
717
+				}elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
718
+					$value = $cf['defaults']['cat_sort'];
719
+					$hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
720
+				}
721 721
 
722
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
723
-                ?>
722
+				$hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
723
+				?>
724 724
                 <li <?php echo $hide_cat_sort ;?>>
725 725
                     <h3><?php
726
-                        /**
727
-                         * Filter the section title.
728
-                         *
729
-                         * Filter the section title in custom field form in admin
730
-                         * custom fields settings.
731
-                         *
732
-                         * @since 1.0.0
733
-                         *
734
-                         * @param string $title Title of the section.
735
-                         * @param string $field_type Current field type.
736
-                         */
737
-                        echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
738
-
739
-                        ?></h3>
726
+						/**
727
+						 * Filter the section title.
728
+						 *
729
+						 * Filter the section title in custom field form in admin
730
+						 * custom fields settings.
731
+						 *
732
+						 * @since 1.0.0
733
+						 *
734
+						 * @param string $title Title of the section.
735
+						 * @param string $field_type Current field type.
736
+						 */
737
+						echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
738
+
739
+						?></h3>
740 740
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
741 741
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
742 742
                         <div class="gdcf-tooltip">
@@ -748,42 +748,42 @@  discard block
 block discarded – undo
748 748
 
749 749
                         <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
750 750
                             <?php if ($value == '1') {
751
-                                echo 'checked';
752
-                            } ?>/>
751
+								echo 'checked';
752
+							} ?>/>
753 753
                         <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
754 754
 
755 755
                         <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
756 756
                             <?php if (!$value) {
757
-                                echo 'checked';
758
-                            } ?>/>
757
+								echo 'checked';
758
+							} ?>/>
759 759
                         <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
760 760
 
761 761
                     </div>
762 762
                 </li>
763 763
                 <?php
764
-            }
765
-
766
-
767
-
768
-            switch ($field_type):
769
-                case 'html':
770
-                case 'file':
771
-                case 'url':
772
-                case 'fieldset':
773
-                    break;
774
-                default:
775
-
776
-                    /**
777
-                     * Called at the end of the advanced custom fields settings page loop.
778
-                     *
779
-                     * Can be used to add or deal with different settings types.
780
-                     *
781
-                     * @since 1.0.0
782
-                     * @since 1.6.6 $cf param added.
783
-                     * @param object $field_info The current fields info.
784
-                     * @param array $cf The custom field settings
785
-                     */
786
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
764
+			}
765
+
766
+
767
+
768
+			switch ($field_type):
769
+				case 'html':
770
+				case 'file':
771
+				case 'url':
772
+				case 'fieldset':
773
+					break;
774
+				default:
775
+
776
+					/**
777
+					 * Called at the end of the advanced custom fields settings page loop.
778
+					 *
779
+					 * Can be used to add or deal with different settings types.
780
+					 *
781
+					 * @since 1.0.0
782
+					 * @since 1.6.6 $cf param added.
783
+					 * @param object $field_info The current fields info.
784
+					 * @param array $cf The custom field settings
785
+					 */
786
+					do_action('geodir_advance_custom_fields', $field_info,$cf);?>
787 787
 
788 788
 
789 789
                 <?php endswitch; ?>
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : '';
40 40
 
41 41
 
42
-if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;}
42
+if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; }
43 43
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
44
-if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;}
44
+if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; }
45 45
 
46 46
 
47
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
47
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 71
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
72
+}elseif (isset($cf['icon']) && $cf['icon']) {
73 73
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74
-}else{
74
+} else {
75 75
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78
-if(isset($cf['name']) && $cf['name']){
78
+if (isset($cf['name']) && $cf['name']) {
79 79
     $field_type_name = $cf['name'];
80
-}else{
80
+} else {
81 81
     $field_type_name = $field_type;
82 82
 }
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
89 89
         <?php
90 90
 
91
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
91
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
92 92
         ?>
93 93
 
94 94
         <?php if (!$default): ?>
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
102 102
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
103 103
             <b style="cursor:pointer;"
104
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
104
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
105 105
         <?php
106 106
         } else {echo $field_icon;
107 107
             ?>
108 108
             <b style="cursor:pointer;"
109
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
109
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
110 110
         <?php
111 111
         }
112 112
         ?>
@@ -129,43 +129,43 @@  discard block
 block discarded – undo
129 129
         } ?>"/>
130 130
         <input type="hidden" name="is_active" id="is_active" value="1"/>
131 131
 
132
-        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
133
-        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
134
-        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
135
-        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" />
132
+        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?>
133
+        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
134
+        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
135
+        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" />
136 136
 
137 137
         <ul class="widefat post fixed" border="0" style="width:100%;">
138 138
 
139 139
             <?php
140 140
 
141 141
             // data_type
142
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
142
+            if (has_filter("geodir_cfa_data_type_{$field_type}")) {
143 143
 
144
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
144
+                echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
145 145
 
146
-            }else{
146
+            } else {
147 147
                 $value = '';
148 148
                 if (isset($field_info->data_type)) {
149 149
                     $value = esc_attr($field_info->data_type);
150
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
150
+                }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
151 151
                     $value = $cf['defaults']['data_type'];
152 152
                 }
153 153
                 ?>
154
-                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
154
+                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/>
155 155
             <?php
156 156
             }
157 157
 
158 158
 
159 159
             // admin_title
160
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
160
+            if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
161 161
 
162
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
162
+                echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
163 163
 
164
-            }else{
164
+            } else {
165 165
                 $value = '';
166 166
                 if (isset($field_info->admin_title)) {
167 167
                     $value = esc_attr($field_info->admin_title);
168
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
168
+                }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
169 169
                     $value = $cf['defaults']['admin_title'];
170 170
                 }
171 171
                 ?>
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                     </label>
179 179
                     <div class="gd-cf-input-wrap">
180 180
                         <input type="text" name="admin_title" id="admin_title"
181
-                               value="<?php echo $value;?>"/>
181
+                               value="<?php echo $value; ?>"/>
182 182
                     </div>
183 183
                 </li>
184 184
                 <?php
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
 
187 187
 
188 188
             // site_title
189
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
189
+            if (has_filter("geodir_cfa_site_title_{$field_type}")) {
190 190
 
191
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
191
+                echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
192 192
 
193
-            }else{
193
+            } else {
194 194
                 $value = '';
195 195
                 if (isset($field_info->site_title)) {
196 196
                     $value = esc_attr($field_info->site_title);
197
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
197
+                }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
198 198
                     $value = $cf['defaults']['site_title'];
199 199
                 }
200 200
                 ?>
@@ -214,15 +214,15 @@  discard block
 block discarded – undo
214 214
 
215 215
 
216 216
             // admin_desc
217
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
217
+            if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
218 218
 
219
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
219
+                echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
220 220
 
221
-            }else{
221
+            } else {
222 222
                 $value = '';
223 223
                 if (isset($field_info->admin_desc)) {
224 224
                     $value = esc_attr($field_info->admin_desc);
225
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
225
+                }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
226 226
                     $value = $cf['defaults']['admin_desc'];
227 227
                 }
228 228
                 ?>
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
                         </div>
234 234
                     </label>
235 235
                     <div class="gd-cf-input-wrap">
236
-                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/>
236
+                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/>
237 237
                     </div>
238 238
                 </li>
239 239
                 <?php
@@ -242,26 +242,26 @@  discard block
 block discarded – undo
242 242
 
243 243
 
244 244
             // htmlvar_name
245
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
245
+            if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
246 246
 
247
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
247
+                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
248 248
 
249
-            }else{
249
+            } else {
250 250
                 $value = '';
251 251
                 if (isset($field_info->htmlvar_name)) {
252 252
                     $value = esc_attr($field_info->htmlvar_name);
253
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
253
+                }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
254 254
                     $value = $cf['defaults']['htmlvar_name'];
255 255
                 }
256 256
                 ?>
257 257
                 <li>
258
-                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
258
+                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
259 259
                         <div class="gdcf-tooltip">
260 260
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
261 261
                         </div>
262 262
                     </label>
263 263
                     <div class="gd-cf-input-wrap">
264
-                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
264
+                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
265 265
                                value="<?php if ($value) {
266 266
                                    echo preg_replace('/geodir_/', '', $value, 1);
267 267
                                }?>" <?php if ($default) {
@@ -274,15 +274,15 @@  discard block
 block discarded – undo
274 274
 
275 275
 
276 276
             // is_active
277
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
277
+            if (has_filter("geodir_cfa_is_active_{$field_type}")) {
278 278
 
279
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
279
+                echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
280 280
 
281
-            }else{
281
+            } else {
282 282
                 $value = '';
283 283
                 if (isset($field_info->is_active)) {
284 284
                     $value = esc_attr($field_info->is_active);
285
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
285
+                }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
286 286
                     $value = $cf['defaults']['is_active'];
287 287
                 }
288 288
                 ?>
@@ -294,17 +294,17 @@  discard block
 block discarded – undo
294 294
                     </label>
295 295
                     <div class="gd-cf-input-wrap gd-switch">
296 296
 
297
-                        <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
297
+                        <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
298 298
                             <?php if ($value == '1') {
299 299
                                 echo 'checked';
300 300
                             } ?>/>
301
-                        <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
301
+                        <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
302 302
 
303
-                        <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
303
+                        <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
304 304
                             <?php if ($value == '0' || !$value) {
305 305
                                 echo 'checked';
306 306
                             } ?>/>
307
-                        <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
307
+                        <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
308 308
 
309 309
                     </div>
310 310
                 </li>
@@ -313,15 +313,15 @@  discard block
 block discarded – undo
313 313
 
314 314
 
315 315
             // for_admin_use
316
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
316
+            if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
317 317
 
318
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
318
+                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
319 319
 
320
-            }else{
320
+            } else {
321 321
                 $value = '';
322 322
                 if (isset($field_info->for_admin_use)) {
323 323
                     $value = esc_attr($field_info->for_admin_use);
324
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
324
+                }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
325 325
                     $value = $cf['defaults']['for_admin_use'];
326 326
                 }
327 327
                 ?>
@@ -333,17 +333,17 @@  discard block
 block discarded – undo
333 333
                     </label>
334 334
                     <div class="gd-cf-input-wrap gd-switch">
335 335
 
336
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
336
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
337 337
                             <?php if ($value == '1') {
338 338
                                 echo 'checked';
339 339
                             } ?>/>
340
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
340
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
341 341
 
342
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
342
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
343 343
                             <?php if ($value == '0' || !$value) {
344 344
                                 echo 'checked';
345 345
                             } ?>/>
346
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
346
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
347 347
 
348 348
                     </div>
349 349
                 </li>
@@ -352,20 +352,20 @@  discard block
 block discarded – undo
352 352
 
353 353
 
354 354
             // default_value
355
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
355
+            if (has_filter("geodir_cfa_default_value_{$field_type}")) {
356 356
 
357
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
357
+                echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
358 358
 
359
-            }else{
359
+            } else {
360 360
                 $value = '';
361 361
                 if (isset($field_info->default_value)) {
362 362
                     $value = esc_attr($field_info->default_value);
363
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
363
+                }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
364 364
                     $value = $cf['defaults']['default_value'];
365 365
                 }
366 366
                 ?>
367 367
                 <li>
368
-                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
368
+                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
369 369
                         <div class="gdcf-tooltip">
370 370
                             <?php
371 371
                             if ($field_type == 'checkbox') {
@@ -382,12 +382,12 @@  discard block
 block discarded – undo
382 382
                         <?php if ($field_type == 'checkbox') { ?>
383 383
                             <select name="default_value" id="default_value">
384 384
                                 <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
385
-                                <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
385
+                                <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
386 386
                             </select>
387 387
                         <?php } else if ($field_type == 'email') { ?>
388
-                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
388
+                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
389 389
                         <?php } else { ?>
390
-                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
390
+                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
391 391
                         <?php } ?>
392 392
                     </div>
393 393
                 </li>
@@ -396,15 +396,15 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
             // show_in
399
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
399
+            if (has_filter("geodir_cfa_show_in_{$field_type}")) {
400 400
 
401
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
401
+                echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
402 402
 
403
-            }else{
403
+            } else {
404 404
                 $value = '';
405 405
                 if (isset($field_info->show_in)) {
406 406
                     $value = esc_attr($field_info->show_in);
407
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
407
+                }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
408 408
                     $value = esc_attr($cf['defaults']['show_in']);
409 409
                 }
410 410
                 ?>
@@ -437,18 +437,18 @@  discard block
 block discarded – undo
437 437
                          * @param object $field_info The field being displayed info.
438 438
                          * @param string $field_info The type of field.
439 439
                          */
440
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
440
+                        $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
441 441
 
442 442
 
443 443
                         // remove some locations for some field types
444 444
 
445 445
                         // don't show new tab option for some types
446
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
447
-                        }else{
446
+                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
447
+                        } else {
448 448
                             unset($show_in_locations['[owntab]']);
449 449
                         }
450 450
 
451
-                        if(!$display_on_listing){
451
+                        if (!$display_on_listing) {
452 452
                             unset($show_in_locations['[listings]']);
453 453
                         }
454 454
 
@@ -462,17 +462,17 @@  discard block
 block discarded – undo
462 462
                                 option-ajaxchosen="false">
463 463
                             <?php
464 464
 
465
-                            $show_in_values = explode(',',$value);
465
+                            $show_in_values = explode(',', $value);
466 466
 
467
-                            foreach( $show_in_locations as $key => $val){
467
+                            foreach ($show_in_locations as $key => $val) {
468 468
                                 $selected = '';
469 469
 
470
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
470
+                                if (is_array($show_in_values) && in_array($key, $show_in_values)) {
471 471
                                     $selected = 'selected';
472 472
                                 }
473 473
 
474 474
                                 ?>
475
-                                <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
475
+                                <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
476 476
                                 <?php
477 477
                             }
478 478
                             ?>
@@ -484,9 +484,9 @@  discard block
 block discarded – undo
484 484
 
485 485
 
486 486
             // advanced_editor
487
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
487
+            if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
488 488
 
489
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
489
+                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
490 490
 
491 491
             }
492 492
 
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
 
498 498
 
499 499
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
500
-            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
500
+            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
501 501
 
502 502
             <?php // we dont need to show the sort order ?>
503
-            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
503
+            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
504 504
 
505 505
 
506 506
 
@@ -553,15 +553,15 @@  discard block
 block discarded – undo
553 553
             <?php
554 554
 
555 555
             // is_required
556
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
556
+            if (has_filter("geodir_cfa_is_required_{$field_type}")) {
557 557
 
558
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
558
+                echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
559 559
 
560
-            }else{
560
+            } else {
561 561
                 $value = '';
562 562
                 if (isset($field_info->is_required)) {
563 563
                     $value = esc_attr($field_info->is_required);
564
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
564
+                }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
565 565
                     $value = $cf['defaults']['is_required'];
566 566
                 }
567 567
                 ?>
@@ -574,17 +574,17 @@  discard block
 block discarded – undo
574 574
 
575 575
                     <div class="gd-cf-input-wrap gd-switch">
576 576
 
577
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
577
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
578 578
                             <?php if ($value == '1') {
579 579
                                 echo 'checked';
580 580
                             } ?>/>
581
-                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
581
+                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
582 582
 
583
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
583
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
584 584
                             <?php if ($value == '0' || !$value) {
585 585
                                 echo 'checked';
586 586
                             } ?>/>
587
-                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
587
+                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
588 588
 
589 589
                     </div>
590 590
 
@@ -594,19 +594,19 @@  discard block
 block discarded – undo
594 594
             }
595 595
 
596 596
             // required_msg
597
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
597
+            if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
598 598
 
599
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
599
+                echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
600 600
 
601
-            }else{
601
+            } else {
602 602
                 $value = '';
603 603
                 if (isset($field_info->required_msg)) {
604 604
                     $value = esc_attr($field_info->required_msg);
605
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
605
+                }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
606 606
                     $value = $cf['defaults']['required_msg'];
607 607
                 }
608 608
                 ?>
609
-                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
609
+                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
610 610
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
611 611
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
612 612
                         <div class="gdcf-tooltip">
@@ -623,31 +623,31 @@  discard block
 block discarded – undo
623 623
 
624 624
 
625 625
             // required_msg
626
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
626
+            if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
627 627
 
628
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
628
+                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
629 629
 
630 630
             }
631 631
 
632 632
 
633 633
             // extra_fields
634
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
634
+            if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
635 635
 
636
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
636
+                echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
637 637
 
638 638
             }
639 639
 
640 640
 
641 641
             // field_icon
642
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
642
+            if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
643 643
 
644
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
644
+                echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
645 645
 
646
-            }else{
646
+            } else {
647 647
                 $value = '';
648 648
                 if (isset($field_info->field_icon)) {
649 649
                     $value = esc_attr($field_info->field_icon);
650
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
650
+                }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
651 651
                     $value = $cf['defaults']['field_icon'];
652 652
                 }
653 653
                 ?>
@@ -658,12 +658,12 @@  discard block
 block discarded – undo
658 658
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
659 659
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
660 660
                         <div class="gdcf-tooltip">
661
-                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
661
+                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
662 662
                         </div>
663 663
                     </label>
664 664
                     <div class="gd-cf-input-wrap">
665 665
                         <input type="text" name="field_icon" id="field_icon"
666
-                               value="<?php echo $value;?>"/>
666
+                               value="<?php echo $value; ?>"/>
667 667
                     </div>
668 668
 
669 669
                 </li>
@@ -672,15 +672,15 @@  discard block
 block discarded – undo
672 672
 
673 673
 
674 674
             // css_class
675
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
675
+            if (has_filter("geodir_cfa_css_class_{$field_type}")) {
676 676
 
677
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
677
+                echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
678 678
 
679
-            }else{
679
+            } else {
680 680
                 $value = '';
681 681
                 if (isset($field_info->css_class)) {
682 682
                     $value = esc_attr($field_info->css_class);
683
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
683
+                }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
684 684
                     $value = $cf['defaults']['css_class'];
685 685
                 }
686 686
                 ?>
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
                     <label for="css_class" class="gd-cf-tooltip-wrap">
690 690
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
691 691
                         <div class="gdcf-tooltip">
692
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
693
-                            <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
692
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
693
+                            <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
694 694
                         </div>
695 695
                     </label>
696 696
                     <div class="gd-cf-input-wrap">
@@ -705,23 +705,23 @@  discard block
 block discarded – undo
705 705
 
706 706
 
707 707
             // cat_sort
708
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
708
+            if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
709 709
 
710
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
710
+                echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
711 711
 
712
-            }else{
712
+            } else {
713 713
                 $value = '';
714
-                $hide_cat_sort  ='';
714
+                $hide_cat_sort = '';
715 715
                 if (isset($field_info->cat_sort)) {
716 716
                     $value = esc_attr($field_info->cat_sort);
717
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
717
+                }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
718 718
                     $value = $cf['defaults']['cat_sort'];
719
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
719
+                    $hide_cat_sort = ($value === false) ? "style='display:none;'" : '';
720 720
                 }
721 721
 
722
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
722
+                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : '';
723 723
                 ?>
724
-                <li <?php echo $hide_cat_sort ;?>>
724
+                <li <?php echo $hide_cat_sort; ?>>
725 725
                     <h3><?php
726 726
                         /**
727 727
                          * Filter the section title.
@@ -740,23 +740,23 @@  discard block
 block discarded – undo
740 740
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
741 741
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
742 742
                         <div class="gdcf-tooltip">
743
-                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
743
+                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
744 744
                         </div>
745 745
                     </label>
746 746
 
747 747
                     <div class="gd-cf-input-wrap gd-switch">
748 748
 
749
-                        <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
749
+                        <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
750 750
                             <?php if ($value == '1') {
751 751
                                 echo 'checked';
752 752
                             } ?>/>
753
-                        <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
753
+                        <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
754 754
 
755
-                        <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
755
+                        <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
756 756
                             <?php if (!$value) {
757 757
                                 echo 'checked';
758 758
                             } ?>/>
759
-                        <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
759
+                        <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
760 760
 
761 761
                     </div>
762 762
                 </li>
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
                      * @param object $field_info The current fields info.
784 784
                      * @param array $cf The custom field settings
785 785
                      */
786
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
786
+                    do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
787 787
 
788 788
 
789 789
                 <?php endswitch; ?>
@@ -795,10 +795,10 @@  discard block
 block discarded – undo
795 795
                     <h3></h3>
796 796
                 </label>
797 797
                 <div class="gd-cf-input-wrap">
798
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
798
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
799 799
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
800 800
                     <?php if (!$default): ?>
801
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
801
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
802 802
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
803 803
                                                             class="button"/></a>
804 804
                     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +38 added lines, -36 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 27
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
48 49
 
49 50
 $field_admin_title = '';
50
-if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+if (isset($field_info->admin_title)) {
52
+    $field_admin_title = $field_info->admin_title;
53
+}
52 54
 
53 55
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 56
 
@@ -69,15 +71,15 @@  discard block
 block discarded – undo
69 71
 
70 72
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 73
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
74
+} elseif(isset($cf['icon']) && $cf['icon']){
73 75
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74
-}else{
76
+} else{
75 77
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 78
 }
77 79
 
78 80
 if(isset($cf['name']) && $cf['name']){
79 81
     $field_type_name = $cf['name'];
80
-}else{
82
+} else{
81 83
     $field_type_name = $field_type;
82 84
 }
83 85
 
@@ -143,11 +145,11 @@  discard block
 block discarded – undo
143 145
 
144 146
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
145 147
 
146
-            }else{
148
+            } else{
147 149
                 $value = '';
148 150
                 if (isset($field_info->data_type)) {
149 151
                     $value = esc_attr($field_info->data_type);
150
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
152
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
151 153
                     $value = $cf['defaults']['data_type'];
152 154
                 }
153 155
                 ?>
@@ -161,11 +163,11 @@  discard block
 block discarded – undo
161 163
 
162 164
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
163 165
 
164
-            }else{
166
+            } else{
165 167
                 $value = '';
166 168
                 if (isset($field_info->admin_title)) {
167 169
                     $value = esc_attr($field_info->admin_title);
168
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
170
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
169 171
                     $value = $cf['defaults']['admin_title'];
170 172
                 }
171 173
                 ?>
@@ -190,11 +192,11 @@  discard block
 block discarded – undo
190 192
 
191 193
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
192 194
 
193
-            }else{
195
+            } else{
194 196
                 $value = '';
195 197
                 if (isset($field_info->site_title)) {
196 198
                     $value = esc_attr($field_info->site_title);
197
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
199
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
198 200
                     $value = $cf['defaults']['site_title'];
199 201
                 }
200 202
                 ?>
@@ -218,11 +220,11 @@  discard block
 block discarded – undo
218 220
 
219 221
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
220 222
 
221
-            }else{
223
+            } else{
222 224
                 $value = '';
223 225
                 if (isset($field_info->admin_desc)) {
224 226
                     $value = esc_attr($field_info->admin_desc);
225
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
227
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
226 228
                     $value = $cf['defaults']['admin_desc'];
227 229
                 }
228 230
                 ?>
@@ -246,11 +248,11 @@  discard block
 block discarded – undo
246 248
 
247 249
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
248 250
 
249
-            }else{
251
+            } else{
250 252
                 $value = '';
251 253
                 if (isset($field_info->htmlvar_name)) {
252 254
                     $value = esc_attr($field_info->htmlvar_name);
253
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
255
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
254 256
                     $value = $cf['defaults']['htmlvar_name'];
255 257
                 }
256 258
                 ?>
@@ -278,11 +280,11 @@  discard block
 block discarded – undo
278 280
 
279 281
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
280 282
 
281
-            }else{
283
+            } else{
282 284
                 $value = '';
283 285
                 if (isset($field_info->is_active)) {
284 286
                     $value = esc_attr($field_info->is_active);
285
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
287
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
286 288
                     $value = $cf['defaults']['is_active'];
287 289
                 }
288 290
                 ?>
@@ -317,11 +319,11 @@  discard block
 block discarded – undo
317 319
 
318 320
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
319 321
 
320
-            }else{
322
+            } else{
321 323
                 $value = '';
322 324
                 if (isset($field_info->for_admin_use)) {
323 325
                     $value = esc_attr($field_info->for_admin_use);
324
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
326
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
325 327
                     $value = $cf['defaults']['for_admin_use'];
326 328
                 }
327 329
                 ?>
@@ -356,11 +358,11 @@  discard block
 block discarded – undo
356 358
 
357 359
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
358 360
 
359
-            }else{
361
+            } else{
360 362
                 $value = '';
361 363
                 if (isset($field_info->default_value)) {
362 364
                     $value = esc_attr($field_info->default_value);
363
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
365
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
364 366
                     $value = $cf['defaults']['default_value'];
365 367
                 }
366 368
                 ?>
@@ -400,11 +402,11 @@  discard block
 block discarded – undo
400 402
 
401 403
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
402 404
 
403
-            }else{
405
+            } else{
404 406
                 $value = '';
405 407
                 if (isset($field_info->show_in)) {
406 408
                     $value = esc_attr($field_info->show_in);
407
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
409
+                } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
408 410
                     $value = esc_attr($cf['defaults']['show_in']);
409 411
                 }
410 412
                 ?>
@@ -444,7 +446,7 @@  discard block
 block discarded – undo
444 446
 
445 447
                         // don't show new tab option for some types
446 448
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
447
-                        }else{
449
+                        } else{
448 450
                             unset($show_in_locations['[owntab]']);
449 451
                         }
450 452
 
@@ -557,11 +559,11 @@  discard block
 block discarded – undo
557 559
 
558 560
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
559 561
 
560
-            }else{
562
+            } else{
561 563
                 $value = '';
562 564
                 if (isset($field_info->is_required)) {
563 565
                     $value = esc_attr($field_info->is_required);
564
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
566
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
565 567
                     $value = $cf['defaults']['is_required'];
566 568
                 }
567 569
                 ?>
@@ -598,11 +600,11 @@  discard block
 block discarded – undo
598 600
 
599 601
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
600 602
 
601
-            }else{
603
+            } else{
602 604
                 $value = '';
603 605
                 if (isset($field_info->required_msg)) {
604 606
                     $value = esc_attr($field_info->required_msg);
605
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
607
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
606 608
                     $value = $cf['defaults']['required_msg'];
607 609
                 }
608 610
                 ?>
@@ -643,11 +645,11 @@  discard block
 block discarded – undo
643 645
 
644 646
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
645 647
 
646
-            }else{
648
+            } else{
647 649
                 $value = '';
648 650
                 if (isset($field_info->field_icon)) {
649 651
                     $value = esc_attr($field_info->field_icon);
650
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
652
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
651 653
                     $value = $cf['defaults']['field_icon'];
652 654
                 }
653 655
                 ?>
@@ -676,11 +678,11 @@  discard block
 block discarded – undo
676 678
 
677 679
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
678 680
 
679
-            }else{
681
+            } else{
680 682
                 $value = '';
681 683
                 if (isset($field_info->css_class)) {
682 684
                     $value = esc_attr($field_info->css_class);
683
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
685
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
684 686
                     $value = $cf['defaults']['css_class'];
685 687
                 }
686 688
                 ?>
@@ -709,12 +711,12 @@  discard block
 block discarded – undo
709 711
 
710 712
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
711 713
 
712
-            }else{
714
+            } else{
713 715
                 $value = '';
714 716
                 $hide_cat_sort  ='';
715 717
                 if (isset($field_info->cat_sort)) {
716 718
                     $value = esc_attr($field_info->cat_sort);
717
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
719
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
718 720
                     $value = $cf['defaults']['cat_sort'];
719 721
                     $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
720 722
                 }
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_functions.php 3 patches
Indentation   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function  geodir_init_map_jason()
17 17
 {
18
-    global $map_jason;
19
-    $map_jason = array();
18
+	global $map_jason;
19
+	$map_jason = array();
20 20
 }
21 21
 
22 22
 /**
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function geodir_init_map_canvas_array()
30 30
 {
31
-    global $map_canvas_arr;
32
-    $map_canvas_arr = array();
31
+	global $map_canvas_arr;
32
+	$map_canvas_arr = array();
33 33
 }
34 34
 
35 35
 
@@ -50,63 +50,63 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function create_marker_jason_of_posts($post)
52 52
 {
53
-    global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
53
+	global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
54 54
 
55
-    if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
55
+	if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
56 56
 
57
-        if(isset($map_jason[$post->ID])){return null;}
57
+		if(isset($map_jason[$post->ID])){return null;}
58 58
 
59
-        $srcharr = array("'", "/", "-", '"', '\\');
60
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
59
+		$srcharr = array("'", "/", "-", '"', '\\');
60
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
61 61
 
62 62
 
63
-        $geodir_cat_icons = geodir_get_term_icon();
64
-        $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
63
+		$geodir_cat_icons = geodir_get_term_icon();
64
+		$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
65 65
 
66
-        $post_title = $post->post_title;
67
-        $title = str_replace($srcharr, $replarr, $post_title);
66
+		$post_title = $post->post_title;
67
+		$title = str_replace($srcharr, $replarr, $post_title);
68 68
 
69
-        if (is_ssl()) {
70
-            $icon = str_replace("http:","https:",$icon );
71
-        }
69
+		if (is_ssl()) {
70
+			$icon = str_replace("http:","https:",$icon );
71
+		}
72 72
         
73
-        if ($icon != '') {
74
-            $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
73
+		if ($icon != '') {
74
+			$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
75 75
             
76
-            if (isset($gd_marker_sizes[$icon])) {
77
-                $icon_size = $gd_marker_sizes[$icon];
78
-            } else {
79
-                $icon_size = geodir_get_marker_size($icon);
80
-                $gd_marker_sizes[$icon] = $icon_size;
81
-            }               
82
-        } else {
83
-            $icon_size = array('w' => 36, 'h' => 45);
84
-        }
85
-
86
-        $post_json = '{"id":"' . $post->ID
87
-                     . '","t": "' . $title
88
-                     . '","lt": "' . $post->post_latitude
89
-                     . '","ln": "' . $post->post_longitude
90
-                     . '","mk_id":"' . $post->ID . '_' . $post->default_category
91
-                     . '","i":"' . $icon
92
-                     . '","w":"' . $icon_size['w']
93
-                     . '","h":"' . $icon_size['h'] . '"}';
94
-
95
-        /**
96
-         * Filter the json data when creating output for post json marker..
97
-         *
98
-         * @since 1.5.7
99
-         * @param string $post_json JSON representation of the post marker info.
100
-         * @param object $post The post object.
101
-         */
102
-        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
103
-
104
-        // only assign it if it has a value
105
-        if($post_map_json){
106
-            $map_jason[$post->ID] = $post_map_json;
107
-        }
108
-
109
-    }
76
+			if (isset($gd_marker_sizes[$icon])) {
77
+				$icon_size = $gd_marker_sizes[$icon];
78
+			} else {
79
+				$icon_size = geodir_get_marker_size($icon);
80
+				$gd_marker_sizes[$icon] = $icon_size;
81
+			}               
82
+		} else {
83
+			$icon_size = array('w' => 36, 'h' => 45);
84
+		}
85
+
86
+		$post_json = '{"id":"' . $post->ID
87
+					 . '","t": "' . $title
88
+					 . '","lt": "' . $post->post_latitude
89
+					 . '","ln": "' . $post->post_longitude
90
+					 . '","mk_id":"' . $post->ID . '_' . $post->default_category
91
+					 . '","i":"' . $icon
92
+					 . '","w":"' . $icon_size['w']
93
+					 . '","h":"' . $icon_size['h'] . '"}';
94
+
95
+		/**
96
+		 * Filter the json data when creating output for post json marker..
97
+		 *
98
+		 * @since 1.5.7
99
+		 * @param string $post_json JSON representation of the post marker info.
100
+		 * @param object $post The post object.
101
+		 */
102
+		$post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
103
+
104
+		// only assign it if it has a value
105
+		if($post_map_json){
106
+			$map_jason[$post->ID] = $post_map_json;
107
+		}
108
+
109
+	}
110 110
 }
111 111
 
112 112
 /**
@@ -119,67 +119,67 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function send_marker_jason_to_js()
121 121
 {
122
-    global $map_jason, $map_canvas_arr;
123
-
124
-    if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
125
-        foreach ($map_canvas_arr as $canvas => $jason) {
126
-            if (is_array($map_jason) && !empty($map_jason)) {
127
-
128
-                // on details page only show the main marker on the map
129
-                if(geodir_is_page('detail')){
130
-                    global $post;
131
-                    if(isset($map_jason[$post->ID])){
132
-                        $map_jason = array($map_jason[$post->ID]);
133
-                    }
134
-                }
135
-                $canvas_jason = $canvas . "_jason";
136
-                $map_canvas_arr[$canvas] = array_unique($map_jason);
137
-                unset($cat_content_info);
138
-                $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
139
-                $totalcount = count(array_unique($map_jason));
140
-                if (!empty($cat_content_info)) {
141
-                    $json_content = substr(implode(',', $cat_content_info), 1);
142
-                    $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
143
-                    $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
144
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
145
-                } else {
146
-                    $canvas_jason = '[{"totalcount":"0"}]';
147
-                }
148
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
149
-
150
-                /**
151
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
152
-                 *
153
-                 * You can use this filter to modify map canvas json args.
154
-                 *
155
-                 * @since 1.0.0
156
-                 * @package GeoDirectory
157
-                 * @param string $canvas Map canvas array key.
158
-                 * @param array $map_canvas_jason_args Map canvas args.
159
-                 */
160
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
161
-
162
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
163
-            } else {
164
-                $canvas_jason = '[{"totalcount":"0"}]';
165
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
166
-
167
-                /**
168
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
169
-                 *
170
-                 * You can use this filter to modify map canvas json args.
171
-                 *
172
-                 * @since 1.0.0
173
-                 * @package GeoDirectory
174
-                 * @param string $canvas Map canvas array key.
175
-                 * @param array $map_canvas_jason_args Map canvas args.
176
-                 */
177
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
178
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
179
-            }
180
-        }
181
-
182
-    }
122
+	global $map_jason, $map_canvas_arr;
123
+
124
+	if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
125
+		foreach ($map_canvas_arr as $canvas => $jason) {
126
+			if (is_array($map_jason) && !empty($map_jason)) {
127
+
128
+				// on details page only show the main marker on the map
129
+				if(geodir_is_page('detail')){
130
+					global $post;
131
+					if(isset($map_jason[$post->ID])){
132
+						$map_jason = array($map_jason[$post->ID]);
133
+					}
134
+				}
135
+				$canvas_jason = $canvas . "_jason";
136
+				$map_canvas_arr[$canvas] = array_unique($map_jason);
137
+				unset($cat_content_info);
138
+				$cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
139
+				$totalcount = count(array_unique($map_jason));
140
+				if (!empty($cat_content_info)) {
141
+					$json_content = substr(implode(',', $cat_content_info), 1);
142
+					$json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
143
+					$json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
144
+					$canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
145
+				} else {
146
+					$canvas_jason = '[{"totalcount":"0"}]';
147
+				}
148
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
149
+
150
+				/**
151
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
152
+				 *
153
+				 * You can use this filter to modify map canvas json args.
154
+				 *
155
+				 * @since 1.0.0
156
+				 * @package GeoDirectory
157
+				 * @param string $canvas Map canvas array key.
158
+				 * @param array $map_canvas_jason_args Map canvas args.
159
+				 */
160
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
161
+
162
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
163
+			} else {
164
+				$canvas_jason = '[{"totalcount":"0"}]';
165
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
166
+
167
+				/**
168
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
169
+				 *
170
+				 * You can use this filter to modify map canvas json args.
171
+				 *
172
+				 * @since 1.0.0
173
+				 * @package GeoDirectory
174
+				 * @param string $canvas Map canvas array key.
175
+				 * @param array $map_canvas_jason_args Map canvas args.
176
+				 */
177
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
178
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
179
+			}
180
+		}
181
+
182
+	}
183 183
 }
184 184
 
185 185
 /**
@@ -202,99 +202,99 @@  discard block
 block discarded – undo
202 202
  */
203 203
 function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false)
204 204
 {
205
-    global $cat_count, $geodir_cat_icons, $gd_session;
205
+	global $cat_count, $geodir_cat_icons, $gd_session;
206 206
 
207
-    $exclude_categories = get_option('geodir_exclude_cat_on_map');
208
-    $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
207
+	$exclude_categories = get_option('geodir_exclude_cat_on_map');
208
+	$exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
209 209
 
210
-    // check if exclude categories saved before fix of categories identical names
211
-    if ($exclude_categories_new) {
212
-        $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
213
-        $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
214
-    }
210
+	// check if exclude categories saved before fix of categories identical names
211
+	if ($exclude_categories_new) {
212
+		$gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
213
+		$exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
214
+	}
215 215
 
216
-    $exclude_cat_str = implode(',', $exclude_categories);
216
+	$exclude_cat_str = implode(',', $exclude_categories);
217 217
 
218
-    if ($exclude_cat_str == '') {
219
-        $exclude_cat_str = '0';
220
-    }
218
+	if ($exclude_cat_str == '') {
219
+		$exclude_cat_str = '0';
220
+	}
221 221
 
222
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
222
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
223 223
 
224
-    if ($hide_empty) {
225
-        $cat_terms = geodir_filter_empty_terms($cat_terms);
226
-    }
224
+	if ($hide_empty) {
225
+		$cat_terms = geodir_filter_empty_terms($cat_terms);
226
+	}
227 227
 
228
-    $main_list_class = '';
229
-    //If there are terms, start displaying
230
-    if (count($cat_terms) > 0) {
231
-        //Displaying as a list
232
-        $p = $pading * 15;
233
-        $pading++;
228
+	$main_list_class = '';
229
+	//If there are terms, start displaying
230
+	if (count($cat_terms) > 0) {
231
+		//Displaying as a list
232
+		$p = $pading * 15;
233
+		$pading++;
234 234
 
235
-        if ($cat_parent == 0) {
236
-            $list_class = 'main_list';
237
-            $display = '';
238
-        } else {
239
-            $list_class = 'sub_list';
240
-            $display = !$child_collapse ? '' : 'display:none';
241
-        }
235
+		if ($cat_parent == 0) {
236
+			$list_class = 'main_list';
237
+			$display = '';
238
+		} else {
239
+			$list_class = 'sub_list';
240
+			$display = !$child_collapse ? '' : 'display:none';
241
+		}
242 242
 
243
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
243
+		$out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
244 244
 
245
-        $geodir_cat_icons = geodir_get_term_icon();
245
+		$geodir_cat_icons = geodir_get_term_icon();
246 246
 
247
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
248
-        if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
249
-            $geodir_default_map_search_pt = $homemap_catlist_ptype;
250
-        }
251
-        $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt);
247
+		$geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
248
+		if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
249
+			$geodir_default_map_search_pt = $homemap_catlist_ptype;
250
+		}
251
+		$post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt);
252 252
         
253
-        foreach ($cat_terms as $cat_term):
254
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
255
-
256
-            if (!in_array($cat_term->term_id, $exclude_categories)):
257
-                //Secret sauce.  Function calls itself to display child elements, if any
258
-                $checked = 'checked="checked"';
259
-
260
-                // Untick the category by default on home map
261
-                if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
262
-                    if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
263
-                        global $sitepress;
264
-                        $default_lang = $sitepress->get_default_language();
265
-                        $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
266
-                    }else{
267
-                        $term_id = $cat_term->term_id;
268
-                    }
269
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
270
-                        $checked = '';
271
-                    }
272
-                }
273
-
274
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
275
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
276
-                $term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
277
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
278
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
279
-
280
-            endif;
281
-
282
-
283
-            // get sub category by recursion
284
-            $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
285
-
286
-            $out .= '</li>';
287
-
288
-        endforeach;
289
-
290
-        $out .= '</ul>';
291
-
292
-        return $out;
293
-    } else {
294
-        if ($cat_parent == 0)
295
-            return _e('No category', 'geodirectory');
296
-    }
297
-    return;
253
+		foreach ($cat_terms as $cat_term):
254
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
255
+
256
+			if (!in_array($cat_term->term_id, $exclude_categories)):
257
+				//Secret sauce.  Function calls itself to display child elements, if any
258
+				$checked = 'checked="checked"';
259
+
260
+				// Untick the category by default on home map
261
+				if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
262
+					if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
263
+						global $sitepress;
264
+						$default_lang = $sitepress->get_default_language();
265
+						$term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
266
+					}else{
267
+						$term_id = $cat_term->term_id;
268
+					}
269
+					if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
270
+						$checked = '';
271
+					}
272
+				}
273
+
274
+				$term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
275
+				$term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
276
+				$term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
277
+				$term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
278
+				$out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
279
+
280
+			endif;
281
+
282
+
283
+			// get sub category by recursion
284
+			$out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
285
+
286
+			$out .= '</li>';
287
+
288
+		endforeach;
289
+
290
+		$out .= '</ul>';
291
+
292
+		return $out;
293
+	} else {
294
+		if ($cat_parent == 0)
295
+			return _e('No category', 'geodirectory');
296
+	}
297
+	return;
298 298
 }
299 299
 
300 300
 /**
@@ -306,19 +306,19 @@  discard block
 block discarded – undo
306 306
  * @return string The map API provider name.
307 307
  */
308 308
 function geodir_map_name() {
309
-    $geodir_map_name = get_option('geodir_load_map', 'google');
309
+	$geodir_map_name = get_option('geodir_load_map', 'google');
310 310
     
311
-    if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
312
-        $geodir_map_name = 'auto';
313
-    }
314
-
315
-    /**
316
-     * Filter the map JS API provider name.
317
-     *
318
-     * @since 1.6.1
319
-     * @param string $geodir_map_name The map API provider name.
320
-     */
321
-    return apply_filters('geodir_map_name', $geodir_map_name);
311
+	if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
312
+		$geodir_map_name = 'auto';
313
+	}
314
+
315
+	/**
316
+	 * Filter the map JS API provider name.
317
+	 *
318
+	 * @since 1.6.1
319
+	 * @param string $geodir_map_name The map API provider name.
320
+	 */
321
+	return apply_filters('geodir_map_name', $geodir_map_name);
322 322
 }
323 323
 
324 324
 /**
@@ -334,48 +334,48 @@  discard block
 block discarded – undo
334 334
  * @return array The icon size.
335 335
  */
336 336
 function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
337
-    global $gd_marker_sizes;
337
+	global $gd_marker_sizes;
338 338
     
339
-    if (empty($gd_marker_sizes)) {
340
-        $gd_marker_sizes = array();
341
-    }
339
+	if (empty($gd_marker_sizes)) {
340
+		$gd_marker_sizes = array();
341
+	}
342 342
       
343
-    if (!empty($gd_marker_sizes[$icon])) {
344
-        return $gd_marker_sizes[$icon];
345
-    }
343
+	if (!empty($gd_marker_sizes[$icon])) {
344
+		return $gd_marker_sizes[$icon];
345
+	}
346 346
     
347
-    if (empty($icon)) {
348
-        $gd_marker_sizes[$icon] = $default_size;
347
+	if (empty($icon)) {
348
+		$gd_marker_sizes[$icon] = $default_size;
349 349
         
350
-        return $default_size;
351
-    }
350
+		return $default_size;
351
+	}
352 352
     
353
-    $icon_url = $icon;
353
+	$icon_url = $icon;
354 354
     
355
-    $uploads = wp_upload_dir(); // Array of key => value pairs
355
+	$uploads = wp_upload_dir(); // Array of key => value pairs
356 356
       
357
-    if (!path_is_absolute($icon)) {
358
-        $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
359
-    }
357
+	if (!path_is_absolute($icon)) {
358
+		$icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
359
+	}
360 360
     
361
-    if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
362
-        $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
363
-    }
361
+	if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
362
+		$icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
363
+	}
364 364
     
365
-    $sizes = array();
366
-    if (is_file($icon) && file_exists($icon)) {
367
-        $size = getimagesize(trim($icon));
365
+	$sizes = array();
366
+	if (is_file($icon) && file_exists($icon)) {
367
+		$size = getimagesize(trim($icon));
368 368
         
369
-        if (!empty($size[0]) && !empty($size[1])) {
370
-            $sizes = array('w' => $size[0], 'h' => $size[1]);
371
-        }
372
-    }
369
+		if (!empty($size[0]) && !empty($size[1])) {
370
+			$sizes = array('w' => $size[0], 'h' => $size[1]);
371
+		}
372
+	}
373 373
     
374
-    $sizes = !empty($sizes) ? $sizes : $default_size;
374
+	$sizes = !empty($sizes) ? $sizes : $default_size;
375 375
     
376
-    $gd_marker_sizes[$icon_url] = $sizes;
376
+	$gd_marker_sizes[$icon_url] = $sizes;
377 377
     
378
-    return $sizes;
378
+	return $sizes;
379 379
 }
380 380
 
381 381
 add_action('wp_footer', 'geodir_map_load_script', 10);
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
  * @package GeoDirectory
388 388
  */
389 389
 function geodir_map_load_script() {
390
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
391
-        $plugin_url = geodir_plugin_url();
390
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
391
+		$plugin_url = geodir_plugin_url();
392 392
 ?>
393 393
 <script type="text/javascript">
394 394
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -403,5 +403,5 @@  discard block
 block discarded – undo
403 403
 }
404 404
 </script>
405 405
 <?php
406
-    }
406
+	}
407 407
 }
408 408
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
56 56
 
57
-        if(isset($map_jason[$post->ID])){return null;}
57
+        if (isset($map_jason[$post->ID])) {return null; }
58 58
 
59 59
         $srcharr = array("'", "/", "-", '"', '\\');
60 60
         $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $title = str_replace($srcharr, $replarr, $post_title);
68 68
 
69 69
         if (is_ssl()) {
70
-            $icon = str_replace("http:","https:",$icon );
70
+            $icon = str_replace("http:", "https:", $icon);
71 71
         }
72 72
         
73 73
         if ($icon != '') {
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
             $icon_size = array('w' => 36, 'h' => 45);
84 84
         }
85 85
 
86
-        $post_json = '{"id":"' . $post->ID
87
-                     . '","t": "' . $title
88
-                     . '","lt": "' . $post->post_latitude
89
-                     . '","ln": "' . $post->post_longitude
90
-                     . '","mk_id":"' . $post->ID . '_' . $post->default_category
91
-                     . '","i":"' . $icon
92
-                     . '","w":"' . $icon_size['w']
93
-                     . '","h":"' . $icon_size['h'] . '"}';
86
+        $post_json = '{"id":"'.$post->ID
87
+                     . '","t": "'.$title
88
+                     . '","lt": "'.$post->post_latitude
89
+                     . '","ln": "'.$post->post_longitude
90
+                     . '","mk_id":"'.$post->ID.'_'.$post->default_category
91
+                     . '","i":"'.$icon
92
+                     . '","w":"'.$icon_size['w']
93
+                     . '","h":"'.$icon_size['h'].'"}';
94 94
 
95 95
         /**
96 96
          * Filter the json data when creating output for post json marker..
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
          * @param string $post_json JSON representation of the post marker info.
100 100
          * @param object $post The post object.
101 101
          */
102
-        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
102
+        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
103 103
 
104 104
         // only assign it if it has a value
105
-        if($post_map_json){
105
+        if ($post_map_json) {
106 106
             $map_jason[$post->ID] = $post_map_json;
107 107
         }
108 108
 
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
             if (is_array($map_jason) && !empty($map_jason)) {
127 127
 
128 128
                 // on details page only show the main marker on the map
129
-                if(geodir_is_page('detail')){
129
+                if (geodir_is_page('detail')) {
130 130
                     global $post;
131
-                    if(isset($map_jason[$post->ID])){
131
+                    if (isset($map_jason[$post->ID])) {
132 132
                         $map_jason = array($map_jason[$post->ID]);
133 133
                     }
134 134
                 }
135
-                $canvas_jason = $canvas . "_jason";
135
+                $canvas_jason = $canvas."_jason";
136 136
                 $map_canvas_arr[$canvas] = array_unique($map_jason);
137 137
                 unset($cat_content_info);
138 138
                 $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
                     $json_content = substr(implode(',', $cat_content_info), 1);
142 142
                     $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
143 143
                     $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
144
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
144
+                    $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
145 145
                 } else {
146 146
                     $canvas_jason = '[{"totalcount":"0"}]';
147 147
                 }
148
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
148
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
149 149
 
150 150
                 /**
151 151
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
                  * @param string $canvas Map canvas array key.
158 158
                  * @param array $map_canvas_jason_args Map canvas args.
159 159
                  */
160
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
160
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
161 161
 
162
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
162
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
163 163
             } else {
164 164
                 $canvas_jason = '[{"totalcount":"0"}]';
165
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
165
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
166 166
 
167 167
                 /**
168 168
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
                  * @param string $canvas Map canvas array key.
175 175
                  * @param array $map_canvas_jason_args Map canvas args.
176 176
                  */
177
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
178
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
177
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
178
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
179 179
             }
180 180
         }
181 181
 
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
             $display = !$child_collapse ? '' : 'display:none';
241 241
         }
242 242
 
243
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
243
+        $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">';
244 244
 
245 245
         $geodir_cat_icons = geodir_get_term_icon();
246 246
 
247
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
247
+        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
248 248
         if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
249 249
             $geodir_default_map_search_pt = $homemap_catlist_ptype;
250 250
         }
@@ -259,23 +259,23 @@  discard block
 block discarded – undo
259 259
 
260 260
                 // Untick the category by default on home map
261 261
                 if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
262
-                    if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
262
+                    if (geodir_wpml_is_taxonomy_translated($post_type.'category')) { // if WPML
263 263
                         global $sitepress;
264 264
                         $default_lang = $sitepress->get_default_language();
265 265
                         $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
266
-                    }else{
266
+                    } else {
267 267
                         $term_id = $cat_term->term_id;
268 268
                     }
269
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
269
+                    if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$term_id, $geodir_home_map_untick)) {
270 270
                         $checked = '';
271 271
                     }
272 272
                 }
273 273
 
274
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
275
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
276
-                $term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
277
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
278
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
274
+                $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"';
275
+                $term_check .= ' name="'.$map_canvas_name.'_cat[]" ';
276
+                $term_check .= '  title="'.esc_attr(geodir_utf8_ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">';
277
+                $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.geodir_utf8_ucfirst($cat_term->name).'"/>';
278
+                $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.geodir_utf8_ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>';
279 279
 
280 280
             endif;
281 281
 
@@ -387,19 +387,19 @@  discard block
 block discarded – undo
387 387
  * @package GeoDirectory
388 388
  */
389 389
 function geodir_map_load_script() {
390
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
390
+    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
391 391
         $plugin_url = geodir_plugin_url();
392 392
 ?>
393 393
 <script type="text/javascript">
394 394
 if (!(window.google && typeof google.maps !== 'undefined')) {
395
-    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
395
+    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
396 396
     document.getElementsByTagName("head")[0].appendChild(css);
397
-    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
397
+    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
398 398
     document.getElementsByTagName("head")[0].appendChild(css);
399
-    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
400
-    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/osm.geocode.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
401
-    document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
402
-    document.write('<' + 'script id="geodirectory-o-overlappingmarker-script" src="<?php echo $plugin_url;?>/geodirectory-assets/jawj/oms-leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
399
+    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
400
+    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/osm.geocode.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
401
+    document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
402
+    document.write('<' + 'script id="geodirectory-o-overlappingmarker-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/jawj/oms-leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
403 403
 }
404 404
 </script>
405 405
 <?php
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                         global $sitepress;
264 264
                         $default_lang = $sitepress->get_default_language();
265 265
                         $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
266
-                    }else{
266
+                    } else{
267 267
                         $term_id = $cat_term->term_id;
268 268
                     }
269 269
                     if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
@@ -291,8 +291,9 @@  discard block
 block discarded – undo
291 291
 
292 292
         return $out;
293 293
     } else {
294
-        if ($cat_parent == 0)
295
-            return _e('No category', 'geodirectory');
294
+        if ($cat_parent == 0) {
295
+                    return _e('No category', 'geodirectory');
296
+        }
296 297
     }
297 298
     return;
298 299
 }
Please login to merge, or discard this patch.