@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Enfold theme compatibility functions. |
|
4 | - * |
|
5 | - * This file lets the GeoDirectory Plugin use the Enfold theme HTML wrappers to fit and work perfectly. |
|
6 | - * |
|
7 | - * @since 1.0.0 |
|
8 | - * @package GeoDirectory |
|
9 | - */ |
|
3 | + * Enfold theme compatibility functions. |
|
4 | + * |
|
5 | + * This file lets the GeoDirectory Plugin use the Enfold theme HTML wrappers to fit and work perfectly. |
|
6 | + * |
|
7 | + * @since 1.0.0 |
|
8 | + * @package GeoDirectory |
|
9 | + */ |
|
10 | 10 | add_action('after_setup_theme', 'enfold_action_calls', 11); |
11 | 11 | /** |
12 | - * Action calls for enfold theme compatibility. |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * @package GeoDirectory |
|
16 | - */ |
|
12 | + * Action calls for enfold theme compatibility. |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * @package GeoDirectory |
|
16 | + */ |
|
17 | 17 | function enfold_action_calls() |
18 | 18 | { |
19 | 19 |
@@ -113,7 +113,7 @@ |
||
113 | 113 | * @since 1.0.0 |
114 | 114 | * @package GeoDirectory |
115 | 115 | * @param array $classes Class array. |
116 | - * @return array Modified class array. |
|
116 | + * @return string[] Modified class array. |
|
117 | 117 | */ |
118 | 118 | function geodir_x_body_class($classes) |
119 | 119 | { |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Jupiter theme compatibility functions. |
|
4 | - * |
|
5 | - * This file lets the GeoDirectory Plugin use the Jupiter theme HTML wrappers to fit and work perfectly. |
|
6 | - * |
|
7 | - * @since 1.0.0 |
|
8 | - * @package GeoDirectory |
|
9 | - */ |
|
3 | + * Jupiter theme compatibility functions. |
|
4 | + * |
|
5 | + * This file lets the GeoDirectory Plugin use the Jupiter theme HTML wrappers to fit and work perfectly. |
|
6 | + * |
|
7 | + * @since 1.0.0 |
|
8 | + * @package GeoDirectory |
|
9 | + */ |
|
10 | 10 | add_action('after_setup_theme', 'jupiter_action_calls', 11); |
11 | 11 | /** |
12 | - * Action calls for jupiter theme compatibility. |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * @package GeoDirectory |
|
16 | - */ |
|
12 | + * Action calls for jupiter theme compatibility. |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * @package GeoDirectory |
|
16 | + */ |
|
17 | 17 | function jupiter_action_calls() |
18 | 18 | { |
19 | 19 | // REMOVE BREADCRUMB |
@@ -126,8 +126,10 @@ |
||
126 | 126 | $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
127 | 127 | if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
128 | 128 | return $matches[0]; |
129 | - } else return ''; |
|
130 | -} |
|
129 | + } else { |
|
130 | + return ''; |
|
131 | + } |
|
132 | + } |
|
131 | 133 | |
132 | 134 | |
133 | 135 | /** |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin custom field form |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * |
|
7 | - * @package GeoDirectory |
|
8 | - */ |
|
3 | + * Admin custom field form |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * |
|
7 | + * @package GeoDirectory |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Displays the custom field form content. |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | // Remove Send Enquiry | Send To Friend from listings page |
37 | 37 | $htmlvar_name = isset($field_info->htmlvar_name) && $field_info->htmlvar_name != '' ? $field_info->htmlvar_name : ''; |
38 | 38 | if ($htmlvar_name == 'geodir_email') { |
39 | - $field_info->show_on_listing = 0; |
|
40 | - $display_on_listing = false; |
|
39 | + $field_info->show_on_listing = 0; |
|
40 | + $display_on_listing = false; |
|
41 | 41 | } |
42 | 42 | $field_data_type = isset($field_info->data_type) ? $field_info->data_type : ''; |
43 | 43 | ?> |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | |
75 | 75 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
76 | 76 | style="display:<?php if ($field_ins_upd == 'submit') { |
77 | - echo 'block;'; |
|
78 | - } else { |
|
79 | - echo 'none;'; |
|
80 | - } ?>"> |
|
77 | + echo 'block;'; |
|
78 | + } else { |
|
79 | + echo 'none;'; |
|
80 | + } ?>"> |
|
81 | 81 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/> |
82 | 82 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
83 | 83 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | <td align="left"> |
144 | 144 | <input type="text" name="admin_title" id="admin_title" |
145 | 145 | value="<?php if (isset($field_info->admin_title)) { |
146 | - echo esc_attr($field_info->admin_title); |
|
147 | - } ?>"/> |
|
146 | + echo esc_attr($field_info->admin_title); |
|
147 | + } ?>"/> |
|
148 | 148 | <br/><span><?php _e('Personal comment, it would not be displayed anywhere except in custom field settings', 'geodirectory'); ?></span> |
149 | 149 | </td> |
150 | 150 | </tr> |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | <td align="left"> |
154 | 154 | <input type="text" name="site_title" id="site_title" |
155 | 155 | value="<?php if (isset($field_info->site_title)) { |
156 | - echo esc_attr($field_info->site_title); |
|
157 | - } ?>"/> |
|
156 | + echo esc_attr($field_info->site_title); |
|
157 | + } ?>"/> |
|
158 | 158 | <br/><span><?php _e('Section title which you wish to display in frontend', 'geodirectory'); ?></span> |
159 | 159 | </td> |
160 | 160 | </tr> |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | <td align="left"> |
164 | 164 | <input type="text" name="admin_desc" id="admin_desc" |
165 | 165 | value="<?php if (isset($field_info->admin_desc)) { |
166 | - echo esc_attr($field_info->admin_desc); |
|
167 | - } ?>"/> |
|
166 | + echo esc_attr($field_info->admin_desc); |
|
167 | + } ?>"/> |
|
168 | 168 | <br/><span><?php _e('Section description which will appear in frontend', 'geodirectory'); ?></span> |
169 | 169 | </td> |
170 | 170 | </tr> |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | <td align="left"> |
177 | 177 | <input type="text" name="htmlvar_name" id="htmlvar_name" |
178 | 178 | value="<?php if (isset($field_info->htmlvar_name)) { |
179 | - echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1); |
|
180 | - }?>" <?php if ($default) { |
|
179 | + echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1); |
|
180 | + }?>" <?php if ($default) { |
|
181 | 181 | echo 'readonly="readonly"'; |
182 | 182 | }?> /> |
183 | 183 | <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory');?></span> |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | </td> |
199 | 199 | </tr> |
200 | 200 | <?php |
201 | - if ($field_type != 'textarea' && $field_type != 'html' && $field_type != 'file' && $field_type != 'fieldset' && $field_type != 'taxonomy' && $field_type != 'address') { |
|
202 | - $default_value = isset($field_info->default_value) ? $field_info->default_value : ''; |
|
203 | - ?> |
|
201 | + if ($field_type != 'textarea' && $field_type != 'html' && $field_type != 'file' && $field_type != 'fieldset' && $field_type != 'taxonomy' && $field_type != 'address') { |
|
202 | + $default_value = isset($field_info->default_value) ? $field_info->default_value : ''; |
|
203 | + ?> |
|
204 | 204 | <tr> |
205 | 205 | <td><strong><?php _e('Default value :', 'geodirectory');?></strong></td> |
206 | 206 | <td align="left"> |
@@ -299,18 +299,18 @@ discard block |
||
299 | 299 | <?php |
300 | 300 | $html = ob_get_clean(); |
301 | 301 | |
302 | - /** |
|
303 | - * Filter the price packages list. |
|
304 | - * |
|
305 | - * Filter the price packages list in custom field form in admin |
|
302 | + /** |
|
303 | + * Filter the price packages list. |
|
304 | + * |
|
305 | + * Filter the price packages list in custom field form in admin |
|
306 | 306 | * custom fields settings. |
307 | - * |
|
308 | - * @since 1.0.0 |
|
309 | - * |
|
310 | - * @param string $html The price packages content. |
|
311 | - * @param object $field_info Current field object. |
|
312 | - */ |
|
313 | - echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info); |
|
307 | + * |
|
308 | + * @since 1.0.0 |
|
309 | + * |
|
310 | + * @param string $html The price packages content. |
|
311 | + * @param object $field_info Current field object. |
|
312 | + */ |
|
313 | + echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info); |
|
314 | 314 | |
315 | 315 | ?> |
316 | 316 | |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | <td align="left"> |
371 | 371 | <input type="text" name="required_msg" id="required_msg" |
372 | 372 | value="<?php if (isset($field_info->required_msg)) { |
373 | - echo esc_attr($field_info->required_msg); |
|
374 | - } ?>"/> |
|
373 | + echo esc_attr($field_info->required_msg); |
|
374 | + } ?>"/> |
|
375 | 375 | <span> |
376 | 376 | <?php _e('Enter text for error message if field required and have not full fill requirement.', 'geodirectory'); ?> |
377 | 377 | </span> |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | <td align="left"> |
386 | 386 | <input type="text" name="validation_pattern" id="validation_pattern" |
387 | 387 | value="<?php if (isset($field_info->validation_pattern)) { |
388 | - echo esc_attr($field_info->validation_pattern); |
|
389 | - } ?>"/> |
|
388 | + echo esc_attr($field_info->validation_pattern); |
|
389 | + } ?>"/> |
|
390 | 390 | <span> |
391 | 391 | <?php _e('Enter regex expression for HTML5 pattern validation.', 'geodirectory'); ?> |
392 | 392 | </span> |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | <td align="left"> |
400 | 400 | <input type="text" name="validation_msg" id="validation_msg" |
401 | 401 | value="<?php if (isset($field_info->validation_msg)) { |
402 | - echo esc_attr($field_info->validation_msg); |
|
403 | - } ?>"/> |
|
402 | + echo esc_attr($field_info->validation_msg); |
|
403 | + } ?>"/> |
|
404 | 404 | <span> |
405 | 405 | <?php _e('Enter a extra validation message to show to the user if validation fails.', 'geodirectory'); ?> |
406 | 406 | </span> |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | <td align="left"> |
548 | 548 | <input type="text" name="extra[zip_lable]" id="zip_lable" |
549 | 549 | value="<?php if (isset($address['zip_lable'])) { |
550 | - echo esc_attr($address['zip_lable']); |
|
551 | - }?>"/> |
|
550 | + echo esc_attr($address['zip_lable']); |
|
551 | + }?>"/> |
|
552 | 552 | <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory');?></span> |
553 | 553 | </td> |
554 | 554 | </tr> |
@@ -569,8 +569,8 @@ discard block |
||
569 | 569 | <td align="left"> |
570 | 570 | <input type="text" name="extra[map_lable]" id="map_lable" |
571 | 571 | value="<?php if (isset($address['map_lable'])) { |
572 | - echo esc_attr($address['map_lable']); |
|
573 | - }?>"/> |
|
572 | + echo esc_attr($address['map_lable']); |
|
573 | + }?>"/> |
|
574 | 574 | <span><?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?></span> |
575 | 575 | </td> |
576 | 576 | </tr> |
@@ -603,8 +603,8 @@ discard block |
||
603 | 603 | <td align="left"> |
604 | 604 | <input type="text" name="extra[mapview_lable]" id="mapview_lable" |
605 | 605 | value="<?php if (isset($address['mapview_lable'])) { |
606 | - echo esc_attr($address['mapview_lable']); |
|
607 | - }?>"/> |
|
606 | + echo esc_attr($address['mapview_lable']); |
|
607 | + }?>"/> |
|
608 | 608 | <span><?php _e('Enter mapview field label in address section.', 'geodirectory');?></span> |
609 | 609 | </td> |
610 | 610 | </tr> |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | <td align="left"> |
657 | 657 | <input type="text" name="option_values" id="option_values" |
658 | 658 | value="<?php if (isset($field_info->option_values)) { |
659 | - echo esc_attr($field_info->option_values); |
|
660 | - }?>"/> |
|
659 | + echo esc_attr($field_info->option_values); |
|
660 | + }?>"/> |
|
661 | 661 | <br/> |
662 | 662 | <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span> |
663 | 663 | <br/> |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | <td align="left" style="overflow:inherit;"> |
686 | 686 | <input type="text" name="extra[date_format]" id="date_format" |
687 | 687 | value="<?php if (isset($extra['date_format'])) { |
688 | - echo esc_attr($extra['date_format']); |
|
689 | - }else{echo "mm/dd/yy";}?>"/> |
|
688 | + echo esc_attr($extra['date_format']); |
|
689 | + }else{echo "mm/dd/yy";}?>"/> |
|
690 | 690 | |
691 | 691 | <div style="position:relative; cursor:pointer;"> |
692 | 692 | <span onclick="jQuery('#show_dateformat').toggle();"> |
@@ -770,12 +770,12 @@ discard block |
||
770 | 770 | <?php |
771 | 771 | } |
772 | 772 | break; |
773 | - case 'file': { |
|
774 | - $allowed_file_types = geodir_allowed_mime_types(); |
|
773 | + case 'file': { |
|
774 | + $allowed_file_types = geodir_allowed_mime_types(); |
|
775 | 775 | |
776 | - $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
777 | - $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*'); |
|
778 | - ?> |
|
776 | + $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
777 | + $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*'); |
|
778 | + ?> |
|
779 | 779 | <tr> |
780 | 780 | <td><strong><?php _e('Allowed file types:', 'geodirectory');?></strong></td> |
781 | 781 | <td align="left"> |
@@ -794,8 +794,8 @@ discard block |
||
794 | 794 | </td> |
795 | 795 | </tr> |
796 | 796 | <?php |
797 | - } |
|
798 | - break; |
|
797 | + } |
|
798 | + break; |
|
799 | 799 | |
800 | 800 | endswitch; ?> |
801 | 801 | <?php if ($field_type != 'fieldset') { |
@@ -809,8 +809,8 @@ discard block |
||
809 | 809 | <td align="left"> |
810 | 810 | <input type="text" name="field_icon" id="field_icon" |
811 | 811 | value="<?php if (isset($field_info->field_icon)) { |
812 | - echo $field_info->field_icon; |
|
813 | - }?>"/> |
|
812 | + echo $field_info->field_icon; |
|
813 | + }?>"/> |
|
814 | 814 | <span> |
815 | 815 | <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?> |
816 | 816 | </span> |
@@ -823,8 +823,8 @@ discard block |
||
823 | 823 | <td align="left"> |
824 | 824 | <input type="text" name="css_class" id="css_class" |
825 | 825 | value="<?php if (isset($field_info->css_class)) { |
826 | - echo esc_attr($field_info->css_class); |
|
827 | - }?>"/> |
|
826 | + echo esc_attr($field_info->css_class); |
|
827 | + }?>"/> |
|
828 | 828 | <span> |
829 | 829 | <?php _e('Enter custom css class for field custom style.', 'geodirectory');?> |
830 | 830 | </span> |
@@ -849,18 +849,18 @@ discard block |
||
849 | 849 | <tr> |
850 | 850 | <td colspan="2" align="left"> |
851 | 851 | <h3><?php |
852 | - /** |
|
853 | - * Filter the section title. |
|
854 | - * |
|
855 | - * Filter the section title in custom field form in admin |
|
856 | - * custom fields settings. |
|
857 | - * |
|
858 | - * @since 1.0.0 |
|
859 | - * |
|
860 | - * @param string $title Title of the section. |
|
861 | - * @param string $field_type Current field type. |
|
862 | - */ |
|
863 | - echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
852 | + /** |
|
853 | + * Filter the section title. |
|
854 | + * |
|
855 | + * Filter the section title in custom field form in admin |
|
856 | + * custom fields settings. |
|
857 | + * |
|
858 | + * @since 1.0.0 |
|
859 | + * |
|
860 | + * @param string $title Title of the section. |
|
861 | + * @param string $field_type Current field type. |
|
862 | + */ |
|
863 | + echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
864 | 864 | |
865 | 865 | ?></h3> |
866 | 866 | </td> |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | ?> |
62 | 62 | |
63 | 63 | <b style="cursor:pointer;" |
64 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
|
64 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title); ?></b> |
|
65 | 65 | <?php |
66 | 66 | } else { |
67 | 67 | ?> |
68 | 68 | <b style="cursor:pointer;" |
69 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')');?></b> |
|
69 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')'); ?></b> |
|
70 | 70 | <?php |
71 | 71 | } |
72 | 72 | ?> |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | ?> |
173 | 173 | |
174 | 174 | <tr> |
175 | - <td><strong><?php _e('HTML variable name :', 'geodirectory');?></strong></td> |
|
175 | + <td><strong><?php _e('HTML variable name :', 'geodirectory'); ?></strong></td> |
|
176 | 176 | <td align="left"> |
177 | 177 | <input type="text" name="htmlvar_name" id="htmlvar_name" |
178 | 178 | value="<?php if (isset($field_info->htmlvar_name)) { |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | }?>" <?php if ($default) { |
181 | 181 | echo 'readonly="readonly"'; |
182 | 182 | }?> /> |
183 | - <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory');?></span> |
|
184 | - <br/> <span><?php _e('This should be a unique name', 'geodirectory');?></span> |
|
183 | + <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory'); ?></span> |
|
184 | + <br/> <span><?php _e('This should be a unique name', 'geodirectory'); ?></span> |
|
185 | 185 | <br/> |
186 | - <span><?php _e('HTML variable name not use spaces, special characters', 'geodirectory');?></span> |
|
186 | + <span><?php _e('HTML variable name not use spaces, special characters', 'geodirectory'); ?></span> |
|
187 | 187 | </td> |
188 | 188 | </tr> |
189 | 189 | <?php } ?> |
@@ -202,19 +202,19 @@ discard block |
||
202 | 202 | $default_value = isset($field_info->default_value) ? $field_info->default_value : ''; |
203 | 203 | ?> |
204 | 204 | <tr> |
205 | - <td><strong><?php _e('Default value :', 'geodirectory');?></strong></td> |
|
205 | + <td><strong><?php _e('Default value :', 'geodirectory'); ?></strong></td> |
|
206 | 206 | <td align="left"> |
207 | 207 | <?php if ($field_type == 'checkbox') { ?> |
208 | 208 | <select name="default_value" id="default_value"> |
209 | 209 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option> |
210 | - <option value="1" <?php selected(true, (int)$default_value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
210 | + <option value="1" <?php selected(true, (int) $default_value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
211 | 211 | </select> |
212 | 212 | <?php } else if ($field_type == 'email') { ?> |
213 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($default_value);?>" /><br/> |
|
214 | - <span><?php _e('Enter the default value. Ex: [email protected]', 'geodirectory');?></span> |
|
213 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($default_value); ?>" /><br/> |
|
214 | + <span><?php _e('Enter the default value. Ex: [email protected]', 'geodirectory'); ?></span> |
|
215 | 215 | <?php } else { ?> |
216 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($default_value);?>" /><br/> |
|
217 | - <span><?php _e('Enter the default value (for "link" this will be used as the link text)', 'geodirectory');?></span> |
|
216 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($default_value); ?>" /><br/> |
|
217 | + <span><?php _e('Enter the default value (for "link" this will be used as the link text)', 'geodirectory'); ?></span> |
|
218 | 218 | <?php } ?> |
219 | 219 | </td> |
220 | 220 | </tr> |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | </td> |
380 | 380 | </tr> |
381 | 381 | |
382 | - <?php if ($field_type == 'text'){?> |
|
382 | + <?php if ($field_type == 'text') {?> |
|
383 | 383 | <tr> |
384 | 384 | <td><strong><?php _e('Validation Pattern:', 'geodirectory'); ?></strong></td> |
385 | 385 | <td align="left"> |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | </tr> |
410 | 410 | <?php } ?> |
411 | 411 | |
412 | - <tr <?php echo (!$display_on_listing ? 'style="display:none"' : '') ;?>> |
|
412 | + <tr <?php echo (!$display_on_listing ? 'style="display:none"' : ''); ?>> |
|
413 | 413 | <td><strong><?php _e('Show on listing page ? :', 'geodirectory'); ?></strong></td> |
414 | 414 | <td align="left"> |
415 | 415 | <select name="show_on_listing" id="show_on_listing"> |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | case 'taxonomy': { |
469 | 469 | ?> |
470 | 470 | <tr> |
471 | - <td><strong><?php _e('Select taxonomy:', 'geodirectory');?></strong></td> |
|
471 | + <td><strong><?php _e('Select taxonomy:', 'geodirectory'); ?></strong></td> |
|
472 | 472 | <td align="left"> |
473 | 473 | <select name="htmlvar_name" id="htmlvar_name"> |
474 | 474 | <?php |
@@ -478,40 +478,40 @@ discard block |
||
478 | 478 | ?> |
479 | 479 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) { |
480 | 480 | echo 'selected="selected"'; |
481 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
481 | + }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php |
|
482 | 482 | } |
483 | 483 | ?> |
484 | 484 | </select> |
485 | 485 | |
486 | 486 | <br/> |
487 | - <span><?php _e('Selected taxonomy name use as field name index. ex:-( post_category[gd_placecategory] )', 'geodirectory');?></span> |
|
487 | + <span><?php _e('Selected taxonomy name use as field name index. ex:-( post_category[gd_placecategory] )', 'geodirectory'); ?></span> |
|
488 | 488 | </td> |
489 | 489 | </tr> |
490 | 490 | |
491 | 491 | <tr> |
492 | - <td><strong><?php _e('Category display type :', 'geodirectory');?></strong></td> |
|
492 | + <td><strong><?php _e('Category display type :', 'geodirectory'); ?></strong></td> |
|
493 | 493 | <td align="left"> |
494 | 494 | |
495 | 495 | <select name="cat_display_type" id="cat_display_type"> |
496 | 496 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') { |
497 | 497 | echo 'selected="selected"'; |
498 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option> |
|
498 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option> |
|
499 | 499 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') { |
500 | 500 | echo 'selected="selected"'; |
501 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option> |
|
501 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option> |
|
502 | 502 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') { |
503 | 503 | echo 'selected="selected"'; |
504 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option> |
|
504 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option> |
|
505 | 505 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') { |
506 | 506 | echo 'selected="selected"'; |
507 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option> |
|
507 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option> |
|
508 | 508 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') { |
509 | 509 | echo 'selected="selected"'; |
510 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option> |
|
510 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option> |
|
511 | 511 | </select> |
512 | 512 | |
513 | 513 | <br/> |
514 | - <span><?php _e('Show categories list as select,multiselect,checkbox or radio', 'geodirectory');?></span> |
|
514 | + <span><?php _e('Show categories list as select,multiselect,checkbox or radio', 'geodirectory'); ?></span> |
|
515 | 515 | </td> |
516 | 516 | </tr> |
517 | 517 | <?php } // end of additional field for taxonomy field type |
@@ -532,92 +532,92 @@ discard block |
||
532 | 532 | do_action('geodir_address_extra_admin_fields', $address, $field_info); ?> |
533 | 533 | |
534 | 534 | <tr> |
535 | - <td><strong><?php _e('Display zip/post code :', 'geodirectory');?></strong></td> |
|
535 | + <td><strong><?php _e('Display zip/post code :', 'geodirectory'); ?></strong></td> |
|
536 | 536 | <td align="left"> |
537 | 537 | <input type="checkbox" name="extra[show_zip]" id="show_zip" |
538 | 538 | value="1" <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') { |
539 | 539 | echo 'checked="checked"'; |
540 | 540 | }?>/> |
541 | - <span><?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?></span> |
|
541 | + <span><?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?></span> |
|
542 | 542 | </td> |
543 | 543 | </tr> |
544 | 544 | |
545 | 545 | <tr> |
546 | - <td><strong><?php _e('Zip/Post code label :', 'geodirectory');?></strong></td> |
|
546 | + <td><strong><?php _e('Zip/Post code label :', 'geodirectory'); ?></strong></td> |
|
547 | 547 | <td align="left"> |
548 | 548 | <input type="text" name="extra[zip_lable]" id="zip_lable" |
549 | 549 | value="<?php if (isset($address['zip_lable'])) { |
550 | 550 | echo esc_attr($address['zip_lable']); |
551 | 551 | }?>"/> |
552 | - <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory');?></span> |
|
552 | + <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?></span> |
|
553 | 553 | </td> |
554 | 554 | </tr> |
555 | 555 | |
556 | 556 | <tr style="display:none;"> |
557 | - <td><strong><?php _e('Display map :', 'geodirectory');?></strong></td> |
|
557 | + <td><strong><?php _e('Display map :', 'geodirectory'); ?></strong></td> |
|
558 | 558 | <td align="left"> |
559 | 559 | <input type="checkbox" name="extra[show_map]" id="show_map" |
560 | 560 | value="1" <?php if (isset($address['show_map']) && $address['show_map'] == '1') { |
561 | 561 | echo 'checked="checked"'; |
562 | 562 | }?>/> |
563 | - <span><?php _e('Select if you want to `set address on map` field in address section.', 'geodirectory');?></span> |
|
563 | + <span><?php _e('Select if you want to `set address on map` field in address section.', 'geodirectory'); ?></span> |
|
564 | 564 | </td> |
565 | 565 | </tr> |
566 | 566 | |
567 | 567 | <tr> |
568 | - <td><strong><?php _e('Map button label :', 'geodirectory');?></strong></td> |
|
568 | + <td><strong><?php _e('Map button label :', 'geodirectory'); ?></strong></td> |
|
569 | 569 | <td align="left"> |
570 | 570 | <input type="text" name="extra[map_lable]" id="map_lable" |
571 | 571 | value="<?php if (isset($address['map_lable'])) { |
572 | 572 | echo esc_attr($address['map_lable']); |
573 | 573 | }?>"/> |
574 | - <span><?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?></span> |
|
574 | + <span><?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?></span> |
|
575 | 575 | </td> |
576 | 576 | </tr> |
577 | 577 | |
578 | 578 | <tr> |
579 | - <td><strong><?php _e('Use user zoom level:', 'geodirectory');?></strong></td> |
|
579 | + <td><strong><?php _e('Use user zoom level:', 'geodirectory'); ?></strong></td> |
|
580 | 580 | <td align="left"> |
581 | 581 | <input type="checkbox" name="extra[show_mapzoom]" id="show_mapzoom" |
582 | 582 | value="1" <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') { |
583 | 583 | echo 'checked="checked"'; |
584 | 584 | }?>/> |
585 | - <span><?php _e('Select if you want to use the user defined map zoom level.', 'geodirectory');?></span> |
|
585 | + <span><?php _e('Select if you want to use the user defined map zoom level.', 'geodirectory'); ?></span> |
|
586 | 586 | </td> |
587 | 587 | </tr> |
588 | 588 | |
589 | 589 | <tr> |
590 | - <td><strong><?php _e('Display map view:', 'geodirectory');?></strong></td> |
|
590 | + <td><strong><?php _e('Display map view:', 'geodirectory'); ?></strong></td> |
|
591 | 591 | <td align="left"> |
592 | 592 | <input type="checkbox" name="extra[show_mapview]" id="show_mapview" |
593 | 593 | value="1" <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') { |
594 | 594 | echo 'checked="checked"'; |
595 | 595 | }?>/> |
596 | - <span><?php _e('Select if you want to `set default map` options in address section.', 'geodirectory');?></span> |
|
596 | + <span><?php _e('Select if you want to `set default map` options in address section.', 'geodirectory'); ?></span> |
|
597 | 597 | </td> |
598 | 598 | </tr> |
599 | 599 | |
600 | 600 | |
601 | 601 | <tr> |
602 | - <td><strong><?php _e('Map view label :', 'geodirectory');?></strong></td> |
|
602 | + <td><strong><?php _e('Map view label :', 'geodirectory'); ?></strong></td> |
|
603 | 603 | <td align="left"> |
604 | 604 | <input type="text" name="extra[mapview_lable]" id="mapview_lable" |
605 | 605 | value="<?php if (isset($address['mapview_lable'])) { |
606 | 606 | echo esc_attr($address['mapview_lable']); |
607 | 607 | }?>"/> |
608 | - <span><?php _e('Enter mapview field label in address section.', 'geodirectory');?></span> |
|
608 | + <span><?php _e('Enter mapview field label in address section.', 'geodirectory'); ?></span> |
|
609 | 609 | </td> |
610 | 610 | </tr> |
611 | 611 | <tr> |
612 | 612 | <td> |
613 | - <strong><?php _e('Show latitude and longitude from front-end :', 'geodirectory');?></strong> |
|
613 | + <strong><?php _e('Show latitude and longitude from front-end :', 'geodirectory'); ?></strong> |
|
614 | 614 | </td> |
615 | 615 | <td align="left"> |
616 | 616 | <input type="checkbox" name="extra[show_latlng]" id="show_latlng" |
617 | 617 | value="1" <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') { |
618 | 618 | echo 'checked="checked"'; |
619 | 619 | }?>/> |
620 | - <span><?php _e('Select if you want to show latitude and logatude fields in address section from front-end.', 'geodirectory');?></span> |
|
620 | + <span><?php _e('Select if you want to show latitude and logatude fields in address section from front-end.', 'geodirectory'); ?></span> |
|
621 | 621 | </td> |
622 | 622 | </tr> |
623 | 623 | <?php } // end of extra fields for address field type |
@@ -629,41 +629,41 @@ discard block |
||
629 | 629 | |
630 | 630 | ?> |
631 | 631 | <tr> |
632 | - <td><strong><?php _e('Multiselect display type :', 'geodirectory');?></strong></td> |
|
632 | + <td><strong><?php _e('Multiselect display type :', 'geodirectory'); ?></strong></td> |
|
633 | 633 | <td align="left"> |
634 | 634 | |
635 | 635 | <select name="multi_display_type" id="multi_display_type"> |
636 | 636 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') { |
637 | 637 | echo 'selected="selected"'; |
638 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option> |
|
638 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option> |
|
639 | 639 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') { |
640 | 640 | echo 'selected="selected"'; |
641 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option> |
|
641 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option> |
|
642 | 642 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') { |
643 | 643 | echo 'selected="selected"'; |
644 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option> |
|
644 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option> |
|
645 | 645 | </select> |
646 | 646 | |
647 | 647 | <br/> |
648 | - <span><?php _e('Show multiselect list as multiselect,checkbox or radio', 'geodirectory');?></span> |
|
648 | + <span><?php _e('Show multiselect list as multiselect,checkbox or radio', 'geodirectory'); ?></span> |
|
649 | 649 | </td> |
650 | 650 | </tr> |
651 | 651 | <?php |
652 | 652 | } |
653 | 653 | ?> |
654 | 654 | <tr> |
655 | - <td><strong><?php _e('Option Values :', 'geodirectory');?></strong></td> |
|
655 | + <td><strong><?php _e('Option Values :', 'geodirectory'); ?></strong></td> |
|
656 | 656 | <td align="left"> |
657 | 657 | <input type="text" name="option_values" id="option_values" |
658 | 658 | value="<?php if (isset($field_info->option_values)) { |
659 | 659 | echo esc_attr($field_info->option_values); |
660 | 660 | }?>"/> |
661 | 661 | <br/> |
662 | - <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span> |
|
662 | + <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span> |
|
663 | 663 | <br/> |
664 | - <span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span> |
|
664 | + <span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span> |
|
665 | 665 | <br/> |
666 | - <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span> |
|
666 | + <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span> |
|
667 | 667 | <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?> |
668 | 668 | <br/> |
669 | 669 | <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span> |
@@ -681,12 +681,12 @@ discard block |
||
681 | 681 | } |
682 | 682 | ?> |
683 | 683 | <tr> |
684 | - <td><strong><?php _e('Date Format :', 'geodirectory');?></strong></td> |
|
684 | + <td><strong><?php _e('Date Format :', 'geodirectory'); ?></strong></td> |
|
685 | 685 | <td align="left" style="overflow:inherit;"> |
686 | 686 | <input type="text" name="extra[date_format]" id="date_format" |
687 | 687 | value="<?php if (isset($extra['date_format'])) { |
688 | 688 | echo esc_attr($extra['date_format']); |
689 | - }else{echo "mm/dd/yy";}?>"/> |
|
689 | + } else {echo "mm/dd/yy"; }?>"/> |
|
690 | 690 | |
691 | 691 | <div style="position:relative; cursor:pointer;"> |
692 | 692 | <span onclick="jQuery('#show_dateformat').toggle();"> |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | |
765 | 765 | </div> |
766 | 766 | <br/> |
767 | - <span><?php _e('Enter the date format.', 'geodirectory');?></span> |
|
767 | + <span><?php _e('Enter the date format.', 'geodirectory'); ?></span> |
|
768 | 768 | </td> |
769 | 769 | </tr> |
770 | 770 | <?php |
@@ -777,20 +777,20 @@ discard block |
||
777 | 777 | $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*'); |
778 | 778 | ?> |
779 | 779 | <tr> |
780 | - <td><strong><?php _e('Allowed file types:', 'geodirectory');?></strong></td> |
|
780 | + <td><strong><?php _e('Allowed file types:', 'geodirectory'); ?></strong></td> |
|
781 | 781 | <td align="left"> |
782 | 782 | <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;"> |
783 | - <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option> |
|
784 | - <?php foreach ( $allowed_file_types as $format => $types ) { ?> |
|
785 | - <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>"> |
|
786 | - <?php foreach ( $types as $ext => $type ) { ?> |
|
787 | - <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option> |
|
783 | + <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option> |
|
784 | + <?php foreach ($allowed_file_types as $format => $types) { ?> |
|
785 | + <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>"> |
|
786 | + <?php foreach ($types as $ext => $type) { ?> |
|
787 | + <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.' . $ext; ?></option> |
|
788 | 788 | <?php } ?> |
789 | 789 | </optgroup> |
790 | 790 | <?php } ?> |
791 | 791 | </select> |
792 | 792 | <br /> |
793 | - <span><?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', GEODIRPAYMENT_TEXTDOMAIN);?></span> |
|
793 | + <span><?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', GEODIRPAYMENT_TEXTDOMAIN); ?></span> |
|
794 | 794 | </td> |
795 | 795 | </tr> |
796 | 796 | <?php |
@@ -805,28 +805,28 @@ discard block |
||
805 | 805 | </tr> |
806 | 806 | |
807 | 807 | <tr> |
808 | - <td><strong><?php _e('Upload icon:', 'geodirectory');?></strong></td> |
|
808 | + <td><strong><?php _e('Upload icon:', 'geodirectory'); ?></strong></td> |
|
809 | 809 | <td align="left"> |
810 | 810 | <input type="text" name="field_icon" id="field_icon" |
811 | 811 | value="<?php if (isset($field_info->field_icon)) { |
812 | 812 | echo $field_info->field_icon; |
813 | 813 | }?>"/> |
814 | 814 | <span> |
815 | - <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?> |
|
815 | + <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?> |
|
816 | 816 | </span> |
817 | 817 | </td> |
818 | 818 | </td> |
819 | 819 | </tr> |
820 | 820 | |
821 | 821 | <tr> |
822 | - <td><strong><?php _e('Css class:', 'geodirectory');?></strong></td> |
|
822 | + <td><strong><?php _e('Css class:', 'geodirectory'); ?></strong></td> |
|
823 | 823 | <td align="left"> |
824 | 824 | <input type="text" name="css_class" id="css_class" |
825 | 825 | value="<?php if (isset($field_info->css_class)) { |
826 | 826 | echo esc_attr($field_info->css_class); |
827 | 827 | }?>"/> |
828 | 828 | <span> |
829 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?> |
|
829 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?> |
|
830 | 830 | </span> |
831 | 831 | </td> |
832 | 832 | </td> |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * @since 1.0.0 |
889 | 889 | * @param object $field_info The current fields info. |
890 | 890 | */ |
891 | - do_action('geodir_advance_custom_fields', $field_info);?> |
|
891 | + do_action('geodir_advance_custom_fields', $field_info); ?> |
|
892 | 892 | |
893 | 893 | <?php /*if(!in_array($field_type,array() )){?> |
894 | 894 | <tr> |
@@ -907,10 +907,10 @@ discard block |
||
907 | 907 | <td> </td> |
908 | 908 | <td align="left"> |
909 | 909 | |
910 | - <input type="button" class="button" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>" |
|
910 | + <input type="button" class="button" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>" |
|
911 | 911 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/> |
912 | 912 | <?php if (!$default): ?> |
913 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>" |
|
913 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>" |
|
914 | 914 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')" |
915 | 915 | class="button_n"/></a> |
916 | 916 | <?php endif; ?> |
@@ -19,16 +19,18 @@ discard block |
||
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | 21 | $post_type = $_REQUEST['listing_type']; |
22 | -} else |
|
23 | - $post_type = $field_info->post_type; |
|
22 | +} else { |
|
23 | + $post_type = $field_info->post_type; |
|
24 | +} |
|
24 | 25 | |
25 | 26 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
26 | 27 | |
27 | 28 | $nonce = wp_create_nonce('custom_fields_' . $result_str); |
28 | 29 | |
29 | 30 | $field_admin_title = ''; |
30 | -if (isset($field_info->admin_title)) |
|
31 | - $field_admin_title = $field_info->admin_title; |
|
31 | +if (isset($field_info->admin_title)) { |
|
32 | + $field_admin_title = $field_info->admin_title; |
|
33 | +} |
|
32 | 34 | |
33 | 35 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
34 | 36 | |
@@ -52,8 +54,11 @@ discard block |
||
52 | 54 | |
53 | 55 | <?php if ($default): ?> |
54 | 56 | <div title="<?php _e('Drag and drop to sort', 'geodirectory'); ?>" class="handlediv move"></div> |
55 | - <?php else: ?> |
|
56 | - <div title="<?php _e('Click to remove field', 'geodirectory'); ?>" |
|
57 | + <?php else { |
|
58 | + : ?> |
|
59 | + <div title="<?php _e('Click to remove field', 'geodirectory'); |
|
60 | +} |
|
61 | +?>" |
|
57 | 62 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')" |
58 | 63 | class="handlediv close"></div> |
59 | 64 | <?php endif; |
@@ -255,11 +260,13 @@ discard block |
||
255 | 260 | |
256 | 261 | <?php |
257 | 262 | $selected = ''; |
258 | - if (isset($field_info->extra_fields)) |
|
259 | - $advanced_editor = unserialize($field_info->extra_fields); |
|
263 | + if (isset($field_info->extra_fields)) { |
|
264 | + $advanced_editor = unserialize($field_info->extra_fields); |
|
265 | + } |
|
260 | 266 | |
261 | - if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) |
|
262 | - $selected = 'checked="checked"'; |
|
267 | + if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) { |
|
268 | + $selected = 'checked="checked"'; |
|
269 | + } |
|
263 | 270 | ?> |
264 | 271 | |
265 | 272 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor" |
@@ -686,7 +693,7 @@ discard block |
||
686 | 693 | <input type="text" name="extra[date_format]" id="date_format" |
687 | 694 | value="<?php if (isset($extra['date_format'])) { |
688 | 695 | echo esc_attr($extra['date_format']); |
689 | - }else{echo "mm/dd/yy";}?>"/> |
|
696 | + } else{echo "mm/dd/yy";}?>"/> |
|
690 | 697 | |
691 | 698 | <div style="position:relative; cursor:pointer;"> |
692 | 699 | <span onclick="jQuery('#show_dateformat').toggle();"> |
@@ -72,58 +72,58 @@ discard block |
||
72 | 72 | |
73 | 73 | $start_date = ''; |
74 | 74 | $end_date = ''; |
75 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){ |
|
76 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));} |
|
77 | - if(!$ga_end){$ga_end = date('Y-m-d');} |
|
75 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisweek') { |
|
76 | + if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-6 day")); } |
|
77 | + if (!$ga_end) {$ga_end = date('Y-m-d'); } |
|
78 | 78 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
79 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){ |
|
80 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));} |
|
81 | - if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));} |
|
79 | + }elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastweek') { |
|
80 | + if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-13 day")); } |
|
81 | + if (!$ga_end) {$ga_end = date('Y-m-d', strtotime("-7 day")); } |
|
82 | 82 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
83 | 83 | } |
84 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){ |
|
85 | - if(!$ga_start){$ga_start = date('Y')."-01-01";} |
|
86 | - if(!$ga_end){$ga_end = date('Y-m-d');} |
|
84 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisyear') { |
|
85 | + if (!$ga_start) {$ga_start = date('Y') . "-01-01"; } |
|
86 | + if (!$ga_end) {$ga_end = date('Y-m-d'); } |
|
87 | 87 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
88 | 88 | } |
89 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){ |
|
90 | - if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";} |
|
91 | - if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";} |
|
89 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastyear') { |
|
90 | + if (!$ga_start) {$ga_start = date('Y', strtotime("-1 year")) . "-01-01"; } |
|
91 | + if (!$ga_end) {$ga_end = date('Y', strtotime("-1 year")) . "-12-31"; } |
|
92 | 92 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
93 | 93 | } |
94 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
95 | - if(!$ga_start){$ga_start = "14daysAgo";} |
|
96 | - if(!$ga_end){$ga_end = "yesterday";} |
|
94 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') { |
|
95 | + if (!$ga_start) {$ga_start = "14daysAgo"; } |
|
96 | + if (!$ga_end) {$ga_end = "yesterday"; } |
|
97 | 97 | $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?"; |
102 | - $ids = "ids=".$id; |
|
103 | - if(!$start_date){$start_date = "&start-date=".$ga_start;} |
|
104 | - if(!$end_date){$end_date = "&end-date=".$ga_end;} |
|
102 | + $ids = "ids=" . $id; |
|
103 | + if (!$start_date) {$start_date = "&start-date=" . $ga_start; } |
|
104 | + if (!$end_date) {$end_date = "&end-date=" . $ga_end; } |
|
105 | 105 | $metrics = "&metrics=ga:pageviews"; |
106 | - $filters = "&filters=ga:pagePath==".$page; |
|
107 | - $access_token = "&access_token=".$at; |
|
106 | + $filters = "&filters=ga:pagePath==" . $page; |
|
107 | + $access_token = "&access_token=" . $at; |
|
108 | 108 | |
109 | - $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token; |
|
109 | + $use_url = $APIURL . $ids . $start_date . $end_date . $dimensions . $metrics . $filters . $access_token; |
|
110 | 110 | |
111 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){ |
|
111 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'realtime') { |
|
112 | 112 | $metrics = "&metrics=rt:activeUsers"; |
113 | - $dimensions = "&filters=ga:pagePath==".$page; |
|
113 | + $dimensions = "&filters=ga:pagePath==" . $page; |
|
114 | 114 | |
115 | - $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions; |
|
115 | + $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?" . $ids . $access_token . $metrics . $dimensions; |
|
116 | 116 | } |
117 | 117 | |
118 | - $response = wp_remote_get($use_url,array('timeout' => 15)); |
|
118 | + $response = wp_remote_get($use_url, array('timeout' => 15)); |
|
119 | 119 | |
120 | 120 | // Make countries translatable |
121 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
121 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') { |
|
122 | 122 | $c_arr = json_decode($response['body']); |
123 | - if(is_array($c_arr->rows)){ |
|
123 | + if (is_array($c_arr->rows)) { |
|
124 | 124 | $new_rows = array(); |
125 | - foreach($c_arr->rows as $wow){ |
|
126 | - $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]); |
|
125 | + foreach ($c_arr->rows as $wow) { |
|
126 | + $new_rows[] = array(__($wow[0], 'geodirectory'), $wow[1]); |
|
127 | 127 | } |
128 | 128 | $c_arr->rows = $new_rows; |
129 | 129 | } |
@@ -136,39 +136,39 @@ discard block |
||
136 | 136 | }// end GA function |
137 | 137 | |
138 | 138 | |
139 | -function geodir_ga_get_token(){ |
|
139 | +function geodir_ga_get_token() { |
|
140 | 140 | $at = get_option('gd_ga_access_token'); |
141 | - $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at; |
|
142 | - $response = wp_remote_get($use_url,array('timeout' => 15)); |
|
141 | + $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=" . $at; |
|
142 | + $response = wp_remote_get($use_url, array('timeout' => 15)); |
|
143 | 143 | |
144 | - if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid |
|
144 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) {//access token is valid |
|
145 | 145 | |
146 | 146 | return $at; |
147 | - }else{//else get new access token |
|
147 | + } else {//else get new access token |
|
148 | 148 | |
149 | 149 | $refresh_at = get_option('gd_ga_refresh_token'); |
150 | - if(!$refresh_at){ |
|
151 | - echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit; |
|
150 | + if (!$refresh_at) { |
|
151 | + echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory'))); exit; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $rat_url = "https://www.googleapis.com/oauth2/v3/token?"; |
155 | - $client_id = "client_id=".get_option('geodir_ga_client_id'); |
|
156 | - $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
|
157 | - $refresh_token = "&refresh_token=".$refresh_at; |
|
155 | + $client_id = "client_id=" . get_option('geodir_ga_client_id'); |
|
156 | + $client_secret = "&client_secret=" . get_option('geodir_ga_client_secret'); |
|
157 | + $refresh_token = "&refresh_token=" . $refresh_at; |
|
158 | 158 | $grant_type = "&grant_type=refresh_token"; |
159 | 159 | |
160 | - $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type; |
|
160 | + $rat_url_use = $rat_url . $client_id . $client_secret . $refresh_token . $grant_type; |
|
161 | 161 | |
162 | - $rat_response = wp_remote_post($rat_url_use,array('timeout' => 15)); |
|
163 | - if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) { |
|
162 | + $rat_response = wp_remote_post($rat_url_use, array('timeout' => 15)); |
|
163 | + if (!empty($rat_response['response']['code']) && $rat_response['response']['code'] == 200) { |
|
164 | 164 | $parts = json_decode($rat_response['body']); |
165 | 165 | |
166 | 166 | |
167 | 167 | update_option('gd_ga_access_token', $parts->access_token); |
168 | 168 | return $parts->access_token; |
169 | 169 | |
170 | - }else{ |
|
171 | - echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit; |
|
170 | + } else { |
|
171 | + echo json_encode(array('error'=>__('Login failed', 'geodirectory'))); exit; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 |
@@ -76,22 +76,19 @@ discard block |
||
76 | 76 | if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));} |
77 | 77 | if(!$ga_end){$ga_end = date('Y-m-d');} |
78 | 78 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
79 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){ |
|
79 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){ |
|
80 | 80 | if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));} |
81 | 81 | if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));} |
82 | 82 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
83 | - } |
|
84 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){ |
|
83 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){ |
|
85 | 84 | if(!$ga_start){$ga_start = date('Y')."-01-01";} |
86 | 85 | if(!$ga_end){$ga_end = date('Y-m-d');} |
87 | 86 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
88 | - } |
|
89 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){ |
|
87 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){ |
|
90 | 88 | if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";} |
91 | 89 | if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";} |
92 | 90 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
93 | - } |
|
94 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
91 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
95 | 92 | if(!$ga_start){$ga_start = "14daysAgo";} |
96 | 93 | if(!$ga_end){$ga_end = "yesterday";} |
97 | 94 | $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
@@ -144,7 +141,7 @@ discard block |
||
144 | 141 | if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid |
145 | 142 | |
146 | 143 | return $at; |
147 | - }else{//else get new access token |
|
144 | + } else{//else get new access token |
|
148 | 145 | |
149 | 146 | $refresh_at = get_option('gd_ga_refresh_token'); |
150 | 147 | if(!$refresh_at){ |
@@ -167,7 +164,7 @@ discard block |
||
167 | 164 | update_option('gd_ga_access_token', $parts->access_token); |
168 | 165 | return $parts->access_token; |
169 | 166 | |
170 | - }else{ |
|
167 | + } else{ |
|
171 | 168 | echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit; |
172 | 169 | } |
173 | 170 |
@@ -286,42 +286,42 @@ discard block |
||
286 | 286 | * @return array Parsed url and title. |
287 | 287 | */ |
288 | 288 | function geodir_parse_custom_field_url($url, $formatted = true) { |
289 | - if ($url == '' || !is_string($url)) { |
|
290 | - return NULL; |
|
291 | - } |
|
292 | - $original_url = $url; |
|
289 | + if ($url == '' || !is_string($url)) { |
|
290 | + return NULL; |
|
291 | + } |
|
292 | + $original_url = $url; |
|
293 | 293 | |
294 | - $url = stripcslashes($url); |
|
295 | - $parts = explode('|', $url, 2); |
|
294 | + $url = stripcslashes($url); |
|
295 | + $parts = explode('|', $url, 2); |
|
296 | 296 | |
297 | - $url = trim($parts[0]); |
|
298 | - if ($formatted && $url != '') { |
|
299 | - $url = str_replace( ' ', '%20', $url ); |
|
300 | - $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); |
|
297 | + $url = trim($parts[0]); |
|
298 | + if ($formatted && $url != '') { |
|
299 | + $url = str_replace( ' ', '%20', $url ); |
|
300 | + $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); |
|
301 | 301 | |
302 | - if (0 !== stripos($url, 'mailto:')) { |
|
303 | - $strip = array('%0d', '%0a', '%0D', '%0A'); |
|
304 | - $url = _deep_replace($strip, $url); |
|
305 | - } |
|
302 | + if (0 !== stripos($url, 'mailto:')) { |
|
303 | + $strip = array('%0d', '%0a', '%0D', '%0A'); |
|
304 | + $url = _deep_replace($strip, $url); |
|
305 | + } |
|
306 | 306 | |
307 | - $url = str_replace(';//', '://', $url); |
|
307 | + $url = str_replace(';//', '://', $url); |
|
308 | 308 | |
309 | - if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
310 | - $url = 'http://' . $url; |
|
311 | - } |
|
309 | + if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
310 | + $url = 'http://' . $url; |
|
311 | + } |
|
312 | 312 | |
313 | - $url = wp_kses_normalize_entities($url); |
|
314 | - $url = str_replace('&', '&', $url); |
|
315 | - $url = str_replace("'", ''', $url); |
|
316 | - } |
|
313 | + $url = wp_kses_normalize_entities($url); |
|
314 | + $url = str_replace('&', '&', $url); |
|
315 | + $url = str_replace("'", ''', $url); |
|
316 | + } |
|
317 | 317 | |
318 | - $return = array(); |
|
319 | - $return['url'] = $url; |
|
320 | - if (!empty($parts[1]) && trim($parts[1]) != '') { |
|
321 | - $return['label'] = trim($parts[1]); |
|
322 | - } |
|
318 | + $return = array(); |
|
319 | + $return['url'] = $url; |
|
320 | + if (!empty($parts[1]) && trim($parts[1]) != '') { |
|
321 | + $return['label'] = trim($parts[1]); |
|
322 | + } |
|
323 | 323 | |
324 | - return $return; |
|
324 | + return $return; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -334,24 +334,24 @@ discard block |
||
334 | 334 | * @return array Modified listing request info. |
335 | 335 | */ |
336 | 336 | function geodir_attach_parent_categories($request_info) { |
337 | - if (!empty($request_info['post_category']) && is_array($request_info['post_category'])) { |
|
338 | - foreach ($request_info['post_category'] as $taxomony => $term_ids) { |
|
339 | - $attach_term_ids = array(); |
|
337 | + if (!empty($request_info['post_category']) && is_array($request_info['post_category'])) { |
|
338 | + foreach ($request_info['post_category'] as $taxomony => $term_ids) { |
|
339 | + $attach_term_ids = array(); |
|
340 | 340 | |
341 | - if (!empty($term_ids) && is_array($term_ids) && taxonomy_exists($taxomony) && strpos($taxomony, 'category') !== false) { |
|
342 | - $attach_term_ids = geodir_add_parent_terms($term_ids, $taxomony); |
|
341 | + if (!empty($term_ids) && is_array($term_ids) && taxonomy_exists($taxomony) && strpos($taxomony, 'category') !== false) { |
|
342 | + $attach_term_ids = geodir_add_parent_terms($term_ids, $taxomony); |
|
343 | 343 | |
344 | - if (!empty($attach_term_ids)) { |
|
345 | - if (!isset($request_info['post_default_category'])) { |
|
346 | - $request_info['post_default_category'] = $attach_term_ids[0]; |
|
347 | - } |
|
348 | - $request_info['post_category'][$taxomony] = $attach_term_ids; |
|
349 | - } |
|
350 | - } |
|
351 | - } |
|
352 | - } |
|
344 | + if (!empty($attach_term_ids)) { |
|
345 | + if (!isset($request_info['post_default_category'])) { |
|
346 | + $request_info['post_default_category'] = $attach_term_ids[0]; |
|
347 | + } |
|
348 | + $request_info['post_category'][$taxomony] = $attach_term_ids; |
|
349 | + } |
|
350 | + } |
|
351 | + } |
|
352 | + } |
|
353 | 353 | |
354 | - return $request_info; |
|
354 | + return $request_info; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -365,22 +365,22 @@ discard block |
||
365 | 365 | * @return array Modified term ids. |
366 | 366 | */ |
367 | 367 | function geodir_add_parent_terms($term_ids, $taxomony) { |
368 | - if (is_int($term_ids)) { |
|
369 | - $term_ids = array($term_ids); |
|
370 | - } |
|
368 | + if (is_int($term_ids)) { |
|
369 | + $term_ids = array($term_ids); |
|
370 | + } |
|
371 | 371 | |
372 | - $parent_terms = array(); |
|
372 | + $parent_terms = array(); |
|
373 | 373 | |
374 | - foreach ($term_ids as $term_id) { |
|
375 | - $parent_terms[] = $term_id; |
|
376 | - $term_parents = geodir_get_category_parents($term_id, $taxomony, $parent_terms); |
|
374 | + foreach ($term_ids as $term_id) { |
|
375 | + $parent_terms[] = $term_id; |
|
376 | + $term_parents = geodir_get_category_parents($term_id, $taxomony, $parent_terms); |
|
377 | 377 | |
378 | - if (!empty($term_parents)) { |
|
379 | - $parent_terms = array_merge($parent_terms, $term_parents); |
|
380 | - } |
|
381 | - } |
|
378 | + if (!empty($term_parents)) { |
|
379 | + $parent_terms = array_merge($parent_terms, $term_parents); |
|
380 | + } |
|
381 | + } |
|
382 | 382 | |
383 | - return $parent_terms; |
|
383 | + return $parent_terms; |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | * @return array Category ids. |
397 | 397 | */ |
398 | 398 | function geodir_get_category_parents($id, $taxomony, $visited = array(), $parents = array()) { |
399 | - $parent = get_term($id, $taxomony); |
|
400 | - if (is_wp_error($parent)) { |
|
401 | - return $parents; |
|
402 | - } |
|
403 | - |
|
404 | - if ($parent->parent && ($parent->parent != $parent->term_id) && !in_array($parent->parent, $visited)) { |
|
405 | - $visited[] = $parent->parent; |
|
406 | - $parents[] = $parent->parent; |
|
407 | - $parents = geodir_get_category_parents($parent->parent, $taxomony, $visited, $parents); |
|
408 | - } |
|
409 | - |
|
410 | - return $parents; |
|
399 | + $parent = get_term($id, $taxomony); |
|
400 | + if (is_wp_error($parent)) { |
|
401 | + return $parents; |
|
402 | + } |
|
403 | + |
|
404 | + if ($parent->parent && ($parent->parent != $parent->term_id) && !in_array($parent->parent, $visited)) { |
|
405 | + $visited[] = $parent->parent; |
|
406 | + $parents[] = $parent->parent; |
|
407 | + $parents = geodir_get_category_parents($parent->parent, $taxomony, $visited, $parents); |
|
408 | + } |
|
409 | + |
|
410 | + return $parents; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | if (!function_exists('geodir_get_ip')) { |
@@ -420,24 +420,24 @@ discard block |
||
420 | 420 | * @return string The IP address. |
421 | 421 | */ |
422 | 422 | function geodir_get_ip() { |
423 | - if (!empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
424 | - //check ip from share internet |
|
425 | - $ip = $_SERVER['HTTP_CLIENT_IP']; |
|
426 | - } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
427 | - //to check ip is pass from proxy |
|
428 | - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
429 | - } else { |
|
430 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
431 | - } |
|
423 | + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
424 | + //check ip from share internet |
|
425 | + $ip = $_SERVER['HTTP_CLIENT_IP']; |
|
426 | + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
427 | + //to check ip is pass from proxy |
|
428 | + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
429 | + } else { |
|
430 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
431 | + } |
|
432 | 432 | |
433 | - /** |
|
434 | - * Filter the the visitor's IP address. |
|
435 | - * |
|
436 | - * @since 1.5.7 |
|
437 | - * @package GeoDirectory |
|
438 | - * |
|
439 | - * @param string $ip The IP address. |
|
440 | - */ |
|
441 | - return apply_filters('geodir_get_ip', $ip); |
|
433 | + /** |
|
434 | + * Filter the the visitor's IP address. |
|
435 | + * |
|
436 | + * @since 1.5.7 |
|
437 | + * @package GeoDirectory |
|
438 | + * |
|
439 | + * @param string $ip The IP address. |
|
440 | + */ |
|
441 | + return apply_filters('geodir_get_ip', $ip); |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | \ No newline at end of file |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | * @since 1.4.6 |
14 | 14 | * @return int|null Return the page ID if present or null if not. |
15 | 15 | */ |
16 | -function geodir_add_listing_page_id(){ |
|
16 | +function geodir_add_listing_page_id() { |
|
17 | 17 | $gd_page_id = get_option('geodir_add_listing_page'); |
18 | 18 | |
19 | 19 | if (function_exists('icl_object_id')) { |
20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | return $gd_page_id; |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * @since 1.4.6 |
31 | 31 | * @return int|null Return the page ID if present or null if not. |
32 | 32 | */ |
33 | -function geodir_preview_page_id(){ |
|
33 | +function geodir_preview_page_id() { |
|
34 | 34 | $gd_page_id = get_option('geodir_preview_page'); |
35 | 35 | |
36 | 36 | if (function_exists('icl_object_id')) { |
37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $gd_page_id; |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @since 1.4.6 |
48 | 48 | * @return int|null Return the page ID if present or null if not. |
49 | 49 | */ |
50 | -function geodir_success_page_id(){ |
|
50 | +function geodir_success_page_id() { |
|
51 | 51 | $gd_page_id = get_option('geodir_success_page'); |
52 | 52 | |
53 | 53 | if (function_exists('icl_object_id')) { |
54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return $gd_page_id; |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * @since 1.4.6 |
65 | 65 | * @return int|null Return the page ID if present or null if not. |
66 | 66 | */ |
67 | -function geodir_location_page_id(){ |
|
67 | +function geodir_location_page_id() { |
|
68 | 68 | $gd_page_id = get_option('geodir_location_page'); |
69 | 69 | |
70 | 70 | if (function_exists('icl_object_id')) { |
71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $gd_page_id; |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @since 1.5.4 |
82 | 82 | * @return int|null Return the page ID if present or null if not. |
83 | 83 | */ |
84 | -function geodir_home_page_id(){ |
|
84 | +function geodir_home_page_id() { |
|
85 | 85 | $gd_page_id = get_option('geodir_home_page'); |
86 | 86 | |
87 | 87 | if (function_exists('icl_object_id')) { |
88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $gd_page_id; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @since 1.5.3 |
99 | 99 | * @return int|null Return the page ID if present or null if not. |
100 | 100 | */ |
101 | -function geodir_info_page_id(){ |
|
101 | +function geodir_info_page_id() { |
|
102 | 102 | $gd_page_id = get_option('geodir_info_page'); |
103 | 103 | |
104 | 104 | if (function_exists('icl_object_id')) { |
105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return $gd_page_id; |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | * @since 1.5.3 |
116 | 116 | * @return int|null Return the page ID if present or null if not. |
117 | 117 | */ |
118 | -function geodir_login_page_id(){ |
|
118 | +function geodir_login_page_id() { |
|
119 | 119 | $gd_page_id = get_option('geodir_login_page'); |
120 | 120 | |
121 | 121 | if (function_exists('icl_object_id')) { |
122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $gd_page_id; |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | * @since 1.5.3 |
134 | 134 | * @return int|null Return the page ID if present or null if not. |
135 | 135 | */ |
136 | -function geodir_login_url($args=array()){ |
|
136 | +function geodir_login_url($args = array()) { |
|
137 | 137 | $gd_page_id = get_option('geodir_login_page'); |
138 | 138 | |
139 | 139 | if (function_exists('icl_object_id')) { |
140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -148,17 +148,17 @@ discard block |
||
148 | 148 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
149 | 149 | } |
150 | 150 | |
151 | - if($gd_page_id){ |
|
151 | + if ($gd_page_id) { |
|
152 | 152 | $post = get_post($gd_page_id); |
153 | 153 | $slug = $post->post_name; |
154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
155 | - $login_url = trailingslashit($home_url)."$slug/"; |
|
156 | - }else{ |
|
157 | - $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
155 | + $login_url = trailingslashit($home_url) . "$slug/"; |
|
156 | + } else { |
|
157 | + $login_url = trailingslashit($home_url) . "?geodir_signup=true"; |
|
158 | 158 | } |
159 | 159 | |
160 | - if($args){ |
|
161 | - $login_url = add_query_arg($args,$login_url ); |
|
160 | + if ($args) { |
|
161 | + $login_url = add_query_arg($args, $login_url); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param array $args The array of query args used. |
173 | 173 | * @param int $gd_page_id The page id of the GD login page. |
174 | 174 | */ |
175 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
175 | + return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | * @since 1.5.4 |
183 | 183 | * @return string Info page url. |
184 | 184 | */ |
185 | -function geodir_info_url($args=array()){ |
|
185 | +function geodir_info_url($args = array()) { |
|
186 | 186 | $gd_page_id = get_option('geodir_info_page'); |
187 | 187 | |
188 | 188 | if (function_exists('icl_object_id')) { |
189 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
189 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
198 | 198 | } |
199 | 199 | |
200 | - if($gd_page_id){ |
|
200 | + if ($gd_page_id) { |
|
201 | 201 | $post = get_post($gd_page_id); |
202 | 202 | $slug = $post->post_name; |
203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
204 | - $info_url = trailingslashit($home_url)."$slug/"; |
|
205 | - }else{ |
|
204 | + $info_url = trailingslashit($home_url) . "$slug/"; |
|
205 | + } else { |
|
206 | 206 | $info_url = trailingslashit($home_url); |
207 | 207 | } |
208 | 208 | |
209 | - if($args){ |
|
210 | - $info_url = add_query_arg($args,$info_url ); |
|
209 | + if ($args) { |
|
210 | + $info_url = add_query_arg($args, $info_url); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | return $info_url; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param string $charset Character set to use for conversion. |
226 | 226 | * @return string Returns converted string. |
227 | 227 | */ |
228 | -function geodir_ucwords($string, $charset='UTF-8') { |
|
228 | +function geodir_ucwords($string, $charset = 'UTF-8') { |
|
229 | 229 | if (function_exists('mb_convert_case')) { |
230 | 230 | return mb_convert_case($string, MB_CASE_TITLE, $charset); |
231 | 231 | } else { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param string $charset Character set to use for conversion. |
246 | 246 | * @return string Returns converted string. |
247 | 247 | */ |
248 | -function geodir_strtolower($string, $charset='UTF-8') { |
|
248 | +function geodir_strtolower($string, $charset = 'UTF-8') { |
|
249 | 249 | if (function_exists('mb_convert_case')) { |
250 | 250 | return mb_convert_case($string, MB_CASE_LOWER, $charset); |
251 | 251 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @param string $charset Character set to use for conversion. |
266 | 266 | * @return string Returns converted string. |
267 | 267 | */ |
268 | -function geodir_strtoupper($string, $charset='UTF-8') { |
|
268 | +function geodir_strtoupper($string, $charset = 'UTF-8') { |
|
269 | 269 | if (function_exists('mb_convert_case')) { |
270 | 270 | return mb_convert_case($string, MB_CASE_UPPER, $charset); |
271 | 271 | } else { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | $url = trim($parts[0]); |
298 | 298 | if ($formatted && $url != '') { |
299 | - $url = str_replace( ' ', '%20', $url ); |
|
299 | + $url = str_replace(' ', '%20', $url); |
|
300 | 300 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); |
301 | 301 | |
302 | 302 | if (0 !== stripos($url, 'mailto:')) { |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | $url = str_replace(';//', '://', $url); |
308 | 308 | |
309 | - if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
309 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
310 | 310 | $url = 'http://' . $url; |
311 | 311 | } |
312 | 312 |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $slug = $post->post_name; |
154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
155 | 155 | $login_url = trailingslashit($home_url)."$slug/"; |
156 | - }else{ |
|
156 | + } else{ |
|
157 | 157 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
158 | 158 | } |
159 | 159 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $slug = $post->post_name; |
203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
204 | 204 | $info_url = trailingslashit($home_url)."$slug/"; |
205 | - }else{ |
|
205 | + } else{ |
|
206 | 206 | $info_url = trailingslashit($home_url); |
207 | 207 | } |
208 | 208 |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | } // Distance |
100 | 100 | |
101 | 101 | if (isset($_REQUEST['sgeo_lat'])) { |
102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
102 | + $mylat = (float) esc_attr($_REQUEST['sgeo_lat']); |
|
103 | 103 | } else { |
104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
104 | + $mylat = (float) geodir_get_current_city_lat(); |
|
105 | 105 | } // Latatude |
106 | 106 | |
107 | 107 | if (isset($_REQUEST['sgeo_lon'])) { |
108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
108 | + $mylon = (float) esc_attr($_REQUEST['sgeo_lon']); |
|
109 | 109 | } else { |
110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
110 | + $mylon = (float) geodir_get_current_city_lng(); |
|
111 | 111 | } // Distance |
112 | 112 | |
113 | 113 | if (isset($_REQUEST['snear'])) { |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
251 | 251 | $keywords = explode(" ", $s); |
252 | 252 | |
253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
254 | - foreach($keywords as $kkey=>$kword){ |
|
255 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
253 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
254 | + foreach ($keywords as $kkey=>$kword) { |
|
255 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) { |
|
256 | 256 | unset($keywords[$kkey]); |
257 | 257 | } |
258 | 258 | } |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | |
439 | 439 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
440 | 440 | $keywords = explode(" ", $s); |
441 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
442 | - foreach($keywords as $kkey=>$kword){ |
|
443 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
441 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
442 | + foreach ($keywords as $kkey=>$kword) { |
|
443 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) { |
|
444 | 444 | unset($keywords[$kkey]); |
445 | 445 | } |
446 | 446 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | case 'post_date': |
510 | 510 | case 'comment_count': |
511 | 511 | |
512 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
512 | + $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", " . $table . ".overall_rating " . $order . ", "; |
|
513 | 513 | break; |
514 | 514 | |
515 | 515 | case 'distance': |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | //if (!geodir_is_page('detail')) |
575 | - add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
575 | + add_filter('posts_where', 'geodir_default_where', 1); /**/ |
|
576 | 576 | |
577 | 577 | //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
578 | 578 | |
@@ -736,9 +736,9 @@ discard block |
||
736 | 736 | |
737 | 737 | if ($s != '') { |
738 | 738 | $keywords = explode(" ", $s); |
739 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
740 | - foreach($keywords as $kkey=>$kword){ |
|
741 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){ |
|
739 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
740 | + foreach ($keywords as $kkey=>$kword) { |
|
741 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) { |
|
742 | 742 | unset($keywords[$kkey]); |
743 | 743 | } |
744 | 744 | } |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | |
758 | 758 | /* get taxonomy */ |
759 | 759 | $taxonomies = geodir_get_taxonomies($post_types, true); |
760 | - if($taxonomies) { |
|
760 | + if ($taxonomies) { |
|
761 | 761 | $taxonomies = implode("','", $taxonomies); |
762 | 762 | $taxonomies = "'" . $taxonomies . "'"; |
763 | - }else{$taxonomies='';} |
|
763 | + } else {$taxonomies = ''; } |
|
764 | 764 | |
765 | 765 | $content_where = $terms_where = ''; |
766 | 766 | if ($s != '') { |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | * @package GeoDirectory |
772 | 772 | * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
773 | 773 | */ |
774 | - $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
|
774 | + $content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
|
775 | 775 | /** |
776 | 776 | * Filter the search query term values. |
777 | 777 | * |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | * @package GeoDirectory |
780 | 780 | * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
781 | 781 | */ |
782 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
|
782 | + $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | if ($snear != '') { |
@@ -836,11 +836,11 @@ discard block |
||
836 | 836 | } |
837 | 837 | |
838 | 838 | ########### WPML ########### |
839 | - if ( function_exists( 'icl_object_id' ) ) { |
|
839 | + if (function_exists('icl_object_id')) { |
|
840 | 840 | $lang_code = ICL_LANGUAGE_CODE; |
841 | 841 | |
842 | 842 | if ($lang_code && $post_types) { |
843 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
843 | + $where .= " AND icl_t.language_code = '" . $lang_code . "' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
844 | 844 | } |
845 | 845 | } |
846 | 846 | ########### WPML ########### |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | //$user_id = get_current_user_id(); |
870 | 870 | $user_id = $curauth->ID; |
871 | 871 | if (isset($_REQUEST['stype'])) { |
872 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
872 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']); |
|
873 | 873 | } else { |
874 | 874 | $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
875 | 875 | } |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function geodir_session_start() |
18 | 18 | { |
19 | - if (!session_id()) session_start(); |
|
19 | + if (!session_id()) { |
|
20 | + session_start(); |
|
21 | + } |
|
20 | 22 | global $geodir_add_location_url; |
21 | 23 | |
22 | 24 | $geodir_add_location_url = NULL; |
@@ -86,7 +88,9 @@ discard block |
||
86 | 88 | |
87 | 89 | if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
88 | 90 | |
89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
91 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') { |
|
92 | + $_REQUEST['scat'] = ''; |
|
93 | + } |
|
90 | 94 | //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
91 | 95 | |
92 | 96 | if (isset($_REQUEST['sdist'])) { |
@@ -198,8 +202,9 @@ discard block |
||
198 | 202 | add_filter('posts_fields', 'geodir_posts_fields', 1); |
199 | 203 | add_filter('posts_join', 'geodir_posts_join', 1); |
200 | 204 | geodir_post_where(); |
201 | - if (!is_admin()) |
|
202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
205 | + if (!is_admin()) { |
|
206 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
207 | + } |
|
203 | 208 | |
204 | 209 | // advanced filter for popular post view widget |
205 | 210 | global $wp_query; |
@@ -346,8 +351,9 @@ discard block |
||
346 | 351 | $sort_by = ''; |
347 | 352 | $orderby = ' '; |
348 | 353 | |
349 | - if (get_query_var('order_by')) |
|
350 | - $sort_by = get_query_var('order_by'); |
|
354 | + if (get_query_var('order_by')) { |
|
355 | + $sort_by = get_query_var('order_by'); |
|
356 | + } |
|
351 | 357 | |
352 | 358 | /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){ |
353 | 359 | $current_term = $wp_query->get_queried_object(); |
@@ -367,14 +373,16 @@ discard block |
||
367 | 373 | $orderby .= " distance,"; |
368 | 374 | } |
369 | 375 | |
370 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
371 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
376 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) { |
|
377 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
378 | + } |
|
372 | 379 | |
373 | 380 | |
374 | 381 | if ($sort_by == '') { |
375 | 382 | $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
376 | - if (!empty($default_sort)) |
|
377 | - $sort_by = $default_sort; |
|
383 | + if (!empty($default_sort)) { |
|
384 | + $sort_by = $default_sort; |
|
385 | + } |
|
378 | 386 | } |
379 | 387 | |
380 | 388 | /* |
@@ -560,8 +568,9 @@ discard block |
||
560 | 568 | |
561 | 569 | add_filter('posts_where', 'searching_filter_where', 1); |
562 | 570 | |
563 | - if ($snear != '') |
|
564 | - add_filter('posts_where', 'searching_filter_where', 1); |
|
571 | + if ($snear != '') { |
|
572 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
573 | + } |
|
565 | 574 | |
566 | 575 | add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
567 | 576 | |
@@ -729,10 +738,11 @@ discard block |
||
729 | 738 | } |
730 | 739 | |
731 | 740 | $better_search_terms = ''; |
732 | - if (isset($_REQUEST['stype'])) |
|
733 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
734 | - else |
|
735 | - $post_types = 'gd_place'; |
|
741 | + if (isset($_REQUEST['stype'])) { |
|
742 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
743 | + } else { |
|
744 | + $post_types = 'gd_place'; |
|
745 | + } |
|
736 | 746 | |
737 | 747 | if ($s != '') { |
738 | 748 | $keywords = explode(" ", $s); |
@@ -760,7 +770,7 @@ discard block |
||
760 | 770 | if($taxonomies) { |
761 | 771 | $taxonomies = implode("','", $taxonomies); |
762 | 772 | $taxonomies = "'" . $taxonomies . "'"; |
763 | - }else{$taxonomies='';} |
|
773 | + } else{$taxonomies='';} |
|
764 | 774 | |
765 | 775 | $content_where = $terms_where = ''; |
766 | 776 | if ($s != '') { |
@@ -875,11 +885,13 @@ discard block |
||
875 | 885 | } |
876 | 886 | |
877 | 887 | if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
878 | - if ($user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true)) |
|
879 | - $user_fav_posts = implode("','", $user_fav_posts); |
|
888 | + if ($user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true)) { |
|
889 | + $user_fav_posts = implode("','", $user_fav_posts); |
|
890 | + } |
|
880 | 891 | $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts') "; |
881 | - } else |
|
882 | - $where .= " AND $wpdb->posts.post_author = $user_id "; |
|
892 | + } else { |
|
893 | + $where .= " AND $wpdb->posts.post_author = $user_id "; |
|
894 | + } |
|
883 | 895 | |
884 | 896 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
885 | 897 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Contains all function for filtering listing. |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * Contains all function for filtering listing. |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Starts session if not started. |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | // Filter-Location-Manager to add location table. |
236 | 236 | $fields .= ", " . $table . ".* "; |
237 | 237 | |
238 | - if ($snear != '' || $gd_session->get('all_near_me')) { |
|
238 | + if ($snear != '' || $gd_session->get('all_near_me')) { |
|
239 | 239 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
240 | 240 | |
241 | - if ($gd_session->get('all_near_me')) { |
|
241 | + if ($gd_session->get('all_near_me')) { |
|
242 | 242 | $mylat = $gd_session->get('user_lat'); |
243 | 243 | $mylon = $gd_session->get('user_lon'); |
244 | 244 | } |
@@ -270,13 +270,13 @@ discard block |
||
270 | 270 | $count = 0; |
271 | 271 | foreach ($keywords as $keyword) { |
272 | 272 | $keyword = trim($keyword); |
273 | - $count++; |
|
273 | + $count++; |
|
274 | 274 | if ($count < count($keywords)) { |
275 | - // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
276 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
|
275 | + // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
276 | + $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
|
277 | 277 | } else { |
278 | 278 | //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
279 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
|
279 | + $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $gd_titlematch_part = ""; |
286 | 286 | } |
287 | 287 | //$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title=%s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN " . $wpdb->posts . ".post_content LIKE %s THEN 1 ELSE 0 END AS gd_content", array($s, '%' . $s . '%', '%' . $s . '%')); |
288 | - $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s)); |
|
288 | + $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s)); |
|
289 | 289 | } |
290 | 290 | return $fields; |
291 | 291 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | break; |
407 | 407 | case 'high_review': |
408 | 408 | case 'rating_count_desc': |
409 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
409 | + $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
410 | 410 | break; |
411 | 411 | case 'low_rating': |
412 | 412 | $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | |
527 | 527 | default: |
528 | 528 | if (geodir_column_exist($table, $sort_by)) { |
529 | - $orderby = $table . "." . $sort_by . " " . $order . ", "; |
|
530 | - } |
|
529 | + $orderby = $table . "." . $sort_by . " " . $order . ", "; |
|
530 | + } |
|
531 | 531 | break; |
532 | 532 | |
533 | 533 | endswitch; |
@@ -704,14 +704,14 @@ discard block |
||
704 | 704 | $category_search_range = ''; |
705 | 705 | |
706 | 706 | if (is_single() && get_query_var('post_type')) { |
707 | - return $where; |
|
708 | - } |
|
707 | + return $where; |
|
708 | + } |
|
709 | 709 | |
710 | 710 | if (is_tax()) { |
711 | - return $where; |
|
712 | - } |
|
711 | + return $where; |
|
712 | + } |
|
713 | 713 | |
714 | - $s = trim($s); |
|
714 | + $s = trim($s); |
|
715 | 715 | |
716 | 716 | $where = ''; |
717 | 717 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | foreach ($s_SA as $s_term) { |
723 | 723 | //$s_term = esc_attr($s_term); |
724 | 724 | //$better_search[] = " OR $wpdb->posts.post_title LIKE\"%$s_term%\" "; |
725 | - $better_search[] = " OR ( $wpdb->posts.post_title LIKE \"$s_term\" OR $wpdb->posts.post_title LIKE \"$s_term%\" OR $wpdb->posts.post_title LIKE \"% $s_term%\" ) "; |
|
725 | + $better_search[] = " OR ( $wpdb->posts.post_title LIKE \"$s_term\" OR $wpdb->posts.post_title LIKE \"$s_term%\" OR $wpdb->posts.post_title LIKE \"% $s_term%\" ) "; |
|
726 | 726 | } |
727 | 727 | } |
728 | 728 | |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | $keyword = trim($keyword); |
752 | 752 | if ($keyword != '') { |
753 | 753 | //$better_search_terms .= ' OR ' . $wpdb->posts . '.post_title LIKE "%' . $adv_search_val . '%"'; |
754 | - $better_search_terms .= ' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'; |
|
754 | + $better_search_terms .= ' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'; |
|
755 | 755 | } |
756 | 756 | } |
757 | 757 | } |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | }else{$taxonomies='';} |
766 | 766 | |
767 | 767 | $content_where = $terms_where = ''; |
768 | - if ($s != '') { |
|
768 | + if ($s != '') { |
|
769 | 769 | /** |
770 | 770 | * Filter the search query content where values. |
771 | 771 | * |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * @package GeoDirectory |
774 | 774 | * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
775 | 775 | */ |
776 | - $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
|
776 | + $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
|
777 | 777 | /** |
778 | 778 | * Filter the search query term values. |
779 | 779 | * |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
783 | 783 | */ |
784 | 784 | $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
785 | - } |
|
785 | + } |
|
786 | 786 | |
787 | 787 | if ($snear != '') { |
788 | 788 | if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) { |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
799 | 799 | $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
800 | 800 | |
801 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
801 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
802 | 802 | $content_where |
803 | 803 | OR ($wpdb->posts.ID IN( |
804 | 804 | SELECT $wpdb->term_relationships.object_id as post_id |
@@ -837,11 +837,11 @@ discard block |
||
837 | 837 | AND ($wpdb->posts.post_status = 'publish') "; |
838 | 838 | } |
839 | 839 | |
840 | - ########### WPML ########### |
|
840 | + ########### WPML ########### |
|
841 | 841 | if ( function_exists( 'icl_object_id' ) ) { |
842 | - $lang_code = ICL_LANGUAGE_CODE; |
|
842 | + $lang_code = ICL_LANGUAGE_CODE; |
|
843 | 843 | |
844 | - if ($lang_code && $post_types) { |
|
844 | + if ($lang_code && $post_types) { |
|
845 | 845 | $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
846 | 846 | } |
847 | 847 | } |
@@ -107,11 +107,13 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - if (!empty($field_default_cat)) |
|
111 | - $field_default_cat = ''; |
|
110 | + if (!empty($field_default_cat)) { |
|
111 | + $field_default_cat = ''; |
|
112 | + } |
|
112 | 113 | |
113 | - if (!empty($cat_find_array)) |
|
114 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
114 | + if (!empty($cat_find_array)) { |
|
115 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
116 | + } |
|
115 | 117 | |
116 | 118 | $main_query_array = $map_cat_ids_array; |
117 | 119 | |
@@ -143,8 +145,9 @@ discard block |
||
143 | 145 | $gd_posttype = " AND p.post_type = %s"; |
144 | 146 | $main_query_array[] = $_REQUEST['gd_posttype']; |
145 | 147 | |
146 | - } else |
|
147 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
148 | + } else { |
|
149 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
150 | + } |
|
148 | 151 | |
149 | 152 | $join = ", " . $table . " AS pd "; |
150 | 153 | |
@@ -309,8 +312,7 @@ discard block |
||
309 | 312 | |
310 | 313 | if (!empty($cat_content_info)) { |
311 | 314 | return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
312 | - } |
|
313 | - else { |
|
315 | + } else { |
|
314 | 316 | return '[{"totalcount":"0"}]'; |
315 | 317 | } |
316 | 318 | } |
317 | 319 | \ No newline at end of file |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | $join = ", " . $table . " AS pd "; |
150 | 150 | |
151 | 151 | /** |
152 | - * Filter the SQL JOIN clause for the markers data |
|
153 | - * |
|
154 | - * @since 1.0.0 |
|
155 | - * |
|
156 | - * @param string $join Row of SQL JOIN clause to join table. |
|
157 | - */ |
|
158 | - $join = apply_filters('geodir_home_map_listing_join', $join); |
|
152 | + * Filter the SQL JOIN clause for the markers data |
|
153 | + * |
|
154 | + * @since 1.0.0 |
|
155 | + * |
|
156 | + * @param string $join Row of SQL JOIN clause to join table. |
|
157 | + */ |
|
158 | + $join = apply_filters('geodir_home_map_listing_join', $join); |
|
159 | 159 | |
160 | - /** |
|
161 | - * Filter the searched fields for the markers data |
|
162 | - * |
|
163 | - * @since 1.0.0 |
|
164 | - * |
|
165 | - * @param string $search Row of searched fields to use in WHERE clause. |
|
166 | - */ |
|
167 | - $search = apply_filters('geodir_home_map_listing_where', $search); |
|
160 | + /** |
|
161 | + * Filter the searched fields for the markers data |
|
162 | + * |
|
163 | + * @since 1.0.0 |
|
164 | + * |
|
165 | + * @param string $search Row of searched fields to use in WHERE clause. |
|
166 | + */ |
|
167 | + $search = apply_filters('geodir_home_map_listing_where', $search); |
|
168 | 168 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
169 | 169 | $cat_type = $post_type . 'category'; |
170 | 170 | if ($post_type == 'gd_event') { |
@@ -175,35 +175,35 @@ discard block |
||
175 | 175 | |
176 | 176 | $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
177 | 177 | /** |
178 | - * Filter the SQL SELECT clause to retrive fields data |
|
179 | - * |
|
180 | - * @since 1.0.0 |
|
181 | - * |
|
182 | - * @param string $sql_select Row of SQL SELECT clause. |
|
183 | - */ |
|
184 | - $select = apply_filters('geodir_home_map_listing_select', $sql_select); |
|
178 | + * Filter the SQL SELECT clause to retrive fields data |
|
179 | + * |
|
180 | + * @since 1.0.0 |
|
181 | + * |
|
182 | + * @param string $sql_select Row of SQL SELECT clause. |
|
183 | + */ |
|
184 | + $select = apply_filters('geodir_home_map_listing_select', $sql_select); |
|
185 | 185 | |
186 | - $groupby = " GROUP BY pd.post_id"; |
|
187 | - /** |
|
188 | - * Filter the SQL GROUP BY clause to retrive map markers data. |
|
189 | - * |
|
190 | - * @since 1.5.7 |
|
191 | - * |
|
192 | - * @param string $groupby Row of SQL GROUP BY clause. |
|
193 | - */ |
|
194 | - $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
|
186 | + $groupby = " GROUP BY pd.post_id"; |
|
187 | + /** |
|
188 | + * Filter the SQL GROUP BY clause to retrive map markers data. |
|
189 | + * |
|
190 | + * @since 1.5.7 |
|
191 | + * |
|
192 | + * @param string $groupby Row of SQL GROUP BY clause. |
|
193 | + */ |
|
194 | + $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
|
195 | 195 | |
196 | 196 | $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
197 | 197 | |
198 | - /** |
|
199 | - * Filter the SQL query to retrive markers data |
|
200 | - * |
|
201 | - * @since 1.0.0 |
|
202 | - * |
|
203 | - * @param string $catsql Row of SQL query. |
|
204 | - * @param string $search Row of searched fields to use in WHERE clause. |
|
205 | - */ |
|
206 | - $catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search); |
|
198 | + /** |
|
199 | + * Filter the SQL query to retrive markers data |
|
200 | + * |
|
201 | + * @since 1.0.0 |
|
202 | + * |
|
203 | + * @param string $catsql Row of SQL query. |
|
204 | + * @param string $search Row of searched fields to use in WHERE clause. |
|
205 | + */ |
|
206 | + $catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search); |
|
207 | 207 | |
208 | 208 | $catinfo = $wpdb->get_results($catsql); |
209 | 209 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
11 | 11 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
12 | 12 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
13 | - $child_collapse = (int)$_REQUEST['child_collapse']; |
|
13 | + $child_collapse = (int) $_REQUEST['child_collapse']; |
|
14 | 14 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
15 | 15 | die; |
16 | 16 | } |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | global $wpdb, $plugin_prefix, $gd_session; |
31 | 31 | |
32 | 32 | if ($_REQUEST['m_id'] != '') { |
33 | - $pid = (int)$_REQUEST['m_id']; |
|
33 | + $pid = (int) $_REQUEST['m_id']; |
|
34 | 34 | } else { |
35 | 35 | echo __('No marker data found', 'geodirectory'); |
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
39 | 39 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) { |
40 | - $post = (object)$gd_ses_listing; |
|
40 | + $post = (object) $gd_ses_listing; |
|
41 | 41 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
42 | 42 | } else { |
43 | 43 | $geodir_post_type = get_post_type($pid); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
195 | 195 | |
196 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
|
196 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby, $main_query_array); |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Filter the SQL query to retrive markers data |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
270 | 270 | |
271 | 271 | if ($end_date != '' && strtotime($end_date) >= $today) { |
272 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
272 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) . ' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
285 | 285 | $title = str_replace($srcharr, $replarr, $post_title); |
286 | 286 | |
287 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}'; |
|
287 | + $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"' . $mark_extra . '}'; |
|
288 | 288 | $post_ids[] = $catinfo_obj->post_id; |
289 | 289 | } |
290 | 290 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Google Map related functions. |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * Google Map related functions. |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Creates a global variable for storing map json data. |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $title = str_replace($srcharr, $replarr, $post_title); |
62 | 62 | |
63 | 63 | if (is_ssl()) { |
64 | - $icon = str_replace("http:","https:",$icon ); |
|
64 | + $icon = str_replace("http:", "https:", $icon); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '"}'; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param string $post_json JSON representation of the post marker info. |
74 | 74 | * @param object $post The post object. |
75 | 75 | */ |
76 | - $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post); |
|
76 | + $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
215 | + $term_check = '<input type="checkbox" ' . $checked . ' id="' . $map_canvas_name . '_tick_cat_' . $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
216 | 216 | $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
217 | 217 | $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
218 | 218 | $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
219 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
219 | + $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name . '_tick_cat_' . $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
220 | 220 | |
221 | 221 | endif; |
222 | 222 |
@@ -98,10 +98,11 @@ discard block |
||
98 | 98 | unset($cat_content_info); |
99 | 99 | $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]); |
100 | 100 | $totalcount = count(array_unique($map_jason)); |
101 | - if (!empty($cat_content_info)) |
|
102 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
103 | - else |
|
104 | - $canvas_jason = '[{"totalcount":"0"}]'; |
|
101 | + if (!empty($cat_content_info)) { |
|
102 | + $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
103 | + } else { |
|
104 | + $canvas_jason = '[{"totalcount":"0"}]'; |
|
105 | + } |
|
105 | 106 | |
106 | 107 | $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
107 | 108 | |
@@ -232,8 +233,9 @@ discard block |
||
232 | 233 | |
233 | 234 | return $out; |
234 | 235 | } else { |
235 | - if ($cat_parent == 0) |
|
236 | - return _e('No category', 'geodirectory'); |
|
236 | + if ($cat_parent == 0) { |
|
237 | + return _e('No category', 'geodirectory'); |
|
238 | + } |
|
237 | 239 | } |
238 | 240 | return; |
239 | 241 | } |