@@ -28,68 +28,68 @@ |
||
28 | 28 | action="<?php echo get_permalink($post_info->ID); ?>"> |
29 | 29 | |
30 | 30 | <?php |
31 | - wp_nonce_field( 'send_inquiry_'.$post_info->ID ); |
|
32 | - ?> |
|
31 | + wp_nonce_field( 'send_inquiry_'.$post_info->ID ); |
|
32 | + ?> |
|
33 | 33 | <input type="hidden" name="sendact" value="send_inqury"/> |
34 | 34 | <input type="hidden" name="pid" value="<?php echo $post_info->ID;?>"/> |
35 | 35 | |
36 | 36 | <h3><?php |
37 | - /** |
|
38 | - * Filter the title for the send inquiry popup form. |
|
39 | - * |
|
40 | - * @since 1.0.0 |
|
41 | - * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
|
42 | - */ |
|
43 | - echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
37 | + /** |
|
38 | + * Filter the title for the send inquiry popup form. |
|
39 | + * |
|
40 | + * @since 1.0.0 |
|
41 | + * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
|
42 | + */ |
|
43 | + echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
44 | 44 | |
45 | 45 | <p id="inquiry_send_success" class="sucess_msg" style="display:none;"></p> |
46 | 46 | <?php |
47 | - /** |
|
48 | - * Called before each field in the send inquiry template. |
|
49 | - * |
|
50 | - * @since 1.0.0 |
|
51 | - * @param string $field The field name the actions is called before. |
|
52 | - */ |
|
53 | - do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
47 | + /** |
|
48 | + * Called before each field in the send inquiry template. |
|
49 | + * |
|
50 | + * @since 1.0.0 |
|
51 | + * @param string $field The field name the actions is called before. |
|
52 | + */ |
|
53 | + do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
54 | 54 | <div class="row clearfix"> |
55 | 55 | <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/> |
56 | 56 | </div> |
57 | 57 | <?php |
58 | - /** |
|
59 | - * Called after each field in the send inquiry template. |
|
60 | - * |
|
61 | - * @since 1.0.0 |
|
62 | - * @param string $field The field name the actions is called after. |
|
63 | - */ |
|
64 | - do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
58 | + /** |
|
59 | + * Called after each field in the send inquiry template. |
|
60 | + * |
|
61 | + * @since 1.0.0 |
|
62 | + * @param string $field The field name the actions is called after. |
|
63 | + */ |
|
64 | + do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
65 | 65 | <?php |
66 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
67 | - do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
66 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
67 | + do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
68 | 68 | <div class="row clearfix"> |
69 | 69 | <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory');?>"/> |
70 | 70 | </div> |
71 | 71 | <?php |
72 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
73 | - do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
72 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
73 | + do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
74 | 74 | <?php |
75 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
76 | - do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
75 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
76 | + do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
77 | 77 | <div class="row clearfix"> |
78 | 78 | <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory');?>"/> |
79 | 79 | </div> |
80 | 80 | <?php |
81 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
82 | - do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
81 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
82 | + do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
83 | 83 | <?php |
84 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
85 | - do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
84 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
85 | + do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
86 | 86 | <div class="row clearfix"> |
87 | 87 | <textarea required field_type="textarea" name="inq_msg" cols="" |
88 | 88 | rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT;?>"></textarea> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
92 | - do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
91 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
92 | + do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
93 | 93 | <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory');?>" |
94 | 94 | class="button clearfix"/> |
95 | 95 | </form> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param int $post_id The post id requested by the popup. |
20 | 20 | * @param object $post_info The post object requested by the popup. |
21 | 21 | */ |
22 | -do_action('geodir_popup_forms_template_start',$post_id,$post_info); |
|
22 | +do_action('geodir_popup_forms_template_start', $post_id, $post_info); |
|
23 | 23 | |
24 | 24 | if ($_REQUEST['popuptype'] == 'b_send_inquiry') { ?> |
25 | 25 | |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | action="<?php echo get_permalink($post_info->ID); ?>"> |
29 | 29 | |
30 | 30 | <?php |
31 | - wp_nonce_field( 'send_inquiry_'.$post_info->ID ); |
|
31 | + wp_nonce_field('send_inquiry_'.$post_info->ID); |
|
32 | 32 | ?> |
33 | 33 | <input type="hidden" name="sendact" value="send_inqury"/> |
34 | - <input type="hidden" name="pid" value="<?php echo $post_info->ID;?>"/> |
|
34 | + <input type="hidden" name="pid" value="<?php echo $post_info->ID; ?>"/> |
|
35 | 35 | |
36 | 36 | <h3><?php |
37 | 37 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @since 1.0.0 |
41 | 41 | * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
42 | 42 | */ |
43 | - echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
43 | + echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY); ?> </h3> |
|
44 | 44 | |
45 | 45 | <p id="inquiry_send_success" class="sucess_msg" style="display:none;"></p> |
46 | 46 | <?php |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * @since 1.0.0 |
51 | 51 | * @param string $field The field name the actions is called before. |
52 | 52 | */ |
53 | - do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
53 | + do_action('geodir_before_inquiry_form_field', 'inq_name'); ?> |
|
54 | 54 | <div class="row clearfix"> |
55 | - <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/> |
|
55 | + <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory'); ?>"/> |
|
56 | 56 | </div> |
57 | 57 | <?php |
58 | 58 | /** |
@@ -61,36 +61,36 @@ discard block |
||
61 | 61 | * @since 1.0.0 |
62 | 62 | * @param string $field The field name the actions is called after. |
63 | 63 | */ |
64 | - do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
64 | + do_action('geodir_after_inquiry_form_field', 'inq_name'); ?> |
|
65 | 65 | <?php |
66 | 66 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
67 | - do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
67 | + do_action('geodir_before_inquiry_form_field', 'inq_email'); ?> |
|
68 | 68 | <div class="row clearfix"> |
69 | - <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory');?>"/> |
|
69 | + <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory'); ?>"/> |
|
70 | 70 | </div> |
71 | 71 | <?php |
72 | 72 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
73 | - do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
73 | + do_action('geodir_after_inquiry_form_field', 'inq_email'); ?> |
|
74 | 74 | <?php |
75 | 75 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
76 | - do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
76 | + do_action('geodir_before_inquiry_form_field', 'inq_phone'); ?> |
|
77 | 77 | <div class="row clearfix"> |
78 | - <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory');?>"/> |
|
78 | + <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory'); ?>"/> |
|
79 | 79 | </div> |
80 | 80 | <?php |
81 | 81 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
82 | - do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
82 | + do_action('geodir_after_inquiry_form_field', 'inq_phone'); ?> |
|
83 | 83 | <?php |
84 | 84 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
85 | - do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
85 | + do_action('geodir_before_inquiry_form_field', 'inq_msg'); ?> |
|
86 | 86 | <div class="row clearfix"> |
87 | 87 | <textarea required field_type="textarea" name="inq_msg" cols="" |
88 | - rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT;?>"></textarea> |
|
88 | + rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT; ?>"></textarea> |
|
89 | 89 | </div> |
90 | 90 | <?php |
91 | 91 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
92 | - do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
93 | - <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory');?>" |
|
92 | + do_action('geodir_after_inquiry_form_field', 'inq_msg'); ?> |
|
93 | + <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory'); ?>" |
|
94 | 94 | class="button clearfix"/> |
95 | 95 | </form> |
96 | 96 | </div> <?php |
@@ -17,278 +17,278 @@ |
||
17 | 17 | $geodir_settings['notifications_settings'] = apply_filters('geodir_notifications_settings', array( |
18 | 18 | |
19 | 19 | |
20 | - array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'), |
|
21 | - |
|
22 | - |
|
23 | - array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'), |
|
24 | - |
|
25 | - array( |
|
26 | - 'name' => __('List of usable shortcodes', 'geodirectory'), |
|
27 | - 'desc' => __('[#client_name#],[#listing_link#],[#posted_date#],[#number_of_days#],[#number_of_grace_days#],[#login_url#],[#username#],[#user_email#],[#site_name_url#],[#renew_link#],[#post_id#],[#site_name#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'), |
|
28 | - 'id' => 'geodir_list_of_usable_shordcodes', |
|
29 | - 'type' => 'html_content', |
|
30 | - 'css' => 'min-width:300px;', |
|
31 | - 'std' => 'All Places' // Default value for the page title - changed in settings |
|
32 | - ), |
|
33 | - |
|
34 | - array( |
|
35 | - 'name' => __('Use advanced editor? (slow loading)', 'geodirectory'), |
|
36 | - 'desc' => __('Yes', 'geodirectory'), |
|
37 | - 'id' => 'geodir_tiny_editor', |
|
38 | - 'std' => 'yes', |
|
39 | - 'type' => 'radio', |
|
40 | - 'value' => '1', |
|
41 | - 'radiogroup' => 'start' |
|
42 | - ), |
|
43 | - array( |
|
44 | - 'name' => __('Use advanced editor?(slow loading)', 'geodirectory'), |
|
45 | - 'desc' => __('No', 'geodirectory'), |
|
46 | - 'id' => 'geodir_tiny_editor', |
|
47 | - 'std' => 'yes', |
|
48 | - 'type' => 'radio', |
|
49 | - 'value' => '0', |
|
50 | - 'radiogroup' => 'end' |
|
51 | - ), |
|
52 | - |
|
53 | - |
|
54 | - array('type' => 'sectionend', 'id' => 'notification_options'), |
|
55 | - |
|
56 | - |
|
57 | - array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'), |
|
58 | - |
|
59 | - array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'), |
|
60 | - |
|
61 | - array( |
|
62 | - 'name' => __('New user registration', 'geodirectory'), |
|
63 | - 'desc' => __('Yes', 'geodirectory'), |
|
64 | - 'id' => 'geodir_bcc_new_user', |
|
65 | - 'std' => 'yes', |
|
66 | - 'type' => 'radio', |
|
67 | - 'value' => '1', |
|
68 | - 'radiogroup' => 'start' |
|
69 | - ), |
|
70 | - array( |
|
71 | - 'name' => __('New user registration', 'geodirectory'), |
|
72 | - 'desc' => __('No', 'geodirectory'), |
|
73 | - 'id' => 'geodir_bcc_new_user', |
|
74 | - 'std' => 'yes', |
|
75 | - 'type' => 'radio', |
|
76 | - 'value' => '0', |
|
77 | - 'radiogroup' => 'end' |
|
78 | - ), |
|
79 | - |
|
80 | - array( |
|
81 | - 'name' => __('Send enquiry', 'geodirectory'), |
|
82 | - 'desc' => __('Yes', 'geodirectory'), |
|
83 | - 'id' => 'geodir_bcc_enquiry', |
|
84 | - 'std' => 'yes', |
|
85 | - 'type' => 'radio', |
|
86 | - 'value' => '1', |
|
87 | - 'radiogroup' => 'start' |
|
88 | - ), |
|
89 | - array( |
|
90 | - 'name' => __('Send enquiry', 'geodirectory'), |
|
91 | - 'desc' => __('No', 'geodirectory'), |
|
92 | - 'id' => 'geodir_bcc_enquiry', |
|
93 | - 'std' => 'yes', |
|
94 | - 'type' => 'radio', |
|
95 | - 'value' => '0', |
|
96 | - 'radiogroup' => 'end' |
|
97 | - ), |
|
98 | - |
|
99 | - |
|
100 | - array('type' => 'sectionend', 'id' => 'site_bcc_options'), |
|
101 | - |
|
102 | - |
|
103 | - array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'), |
|
104 | - |
|
105 | - array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'), |
|
106 | - |
|
107 | - array( |
|
108 | - 'name' => __('Notify to admin on post submit', 'geodirectory'), |
|
109 | - 'desc' => __('Yes', 'geodirectory'), |
|
110 | - 'id' => 'geodir_notify_post_submit', |
|
111 | - 'std' => '1', |
|
112 | - 'type' => 'radio', |
|
113 | - 'value' => '1', |
|
114 | - 'radiogroup' => 'start' |
|
115 | - ), |
|
116 | - array( |
|
117 | - 'name' => __('Notify to admin on post submit', 'geodirectory'), |
|
118 | - 'desc' => __('No', 'geodirectory'), |
|
119 | - 'id' => 'geodir_notify_post_submit', |
|
120 | - 'std' => '1', |
|
121 | - 'type' => 'radio', |
|
122 | - 'value' => '0', |
|
123 | - 'radiogroup' => 'end' |
|
124 | - ), |
|
125 | - array( |
|
126 | - 'name' => __('Post submit success to admin email', 'geodirectory'), |
|
127 | - 'desc' => '', |
|
128 | - 'id' => 'geodir_post_submited_success_email_subject_admin', |
|
129 | - 'type' => 'text', |
|
130 | - 'css' => 'min-width:300px;', |
|
131 | - 'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings |
|
132 | - ), |
|
133 | - array( |
|
134 | - 'name' => '', |
|
135 | - 'desc' => '', |
|
136 | - 'id' => 'geodir_post_submited_success_email_content_admin', |
|
137 | - 'css' => 'width:500px; height: 150px;', |
|
138 | - 'type' => 'textarea', |
|
139 | - 'std' => __('<p>Dear Admin,</p><p>A new listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory') |
|
140 | - ), |
|
141 | - array( |
|
142 | - 'name' => __('Notify Admin when listing edited by Author', 'geodirectory'), |
|
143 | - 'desc' => __('Yes', 'geodirectory'), |
|
144 | - 'id' => 'geodir_notify_post_edited', |
|
145 | - 'std' => '0', |
|
146 | - 'type' => 'radio', |
|
147 | - 'value' => '1', |
|
148 | - 'radiogroup' => 'start' |
|
149 | - ), |
|
150 | - array( |
|
151 | - 'name' => __('Notify Admin when listing edited by Author', 'geodirectory'), |
|
152 | - 'desc' => __('No', 'geodirectory'), |
|
153 | - 'id' => 'geodir_notify_post_edited', |
|
154 | - 'std' => '0', |
|
155 | - 'type' => 'radio', |
|
156 | - 'value' => '0', |
|
157 | - 'radiogroup' => 'end' |
|
158 | - ), |
|
159 | - array( |
|
160 | - 'name' => __('Listing edited by Author', 'geodirectory'), |
|
161 | - 'desc' => '', |
|
162 | - 'id' => 'geodir_post_edited_email_subject_admin', |
|
163 | - 'type' => 'text', |
|
164 | - 'css' => 'min-width:300px;', |
|
165 | - 'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory') |
|
166 | - ), |
|
167 | - array( |
|
168 | - 'name' => '', |
|
169 | - 'desc' => '', |
|
170 | - 'id' => 'geodir_post_edited_email_content_admin', |
|
171 | - 'css' => 'width:500px; height: 150px;', |
|
172 | - 'type' => 'textarea', |
|
173 | - 'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory') |
|
174 | - ), |
|
175 | - |
|
176 | - |
|
177 | - array('type' => 'sectionend', 'id' => 'admin_emails'), |
|
178 | - |
|
179 | - |
|
180 | - array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'), |
|
181 | - |
|
182 | - array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'), |
|
183 | - |
|
184 | - array( |
|
185 | - 'name' => __('Post submit success to client email', 'geodirectory'), |
|
186 | - 'desc' => '', |
|
187 | - 'id' => 'geodir_post_submited_success_email_subject', |
|
188 | - 'type' => 'text', |
|
189 | - 'css' => 'min-width:300px;', |
|
190 | - 'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings |
|
191 | - ), |
|
192 | - array( |
|
193 | - 'name' => '', |
|
194 | - 'desc' => '', |
|
195 | - 'id' => 'geodir_post_submited_success_email_content', |
|
196 | - 'css' => 'width:500px; height: 150px;', |
|
197 | - 'type' => 'textarea', |
|
198 | - 'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory') |
|
199 | - ), |
|
200 | - |
|
201 | - |
|
202 | - array( |
|
203 | - 'name' => __('User forgot password email', 'geodirectory'), |
|
204 | - 'desc' => '', |
|
205 | - 'id' => 'geodir_forgot_password_subject', |
|
206 | - 'type' => 'text', |
|
207 | - 'css' => 'min-width:300px;', |
|
208 | - 'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings |
|
209 | - ), |
|
210 | - array( |
|
211 | - 'name' => '', |
|
212 | - 'desc' => '', |
|
213 | - 'id' => 'geodir_forgot_password_content', |
|
214 | - 'css' => 'width:500px; height: 150px;', |
|
215 | - 'type' => 'textarea', |
|
216 | - 'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
217 | - ), |
|
218 | - |
|
219 | - array( |
|
220 | - 'name' => __('Registration success email', 'geodirectory'), |
|
221 | - 'desc' => '', |
|
222 | - 'id' => 'geodir_registration_success_email_subject', |
|
223 | - 'type' => 'text', |
|
224 | - 'css' => 'min-width:300px;', |
|
225 | - 'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings |
|
226 | - ), |
|
227 | - array( |
|
228 | - 'name' => '', |
|
229 | - 'desc' => '', |
|
230 | - 'id' => 'geodir_registration_success_email_content', |
|
231 | - 'css' => 'width:500px; height: 150px;', |
|
232 | - 'type' => 'textarea', |
|
233 | - 'std' => __("<p>Dear [#client_name#],</p><p>You can log in with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
234 | - ), |
|
235 | - array( |
|
236 | - 'name' => __('Listing published email', 'geodirectory'), |
|
237 | - 'desc' => '', |
|
238 | - 'id' => 'geodir_post_published_email_subject', |
|
239 | - 'type' => 'text', |
|
240 | - 'css' => 'min-width:300px;', |
|
241 | - 'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings |
|
242 | - ), |
|
243 | - array( |
|
244 | - 'name' => '', |
|
245 | - 'desc' => '', |
|
246 | - 'id' => 'geodir_post_published_email_content', |
|
247 | - 'css' => 'width:500px; height: 150px;', |
|
248 | - 'type' => 'textarea', |
|
249 | - 'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory') |
|
250 | - ), |
|
251 | - |
|
252 | - array('type' => 'sectionend', 'id' => 'client_emails'), |
|
253 | - |
|
254 | - array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'), |
|
255 | - |
|
256 | - array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'), |
|
257 | - |
|
258 | - array( |
|
259 | - 'name' => __('Email enquiry', 'geodirectory'), |
|
260 | - 'desc' => '', |
|
261 | - 'id' => 'geodir_email_enquiry_subject', |
|
262 | - 'type' => 'text', |
|
263 | - 'css' => 'min-width:300px;', |
|
264 | - 'std' => __('Website Enquiry', 'geodirectory') |
|
265 | - ), |
|
266 | - array( |
|
267 | - 'name' => '', |
|
268 | - 'desc' => '', |
|
269 | - 'id' => 'geodir_email_enquiry_content', |
|
270 | - 'css' => 'width:500px; height: 150px;', |
|
271 | - 'type' => 'textarea', |
|
272 | - 'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
273 | - ), |
|
274 | - |
|
275 | - array('type' => 'sectionend', 'id' => 'other_emails'), |
|
276 | - |
|
277 | - |
|
278 | - array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'), |
|
279 | - |
|
280 | - array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'), |
|
281 | - |
|
282 | - array( |
|
283 | - 'name' => __('Post submitted success', 'geodirectory'), |
|
284 | - 'desc' => '', |
|
285 | - 'id' => 'geodir_post_added_success_msg_content', |
|
286 | - 'css' => 'width:500px; height: 150px;', |
|
287 | - 'type' => 'textarea', |
|
288 | - 'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information »</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory') |
|
289 | - ), |
|
290 | - |
|
291 | - |
|
292 | - array('type' => 'sectionend', 'id' => 'messages'), |
|
20 | + array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'), |
|
21 | + |
|
22 | + |
|
23 | + array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'), |
|
24 | + |
|
25 | + array( |
|
26 | + 'name' => __('List of usable shortcodes', 'geodirectory'), |
|
27 | + 'desc' => __('[#client_name#],[#listing_link#],[#posted_date#],[#number_of_days#],[#number_of_grace_days#],[#login_url#],[#username#],[#user_email#],[#site_name_url#],[#renew_link#],[#post_id#],[#site_name#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'), |
|
28 | + 'id' => 'geodir_list_of_usable_shordcodes', |
|
29 | + 'type' => 'html_content', |
|
30 | + 'css' => 'min-width:300px;', |
|
31 | + 'std' => 'All Places' // Default value for the page title - changed in settings |
|
32 | + ), |
|
33 | + |
|
34 | + array( |
|
35 | + 'name' => __('Use advanced editor? (slow loading)', 'geodirectory'), |
|
36 | + 'desc' => __('Yes', 'geodirectory'), |
|
37 | + 'id' => 'geodir_tiny_editor', |
|
38 | + 'std' => 'yes', |
|
39 | + 'type' => 'radio', |
|
40 | + 'value' => '1', |
|
41 | + 'radiogroup' => 'start' |
|
42 | + ), |
|
43 | + array( |
|
44 | + 'name' => __('Use advanced editor?(slow loading)', 'geodirectory'), |
|
45 | + 'desc' => __('No', 'geodirectory'), |
|
46 | + 'id' => 'geodir_tiny_editor', |
|
47 | + 'std' => 'yes', |
|
48 | + 'type' => 'radio', |
|
49 | + 'value' => '0', |
|
50 | + 'radiogroup' => 'end' |
|
51 | + ), |
|
52 | + |
|
53 | + |
|
54 | + array('type' => 'sectionend', 'id' => 'notification_options'), |
|
55 | + |
|
56 | + |
|
57 | + array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'), |
|
58 | + |
|
59 | + array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'), |
|
60 | + |
|
61 | + array( |
|
62 | + 'name' => __('New user registration', 'geodirectory'), |
|
63 | + 'desc' => __('Yes', 'geodirectory'), |
|
64 | + 'id' => 'geodir_bcc_new_user', |
|
65 | + 'std' => 'yes', |
|
66 | + 'type' => 'radio', |
|
67 | + 'value' => '1', |
|
68 | + 'radiogroup' => 'start' |
|
69 | + ), |
|
70 | + array( |
|
71 | + 'name' => __('New user registration', 'geodirectory'), |
|
72 | + 'desc' => __('No', 'geodirectory'), |
|
73 | + 'id' => 'geodir_bcc_new_user', |
|
74 | + 'std' => 'yes', |
|
75 | + 'type' => 'radio', |
|
76 | + 'value' => '0', |
|
77 | + 'radiogroup' => 'end' |
|
78 | + ), |
|
79 | + |
|
80 | + array( |
|
81 | + 'name' => __('Send enquiry', 'geodirectory'), |
|
82 | + 'desc' => __('Yes', 'geodirectory'), |
|
83 | + 'id' => 'geodir_bcc_enquiry', |
|
84 | + 'std' => 'yes', |
|
85 | + 'type' => 'radio', |
|
86 | + 'value' => '1', |
|
87 | + 'radiogroup' => 'start' |
|
88 | + ), |
|
89 | + array( |
|
90 | + 'name' => __('Send enquiry', 'geodirectory'), |
|
91 | + 'desc' => __('No', 'geodirectory'), |
|
92 | + 'id' => 'geodir_bcc_enquiry', |
|
93 | + 'std' => 'yes', |
|
94 | + 'type' => 'radio', |
|
95 | + 'value' => '0', |
|
96 | + 'radiogroup' => 'end' |
|
97 | + ), |
|
98 | + |
|
99 | + |
|
100 | + array('type' => 'sectionend', 'id' => 'site_bcc_options'), |
|
101 | + |
|
102 | + |
|
103 | + array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'), |
|
104 | + |
|
105 | + array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'), |
|
106 | + |
|
107 | + array( |
|
108 | + 'name' => __('Notify to admin on post submit', 'geodirectory'), |
|
109 | + 'desc' => __('Yes', 'geodirectory'), |
|
110 | + 'id' => 'geodir_notify_post_submit', |
|
111 | + 'std' => '1', |
|
112 | + 'type' => 'radio', |
|
113 | + 'value' => '1', |
|
114 | + 'radiogroup' => 'start' |
|
115 | + ), |
|
116 | + array( |
|
117 | + 'name' => __('Notify to admin on post submit', 'geodirectory'), |
|
118 | + 'desc' => __('No', 'geodirectory'), |
|
119 | + 'id' => 'geodir_notify_post_submit', |
|
120 | + 'std' => '1', |
|
121 | + 'type' => 'radio', |
|
122 | + 'value' => '0', |
|
123 | + 'radiogroup' => 'end' |
|
124 | + ), |
|
125 | + array( |
|
126 | + 'name' => __('Post submit success to admin email', 'geodirectory'), |
|
127 | + 'desc' => '', |
|
128 | + 'id' => 'geodir_post_submited_success_email_subject_admin', |
|
129 | + 'type' => 'text', |
|
130 | + 'css' => 'min-width:300px;', |
|
131 | + 'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings |
|
132 | + ), |
|
133 | + array( |
|
134 | + 'name' => '', |
|
135 | + 'desc' => '', |
|
136 | + 'id' => 'geodir_post_submited_success_email_content_admin', |
|
137 | + 'css' => 'width:500px; height: 150px;', |
|
138 | + 'type' => 'textarea', |
|
139 | + 'std' => __('<p>Dear Admin,</p><p>A new listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory') |
|
140 | + ), |
|
141 | + array( |
|
142 | + 'name' => __('Notify Admin when listing edited by Author', 'geodirectory'), |
|
143 | + 'desc' => __('Yes', 'geodirectory'), |
|
144 | + 'id' => 'geodir_notify_post_edited', |
|
145 | + 'std' => '0', |
|
146 | + 'type' => 'radio', |
|
147 | + 'value' => '1', |
|
148 | + 'radiogroup' => 'start' |
|
149 | + ), |
|
150 | + array( |
|
151 | + 'name' => __('Notify Admin when listing edited by Author', 'geodirectory'), |
|
152 | + 'desc' => __('No', 'geodirectory'), |
|
153 | + 'id' => 'geodir_notify_post_edited', |
|
154 | + 'std' => '0', |
|
155 | + 'type' => 'radio', |
|
156 | + 'value' => '0', |
|
157 | + 'radiogroup' => 'end' |
|
158 | + ), |
|
159 | + array( |
|
160 | + 'name' => __('Listing edited by Author', 'geodirectory'), |
|
161 | + 'desc' => '', |
|
162 | + 'id' => 'geodir_post_edited_email_subject_admin', |
|
163 | + 'type' => 'text', |
|
164 | + 'css' => 'min-width:300px;', |
|
165 | + 'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory') |
|
166 | + ), |
|
167 | + array( |
|
168 | + 'name' => '', |
|
169 | + 'desc' => '', |
|
170 | + 'id' => 'geodir_post_edited_email_content_admin', |
|
171 | + 'css' => 'width:500px; height: 150px;', |
|
172 | + 'type' => 'textarea', |
|
173 | + 'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory') |
|
174 | + ), |
|
175 | + |
|
176 | + |
|
177 | + array('type' => 'sectionend', 'id' => 'admin_emails'), |
|
178 | + |
|
179 | + |
|
180 | + array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'), |
|
181 | + |
|
182 | + array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'), |
|
183 | + |
|
184 | + array( |
|
185 | + 'name' => __('Post submit success to client email', 'geodirectory'), |
|
186 | + 'desc' => '', |
|
187 | + 'id' => 'geodir_post_submited_success_email_subject', |
|
188 | + 'type' => 'text', |
|
189 | + 'css' => 'min-width:300px;', |
|
190 | + 'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings |
|
191 | + ), |
|
192 | + array( |
|
193 | + 'name' => '', |
|
194 | + 'desc' => '', |
|
195 | + 'id' => 'geodir_post_submited_success_email_content', |
|
196 | + 'css' => 'width:500px; height: 150px;', |
|
197 | + 'type' => 'textarea', |
|
198 | + 'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory') |
|
199 | + ), |
|
200 | + |
|
201 | + |
|
202 | + array( |
|
203 | + 'name' => __('User forgot password email', 'geodirectory'), |
|
204 | + 'desc' => '', |
|
205 | + 'id' => 'geodir_forgot_password_subject', |
|
206 | + 'type' => 'text', |
|
207 | + 'css' => 'min-width:300px;', |
|
208 | + 'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings |
|
209 | + ), |
|
210 | + array( |
|
211 | + 'name' => '', |
|
212 | + 'desc' => '', |
|
213 | + 'id' => 'geodir_forgot_password_content', |
|
214 | + 'css' => 'width:500px; height: 150px;', |
|
215 | + 'type' => 'textarea', |
|
216 | + 'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
217 | + ), |
|
218 | + |
|
219 | + array( |
|
220 | + 'name' => __('Registration success email', 'geodirectory'), |
|
221 | + 'desc' => '', |
|
222 | + 'id' => 'geodir_registration_success_email_subject', |
|
223 | + 'type' => 'text', |
|
224 | + 'css' => 'min-width:300px;', |
|
225 | + 'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings |
|
226 | + ), |
|
227 | + array( |
|
228 | + 'name' => '', |
|
229 | + 'desc' => '', |
|
230 | + 'id' => 'geodir_registration_success_email_content', |
|
231 | + 'css' => 'width:500px; height: 150px;', |
|
232 | + 'type' => 'textarea', |
|
233 | + 'std' => __("<p>Dear [#client_name#],</p><p>You can log in with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
234 | + ), |
|
235 | + array( |
|
236 | + 'name' => __('Listing published email', 'geodirectory'), |
|
237 | + 'desc' => '', |
|
238 | + 'id' => 'geodir_post_published_email_subject', |
|
239 | + 'type' => 'text', |
|
240 | + 'css' => 'min-width:300px;', |
|
241 | + 'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings |
|
242 | + ), |
|
243 | + array( |
|
244 | + 'name' => '', |
|
245 | + 'desc' => '', |
|
246 | + 'id' => 'geodir_post_published_email_content', |
|
247 | + 'css' => 'width:500px; height: 150px;', |
|
248 | + 'type' => 'textarea', |
|
249 | + 'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory') |
|
250 | + ), |
|
251 | + |
|
252 | + array('type' => 'sectionend', 'id' => 'client_emails'), |
|
253 | + |
|
254 | + array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'), |
|
255 | + |
|
256 | + array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'), |
|
257 | + |
|
258 | + array( |
|
259 | + 'name' => __('Email enquiry', 'geodirectory'), |
|
260 | + 'desc' => '', |
|
261 | + 'id' => 'geodir_email_enquiry_subject', |
|
262 | + 'type' => 'text', |
|
263 | + 'css' => 'min-width:300px;', |
|
264 | + 'std' => __('Website Enquiry', 'geodirectory') |
|
265 | + ), |
|
266 | + array( |
|
267 | + 'name' => '', |
|
268 | + 'desc' => '', |
|
269 | + 'id' => 'geodir_email_enquiry_content', |
|
270 | + 'css' => 'width:500px; height: 150px;', |
|
271 | + 'type' => 'textarea', |
|
272 | + 'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
273 | + ), |
|
274 | + |
|
275 | + array('type' => 'sectionend', 'id' => 'other_emails'), |
|
276 | + |
|
277 | + |
|
278 | + array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'), |
|
279 | + |
|
280 | + array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'), |
|
281 | + |
|
282 | + array( |
|
283 | + 'name' => __('Post submitted success', 'geodirectory'), |
|
284 | + 'desc' => '', |
|
285 | + 'id' => 'geodir_post_added_success_msg_content', |
|
286 | + 'css' => 'width:500px; height: 150px;', |
|
287 | + 'type' => 'textarea', |
|
288 | + 'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information »</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory') |
|
289 | + ), |
|
290 | + |
|
291 | + |
|
292 | + array('type' => 'sectionend', 'id' => 'messages'), |
|
293 | 293 | |
294 | 294 | )); // End Manage NOtifications settings |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'id' => 'geodir_post_submited_success_email_subject_admin', |
129 | 129 | 'type' => 'text', |
130 | 130 | 'css' => 'min-width:300px;', |
131 | - 'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings |
|
131 | + 'std' => __('Post Submitted Successfully', 'geodirectory') // Default value for the page title - changed in settings |
|
132 | 132 | ), |
133 | 133 | array( |
134 | 134 | 'name' => '', |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'id' => 'geodir_post_submited_success_email_content_admin', |
137 | 137 | 'css' => 'width:500px; height: 150px;', |
138 | 138 | 'type' => 'textarea', |
139 | - 'std' => __('<p>Dear Admin,</p><p>A new listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory') |
|
139 | + 'std' => __('<p>Dear Admin,</p><p>A new listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>', 'geodirectory') |
|
140 | 140 | ), |
141 | 141 | array( |
142 | 142 | 'name' => __('Notify Admin when listing edited by Author', 'geodirectory'), |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'id' => 'geodir_post_submited_success_email_subject', |
188 | 188 | 'type' => 'text', |
189 | 189 | 'css' => 'min-width:300px;', |
190 | - 'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings |
|
190 | + 'std' => __('Post Submitted Successfully', 'geodirectory') // Default value for the page title - changed in settings |
|
191 | 191 | ), |
192 | 192 | array( |
193 | 193 | 'name' => '', |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'id' => 'geodir_post_submited_success_email_content', |
196 | 196 | 'css' => 'width:500px; height: 150px;', |
197 | 197 | 'type' => 'textarea', |
198 | - 'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory') |
|
198 | + 'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>', 'geodirectory') |
|
199 | 199 | ), |
200 | 200 | |
201 | 201 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | 'id' => 'geodir_forgot_password_content', |
214 | 214 | 'css' => 'width:500px; height: 150px;', |
215 | 215 | 'type' => 'textarea', |
216 | - 'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
216 | + 'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>", 'geodirectory') |
|
217 | 217 | ), |
218 | 218 | |
219 | 219 | array( |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | 'id' => 'geodir_registration_success_email_content', |
231 | 231 | 'css' => 'width:500px; height: 150px;', |
232 | 232 | 'type' => 'textarea', |
233 | - 'std' => __("<p>Dear [#client_name#],</p><p>You can log in with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
233 | + 'std' => __("<p>Dear [#client_name#],</p><p>You can log in with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>", 'geodirectory') |
|
234 | 234 | ), |
235 | 235 | array( |
236 | 236 | 'name' => __('Listing published email', 'geodirectory'), |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | 'id' => 'geodir_email_enquiry_content', |
270 | 270 | 'css' => 'width:500px; height: 150px;', |
271 | 271 | 'type' => 'textarea', |
272 | - 'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory') |
|
272 | + 'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>", 'geodirectory') |
|
273 | 273 | ), |
274 | 274 | |
275 | 275 | array('type' => 'sectionend', 'id' => 'other_emails'), |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | 'id' => 'geodir_post_added_success_msg_content', |
286 | 286 | 'css' => 'width:500px; height: 150px;', |
287 | 287 | 'type' => 'textarea', |
288 | - 'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information »</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory') |
|
288 | + 'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information »</a></p><p>Thank you for visiting us at [#site_name#].</p>', 'geodirectory') |
|
289 | 289 | ), |
290 | 290 | |
291 | 291 |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | </script> |
261 | 261 | |
262 | 262 | <?php |
263 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
263 | + } elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
264 | 264 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
265 | 265 | } |
266 | 266 | } |
@@ -299,13 +299,14 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function geodir_add_async_forscript($url) |
301 | 301 | { |
302 | - if (strpos($url, '#asyncload')===false) |
|
303 | - return $url; |
|
304 | - else if (is_admin()) |
|
305 | - return str_replace('#asyncload', '', $url); |
|
306 | - else |
|
307 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
308 | -} |
|
302 | + if (strpos($url, '#asyncload')===false) { |
|
303 | + return $url; |
|
304 | + } else if (is_admin()) { |
|
305 | + return str_replace('#asyncload', '', $url); |
|
306 | + } else { |
|
307 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
308 | + } |
|
309 | + } |
|
309 | 310 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
310 | 311 | |
311 | 312 | /** |
@@ -372,8 +373,10 @@ discard block |
||
372 | 373 | |
373 | 374 | $half_pages_to_show = round($pages_to_show / 2); |
374 | 375 | |
375 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
376 | - return; |
|
376 | + if (geodir_is_page('home')) { |
|
377 | + // dont apply default pagination for geodirectory home page. |
|
378 | + return; |
|
379 | + } |
|
377 | 380 | |
378 | 381 | if (!is_single()) { |
379 | 382 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -493,11 +496,21 @@ discard block |
||
493 | 496 | } |
494 | 497 | $dist_dif = 1000; |
495 | 498 | |
496 | - if ($dist <= 5000) $dist_dif = 500; |
|
497 | - if ($dist <= 1000) $dist_dif = 100; |
|
498 | - if ($dist <= 500) $dist_dif = 50; |
|
499 | - if ($dist <= 100) $dist_dif = 10; |
|
500 | - if ($dist <= 50) $dist_dif = 5; |
|
499 | + if ($dist <= 5000) { |
|
500 | + $dist_dif = 500; |
|
501 | + } |
|
502 | + if ($dist <= 1000) { |
|
503 | + $dist_dif = 100; |
|
504 | + } |
|
505 | + if ($dist <= 500) { |
|
506 | + $dist_dif = 50; |
|
507 | + } |
|
508 | + if ($dist <= 100) { |
|
509 | + $dist_dif = 10; |
|
510 | + } |
|
511 | + if ($dist <= 50) { |
|
512 | + $dist_dif = 5; |
|
513 | + } |
|
501 | 514 | |
502 | 515 | ?> |
503 | 516 | <script type="text/javascript"> |
@@ -558,12 +571,14 @@ discard block |
||
558 | 571 | */ |
559 | 572 | function geodir_add_sharelocation_scripts() { |
560 | 573 | $default_search_for_text = SEARCH_FOR_TEXT; |
561 | - if (get_option('geodir_search_field_default_text')) |
|
562 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
574 | + if (get_option('geodir_search_field_default_text')) { |
|
575 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
576 | + } |
|
563 | 577 | |
564 | 578 | $default_near_text = NEAR_TEXT; |
565 | - if (get_option('geodir_near_field_default_text')) |
|
566 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
579 | + if (get_option('geodir_near_field_default_text')) { |
|
580 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
581 | + } |
|
567 | 582 | |
568 | 583 | $search_location = geodir_get_default_location(); |
569 | 584 |
@@ -36,177 +36,177 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function geodir_templates_scripts() |
38 | 38 | { |
39 | - $is_detail_page = false; |
|
40 | - $geodir_map_name = geodir_map_name(); |
|
39 | + $is_detail_page = false; |
|
40 | + $geodir_map_name = geodir_map_name(); |
|
41 | 41 | |
42 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
43 | - $is_detail_page = true; |
|
44 | - } |
|
42 | + if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
43 | + $is_detail_page = true; |
|
44 | + } |
|
45 | 45 | |
46 | - wp_enqueue_script('jquery'); |
|
46 | + wp_enqueue_script('jquery'); |
|
47 | 47 | |
48 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
49 | - wp_enqueue_script('geodirectory-script'); |
|
48 | + wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
49 | + wp_enqueue_script('geodirectory-script'); |
|
50 | 50 | |
51 | - $geodir_vars_data = array( |
|
52 | - 'siteurl' => get_option('siteurl'), |
|
53 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
54 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
55 | - 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
56 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
57 | - 'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue |
|
51 | + $geodir_vars_data = array( |
|
52 | + 'siteurl' => get_option('siteurl'), |
|
53 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
54 | + 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
55 | + 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
56 | + 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
57 | + 'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue |
|
58 | 58 | 'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')), |
59 | 59 | 'lightBox_txtOf' => addslashes(__('of', 'geodirectory')), |
60 | - ); |
|
61 | - |
|
62 | - /** |
|
63 | - * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
64 | - * |
|
65 | - * This is used by addons to add JS translatable variables. |
|
66 | - * |
|
67 | - * @since 1.4.4 |
|
68 | - * @param array $geodir_vars_data { |
|
69 | - * geodir var data used by addons to add JS translatable variables. |
|
70 | - * |
|
71 | - * @type string $siteurl Site url. |
|
72 | - * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
73 | - * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
74 | - * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
75 | - * @type int $is_rtl Checks if current locale is RTL. |
|
76 | - * |
|
77 | - * } |
|
78 | - */ |
|
79 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
80 | - |
|
81 | - wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
82 | - |
|
83 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
85 | - |
|
86 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | - wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
88 | - |
|
89 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
90 | - if ($is_detail_page) { |
|
91 | - wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
92 | - } |
|
60 | + ); |
|
61 | + |
|
62 | + /** |
|
63 | + * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
64 | + * |
|
65 | + * This is used by addons to add JS translatable variables. |
|
66 | + * |
|
67 | + * @since 1.4.4 |
|
68 | + * @param array $geodir_vars_data { |
|
69 | + * geodir var data used by addons to add JS translatable variables. |
|
70 | + * |
|
71 | + * @type string $siteurl Site url. |
|
72 | + * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
73 | + * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
74 | + * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
75 | + * @type int $is_rtl Checks if current locale is RTL. |
|
76 | + * |
|
77 | + * } |
|
78 | + */ |
|
79 | + $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
80 | + |
|
81 | + wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
82 | + |
|
83 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | + if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
85 | + |
|
86 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | + wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
88 | + |
|
89 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
90 | + if ($is_detail_page) { |
|
91 | + wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
92 | + } |
|
93 | 93 | |
94 | - if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
95 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
96 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
97 | - /** |
|
98 | - * Filter the variables that are added to the end of the google maps script call. |
|
99 | - * |
|
100 | - * This i used to change things like google maps language etc. |
|
101 | - * |
|
102 | - * @since 1.0.0 |
|
103 | - * @param string $var The string to filter, default is empty string. |
|
104 | - */ |
|
105 | - $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
106 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
94 | + if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
95 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
96 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
97 | + /** |
|
98 | + * Filter the variables that are added to the end of the google maps script call. |
|
99 | + * |
|
100 | + * This i used to change things like google maps language etc. |
|
101 | + * |
|
102 | + * @since 1.0.0 |
|
103 | + * @param string $var The string to filter, default is empty string. |
|
104 | + */ |
|
105 | + $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
106 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
107 | 107 | |
108 | - // Overlapping Marker Spiderfier |
|
109 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
110 | - wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
111 | - } |
|
108 | + // Overlapping Marker Spiderfier |
|
109 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
110 | + wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
111 | + } |
|
112 | 112 | |
113 | - if ($geodir_map_name == 'osm') { |
|
114 | - // Leaflet OpenStreetMap |
|
115 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
116 | - wp_enqueue_style('geodirectory-leaflet-style'); |
|
113 | + if ($geodir_map_name == 'osm') { |
|
114 | + // Leaflet OpenStreetMap |
|
115 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
116 | + wp_enqueue_style('geodirectory-leaflet-style'); |
|
117 | 117 | |
118 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | - wp_enqueue_script('geodirectory-leaflet-script'); |
|
118 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | + wp_enqueue_script('geodirectory-leaflet-script'); |
|
120 | 120 | |
121 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
122 | - wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
121 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
122 | + wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
123 | 123 | |
124 | - if ($is_detail_page) { |
|
125 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
126 | - wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
124 | + if ($is_detail_page) { |
|
125 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
126 | + wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
127 | 127 | |
128 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
129 | - wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
130 | - } |
|
128 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
129 | + wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
130 | + } |
|
131 | 131 | |
132 | - // Overlapping Marker Spiderfier Leaflet |
|
133 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
134 | - wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
135 | - } |
|
136 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
132 | + // Overlapping Marker Spiderfier Leaflet |
|
133 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
134 | + wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
135 | + } |
|
136 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
137 | 137 | |
138 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
139 | - wp_enqueue_script('geodirectory-goMap-script'); |
|
140 | - |
|
141 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | - wp_enqueue_script('chosen'); |
|
143 | - |
|
144 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
145 | - wp_enqueue_script('geodirectory-choose-ajax'); |
|
146 | - |
|
147 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
148 | - |
|
149 | - if (is_page() && geodir_is_page('add-listing')) { |
|
150 | - // SCRIPT FOR UPLOAD |
|
151 | - wp_enqueue_script('plupload-all'); |
|
152 | - wp_enqueue_script('jquery-ui-sortable'); |
|
153 | - |
|
154 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
155 | - wp_enqueue_script('geodirectory-plupload-script'); |
|
156 | - // SCRIPT FOR UPLOAD END |
|
157 | - |
|
158 | - // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
159 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
160 | - $ajax_url = admin_url('admin-ajax.php'); |
|
161 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
162 | - $ajax_url = admin_url('admin-ajax.php'); |
|
163 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
164 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
165 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
166 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
167 | - } else { |
|
168 | - $ajax_url = admin_url('admin-ajax.php'); |
|
169 | - } |
|
138 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
139 | + wp_enqueue_script('geodirectory-goMap-script'); |
|
140 | + |
|
141 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | + wp_enqueue_script('chosen'); |
|
143 | + |
|
144 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
145 | + wp_enqueue_script('geodirectory-choose-ajax'); |
|
146 | + |
|
147 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
148 | + |
|
149 | + if (is_page() && geodir_is_page('add-listing')) { |
|
150 | + // SCRIPT FOR UPLOAD |
|
151 | + wp_enqueue_script('plupload-all'); |
|
152 | + wp_enqueue_script('jquery-ui-sortable'); |
|
153 | + |
|
154 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
155 | + wp_enqueue_script('geodirectory-plupload-script'); |
|
156 | + // SCRIPT FOR UPLOAD END |
|
157 | + |
|
158 | + // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
159 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
160 | + $ajax_url = admin_url('admin-ajax.php'); |
|
161 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
162 | + $ajax_url = admin_url('admin-ajax.php'); |
|
163 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
164 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
165 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
166 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
167 | + } else { |
|
168 | + $ajax_url = admin_url('admin-ajax.php'); |
|
169 | + } |
|
170 | 170 | |
171 | - // place js config array for plupload |
|
172 | - $plupload_init = array( |
|
173 | - 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
174 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
175 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
176 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
177 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
178 | - 'multiple_queues' => true, |
|
179 | - 'max_file_size' => geodir_max_upload_size(), |
|
180 | - 'url' => $ajax_url, |
|
181 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
182 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
183 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
184 | - 'multipart' => true, |
|
185 | - 'urlstream_upload' => true, |
|
186 | - 'multi_selection' => false, // will be added per uploader |
|
187 | - // additional post data to send to our ajax hook |
|
188 | - 'multipart_params' => array( |
|
189 | - '_ajax_nonce' => "", // will be added per uploader |
|
190 | - 'action' => 'plupload_action', // the ajax action name |
|
191 | - 'imgid' => 0 // will be added per uploader |
|
192 | - ) |
|
193 | - ); |
|
194 | - $base_plupload_config = json_encode($plupload_init); |
|
195 | - |
|
196 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
197 | - 'upload_img_size' => geodir_max_upload_size()); |
|
198 | - |
|
199 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
200 | - |
|
201 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
202 | - } // End if for add place page |
|
203 | - |
|
204 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
205 | - if ($is_detail_page) { |
|
171 | + // place js config array for plupload |
|
172 | + $plupload_init = array( |
|
173 | + 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
174 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
175 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
176 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
177 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
178 | + 'multiple_queues' => true, |
|
179 | + 'max_file_size' => geodir_max_upload_size(), |
|
180 | + 'url' => $ajax_url, |
|
181 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
182 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
183 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
184 | + 'multipart' => true, |
|
185 | + 'urlstream_upload' => true, |
|
186 | + 'multi_selection' => false, // will be added per uploader |
|
187 | + // additional post data to send to our ajax hook |
|
188 | + 'multipart_params' => array( |
|
189 | + '_ajax_nonce' => "", // will be added per uploader |
|
190 | + 'action' => 'plupload_action', // the ajax action name |
|
191 | + 'imgid' => 0 // will be added per uploader |
|
192 | + ) |
|
193 | + ); |
|
194 | + $base_plupload_config = json_encode($plupload_init); |
|
195 | + |
|
196 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
197 | + 'upload_img_size' => geodir_max_upload_size()); |
|
198 | + |
|
199 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
200 | + |
|
201 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
202 | + } // End if for add place page |
|
203 | + |
|
204 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
205 | + if ($is_detail_page) { |
|
206 | 206 | wp_enqueue_script('geodirectory-post-custom-js'); |
207 | 207 | } |
208 | 208 | |
209 | - // font awesome rating script |
|
209 | + // font awesome rating script |
|
210 | 210 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
211 | 211 | wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
212 | 212 | wp_enqueue_script('geodir-barrating-js'); |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | wp_enqueue_script('geodir-jRating-js'); |
216 | 216 | } |
217 | 217 | |
218 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | - wp_enqueue_script('geodir-on-document-load'); |
|
218 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | + wp_enqueue_script('geodir-on-document-load'); |
|
220 | 220 | |
221 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
222 | - wp_enqueue_script('google-geometa'); |
|
221 | + wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
222 | + wp_enqueue_script('google-geometa'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function geodir_header_scripts() |
235 | 235 | { |
236 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
237 | - echo stripslashes(get_option('geodir_header_scripts')); |
|
236 | + echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
237 | + echo stripslashes(get_option('geodir_header_scripts')); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | function geodir_google_analytics_tracking_code() |
249 | 249 | { |
250 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
250 | + if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
251 | 251 | |
252 | 252 | <script> |
253 | 253 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | </script> |
263 | 263 | |
264 | 264 | <?php |
265 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
266 | - echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
267 | - } |
|
265 | + }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
266 | + echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
267 | + } |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -278,16 +278,16 @@ discard block |
||
278 | 278 | function geodir_footer_scripts() |
279 | 279 | { |
280 | 280 | |
281 | - echo stripslashes(get_option('geodir_footer_scripts')); |
|
281 | + echo stripslashes(get_option('geodir_footer_scripts')); |
|
282 | 282 | |
283 | - /* |
|
283 | + /* |
|
284 | 284 | * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041 |
285 | 285 | * |
286 | 286 | * Flexbox wont wrap on ios for search form items |
287 | 287 | */ |
288 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
289 | - echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
290 | - } |
|
288 | + if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
289 | + echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
290 | + } |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function geodir_add_async_forscript($url) |
303 | 303 | { |
304 | - if (strpos($url, '#asyncload')===false) |
|
305 | - return $url; |
|
306 | - else if (is_admin()) |
|
307 | - return str_replace('#asyncload', '', $url); |
|
308 | - else |
|
309 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
304 | + if (strpos($url, '#asyncload')===false) |
|
305 | + return $url; |
|
306 | + else if (is_admin()) |
|
307 | + return str_replace('#asyncload', '', $url); |
|
308 | + else |
|
309 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
310 | 310 | } |
311 | 311 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
312 | 312 | |
@@ -319,18 +319,18 @@ discard block |
||
319 | 319 | function geodir_templates_styles() |
320 | 320 | { |
321 | 321 | |
322 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
323 | - wp_enqueue_style('geodir-core-scss'); |
|
324 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
322 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
323 | + wp_enqueue_style('geodir-core-scss'); |
|
324 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
325 | 325 | |
326 | - if(is_rtl()){ |
|
327 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
328 | - wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
329 | - } |
|
326 | + if(is_rtl()){ |
|
327 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
328 | + wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
329 | + } |
|
330 | 330 | |
331 | - wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION); |
|
332 | - wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION); |
|
333 | - wp_enqueue_script( 'font-awesome' ); |
|
331 | + wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION); |
|
332 | + wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION); |
|
333 | + wp_enqueue_script( 'font-awesome' ); |
|
334 | 334 | |
335 | 335 | |
336 | 336 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function geodir_get_sidebar() |
346 | 346 | { |
347 | - get_sidebar('geodirectory'); |
|
347 | + get_sidebar('geodirectory'); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -363,122 +363,122 @@ discard block |
||
363 | 363 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
364 | 364 | */ |
365 | 365 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
366 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
366 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
367 | 367 | |
368 | - if (empty($prelabel)) { |
|
369 | - $prelabel = '<strong><</strong>'; |
|
370 | - } |
|
368 | + if (empty($prelabel)) { |
|
369 | + $prelabel = '<strong><</strong>'; |
|
370 | + } |
|
371 | 371 | |
372 | - if (empty($nxtlabel)) { |
|
373 | - $nxtlabel = '<strong>></strong>'; |
|
374 | - } |
|
372 | + if (empty($nxtlabel)) { |
|
373 | + $nxtlabel = '<strong>></strong>'; |
|
374 | + } |
|
375 | 375 | |
376 | - $half_pages_to_show = round($pages_to_show / 2); |
|
376 | + $half_pages_to_show = round($pages_to_show / 2); |
|
377 | 377 | |
378 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
379 | - return; |
|
378 | + if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
379 | + return; |
|
380 | 380 | |
381 | - if (!is_single()) { |
|
382 | - if (function_exists('geodir_location_geo_home_link')) { |
|
383 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
384 | - } |
|
385 | - $numposts = $wp_query->found_posts; |
|
381 | + if (!is_single()) { |
|
382 | + if (function_exists('geodir_location_geo_home_link')) { |
|
383 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
384 | + } |
|
385 | + $numposts = $wp_query->found_posts; |
|
386 | 386 | |
387 | - $max_page = ceil($numposts / $posts_per_page); |
|
387 | + $max_page = ceil($numposts / $posts_per_page); |
|
388 | 388 | |
389 | - if (empty($paged)) { |
|
390 | - $paged = 1; |
|
391 | - } |
|
389 | + if (empty($paged)) { |
|
390 | + $paged = 1; |
|
391 | + } |
|
392 | 392 | |
393 | - $post_type = geodir_get_current_posttype(); |
|
394 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
395 | - if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
396 | - $term = array(); |
|
393 | + $post_type = geodir_get_current_posttype(); |
|
394 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
395 | + if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
396 | + $term = array(); |
|
397 | 397 | |
398 | - if (is_tax()) { |
|
399 | - $term_id = get_queried_object_id(); |
|
400 | - $taxonomy = get_query_var('taxonomy'); |
|
398 | + if (is_tax()) { |
|
399 | + $term_id = get_queried_object_id(); |
|
400 | + $taxonomy = get_query_var('taxonomy'); |
|
401 | 401 | |
402 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
403 | - $term = get_term($term_id, $post_type . 'category'); |
|
404 | - } |
|
405 | - } |
|
402 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
403 | + $term = get_term($term_id, $post_type . 'category'); |
|
404 | + } |
|
405 | + } |
|
406 | 406 | |
407 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
408 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
407 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
408 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
409 | 409 | |
410 | - if (!is_array($taxonomy_search)) { |
|
411 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
412 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
413 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
414 | - } |
|
415 | - } |
|
410 | + if (!is_array($taxonomy_search)) { |
|
411 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
412 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
413 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
414 | + } |
|
415 | + } |
|
416 | 416 | |
417 | - if (!empty($term) && !is_wp_error($term)) { |
|
418 | - $listing_type_name = $term->name; |
|
419 | - } |
|
420 | - } |
|
417 | + if (!empty($term) && !is_wp_error($term)) { |
|
418 | + $listing_type_name = $term->name; |
|
419 | + } |
|
420 | + } |
|
421 | 421 | |
422 | - if ($max_page > 1 || $always_show) { |
|
423 | - // Extra pagination info |
|
424 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
425 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
426 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
422 | + if ($max_page > 1 || $always_show) { |
|
423 | + // Extra pagination info |
|
424 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
425 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
426 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
427 | 427 | |
428 | - if ($geodir_pagination_more_info != '') { |
|
429 | - if ($listing_type_name) { |
|
430 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
431 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
432 | - } else { |
|
433 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
434 | - } |
|
435 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
436 | - /** |
|
437 | - * Adds an extra pagination info above/under pagination. |
|
438 | - * |
|
439 | - * @since 1.5.9 |
|
440 | - * |
|
441 | - * @param string $pagination_info Extra pagination info content. |
|
442 | - * @param string $listing_type_name Listing results type. |
|
443 | - * @param string $start_no First result number. |
|
444 | - * @param string $end_no Last result number. |
|
445 | - * @param string $numposts Total number of listings. |
|
446 | - * @param string $post_type The post type. |
|
447 | - */ |
|
448 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
428 | + if ($geodir_pagination_more_info != '') { |
|
429 | + if ($listing_type_name) { |
|
430 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
431 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
432 | + } else { |
|
433 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
434 | + } |
|
435 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
436 | + /** |
|
437 | + * Adds an extra pagination info above/under pagination. |
|
438 | + * |
|
439 | + * @since 1.5.9 |
|
440 | + * |
|
441 | + * @param string $pagination_info Extra pagination info content. |
|
442 | + * @param string $listing_type_name Listing results type. |
|
443 | + * @param string $start_no First result number. |
|
444 | + * @param string $end_no Last result number. |
|
445 | + * @param string $numposts Total number of listings. |
|
446 | + * @param string $post_type The post type. |
|
447 | + */ |
|
448 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
449 | 449 | |
450 | - if ($geodir_pagination_more_info == 'before') { |
|
451 | - $before = $before . $pagination_info; |
|
452 | - } else if ($geodir_pagination_more_info == 'after') { |
|
453 | - $after = $pagination_info . $after; |
|
454 | - } |
|
455 | - } |
|
450 | + if ($geodir_pagination_more_info == 'before') { |
|
451 | + $before = $before . $pagination_info; |
|
452 | + } else if ($geodir_pagination_more_info == 'after') { |
|
453 | + $after = $pagination_info . $after; |
|
454 | + } |
|
455 | + } |
|
456 | 456 | |
457 | - echo "$before <div class='Navi gd-navi'>"; |
|
458 | - if ($paged >= ($pages_to_show - 1)) { |
|
459 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
460 | - } |
|
461 | - previous_posts_link($prelabel); |
|
462 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
463 | - if ($i >= 1 && $i <= $max_page) { |
|
464 | - if ($i == $paged) { |
|
465 | - echo "<strong class='on'>$i</strong>"; |
|
466 | - } else { |
|
467 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
468 | - } |
|
469 | - } |
|
470 | - } |
|
471 | - next_posts_link($nxtlabel, $max_page); |
|
472 | - if (($paged + $half_pages_to_show) < ($max_page)) { |
|
473 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
474 | - } |
|
475 | - echo "</div> $after"; |
|
476 | - } |
|
457 | + echo "$before <div class='Navi gd-navi'>"; |
|
458 | + if ($paged >= ($pages_to_show - 1)) { |
|
459 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
460 | + } |
|
461 | + previous_posts_link($prelabel); |
|
462 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
463 | + if ($i >= 1 && $i <= $max_page) { |
|
464 | + if ($i == $paged) { |
|
465 | + echo "<strong class='on'>$i</strong>"; |
|
466 | + } else { |
|
467 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
468 | + } |
|
469 | + } |
|
470 | + } |
|
471 | + next_posts_link($nxtlabel, $max_page); |
|
472 | + if (($paged + $half_pages_to_show) < ($max_page)) { |
|
473 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
474 | + } |
|
475 | + echo "</div> $after"; |
|
476 | + } |
|
477 | 477 | |
478 | - if (function_exists('geodir_location_geo_home_link')) { |
|
479 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
480 | - } |
|
481 | - } |
|
478 | + if (function_exists('geodir_location_geo_home_link')) { |
|
479 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
480 | + } |
|
481 | + } |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
@@ -489,20 +489,20 @@ discard block |
||
489 | 489 | */ |
490 | 490 | function geodir_listingsearch_scripts() |
491 | 491 | { |
492 | - if (get_option('gd_search_dist') != '') { |
|
493 | - $dist = get_option('gd_search_dist'); |
|
494 | - } else { |
|
495 | - $dist = 500; |
|
496 | - } |
|
497 | - $dist_dif = 1000; |
|
498 | - |
|
499 | - if ($dist <= 5000) $dist_dif = 500; |
|
500 | - if ($dist <= 1000) $dist_dif = 100; |
|
501 | - if ($dist <= 500) $dist_dif = 50; |
|
502 | - if ($dist <= 100) $dist_dif = 10; |
|
503 | - if ($dist <= 50) $dist_dif = 5; |
|
504 | - |
|
505 | - ?> |
|
492 | + if (get_option('gd_search_dist') != '') { |
|
493 | + $dist = get_option('gd_search_dist'); |
|
494 | + } else { |
|
495 | + $dist = 500; |
|
496 | + } |
|
497 | + $dist_dif = 1000; |
|
498 | + |
|
499 | + if ($dist <= 5000) $dist_dif = 500; |
|
500 | + if ($dist <= 1000) $dist_dif = 100; |
|
501 | + if ($dist <= 500) $dist_dif = 50; |
|
502 | + if ($dist <= 100) $dist_dif = 10; |
|
503 | + if ($dist <= 50) $dist_dif = 5; |
|
504 | + |
|
505 | + ?> |
|
506 | 506 | <script type="text/javascript"> |
507 | 507 | |
508 | 508 | jQuery(function ($) { |
@@ -560,20 +560,20 @@ discard block |
||
560 | 560 | * @package GeoDirectory |
561 | 561 | */ |
562 | 562 | function geodir_add_sharelocation_scripts() { |
563 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
564 | - if (get_option('geodir_search_field_default_text')) |
|
565 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
563 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
564 | + if (get_option('geodir_search_field_default_text')) |
|
565 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
566 | 566 | |
567 | - $default_near_text = NEAR_TEXT; |
|
568 | - if (get_option('geodir_near_field_default_text')) |
|
569 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
567 | + $default_near_text = NEAR_TEXT; |
|
568 | + if (get_option('geodir_near_field_default_text')) |
|
569 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
570 | 570 | |
571 | - $search_location = geodir_get_default_location(); |
|
571 | + $search_location = geodir_get_default_location(); |
|
572 | 572 | |
573 | - $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
574 | - $default_near_text = addslashes(stripslashes($default_near_text)); |
|
575 | - $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
576 | - ?> |
|
573 | + $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
574 | + $default_near_text = addslashes(stripslashes($default_near_text)); |
|
575 | + $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
576 | + ?> |
|
577 | 577 | <script type="text/javascript"> |
578 | 578 | var default_location = '<?php echo $city ;?>'; |
579 | 579 | var latlng; |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | initialise2(); |
666 | 666 | } else { |
667 | 667 | <?php |
668 | - $near_add = get_option('geodir_search_near_addition'); |
|
669 | - /** |
|
670 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
671 | - * |
|
672 | - * @since 1.0.0 |
|
673 | - */ |
|
674 | - $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
675 | - ?> |
|
668 | + $near_add = get_option('geodir_search_near_addition'); |
|
669 | + /** |
|
670 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
671 | + * |
|
672 | + * @since 1.0.0 |
|
673 | + */ |
|
674 | + $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
675 | + ?> |
|
676 | 676 | if (window.gdMaps === 'google') { |
677 | 677 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
678 | 678 | function (results, status) { |
@@ -786,32 +786,32 @@ discard block |
||
786 | 786 | */ |
787 | 787 | function geodir_show_badges_on_image($which, $post, $link) |
788 | 788 | { |
789 | - $return = ''; |
|
790 | - switch ($which) { |
|
791 | - case 'featured': |
|
792 | - /** |
|
793 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
794 | - * |
|
795 | - * @since 1.0.0 |
|
796 | - * @param object $post The post object. |
|
797 | - * @param string $link The link to the post. |
|
798 | - */ |
|
799 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
800 | - break; |
|
801 | - case 'new' : |
|
802 | - /** |
|
803 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
804 | - * |
|
805 | - * @since 1.0.0 |
|
806 | - * @param object $post The post object. |
|
807 | - * @param string $link The link to the post. |
|
808 | - */ |
|
809 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
810 | - break; |
|
811 | - |
|
812 | - } |
|
789 | + $return = ''; |
|
790 | + switch ($which) { |
|
791 | + case 'featured': |
|
792 | + /** |
|
793 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
794 | + * |
|
795 | + * @since 1.0.0 |
|
796 | + * @param object $post The post object. |
|
797 | + * @param string $link The link to the post. |
|
798 | + */ |
|
799 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
800 | + break; |
|
801 | + case 'new' : |
|
802 | + /** |
|
803 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
804 | + * |
|
805 | + * @since 1.0.0 |
|
806 | + * @param object $post The post object. |
|
807 | + * @param string $link The link to the post. |
|
808 | + */ |
|
809 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
810 | + break; |
|
811 | + |
|
812 | + } |
|
813 | 813 | |
814 | - return $return; |
|
814 | + return $return; |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | /** |
@@ -820,8 +820,8 @@ discard block |
||
820 | 820 | * @since 1.6.22 |
821 | 821 | */ |
822 | 822 | function geodir_fix_script_conflict() { |
823 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
824 | - wp_dequeue_script( 'flexslider' ); |
|
825 | - } |
|
823 | + if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
824 | + wp_dequeue_script( 'flexslider' ); |
|
825 | + } |
|
826 | 826 | } |
827 | 827 | add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
828 | 828 | \ No newline at end of file |
@@ -39,21 +39,21 @@ discard block |
||
39 | 39 | $is_detail_page = false; |
40 | 40 | $geodir_map_name = geodir_map_name(); |
41 | 41 | |
42 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
42 | + if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) { |
|
43 | 43 | $is_detail_page = true; |
44 | 44 | } |
45 | 45 | |
46 | 46 | wp_enqueue_script('jquery'); |
47 | 47 | |
48 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | + wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
49 | 49 | wp_enqueue_script('geodirectory-script'); |
50 | 50 | |
51 | 51 | $geodir_vars_data = array( |
52 | 52 | 'siteurl' => get_option('siteurl'), |
53 | 53 | 'geodir_plugin_url' => geodir_plugin_url(), |
54 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
54 | + 'geodir_lazy_load' => get_option('geodir_lazy_load', 1), |
|
55 | 55 | 'geodir_ajax_url' => geodir_get_ajax_url(), |
56 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
56 | + 'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'), |
|
57 | 57 | 'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue |
58 | 58 | 'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')), |
59 | 59 | 'lightBox_txtOf' => addslashes(__('of', 'geodirectory')), |
@@ -76,24 +76,24 @@ discard block |
||
76 | 76 | * |
77 | 77 | * } |
78 | 78 | */ |
79 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
79 | + $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data); |
|
80 | 80 | |
81 | 81 | wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
82 | 82 | |
83 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
83 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true); |
|
84 | + if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); } |
|
85 | 85 | |
86 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
86 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true); |
|
87 | 87 | wp_enqueue_script('geodirectory-lightbox-jquery'); |
88 | 88 | |
89 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
89 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true); |
|
90 | 90 | if ($is_detail_page) { |
91 | 91 | wp_enqueue_script('geodirectory-jquery-simplemodal'); |
92 | 92 | } |
93 | 93 | |
94 | 94 | if (in_array($geodir_map_name, array('auto', 'google'))) { |
95 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
96 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
95 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
96 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
97 | 97 | /** |
98 | 98 | * Filter the variables that are added to the end of the google maps script call. |
99 | 99 | * |
@@ -103,55 +103,55 @@ discard block |
||
103 | 103 | * @param string $var The string to filter, default is empty string. |
104 | 104 | */ |
105 | 105 | $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
106 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
106 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL); |
|
107 | 107 | |
108 | 108 | // Overlapping Marker Spiderfier |
109 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
109 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
110 | 110 | wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
111 | 111 | } |
112 | 112 | |
113 | 113 | if ($geodir_map_name == 'osm') { |
114 | 114 | // Leaflet OpenStreetMap |
115 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
115 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
116 | 116 | wp_enqueue_style('geodirectory-leaflet-style'); |
117 | 117 | |
118 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
118 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | 119 | wp_enqueue_script('geodirectory-leaflet-script'); |
120 | 120 | |
121 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
121 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
122 | 122 | wp_enqueue_script('geodirectory-leaflet-geo-script'); |
123 | 123 | |
124 | 124 | if ($is_detail_page) { |
125 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
125 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
126 | 126 | wp_enqueue_style('geodirectory-leaflet-routing-style'); |
127 | 127 | |
128 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
128 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
129 | 129 | wp_enqueue_script('geodirectory-leaflet-routing-script'); |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Overlapping Marker Spiderfier Leaflet |
133 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
133 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
134 | 134 | wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
135 | 135 | } |
136 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
136 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
137 | 137 | |
138 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
138 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
139 | 139 | wp_enqueue_script('geodirectory-goMap-script'); |
140 | 140 | |
141 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
141 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | 142 | wp_enqueue_script('chosen'); |
143 | 143 | |
144 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
144 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
145 | 145 | wp_enqueue_script('geodirectory-choose-ajax'); |
146 | 146 | |
147 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
147 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
148 | 148 | |
149 | 149 | if (is_page() && geodir_is_page('add-listing')) { |
150 | 150 | // SCRIPT FOR UPLOAD |
151 | 151 | wp_enqueue_script('plupload-all'); |
152 | 152 | wp_enqueue_script('jquery-ui-sortable'); |
153 | 153 | |
154 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
154 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
155 | 155 | wp_enqueue_script('geodirectory-plupload-script'); |
156 | 156 | // SCRIPT FOR UPLOAD END |
157 | 157 | |
@@ -198,27 +198,27 @@ discard block |
||
198 | 198 | |
199 | 199 | wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
200 | 200 | |
201 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
201 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
202 | 202 | } // End if for add place page |
203 | 203 | |
204 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
204 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
205 | 205 | if ($is_detail_page) { |
206 | 206 | wp_enqueue_script('geodirectory-post-custom-js'); |
207 | 207 | } |
208 | 208 | |
209 | 209 | // font awesome rating script |
210 | 210 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
211 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
211 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
212 | 212 | wp_enqueue_script('geodir-barrating-js'); |
213 | 213 | } else { // default rating script |
214 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
214 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
215 | 215 | wp_enqueue_script('geodir-jRating-js'); |
216 | 216 | } |
217 | 217 | |
218 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
218 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | 219 | wp_enqueue_script('geodir-on-document-load'); |
220 | 220 | |
221 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
221 | + wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
222 | 222 | wp_enqueue_script('google-geometa'); |
223 | 223 | } |
224 | 224 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function geodir_header_scripts() |
235 | 235 | { |
236 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
236 | + echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>'; |
|
237 | 237 | echo stripslashes(get_option('geodir_header_scripts')); |
238 | 238 | } |
239 | 239 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | function geodir_google_analytics_tracking_code() |
249 | 249 | { |
250 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
250 | + if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?> |
|
251 | 251 | |
252 | 252 | <script> |
253 | 253 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
256 | 256 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
257 | 257 | |
258 | - ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto'); |
|
259 | - <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?> |
|
258 | + ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto'); |
|
259 | + <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?> |
|
260 | 260 | ga('send', 'pageview'); |
261 | 261 | |
262 | 262 | </script> |
263 | 263 | |
264 | 264 | <?php |
265 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
265 | + }elseif (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) { |
|
266 | 266 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
267 | 267 | } |
268 | 268 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * |
286 | 286 | * Flexbox wont wrap on ios for search form items |
287 | 287 | */ |
288 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
288 | + if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) { |
|
289 | 289 | echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
290 | 290 | } |
291 | 291 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function geodir_add_async_forscript($url) |
303 | 303 | { |
304 | - if (strpos($url, '#asyncload')===false) |
|
304 | + if (strpos($url, '#asyncload') === false) |
|
305 | 305 | return $url; |
306 | 306 | else if (is_admin()) |
307 | 307 | return str_replace('#asyncload', '', $url); |
@@ -319,18 +319,18 @@ discard block |
||
319 | 319 | function geodir_templates_styles() |
320 | 320 | { |
321 | 321 | |
322 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
322 | + wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
323 | 323 | wp_enqueue_style('geodir-core-scss'); |
324 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
324 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
325 | 325 | |
326 | - if(is_rtl()){ |
|
327 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
326 | + if (is_rtl()) { |
|
327 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
328 | 328 | wp_enqueue_style('geodirectory-frontend-rtl-style'); |
329 | 329 | } |
330 | 330 | |
331 | 331 | wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js', array('font-awesome-shim'), GEODIRECTORY_VERSION); |
332 | 332 | wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION); |
333 | - wp_enqueue_script( 'font-awesome' ); |
|
333 | + wp_enqueue_script('font-awesome'); |
|
334 | 334 | |
335 | 335 | |
336 | 336 | } |
@@ -399,18 +399,18 @@ discard block |
||
399 | 399 | $term_id = get_queried_object_id(); |
400 | 400 | $taxonomy = get_query_var('taxonomy'); |
401 | 401 | |
402 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
403 | - $term = get_term($term_id, $post_type . 'category'); |
|
402 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') { |
|
403 | + $term = get_term($term_id, $post_type.'category'); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
408 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
407 | + if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) { |
|
408 | + $taxonomy_search = $_REQUEST['s'.$post_type.'category']; |
|
409 | 409 | |
410 | 410 | if (!is_array($taxonomy_search)) { |
411 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
412 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
413 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
411 | + $term = get_term((int) $taxonomy_search, $post_type.'category'); |
|
412 | + } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
413 | + $term = get_term((int) $taxonomy_search[0], $post_type.'category'); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | if ($max_page > 1 || $always_show) { |
423 | 423 | // Extra pagination info |
424 | 424 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
425 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
425 | + $start_no = ($paged - 1) * $posts_per_page + 1; |
|
426 | 426 | $end_no = min($paged * $posts_per_page, $numposts); |
427 | 427 | |
428 | 428 | if ($geodir_pagination_more_info != '') { |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | } else { |
433 | 433 | $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
434 | 434 | } |
435 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
435 | + $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>'; |
|
436 | 436 | /** |
437 | 437 | * Adds an extra pagination info above/under pagination. |
438 | 438 | * |
@@ -448,15 +448,15 @@ discard block |
||
448 | 448 | $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
449 | 449 | |
450 | 450 | if ($geodir_pagination_more_info == 'before') { |
451 | - $before = $before . $pagination_info; |
|
451 | + $before = $before.$pagination_info; |
|
452 | 452 | } else if ($geodir_pagination_more_info == 'after') { |
453 | - $after = $pagination_info . $after; |
|
453 | + $after = $pagination_info.$after; |
|
454 | 454 | } |
455 | 455 | } |
456 | 456 | |
457 | 457 | echo "$before <div class='Navi gd-navi'>"; |
458 | 458 | if ($paged >= ($pages_to_show - 1)) { |
459 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
459 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link()).'">«</a>'; |
|
460 | 460 | } |
461 | 461 | previous_posts_link($prelabel); |
462 | 462 | for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | if ($i == $paged) { |
465 | 465 | echo "<strong class='on'>$i</strong>"; |
466 | 466 | } else { |
467 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
467 | + echo ' <a href="'.str_replace('&paged', '&paged', get_pagenum_link($i)).'">'.$i.'</a> '; |
|
468 | 468 | } |
469 | 469 | } |
470 | 470 | } |
471 | 471 | next_posts_link($nxtlabel, $max_page); |
472 | 472 | if (($paged + $half_pages_to_show) < ($max_page)) { |
473 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
473 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link($max_page)).'">»</a>'; |
|
474 | 474 | } |
475 | 475 | echo "</div> $after"; |
476 | 476 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | jQuery(function ($) { |
509 | 509 | $("#distance_slider").slider({ |
510 | 510 | range: true, |
511 | - values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
511 | + values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
512 | 512 | min: 0, |
513 | 513 | max: <?php echo $dist; ?>, |
514 | 514 | step: <?php echo $dist_dif; ?>, |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
576 | 576 | ?> |
577 | 577 | <script type="text/javascript"> |
578 | - var default_location = '<?php echo $city ;?>'; |
|
578 | + var default_location = '<?php echo $city; ?>'; |
|
579 | 579 | var latlng; |
580 | 580 | var address; |
581 | 581 | var dist = 0; |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | var $form = jQuery(this).closest('form'); |
592 | 592 | |
593 | 593 | if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val(); |
594 | - if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s); |
|
594 | + if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s); |
|
595 | 595 | |
596 | 596 | // Disable location based search for disabled location post type. |
597 | 597 | if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') { |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | } |
606 | 606 | } |
607 | 607 | |
608 | - if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) { |
|
608 | + if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) { |
|
609 | 609 | |
610 | 610 | // OSM can't handel post code with no space so we test for it and add one if needed |
611 | 611 | if(window.gdMaps === 'osm'){ |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | }); |
635 | 635 | |
636 | 636 | function geodir_setsearch($form) { |
637 | - if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location); |
|
637 | + if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location); |
|
638 | 638 | geocodeAddress($form); |
639 | 639 | } |
640 | 640 | |
@@ -653,15 +653,15 @@ discard block |
||
653 | 653 | // Call the geocode function |
654 | 654 | Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
655 | 655 | |
656 | - if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
657 | - if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
656 | + if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
657 | + if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
658 | 658 | jQuery(".snear", $form).val(''); |
659 | 659 | } |
660 | 660 | jQuery($form).submit(); |
661 | 661 | } else { |
662 | 662 | var address = jQuery(".snear", $form).val(); |
663 | 663 | |
664 | - if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') { |
|
664 | + if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') { |
|
665 | 665 | initialise2(); |
666 | 666 | } else { |
667 | 667 | <?php |
@@ -674,21 +674,21 @@ discard block |
||
674 | 674 | $near_add2 = apply_filters('geodir_search_near_addition', ''); |
675 | 675 | ?> |
676 | 676 | if (window.gdMaps === 'google') { |
677 | - Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
|
677 | + Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>}, |
|
678 | 678 | function (results, status) { |
679 | 679 | if (status == google.maps.GeocoderStatus.OK) { |
680 | 680 | updateSearchPosition(results[0].geometry.location, $form); |
681 | 681 | } else { |
682 | - alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status); |
|
682 | + alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status); |
|
683 | 683 | } |
684 | 684 | }); |
685 | 685 | } else if (window.gdMaps === 'osm') { |
686 | - geocodePositionOSM(false, address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>, false, false, |
|
686 | + geocodePositionOSM(false, address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>, false, false, |
|
687 | 687 | function(geo) { |
688 | 688 | if (typeof geo !== 'undefined' && geo.lat && geo.lon) { |
689 | 689 | updateSearchPosition(geo, $form); |
690 | 690 | } else { |
691 | - alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>"); |
|
691 | + alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>"); |
|
692 | 692 | } |
693 | 693 | }); |
694 | 694 | } else { |
@@ -734,19 +734,19 @@ discard block |
||
734 | 734 | var msg; |
735 | 735 | switch (err.code) { |
736 | 736 | case err.UNKNOWN_ERROR: |
737 | - msg = "<?php _e('Unable to find your location','geodirectory');?>"; |
|
737 | + msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>"; |
|
738 | 738 | break; |
739 | 739 | case err.PERMISSION_DENINED: |
740 | - msg = "<?php _e('Permission denied in finding your location','geodirectory');?>"; |
|
740 | + msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>"; |
|
741 | 741 | break; |
742 | 742 | case err.POSITION_UNAVAILABLE: |
743 | - msg = "<?php _e('Your location is currently unknown','geodirectory');?>"; |
|
743 | + msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>"; |
|
744 | 744 | break; |
745 | 745 | case err.BREAK: |
746 | - msg = "<?php _e('Attempt to find location took too long','geodirectory');?>"; |
|
746 | + msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>"; |
|
747 | 747 | break; |
748 | 748 | default: |
749 | - msg = "<?php _e('Location detection not supported in browser','geodirectory');?>"; |
|
749 | + msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>"; |
|
750 | 750 | } |
751 | 751 | jQuery('#info').html(msg); |
752 | 752 | } |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @param object $post The post object. |
797 | 797 | * @param string $link The link to the post. |
798 | 798 | */ |
799 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
799 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img"> </span></a>', $post, $link); |
|
800 | 800 | break; |
801 | 801 | case 'new' : |
802 | 802 | /** |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * @param object $post The post object. |
807 | 807 | * @param string $link The link to the post. |
808 | 808 | */ |
809 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
809 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing"> </span></a>', $post, $link); |
|
810 | 810 | break; |
811 | 811 | |
812 | 812 | } |
@@ -820,8 +820,8 @@ discard block |
||
820 | 820 | * @since 1.6.22 |
821 | 821 | */ |
822 | 822 | function geodir_fix_script_conflict() { |
823 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
824 | - wp_dequeue_script( 'flexslider' ); |
|
823 | + if (wp_script_is('flexslider', 'enqueued') && wp_script_is('geodirectory-jquery-flexslider-js', 'enqueued')) { |
|
824 | + wp_dequeue_script('flexslider'); |
|
825 | 825 | } |
826 | 826 | } |
827 | -add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
|
828 | 827 | \ No newline at end of file |
828 | +add_action('wp_enqueue_scripts', 'geodir_fix_script_conflict', 100); |
|
829 | 829 | \ No newline at end of file |
@@ -33,265 +33,265 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function geodir_add_nav_menu_items() |
35 | 35 | { |
36 | - $items = ''; |
|
37 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
38 | - |
|
39 | - if (get_option('geodir_show_listing_nav')) { |
|
40 | - |
|
41 | - $menu_class = ''; |
|
42 | - if (geodir_is_page('listing')) |
|
43 | - $menu_class = 'current-menu-item'; |
|
44 | - |
|
45 | - |
|
46 | - //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
47 | - $post_types = geodir_get_posttypes('object'); |
|
48 | - $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav'); |
|
49 | - if (!empty($post_types)) { |
|
50 | - foreach ($post_types as $post_type => $args) { |
|
51 | - if (!empty($show_post_type_main_nav)) { |
|
52 | - if (in_array($post_type, $show_post_type_main_nav)) { |
|
53 | - if (get_post_type_archive_link($post_type)) { |
|
54 | - $menu_class = ''; |
|
55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | - $menu_class = 'current-menu-item'; |
|
57 | - /** |
|
58 | - * Filter the menu li class. |
|
59 | - * |
|
60 | - * @since 1.0.0 |
|
61 | - * @param string $menu_class The menu HTML class. |
|
62 | - */ |
|
63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
64 | - /** |
|
65 | - * Filter the menu a class. |
|
66 | - * |
|
67 | - * @since 1.0.0 |
|
68 | - */ |
|
69 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
70 | - $items .= '<li class="' . $li_class . '"> |
|
36 | + $items = ''; |
|
37 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
38 | + |
|
39 | + if (get_option('geodir_show_listing_nav')) { |
|
40 | + |
|
41 | + $menu_class = ''; |
|
42 | + if (geodir_is_page('listing')) |
|
43 | + $menu_class = 'current-menu-item'; |
|
44 | + |
|
45 | + |
|
46 | + //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
47 | + $post_types = geodir_get_posttypes('object'); |
|
48 | + $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav'); |
|
49 | + if (!empty($post_types)) { |
|
50 | + foreach ($post_types as $post_type => $args) { |
|
51 | + if (!empty($show_post_type_main_nav)) { |
|
52 | + if (in_array($post_type, $show_post_type_main_nav)) { |
|
53 | + if (get_post_type_archive_link($post_type)) { |
|
54 | + $menu_class = ''; |
|
55 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | + $menu_class = 'current-menu-item'; |
|
57 | + /** |
|
58 | + * Filter the menu li class. |
|
59 | + * |
|
60 | + * @since 1.0.0 |
|
61 | + * @param string $menu_class The menu HTML class. |
|
62 | + */ |
|
63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
64 | + /** |
|
65 | + * Filter the menu a class. |
|
66 | + * |
|
67 | + * @since 1.0.0 |
|
68 | + */ |
|
69 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
70 | + $items .= '<li class="' . $li_class . '"> |
|
71 | 71 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
72 | 72 | ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
73 | 73 | </a> |
74 | 74 | </li>'; |
75 | - } |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
79 | - } |
|
80 | - //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
81 | - |
|
82 | - $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav'); |
|
83 | - $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
84 | - if ($is_listing_sub_meny_exists) { |
|
85 | - /** |
|
86 | - * Filter the menu li class. |
|
87 | - * |
|
88 | - * @since 1.0.0 |
|
89 | - * @param string $menu_class The menu HTML class. |
|
90 | - */ |
|
91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
92 | - /** |
|
93 | - * Filter the sub menu li class. |
|
94 | - * |
|
95 | - * @since 1.0.0 |
|
96 | - * @param string $menu_class The menu HTML class. |
|
97 | - */ |
|
98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
99 | - /** |
|
100 | - * Filter the sub menu ul class. |
|
101 | - * |
|
102 | - * @since 1.0.0 |
|
103 | - */ |
|
104 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
105 | - /** |
|
106 | - * Filter the menu a class. |
|
107 | - * |
|
108 | - * @since 1.0.0 |
|
109 | - */ |
|
110 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
111 | - /** |
|
112 | - * Filter the sub menu a class. |
|
113 | - * |
|
114 | - * @since 1.0.0 |
|
115 | - */ |
|
116 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
117 | - $items .= '<li class="' . $li_class . '"> |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | + } |
|
80 | + //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
81 | + |
|
82 | + $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav'); |
|
83 | + $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
84 | + if ($is_listing_sub_meny_exists) { |
|
85 | + /** |
|
86 | + * Filter the menu li class. |
|
87 | + * |
|
88 | + * @since 1.0.0 |
|
89 | + * @param string $menu_class The menu HTML class. |
|
90 | + */ |
|
91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
92 | + /** |
|
93 | + * Filter the sub menu li class. |
|
94 | + * |
|
95 | + * @since 1.0.0 |
|
96 | + * @param string $menu_class The menu HTML class. |
|
97 | + */ |
|
98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
99 | + /** |
|
100 | + * Filter the sub menu ul class. |
|
101 | + * |
|
102 | + * @since 1.0.0 |
|
103 | + */ |
|
104 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
105 | + /** |
|
106 | + * Filter the menu a class. |
|
107 | + * |
|
108 | + * @since 1.0.0 |
|
109 | + */ |
|
110 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
111 | + /** |
|
112 | + * Filter the sub menu a class. |
|
113 | + * |
|
114 | + * @since 1.0.0 |
|
115 | + */ |
|
116 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
117 | + $items .= '<li class="' . $li_class . '"> |
|
118 | 118 | <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a> |
119 | 119 | <ul class="' . $sub_ul_class . '">'; |
120 | - $post_types = geodir_get_posttypes('object'); |
|
120 | + $post_types = geodir_get_posttypes('object'); |
|
121 | 121 | |
122 | - $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
|
122 | + $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
|
123 | 123 | |
124 | - if (!empty($post_types)) { |
|
125 | - global $geodir_add_location_url; |
|
126 | - $geodir_add_location_url = true; |
|
127 | - foreach ($post_types as $post_type => $args) { |
|
128 | - if (!empty($show_listing_post_types)) { |
|
129 | - if (in_array($post_type, $show_listing_post_types)) { |
|
130 | - if (get_post_type_archive_link($post_type)) { |
|
124 | + if (!empty($post_types)) { |
|
125 | + global $geodir_add_location_url; |
|
126 | + $geodir_add_location_url = true; |
|
127 | + foreach ($post_types as $post_type => $args) { |
|
128 | + if (!empty($show_listing_post_types)) { |
|
129 | + if (in_array($post_type, $show_listing_post_types)) { |
|
130 | + if (get_post_type_archive_link($post_type)) { |
|
131 | 131 | |
132 | - $menu_class = ''; |
|
133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | - $menu_class = 'current-menu-item'; |
|
132 | + $menu_class = ''; |
|
133 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | + $menu_class = 'current-menu-item'; |
|
135 | 135 | |
136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
136 | + $items .= '<li class="' . $sub_li_class . '"> |
|
137 | 137 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
138 | 138 | ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
139 | 139 | </a> |
140 | 140 | </li>'; |
141 | - } |
|
142 | - } |
|
143 | - } |
|
144 | - } |
|
145 | - $geodir_add_location_url = NULL; |
|
146 | - } |
|
141 | + } |
|
142 | + } |
|
143 | + } |
|
144 | + } |
|
145 | + $geodir_add_location_url = NULL; |
|
146 | + } |
|
147 | 147 | |
148 | - $items .= ' </ul> '; |
|
149 | - /** |
|
150 | - * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
151 | - * |
|
152 | - * @since 1.5.9 |
|
153 | - */ |
|
154 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
155 | - $items .= '</li>'; |
|
156 | - } |
|
157 | - } |
|
158 | - |
|
159 | - if (get_option('geodir_show_addlisting_nav')) { |
|
160 | - |
|
161 | - $menu_class = ''; |
|
162 | - if (geodir_is_page('add-listing')) |
|
163 | - $menu_class = 'current-menu-item'; |
|
164 | - |
|
165 | - //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
166 | - $post_types = geodir_get_posttypes('object'); |
|
167 | - $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav'); |
|
168 | - $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
169 | - |
|
170 | - if (!empty($post_types)) { |
|
171 | - foreach ($post_types as $post_type => $args) { |
|
172 | - if (!empty($geodir_allow_posttype_frontend)) { |
|
173 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
174 | - if (!empty($show_add_listing_post_types_main_nav)) { |
|
175 | - if (in_array($post_type, $show_add_listing_post_types_main_nav)) { |
|
176 | - if (geodir_get_addlisting_link($post_type)) { |
|
177 | - |
|
178 | - $menu_class = ''; |
|
179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
180 | - $menu_class = 'current-menu-item'; |
|
181 | - /** |
|
182 | - * Filter the menu li class. |
|
183 | - * |
|
184 | - * @since 1.0.0 |
|
185 | - * @param string $menu_class The menu HTML class. |
|
186 | - */ |
|
187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
188 | - /** |
|
189 | - * Filter the menu a class. |
|
190 | - * |
|
191 | - * @since 1.0.0 |
|
192 | - */ |
|
193 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
194 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
195 | - $items .= '<li class="' . $li_class . '"> |
|
148 | + $items .= ' </ul> '; |
|
149 | + /** |
|
150 | + * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
151 | + * |
|
152 | + * @since 1.5.9 |
|
153 | + */ |
|
154 | + $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
155 | + $items .= '</li>'; |
|
156 | + } |
|
157 | + } |
|
158 | + |
|
159 | + if (get_option('geodir_show_addlisting_nav')) { |
|
160 | + |
|
161 | + $menu_class = ''; |
|
162 | + if (geodir_is_page('add-listing')) |
|
163 | + $menu_class = 'current-menu-item'; |
|
164 | + |
|
165 | + //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
166 | + $post_types = geodir_get_posttypes('object'); |
|
167 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav'); |
|
168 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
169 | + |
|
170 | + if (!empty($post_types)) { |
|
171 | + foreach ($post_types as $post_type => $args) { |
|
172 | + if (!empty($geodir_allow_posttype_frontend)) { |
|
173 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
174 | + if (!empty($show_add_listing_post_types_main_nav)) { |
|
175 | + if (in_array($post_type, $show_add_listing_post_types_main_nav)) { |
|
176 | + if (geodir_get_addlisting_link($post_type)) { |
|
177 | + |
|
178 | + $menu_class = ''; |
|
179 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
180 | + $menu_class = 'current-menu-item'; |
|
181 | + /** |
|
182 | + * Filter the menu li class. |
|
183 | + * |
|
184 | + * @since 1.0.0 |
|
185 | + * @param string $menu_class The menu HTML class. |
|
186 | + */ |
|
187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
188 | + /** |
|
189 | + * Filter the menu a class. |
|
190 | + * |
|
191 | + * @since 1.0.0 |
|
192 | + */ |
|
193 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
194 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
195 | + $items .= '<li class="' . $li_class . '"> |
|
196 | 196 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
197 | 197 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
198 | 198 | </a> |
199 | 199 | </li>'; |
200 | - } |
|
201 | - } |
|
202 | - } |
|
203 | - } |
|
204 | - } |
|
205 | - } |
|
206 | - } |
|
207 | - //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
208 | - } |
|
209 | - |
|
210 | - $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav'); |
|
211 | - $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
212 | - if ($is_add_listing_sub_meny_exists) { |
|
213 | - |
|
214 | - if (get_option('geodir_show_addlisting_nav')) { |
|
215 | - /** |
|
216 | - * Filter the menu li class. |
|
217 | - * |
|
218 | - * @since 1.0.0 |
|
219 | - * @param string $menu_class The menu HTML class. |
|
220 | - */ |
|
221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
222 | - /** |
|
223 | - * Filter the sub menu li class. |
|
224 | - * |
|
225 | - * @since 1.0.0 |
|
226 | - * @param string $menu_class The menu HTML class. |
|
227 | - */ |
|
228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
229 | - /** |
|
230 | - * Filter the sub menu ul class. |
|
231 | - * |
|
232 | - * @since 1.0.0 |
|
233 | - */ |
|
234 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
235 | - /** |
|
236 | - * Filter the menu a class. |
|
237 | - * |
|
238 | - * @since 1.0.0 |
|
239 | - */ |
|
240 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
241 | - /** |
|
242 | - * Filter the sub menu a class. |
|
243 | - * |
|
244 | - * @since 1.0.0 |
|
245 | - */ |
|
246 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
247 | - $items .= '<li class="' . $li_class . '"> |
|
200 | + } |
|
201 | + } |
|
202 | + } |
|
203 | + } |
|
204 | + } |
|
205 | + } |
|
206 | + } |
|
207 | + //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
208 | + } |
|
209 | + |
|
210 | + $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav'); |
|
211 | + $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
212 | + if ($is_add_listing_sub_meny_exists) { |
|
213 | + |
|
214 | + if (get_option('geodir_show_addlisting_nav')) { |
|
215 | + /** |
|
216 | + * Filter the menu li class. |
|
217 | + * |
|
218 | + * @since 1.0.0 |
|
219 | + * @param string $menu_class The menu HTML class. |
|
220 | + */ |
|
221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
222 | + /** |
|
223 | + * Filter the sub menu li class. |
|
224 | + * |
|
225 | + * @since 1.0.0 |
|
226 | + * @param string $menu_class The menu HTML class. |
|
227 | + */ |
|
228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
229 | + /** |
|
230 | + * Filter the sub menu ul class. |
|
231 | + * |
|
232 | + * @since 1.0.0 |
|
233 | + */ |
|
234 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
235 | + /** |
|
236 | + * Filter the menu a class. |
|
237 | + * |
|
238 | + * @since 1.0.0 |
|
239 | + */ |
|
240 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
241 | + /** |
|
242 | + * Filter the sub menu a class. |
|
243 | + * |
|
244 | + * @since 1.0.0 |
|
245 | + */ |
|
246 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
247 | + $items .= '<li class="' . $li_class . '"> |
|
248 | 248 | <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a> |
249 | 249 | <ul class="' . $sub_ul_class . '">'; |
250 | 250 | |
251 | - $post_types = geodir_get_posttypes('object'); |
|
252 | - |
|
253 | - $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav'); |
|
254 | - |
|
255 | - if (!empty($post_types)) { |
|
256 | - foreach ($post_types as $post_type => $args) { |
|
257 | - if (!empty($geodir_allow_posttype_frontend)) { |
|
258 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
259 | - if (!empty($show_add_listing_post_types)) { |
|
260 | - if (in_array($post_type, $show_add_listing_post_types)) { |
|
261 | - if (geodir_get_addlisting_link($post_type)) { |
|
262 | - |
|
263 | - $menu_class = ''; |
|
264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
265 | - $menu_class = 'current-menu-item'; |
|
266 | - /** |
|
267 | - * Filter the menu li class. |
|
268 | - * |
|
269 | - * @since 1.0.0 |
|
270 | - * @param string $menu_class The menu HTML class. |
|
271 | - */ |
|
272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
273 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
274 | - $items .= '<li class="' . $sub_li_class . '"> |
|
251 | + $post_types = geodir_get_posttypes('object'); |
|
252 | + |
|
253 | + $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav'); |
|
254 | + |
|
255 | + if (!empty($post_types)) { |
|
256 | + foreach ($post_types as $post_type => $args) { |
|
257 | + if (!empty($geodir_allow_posttype_frontend)) { |
|
258 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
259 | + if (!empty($show_add_listing_post_types)) { |
|
260 | + if (in_array($post_type, $show_add_listing_post_types)) { |
|
261 | + if (geodir_get_addlisting_link($post_type)) { |
|
262 | + |
|
263 | + $menu_class = ''; |
|
264 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
265 | + $menu_class = 'current-menu-item'; |
|
266 | + /** |
|
267 | + * Filter the menu li class. |
|
268 | + * |
|
269 | + * @since 1.0.0 |
|
270 | + * @param string $menu_class The menu HTML class. |
|
271 | + */ |
|
272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
273 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
274 | + $items .= '<li class="' . $sub_li_class . '"> |
|
275 | 275 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
276 | 276 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
277 | 277 | </a> |
278 | 278 | </li>'; |
279 | - } |
|
280 | - } |
|
281 | - } |
|
282 | - } |
|
283 | - } |
|
284 | - } |
|
285 | - } |
|
279 | + } |
|
280 | + } |
|
281 | + } |
|
282 | + } |
|
283 | + } |
|
284 | + } |
|
285 | + } |
|
286 | 286 | |
287 | - $items .= ' </ul> '; |
|
288 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
289 | - $items .= '</li>'; |
|
287 | + $items .= ' </ul> '; |
|
288 | + $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
289 | + $items .= '</li>'; |
|
290 | 290 | |
291 | - } |
|
292 | - } |
|
293 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
294 | - return $items; |
|
291 | + } |
|
292 | + } |
|
293 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
294 | + return $items; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -309,20 +309,20 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function geodir_pagemenu_items($menu, $args) |
311 | 311 | { |
312 | - $locations = get_nav_menu_locations(); |
|
313 | - $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
314 | - $geodir_theme_location_nav = array(); |
|
315 | - if (empty($locations) && empty($geodir_theme_location)) { |
|
316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
317 | - $geodir_theme_location_nav[] = $args['theme_location']; |
|
318 | - update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
|
319 | - } |
|
320 | - //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
312 | + $locations = get_nav_menu_locations(); |
|
313 | + $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
314 | + $geodir_theme_location_nav = array(); |
|
315 | + if (empty($locations) && empty($geodir_theme_location)) { |
|
316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
317 | + $geodir_theme_location_nav[] = $args['theme_location']; |
|
318 | + update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
|
319 | + } |
|
320 | + //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
322 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
322 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
324 | 324 | |
325 | - return $menu; |
|
325 | + return $menu; |
|
326 | 326 | |
327 | 327 | } |
328 | 328 | |
@@ -342,18 +342,18 @@ discard block |
||
342 | 342 | function geodir_menu_items($items, $args) |
343 | 343 | { |
344 | 344 | |
345 | - $location = $args->theme_location; |
|
345 | + $location = $args->theme_location; |
|
346 | 346 | |
347 | - $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
347 | + $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
348 | 348 | |
349 | - if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
|
349 | + if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
|
350 | 350 | |
351 | - $items = $items . geodir_add_nav_menu_items(); |
|
352 | - return $items; |
|
351 | + $items = $items . geodir_add_nav_menu_items(); |
|
352 | + return $items; |
|
353 | 353 | |
354 | - } else { |
|
355 | - return $items; |
|
356 | - } |
|
354 | + } else { |
|
355 | + return $items; |
|
356 | + } |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -368,25 +368,25 @@ discard block |
||
368 | 368 | */ |
369 | 369 | function geodir_get_category_all_array() |
370 | 370 | { |
371 | - global $wpdb; |
|
372 | - $return_array = array(); |
|
373 | - |
|
374 | - $taxonomies = geodir_get_taxonomies(); |
|
375 | - $taxonomies = implode("','", $taxonomies); |
|
376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
377 | - |
|
378 | - $pn_categories = $wpdb->get_results( |
|
379 | - $wpdb->prepare( |
|
380 | - "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
381 | - array($wpdb->terms . term_id) |
|
382 | - ) |
|
383 | - ); |
|
384 | - |
|
385 | - foreach ($pn_categories as $pn_categories_obj) { |
|
386 | - $return_array[] = array("id" => $pn_categories_obj->cat_ID, |
|
387 | - "title" => $pn_categories_obj->name,); |
|
388 | - } |
|
389 | - return $return_array; |
|
371 | + global $wpdb; |
|
372 | + $return_array = array(); |
|
373 | + |
|
374 | + $taxonomies = geodir_get_taxonomies(); |
|
375 | + $taxonomies = implode("','", $taxonomies); |
|
376 | + $taxonomies = "'" . $taxonomies . "'"; |
|
377 | + |
|
378 | + $pn_categories = $wpdb->get_results( |
|
379 | + $wpdb->prepare( |
|
380 | + "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
381 | + array($wpdb->terms . term_id) |
|
382 | + ) |
|
383 | + ); |
|
384 | + |
|
385 | + foreach ($pn_categories as $pn_categories_obj) { |
|
386 | + $return_array[] = array("id" => $pn_categories_obj->cat_ID, |
|
387 | + "title" => $pn_categories_obj->name,); |
|
388 | + } |
|
389 | + return $return_array; |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -402,52 +402,52 @@ discard block |
||
402 | 402 | * @return string The post type. |
403 | 403 | */ |
404 | 404 | function geodir_get_current_posttype() { |
405 | - global $wp_query, $post, $geodir_post_type; |
|
405 | + global $wp_query, $post, $geodir_post_type; |
|
406 | 406 | |
407 | - $geodir_post_type = get_query_var('post_type'); |
|
407 | + $geodir_post_type = get_query_var('post_type'); |
|
408 | 408 | if (is_array($geodir_post_type) && ! empty($geodir_post_type[0])) { |
409 | 409 | $geodir_post_type = $geodir_post_type[0]; |
410 | 410 | } |
411 | 411 | |
412 | - if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
|
413 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
414 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
415 | - elseif (isset($_REQUEST['listing_type'])) |
|
416 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
417 | - } |
|
418 | - |
|
419 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
420 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
421 | - |
|
422 | - if (is_tax()) |
|
423 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
424 | - |
|
425 | - // Retrive post type for map marker html ajax request on preview page. |
|
426 | - if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) { |
|
427 | - if (!empty($post->post_type)) { |
|
428 | - $geodir_post_type = $post->post_type; |
|
429 | - } else if (!empty($post->listing_type)) { |
|
430 | - $geodir_post_type = $post->listing_type; |
|
431 | - } |
|
432 | - } |
|
433 | - |
|
434 | - $all_postypes = geodir_get_posttypes(); |
|
435 | - $all_postypes = stripslashes_deep($all_postypes); |
|
436 | - |
|
437 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
438 | - $geodir_post_type = ''; |
|
439 | - |
|
440 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
|
441 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
442 | - } |
|
443 | - |
|
444 | - |
|
445 | - /** |
|
446 | - * Filter the default CPT return. |
|
447 | - * |
|
448 | - * @since 1.6.9 |
|
449 | - */ |
|
450 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type); |
|
412 | + if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
|
413 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
414 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
415 | + elseif (isset($_REQUEST['listing_type'])) |
|
416 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
417 | + } |
|
418 | + |
|
419 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
420 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
421 | + |
|
422 | + if (is_tax()) |
|
423 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
424 | + |
|
425 | + // Retrive post type for map marker html ajax request on preview page. |
|
426 | + if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) { |
|
427 | + if (!empty($post->post_type)) { |
|
428 | + $geodir_post_type = $post->post_type; |
|
429 | + } else if (!empty($post->listing_type)) { |
|
430 | + $geodir_post_type = $post->listing_type; |
|
431 | + } |
|
432 | + } |
|
433 | + |
|
434 | + $all_postypes = geodir_get_posttypes(); |
|
435 | + $all_postypes = stripslashes_deep($all_postypes); |
|
436 | + |
|
437 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
438 | + $geodir_post_type = ''; |
|
439 | + |
|
440 | + if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
|
441 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
442 | + } |
|
443 | + |
|
444 | + |
|
445 | + /** |
|
446 | + * Filter the default CPT return. |
|
447 | + * |
|
448 | + * @since 1.6.9 |
|
449 | + */ |
|
450 | + return apply_filters('geodir_get_current_posttype',$geodir_post_type); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -461,22 +461,22 @@ discard block |
||
461 | 461 | */ |
462 | 462 | function geodir_get_default_posttype() |
463 | 463 | { |
464 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
465 | - |
|
466 | - $stype = false; |
|
467 | - foreach ( $post_types as $post_type => $info ) { |
|
468 | - global $wpdb; |
|
469 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
470 | - if ( $has_posts ) { |
|
471 | - $stype = $post_type; break; |
|
472 | - } |
|
473 | - } |
|
474 | - |
|
475 | - if(!$stype){ |
|
476 | - $stype = 'gd_place'; |
|
477 | - } |
|
478 | - |
|
479 | - return $stype; |
|
464 | + $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
465 | + |
|
466 | + $stype = false; |
|
467 | + foreach ( $post_types as $post_type => $info ) { |
|
468 | + global $wpdb; |
|
469 | + $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
470 | + if ( $has_posts ) { |
|
471 | + $stype = $post_type; break; |
|
472 | + } |
|
473 | + } |
|
474 | + |
|
475 | + if(!$stype){ |
|
476 | + $stype = 'gd_place'; |
|
477 | + } |
|
478 | + |
|
479 | + return $stype; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -490,21 +490,21 @@ discard block |
||
490 | 490 | */ |
491 | 491 | function geodir_get_posttypes($output = 'names') |
492 | 492 | { |
493 | - $post_types = array(); |
|
494 | - $post_types = get_option('geodir_post_types'); |
|
495 | - $post_types = stripslashes_deep($post_types); |
|
496 | - if (!empty($post_types)) { |
|
497 | - switch ($output): |
|
498 | - case 'object': |
|
499 | - case 'Object': |
|
500 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
501 | - break; |
|
502 | - case 'array': |
|
503 | - case 'Array': |
|
504 | - $post_types = (array)$post_types; |
|
505 | - break; |
|
493 | + $post_types = array(); |
|
494 | + $post_types = get_option('geodir_post_types'); |
|
495 | + $post_types = stripslashes_deep($post_types); |
|
496 | + if (!empty($post_types)) { |
|
497 | + switch ($output): |
|
498 | + case 'object': |
|
499 | + case 'Object': |
|
500 | + $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
501 | + break; |
|
502 | + case 'array': |
|
503 | + case 'Array': |
|
504 | + $post_types = (array)$post_types; |
|
505 | + break; |
|
506 | 506 | case 'options': |
507 | - $post_types = (array)$post_types; |
|
507 | + $post_types = (array)$post_types; |
|
508 | 508 | |
509 | 509 | $options = array(); |
510 | 510 | if (!empty($post_types)) { |
@@ -513,17 +513,17 @@ discard block |
||
513 | 513 | } |
514 | 514 | } |
515 | 515 | $post_types = $options; |
516 | - break; |
|
517 | - default: |
|
518 | - $post_types = array_keys($post_types); |
|
519 | - break; |
|
520 | - endswitch; |
|
521 | - } |
|
522 | - |
|
523 | - if (!empty($post_types)) |
|
524 | - return $post_types; |
|
525 | - else |
|
526 | - return array(); |
|
516 | + break; |
|
517 | + default: |
|
518 | + $post_types = array_keys($post_types); |
|
519 | + break; |
|
520 | + endswitch; |
|
521 | + } |
|
522 | + |
|
523 | + if (!empty($post_types)) |
|
524 | + return $post_types; |
|
525 | + else |
|
526 | + return array(); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -536,104 +536,104 @@ discard block |
||
536 | 536 | */ |
537 | 537 | function geodir_get_posttype_info($post_type = '') |
538 | 538 | { |
539 | - $post_types = array(); |
|
540 | - $post_types = get_option('geodir_post_types'); |
|
541 | - $post_types = stripslashes_deep($post_types); |
|
542 | - if (!empty($post_types) && $post_type != '') { |
|
543 | - return $post_types[$post_type]; |
|
544 | - } else |
|
545 | - return false; |
|
539 | + $post_types = array(); |
|
540 | + $post_types = get_option('geodir_post_types'); |
|
541 | + $post_types = stripslashes_deep($post_types); |
|
542 | + if (!empty($post_types) && $post_type != '') { |
|
543 | + return $post_types[$post_type]; |
|
544 | + } else |
|
545 | + return false; |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | if (!function_exists('geodir_get_taxonomies')) { |
549 | - /** |
|
550 | - * Get all custom taxonomies. |
|
551 | - * |
|
552 | - * @since 1.0.0 |
|
553 | - * @package GeoDirectory |
|
554 | - * @param string $post_type The post type. |
|
555 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
556 | - * @return array|bool Taxonomies on success. false on failure. |
|
557 | - */ |
|
558 | - function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) { |
|
559 | - $taxonomies = array(); |
|
560 | - $gd_taxonomies = array(); |
|
561 | - |
|
562 | - if ($taxonomies = get_option('geodir_taxonomies')) { |
|
563 | - $gd_taxonomies = array_keys($taxonomies); |
|
564 | - |
|
565 | - if ($post_type != '') { |
|
566 | - $gd_taxonomies = array(); |
|
567 | - } |
|
549 | + /** |
|
550 | + * Get all custom taxonomies. |
|
551 | + * |
|
552 | + * @since 1.0.0 |
|
553 | + * @package GeoDirectory |
|
554 | + * @param string $post_type The post type. |
|
555 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
556 | + * @return array|bool Taxonomies on success. false on failure. |
|
557 | + */ |
|
558 | + function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) { |
|
559 | + $taxonomies = array(); |
|
560 | + $gd_taxonomies = array(); |
|
561 | + |
|
562 | + if ($taxonomies = get_option('geodir_taxonomies')) { |
|
563 | + $gd_taxonomies = array_keys($taxonomies); |
|
564 | + |
|
565 | + if ($post_type != '') { |
|
566 | + $gd_taxonomies = array(); |
|
567 | + } |
|
568 | 568 | |
569 | - $i = 0; |
|
570 | - foreach ($taxonomies as $taxonomy => $args) { |
|
571 | - if ($post_type != '' && $args['object_type'] == $post_type) { |
|
572 | - $gd_taxonomies[] = $taxonomy; |
|
573 | - } |
|
569 | + $i = 0; |
|
570 | + foreach ($taxonomies as $taxonomy => $args) { |
|
571 | + if ($post_type != '' && $args['object_type'] == $post_type) { |
|
572 | + $gd_taxonomies[] = $taxonomy; |
|
573 | + } |
|
574 | 574 | |
575 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') { |
|
576 | - if (array_search($taxonomy, $gd_taxonomies) !== false) { |
|
577 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
578 | - } |
|
579 | - } |
|
580 | - } |
|
575 | + if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') { |
|
576 | + if (array_search($taxonomy, $gd_taxonomies) !== false) { |
|
577 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
578 | + } |
|
579 | + } |
|
580 | + } |
|
581 | + |
|
582 | + $gd_taxonomies = array_values($gd_taxonomies); |
|
583 | + } |
|
581 | 584 | |
582 | - $gd_taxonomies = array_values($gd_taxonomies); |
|
583 | - } |
|
584 | - |
|
585 | - /** |
|
586 | - * Filter the taxonomies. |
|
587 | - * |
|
588 | - * @since 1.0.0 |
|
589 | - * @param array $gd_taxonomies The taxonomy array. |
|
590 | - */ |
|
591 | - $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies); |
|
592 | - |
|
593 | - if (!empty($taxonomies)) { |
|
594 | - return $taxonomies; |
|
595 | - } else { |
|
596 | - return false; |
|
597 | - } |
|
598 | - } |
|
585 | + /** |
|
586 | + * Filter the taxonomies. |
|
587 | + * |
|
588 | + * @since 1.0.0 |
|
589 | + * @param array $gd_taxonomies The taxonomy array. |
|
590 | + */ |
|
591 | + $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies); |
|
592 | + |
|
593 | + if (!empty($taxonomies)) { |
|
594 | + return $taxonomies; |
|
595 | + } else { |
|
596 | + return false; |
|
597 | + } |
|
598 | + } |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | if (!function_exists(' geodir_get_categories_dl')) { |
602 | - /** |
|
603 | - * Get categories dropdown HTML. |
|
604 | - * |
|
605 | - * @since 1.0.0 |
|
606 | - * @package GeoDirectory |
|
607 | - * @param string $post_type The post type. |
|
608 | - * @param string $selected The selected value. |
|
609 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
610 | - * @param bool $echo Prints the HTML when set to true. Default: true. |
|
611 | - * @return void|string Dropdown HTML. |
|
612 | - */ |
|
613 | - function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
614 | - { |
|
615 | - |
|
616 | - $html = ''; |
|
617 | - $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
618 | - |
|
619 | - $categories = get_terms($taxonomies); |
|
620 | - |
|
621 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
622 | - |
|
623 | - foreach ($categories as $category_obj) { |
|
624 | - $select_opt = ''; |
|
625 | - if ($selected == $category_obj->term_id) { |
|
626 | - $select_opt = 'selected="selected"'; |
|
627 | - } |
|
628 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
629 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
630 | - } |
|
631 | - |
|
632 | - if ($echo) |
|
633 | - echo $html; |
|
634 | - else |
|
635 | - return $html; |
|
636 | - } |
|
602 | + /** |
|
603 | + * Get categories dropdown HTML. |
|
604 | + * |
|
605 | + * @since 1.0.0 |
|
606 | + * @package GeoDirectory |
|
607 | + * @param string $post_type The post type. |
|
608 | + * @param string $selected The selected value. |
|
609 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
610 | + * @param bool $echo Prints the HTML when set to true. Default: true. |
|
611 | + * @return void|string Dropdown HTML. |
|
612 | + */ |
|
613 | + function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
614 | + { |
|
615 | + |
|
616 | + $html = ''; |
|
617 | + $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
618 | + |
|
619 | + $categories = get_terms($taxonomies); |
|
620 | + |
|
621 | + $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
622 | + |
|
623 | + foreach ($categories as $category_obj) { |
|
624 | + $select_opt = ''; |
|
625 | + if ($selected == $category_obj->term_id) { |
|
626 | + $select_opt = 'selected="selected"'; |
|
627 | + } |
|
628 | + $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
629 | + . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
630 | + } |
|
631 | + |
|
632 | + if ($echo) |
|
633 | + echo $html; |
|
634 | + else |
|
635 | + return $html; |
|
636 | + } |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | |
@@ -648,28 +648,28 @@ discard block |
||
648 | 648 | function geodir_get_listing_slug($object_type = '') |
649 | 649 | { |
650 | 650 | |
651 | - $listing_slug = ''; |
|
651 | + $listing_slug = ''; |
|
652 | 652 | |
653 | - $post_types = get_option('geodir_post_types'); |
|
654 | - $taxonomies = get_option('geodir_taxonomies'); |
|
653 | + $post_types = get_option('geodir_post_types'); |
|
654 | + $taxonomies = get_option('geodir_taxonomies'); |
|
655 | 655 | |
656 | 656 | |
657 | - if ($object_type != '') { |
|
658 | - if (!empty($post_types) && array_key_exists($object_type, $post_types)) { |
|
657 | + if ($object_type != '') { |
|
658 | + if (!empty($post_types) && array_key_exists($object_type, $post_types)) { |
|
659 | 659 | |
660 | - $object_info = $post_types[$object_type]; |
|
661 | - $listing_slug = $object_info['listing_slug']; |
|
662 | - } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) { |
|
663 | - $object_info = $taxonomies[$object_type]; |
|
664 | - $listing_slug = $object_info['listing_slug']; |
|
665 | - } |
|
660 | + $object_info = $post_types[$object_type]; |
|
661 | + $listing_slug = $object_info['listing_slug']; |
|
662 | + } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) { |
|
663 | + $object_info = $taxonomies[$object_type]; |
|
664 | + $listing_slug = $object_info['listing_slug']; |
|
665 | + } |
|
666 | 666 | |
667 | - } |
|
667 | + } |
|
668 | 668 | |
669 | - if (!empty($listing_slug)) |
|
670 | - return $listing_slug; |
|
671 | - else |
|
672 | - return false; |
|
669 | + if (!empty($listing_slug)) |
|
670 | + return $listing_slug; |
|
671 | + else |
|
672 | + return false; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | |
@@ -684,212 +684,212 @@ discard block |
||
684 | 684 | */ |
685 | 685 | function geodir_get_taxonomy_posttype($taxonomy = '') |
686 | 686 | { |
687 | - global $wp_query; |
|
688 | - |
|
689 | - $post_type = array(); |
|
690 | - $taxonomies = array(); |
|
691 | - |
|
692 | - if (!empty($taxonomy)) { |
|
693 | - $taxonomies[] = $taxonomy; |
|
694 | - } elseif (isset($wp_query->tax_query->queries)) { |
|
695 | - $tax_arr = $wp_query->tax_query->queries; |
|
696 | - //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
697 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
698 | - $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
699 | - } |
|
700 | - |
|
701 | - if (!empty($taxonomies)) { |
|
702 | - foreach (geodir_get_posttypes() as $pt) { |
|
703 | - $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
704 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
705 | - $post_type[] = $pt; |
|
706 | - } |
|
707 | - } |
|
708 | - |
|
709 | - if (!empty($post_type)) |
|
710 | - return $post_type[0]; |
|
711 | - else |
|
712 | - return false; |
|
687 | + global $wp_query; |
|
688 | + |
|
689 | + $post_type = array(); |
|
690 | + $taxonomies = array(); |
|
691 | + |
|
692 | + if (!empty($taxonomy)) { |
|
693 | + $taxonomies[] = $taxonomy; |
|
694 | + } elseif (isset($wp_query->tax_query->queries)) { |
|
695 | + $tax_arr = $wp_query->tax_query->queries; |
|
696 | + //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
697 | + if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
698 | + $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
699 | + } |
|
700 | + |
|
701 | + if (!empty($taxonomies)) { |
|
702 | + foreach (geodir_get_posttypes() as $pt) { |
|
703 | + $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
704 | + if (array_intersect($taxonomies, $object_taxonomies)) |
|
705 | + $post_type[] = $pt; |
|
706 | + } |
|
707 | + } |
|
708 | + |
|
709 | + if (!empty($post_type)) |
|
710 | + return $post_type[0]; |
|
711 | + else |
|
712 | + return false; |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | if (!function_exists('geodir_custom_taxonomy_walker')) { |
716 | - /** |
|
717 | - * Custom taxonomy walker function. |
|
718 | - * |
|
719 | - * @since 1.0.0 |
|
720 | - * @package GeoDirectory |
|
721 | - * @param string $cat_taxonomy The taxonomy name. |
|
722 | - * @param int $cat_parent The parent term ID. |
|
723 | - * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
724 | - * @param int $pading CSS padding in pixels. |
|
725 | - * @return string|void taxonomy HTML. |
|
726 | - */ |
|
727 | - function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
728 | - { |
|
729 | - global $cat_display, $post_cat, $exclude_cats; |
|
730 | - |
|
731 | - $search_terms = trim($post_cat, ","); |
|
732 | - |
|
733 | - $search_terms = explode(",", $search_terms); |
|
734 | - |
|
735 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats)); |
|
736 | - |
|
737 | - $display = ''; |
|
738 | - $onchange = ''; |
|
739 | - $term_check = ''; |
|
740 | - $main_list_class = ''; |
|
741 | - $out = ''; |
|
742 | - //If there are terms, start displaying |
|
743 | - if (count($cat_terms) > 0) { |
|
744 | - //Displaying as a list |
|
745 | - $p = $pading * 20; |
|
746 | - $pading++; |
|
747 | - |
|
748 | - |
|
749 | - if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
|
750 | - if ($cat_parent == 0) { |
|
751 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
752 | - $main_list_class = 'class="main_list_selecter"'; |
|
753 | - } else { |
|
754 | - //$display = 'display:none'; |
|
755 | - $list_class = 'sub_list gd-sub-cats-list'; |
|
756 | - } |
|
757 | - } |
|
716 | + /** |
|
717 | + * Custom taxonomy walker function. |
|
718 | + * |
|
719 | + * @since 1.0.0 |
|
720 | + * @package GeoDirectory |
|
721 | + * @param string $cat_taxonomy The taxonomy name. |
|
722 | + * @param int $cat_parent The parent term ID. |
|
723 | + * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
724 | + * @param int $pading CSS padding in pixels. |
|
725 | + * @return string|void taxonomy HTML. |
|
726 | + */ |
|
727 | + function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
728 | + { |
|
729 | + global $cat_display, $post_cat, $exclude_cats; |
|
730 | + |
|
731 | + $search_terms = trim($post_cat, ","); |
|
732 | + |
|
733 | + $search_terms = explode(",", $search_terms); |
|
734 | + |
|
735 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats)); |
|
736 | + |
|
737 | + $display = ''; |
|
738 | + $onchange = ''; |
|
739 | + $term_check = ''; |
|
740 | + $main_list_class = ''; |
|
741 | + $out = ''; |
|
742 | + //If there are terms, start displaying |
|
743 | + if (count($cat_terms) > 0) { |
|
744 | + //Displaying as a list |
|
745 | + $p = $pading * 20; |
|
746 | + $pading++; |
|
747 | + |
|
748 | + |
|
749 | + if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
|
750 | + if ($cat_parent == 0) { |
|
751 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
752 | + $main_list_class = 'class="main_list_selecter"'; |
|
753 | + } else { |
|
754 | + //$display = 'display:none'; |
|
755 | + $list_class = 'sub_list gd-sub-cats-list'; |
|
756 | + } |
|
757 | + } |
|
758 | 758 | |
759 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
760 | - $p = 0; |
|
761 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
762 | - } |
|
759 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
760 | + $p = 0; |
|
761 | + $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
762 | + } |
|
763 | 763 | |
764 | - foreach ($cat_terms as $cat_term) { |
|
764 | + foreach ($cat_terms as $cat_term) { |
|
765 | 765 | |
766 | - $checked = ''; |
|
766 | + $checked = ''; |
|
767 | 767 | |
768 | - if (in_array($cat_term->term_id, $search_terms)) { |
|
769 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
770 | - $checked = 'selected="selected"'; |
|
771 | - else |
|
772 | - $checked = 'checked="checked"'; |
|
773 | - } |
|
768 | + if (in_array($cat_term->term_id, $search_terms)) { |
|
769 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
770 | + $checked = 'selected="selected"'; |
|
771 | + else |
|
772 | + $checked = 'checked="checked"'; |
|
773 | + } |
|
774 | 774 | |
775 | - if ($cat_display == 'radio') |
|
776 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
777 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
778 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
775 | + if ($cat_display == 'radio') |
|
776 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
777 | + elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
778 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
779 | 779 | |
780 | - else { |
|
781 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
782 | - } |
|
780 | + else { |
|
781 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
782 | + } |
|
783 | 783 | |
784 | - // Call recurson to print sub cats |
|
785 | - $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
784 | + // Call recurson to print sub cats |
|
785 | + $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
786 | 786 | |
787 | - } |
|
787 | + } |
|
788 | 788 | |
789 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
790 | - $out .= '</div>'; |
|
789 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
790 | + $out .= '</div>'; |
|
791 | 791 | |
792 | - return $out; |
|
793 | - } |
|
794 | - return; |
|
795 | - } |
|
792 | + return $out; |
|
793 | + } |
|
794 | + return; |
|
795 | + } |
|
796 | 796 | } |
797 | 797 | |
798 | 798 | if (!function_exists('geodir_custom_taxonomy_walker2')) { |
799 | - /** |
|
800 | - * Custom taxonomy walker function. |
|
801 | - * |
|
802 | - * @since 1.0.0 |
|
803 | - * @package GeoDirectory |
|
804 | - * @global object $post WordPress Post object. |
|
805 | - * @global object $gd_session GeoDirectory Session object. |
|
806 | - * @param string $cat_taxonomy The taxonomy name. |
|
807 | - * @param string $cat_limit Number of categories to display. |
|
808 | - */ |
|
809 | - function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
810 | - { |
|
811 | - $post_category = ''; |
|
812 | - $post_category_str = ''; |
|
813 | - global $exclude_cats, $gd_session; |
|
814 | - |
|
815 | - $cat_exclude = ''; |
|
816 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
817 | - $cat_exclude = serialize($exclude_cats); |
|
818 | - |
|
819 | - if (isset($_REQUEST['backandedit'])) { |
|
820 | - $post = (object)$gd_session->get('listing'); |
|
821 | - |
|
822 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
823 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
824 | - |
|
825 | - $post_categories = $post->post_category_str; |
|
826 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
827 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
828 | - |
|
829 | - } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
|
830 | - global $post; |
|
831 | - |
|
832 | - $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
833 | - if (empty($post_category) && isset($post->{$cat_taxonomy})) { |
|
834 | - $post_category = $post->{$cat_taxonomy}; |
|
835 | - } |
|
799 | + /** |
|
800 | + * Custom taxonomy walker function. |
|
801 | + * |
|
802 | + * @since 1.0.0 |
|
803 | + * @package GeoDirectory |
|
804 | + * @global object $post WordPress Post object. |
|
805 | + * @global object $gd_session GeoDirectory Session object. |
|
806 | + * @param string $cat_taxonomy The taxonomy name. |
|
807 | + * @param string $cat_limit Number of categories to display. |
|
808 | + */ |
|
809 | + function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
810 | + { |
|
811 | + $post_category = ''; |
|
812 | + $post_category_str = ''; |
|
813 | + global $exclude_cats, $gd_session; |
|
814 | + |
|
815 | + $cat_exclude = ''; |
|
816 | + if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
817 | + $cat_exclude = serialize($exclude_cats); |
|
818 | + |
|
819 | + if (isset($_REQUEST['backandedit'])) { |
|
820 | + $post = (object)$gd_session->get('listing'); |
|
821 | + |
|
822 | + if (!is_array($post->post_category[$cat_taxonomy])) |
|
823 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
824 | + |
|
825 | + $post_categories = $post->post_category_str; |
|
826 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
827 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
828 | + |
|
829 | + } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
|
830 | + global $post; |
|
831 | + |
|
832 | + $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
833 | + if (empty($post_category) && isset($post->{$cat_taxonomy})) { |
|
834 | + $post_category = $post->{$cat_taxonomy}; |
|
835 | + } |
|
836 | 836 | |
837 | - $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
837 | + $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
838 | 838 | |
839 | - if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) { |
|
840 | - foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) { |
|
841 | - if (is_numeric($cat_part)) { |
|
842 | - $cat_part_arr[] = $cat_part; |
|
843 | - } |
|
844 | - } |
|
845 | - if (is_array($cat_part_arr)) { |
|
846 | - $post_category = implode(',', $cat_part_arr); |
|
847 | - } |
|
848 | - } |
|
839 | + if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) { |
|
840 | + foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) { |
|
841 | + if (is_numeric($cat_part)) { |
|
842 | + $cat_part_arr[] = $cat_part; |
|
843 | + } |
|
844 | + } |
|
845 | + if (is_array($cat_part_arr)) { |
|
846 | + $post_category = implode(',', $cat_part_arr); |
|
847 | + } |
|
848 | + } |
|
849 | 849 | |
850 | - if (!empty($post_category)) { |
|
851 | - $cat1 = array_filter(explode(',', $post_category)); |
|
852 | - $post_category = ',' . implode(',', $cat1) . ','; |
|
850 | + if (!empty($post_category)) { |
|
851 | + $cat1 = array_filter(explode(',', $post_category)); |
|
852 | + $post_category = ',' . implode(',', $cat1) . ','; |
|
853 | 853 | |
854 | - } |
|
854 | + } |
|
855 | 855 | |
856 | - if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) { |
|
856 | + if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) { |
|
857 | 857 | |
858 | - $post_category_upd = explode(',', $post_category); |
|
859 | - $post_category_change = ''; |
|
860 | - foreach ($post_category_upd as $cat) { |
|
858 | + $post_category_upd = explode(',', $post_category); |
|
859 | + $post_category_change = ''; |
|
860 | + foreach ($post_category_upd as $cat) { |
|
861 | 861 | |
862 | - if (!in_array($cat, $exclude_cats) && $cat != '') { |
|
863 | - $post_category_change .= ',' . $cat; |
|
864 | - } |
|
865 | - } |
|
866 | - $post_category = $post_category_change; |
|
867 | - } |
|
862 | + if (!in_array($cat, $exclude_cats) && $cat != '') { |
|
863 | + $post_category_change .= ',' . $cat; |
|
864 | + } |
|
865 | + } |
|
866 | + $post_category = $post_category_change; |
|
867 | + } |
|
868 | 868 | |
869 | 869 | |
870 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
871 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
872 | - } |
|
873 | - } |
|
870 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
871 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
872 | + } |
|
873 | + } |
|
874 | 874 | |
875 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
875 | + echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
876 | 876 | |
877 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
877 | + echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
878 | 878 | |
879 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
879 | + echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
880 | 880 | |
881 | 881 | |
882 | - ?> |
|
882 | + ?> |
|
883 | 883 | <div class="cat_sublist"> |
884 | 884 | <?php |
885 | 885 | |
886 | - $post_id = isset($post->ID) ? $post->ID : ''; |
|
886 | + $post_id = isset($post->ID) ? $post->ID : ''; |
|
887 | 887 | |
888 | - if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) { |
|
888 | + if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) { |
|
889 | 889 | |
890 | - geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
891 | - } |
|
892 | - ?> |
|
890 | + geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
891 | + } |
|
892 | + ?> |
|
893 | 893 | </div> |
894 | 894 | <script type="text/javascript"> |
895 | 895 | |
@@ -1012,22 +1012,22 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | </script> |
1014 | 1014 | <?php |
1015 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
1016 | - $post_cat_str = $post_categories[$cat_taxonomy]; |
|
1017 | - $post_cat_array = explode("#", $post_cat_str); |
|
1018 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
1019 | - $style = "display:none;"; |
|
1020 | - } |
|
1021 | - ?> |
|
1015 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
1016 | + $post_cat_str = $post_categories[$cat_taxonomy]; |
|
1017 | + $post_cat_array = explode("#", $post_cat_str); |
|
1018 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
1019 | + $style = "display:none;"; |
|
1020 | + } |
|
1021 | + ?> |
|
1022 | 1022 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
1023 | - echo $style; |
|
1024 | - }?> "> |
|
1023 | + echo $style; |
|
1024 | + }?> "> |
|
1025 | 1025 | <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
1026 | - ?> |
|
1026 | + ?> |
|
1027 | 1027 | </div> |
1028 | 1028 | <?php |
1029 | 1029 | |
1030 | - } |
|
1030 | + } |
|
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | /** |
@@ -1044,23 +1044,23 @@ discard block |
||
1044 | 1044 | */ |
1045 | 1045 | function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '') |
1046 | 1046 | { |
1047 | - global $exclude_cats; |
|
1047 | + global $exclude_cats; |
|
1048 | 1048 | |
1049 | - if ($exclude != '') { |
|
1050 | - $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
1049 | + if ($exclude != '') { |
|
1050 | + $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
1051 | 1051 | |
1052 | - if(is_array( $exclude_cats)){ |
|
1053 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1054 | - }else{ |
|
1055 | - $exclude_cats = intval($exclude_cats); |
|
1056 | - } |
|
1052 | + if(is_array( $exclude_cats)){ |
|
1053 | + $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1054 | + }else{ |
|
1055 | + $exclude_cats = intval($exclude_cats); |
|
1056 | + } |
|
1057 | 1057 | |
1058 | - } |
|
1058 | + } |
|
1059 | 1059 | |
1060 | - if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
1061 | - (!is_array($exclude_cats) || empty($exclude_cats)) |
|
1062 | - ) { |
|
1063 | - ?> |
|
1060 | + if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
1061 | + (!is_array($exclude_cats) || empty($exclude_cats)) |
|
1062 | + ) { |
|
1063 | + ?> |
|
1064 | 1064 | |
1065 | 1065 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1066 | 1066 | |
@@ -1089,8 +1089,8 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | <br/> |
1091 | 1091 | <?php |
1092 | - $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1093 | - if (!empty($cat_terms)) { ?> |
|
1092 | + $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1093 | + if (!empty($cat_terms)) { ?> |
|
1094 | 1094 | <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span> |
1095 | 1095 | <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?> |
1096 | 1096 | <?php } ?> |
@@ -1112,53 +1112,53 @@ discard block |
||
1112 | 1112 | function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories) |
1113 | 1113 | { |
1114 | 1114 | |
1115 | - if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) { |
|
1116 | - $post_cat_str = $post_categories[$request_taxonomy]; |
|
1117 | - $post_cat_array = explode("#", $post_cat_str); |
|
1118 | - if (is_array($post_cat_array)) { |
|
1119 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1115 | + if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) { |
|
1116 | + $post_cat_str = $post_categories[$request_taxonomy]; |
|
1117 | + $post_cat_array = explode("#", $post_cat_str); |
|
1118 | + if (is_array($post_cat_array)) { |
|
1119 | + $post_cat_array = array_unique( $post_cat_array ); |
|
1120 | 1120 | |
1121 | 1121 | foreach ($post_cat_array as $post_cat_html) { |
1122 | 1122 | |
1123 | - $post_cat_info = explode(":", $post_cat_html); |
|
1124 | - $post_maincat_str = $post_cat_info[0]; |
|
1123 | + $post_cat_info = explode(":", $post_cat_html); |
|
1124 | + $post_maincat_str = $post_cat_info[0]; |
|
1125 | 1125 | |
1126 | - if (!empty($post_maincat_str)) { |
|
1127 | - $post_maincat_info = explode(",", $post_maincat_str); |
|
1128 | - $post_maincat_id = $post_maincat_info[0]; |
|
1129 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1130 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1131 | - } |
|
1132 | - $post_sub_catid = ''; |
|
1133 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1134 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1135 | - } |
|
1126 | + if (!empty($post_maincat_str)) { |
|
1127 | + $post_maincat_info = explode(",", $post_maincat_str); |
|
1128 | + $post_maincat_id = $post_maincat_info[0]; |
|
1129 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1130 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1131 | + } |
|
1132 | + $post_sub_catid = ''; |
|
1133 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1134 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
1135 | + } |
|
1136 | 1136 | |
1137 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1137 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1138 | 1138 | |
1139 | - } |
|
1140 | - } else { |
|
1139 | + } |
|
1140 | + } else { |
|
1141 | 1141 | |
1142 | - $post_cat_info = explode(":", $post_cat_str); |
|
1143 | - $post_maincat_str = $post_cat_info[0]; |
|
1142 | + $post_cat_info = explode(":", $post_cat_str); |
|
1143 | + $post_maincat_str = $post_cat_info[0]; |
|
1144 | 1144 | |
1145 | - $post_sub_catid = ''; |
|
1145 | + $post_sub_catid = ''; |
|
1146 | 1146 | |
1147 | - if (!empty($post_maincat_str)) { |
|
1148 | - $post_maincat_info = explode(",", $post_maincat_str); |
|
1149 | - $post_maincat_id = $post_maincat_info[0]; |
|
1150 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1151 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1152 | - } |
|
1147 | + if (!empty($post_maincat_str)) { |
|
1148 | + $post_maincat_info = explode(",", $post_maincat_str); |
|
1149 | + $post_maincat_id = $post_maincat_info[0]; |
|
1150 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1151 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1152 | + } |
|
1153 | 1153 | |
1154 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1155 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1156 | - } |
|
1154 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1155 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
1156 | + } |
|
1157 | 1157 | |
1158 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1158 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1159 | 1159 | |
1160 | - } |
|
1161 | - } |
|
1160 | + } |
|
1161 | + } |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | 1164 | /** |
@@ -1172,35 +1172,35 @@ discard block |
||
1172 | 1172 | */ |
1173 | 1173 | function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false) |
1174 | 1174 | { |
1175 | - global $exclude_cats; |
|
1175 | + global $exclude_cats; |
|
1176 | 1176 | |
1177 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1177 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1178 | 1178 | |
1179 | - if (!empty($cat_terms)) { |
|
1180 | - $onchange = ''; |
|
1181 | - $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
1179 | + if (!empty($cat_terms)) { |
|
1180 | + $onchange = ''; |
|
1181 | + $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
1182 | 1182 | |
1183 | - $option_selected = ''; |
|
1184 | - if (!$selected) |
|
1185 | - $option_slected = ' selected="selected" '; |
|
1183 | + $option_selected = ''; |
|
1184 | + if (!$selected) |
|
1185 | + $option_slected = ' selected="selected" '; |
|
1186 | 1186 | |
1187 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1187 | + echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1188 | 1188 | |
1189 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1189 | + echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1190 | 1190 | |
1191 | - foreach ($cat_terms as $cat_term) { |
|
1192 | - $option_selected = ''; |
|
1193 | - if ($selected == $cat_term->term_id) |
|
1194 | - $option_selected = ' selected="selected" '; |
|
1191 | + foreach ($cat_terms as $cat_term) { |
|
1192 | + $option_selected = ''; |
|
1193 | + if ($selected == $cat_term->term_id) |
|
1194 | + $option_selected = ' selected="selected" '; |
|
1195 | 1195 | |
1196 | - // Count child terms |
|
1197 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1198 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1196 | + // Count child terms |
|
1197 | + $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1198 | + $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1199 | 1199 | |
1200 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
1201 | - } |
|
1202 | - echo '</select>'; |
|
1203 | - } |
|
1200 | + echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
1201 | + } |
|
1202 | + echo '</select>'; |
|
1203 | + } |
|
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | /** |
@@ -1216,28 +1216,28 @@ discard block |
||
1216 | 1216 | */ |
1217 | 1217 | function geodir_custom_update_messages($messages) |
1218 | 1218 | { |
1219 | - global $post, $post_ID; |
|
1220 | - |
|
1221 | - $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects'); |
|
1222 | - |
|
1223 | - foreach ($post_types as $post_type => $post_object) { |
|
1224 | - |
|
1225 | - $messages[$post_type] = array( |
|
1226 | - 0 => '', // Unused. Messages start at index 1. |
|
1227 | - 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1228 | - 2 => __('Custom field updated.', 'geodirectory'), |
|
1229 | - 3 => __('Custom field deleted.', 'geodirectory'), |
|
1230 | - 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
|
1231 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1232 | - 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1233 | - 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
|
1234 | - 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1235 | - 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1236 | - 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1237 | - ); |
|
1238 | - } |
|
1239 | - |
|
1240 | - return $messages; |
|
1219 | + global $post, $post_ID; |
|
1220 | + |
|
1221 | + $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects'); |
|
1222 | + |
|
1223 | + foreach ($post_types as $post_type => $post_object) { |
|
1224 | + |
|
1225 | + $messages[$post_type] = array( |
|
1226 | + 0 => '', // Unused. Messages start at index 1. |
|
1227 | + 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1228 | + 2 => __('Custom field updated.', 'geodirectory'), |
|
1229 | + 3 => __('Custom field deleted.', 'geodirectory'), |
|
1230 | + 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
|
1231 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1232 | + 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1233 | + 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
|
1234 | + 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1235 | + 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1236 | + 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1237 | + ); |
|
1238 | + } |
|
1239 | + |
|
1240 | + return $messages; |
|
1241 | 1241 | } |
1242 | 1242 | |
1243 | 1243 | |
@@ -1252,182 +1252,182 @@ discard block |
||
1252 | 1252 | function geodir_register_defaults() |
1253 | 1253 | { |
1254 | 1254 | |
1255 | - global $wpdb; |
|
1256 | - |
|
1257 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1258 | - |
|
1259 | - if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1260 | - $listing_slug = 'places'; |
|
1261 | - |
|
1262 | - /** |
|
1263 | - * Taxonomies |
|
1264 | - **/ |
|
1265 | - //if ( ! taxonomy_exists('gd_place_tags') ) |
|
1266 | - { |
|
1267 | - |
|
1268 | - $gd_placetags = array(); |
|
1269 | - $gd_placetags['object_type'] = 'gd_place'; |
|
1270 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1271 | - $gd_placetags['args'] = array( |
|
1272 | - 'public' => true, |
|
1273 | - 'hierarchical' => false, |
|
1274 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1275 | - 'query_var' => true, |
|
1276 | - |
|
1277 | - 'labels' => array( |
|
1278 | - 'name' => __('Place Tags', 'geodirectory'), |
|
1279 | - 'singular_name' => __('Place Tag', 'geodirectory'), |
|
1280 | - 'search_items' => __('Search Place Tags', 'geodirectory'), |
|
1281 | - 'popular_items' => __('Popular Place Tags', 'geodirectory'), |
|
1282 | - 'all_items' => __('All Place Tags', 'geodirectory'), |
|
1283 | - 'edit_item' => __('Edit Place Tag', 'geodirectory'), |
|
1284 | - 'update_item' => __('Update Place Tag', 'geodirectory'), |
|
1285 | - 'add_new_item' => __('Add New Place Tag', 'geodirectory'), |
|
1286 | - 'new_item_name' => __('New Place Tag Name', 'geodirectory'), |
|
1287 | - 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'), |
|
1288 | - 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'), |
|
1289 | - 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'), |
|
1290 | - ), |
|
1291 | - ); |
|
1292 | - |
|
1293 | - |
|
1294 | - $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1295 | - $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
1296 | - update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1297 | - |
|
1298 | - |
|
1299 | - // Update post types and delete tmp options |
|
1300 | - flush_rewrite_rules(); |
|
1301 | - |
|
1302 | - } |
|
1303 | - |
|
1304 | - //if ( ! taxonomy_exists('gd_placecategory') ) |
|
1305 | - { |
|
1306 | - |
|
1307 | - $gd_placecategory = array(); |
|
1308 | - $gd_placecategory['object_type'] = 'gd_place'; |
|
1309 | - $gd_placecategory['listing_slug'] = $listing_slug; |
|
1310 | - $gd_placecategory['args'] = array( |
|
1311 | - 'public' => true, |
|
1312 | - 'hierarchical' => true, |
|
1313 | - 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), |
|
1314 | - 'query_var' => true, |
|
1315 | - 'labels' => array( |
|
1316 | - 'name' => __('Place Categories', 'geodirectory'), |
|
1317 | - 'singular_name' => __('Place Category', 'geodirectory'), |
|
1318 | - 'search_items' => __('Search Place Categories', 'geodirectory'), |
|
1319 | - 'popular_items' => __('Popular Place Categories', 'geodirectory'), |
|
1320 | - 'all_items' => __('All Place Categories', 'geodirectory'), |
|
1321 | - 'edit_item' => __('Edit Place Category', 'geodirectory'), |
|
1322 | - 'update_item' => __('Update Place Category', 'geodirectory'), |
|
1323 | - 'add_new_item' => __('Add New Place Category', 'geodirectory'), |
|
1324 | - 'new_item_name' => __('New Place Category', 'geodirectory'), |
|
1325 | - 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'), |
|
1326 | - ), |
|
1327 | - ); |
|
1328 | - |
|
1329 | - |
|
1330 | - $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1331 | - $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
1332 | - update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1333 | - |
|
1334 | - |
|
1335 | - flush_rewrite_rules(); |
|
1336 | - } |
|
1337 | - |
|
1338 | - /** |
|
1339 | - * Post Types |
|
1340 | - **/ |
|
1341 | - |
|
1342 | - //if ( ! post_type_exists('gd_place') ) |
|
1343 | - { |
|
1344 | - |
|
1345 | - $labels = array( |
|
1346 | - 'name' => __('Places', 'geodirectory'), |
|
1347 | - 'singular_name' => __('Place', 'geodirectory'), |
|
1348 | - 'add_new' => __('Add New', 'geodirectory'), |
|
1349 | - 'add_new_item' => __('Add New Place', 'geodirectory'), |
|
1350 | - 'edit_item' => __('Edit Place', 'geodirectory'), |
|
1351 | - 'new_item' => __('New Place', 'geodirectory'), |
|
1352 | - 'view_item' => __('View Place', 'geodirectory'), |
|
1353 | - 'search_items' => __('Search Places', 'geodirectory'), |
|
1354 | - 'not_found' => __('No Place Found', 'geodirectory'), |
|
1355 | - 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory')); |
|
1356 | - |
|
1357 | - $place_default = array( |
|
1358 | - 'labels' => $labels, |
|
1359 | - 'can_export' => true, |
|
1360 | - 'capability_type' => 'post', |
|
1361 | - 'description' => 'Place post type.', |
|
1362 | - 'has_archive' => $listing_slug, |
|
1363 | - 'hierarchical' => false, |
|
1364 | - 'map_meta_cap' => true, |
|
1365 | - 'menu_icon' => $menu_icon, |
|
1366 | - 'public' => true, |
|
1367 | - 'query_var' => true, |
|
1368 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1369 | - 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
|
1370 | - 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
|
1371 | - |
|
1372 | - //Update custom post types |
|
1373 | - $geodir_post_types = get_option('geodir_post_types'); |
|
1374 | - $geodir_post_types['gd_place'] = $place_default; |
|
1375 | - update_option('geodir_post_types', $geodir_post_types); |
|
1376 | - |
|
1377 | - // Update post types and delete tmp options |
|
1378 | - flush_rewrite_rules(); |
|
1379 | - } |
|
1380 | - |
|
1381 | - |
|
1382 | - geodir_register_taxonomies(); |
|
1383 | - geodir_register_post_types(); |
|
1384 | - |
|
1385 | - //die; |
|
1255 | + global $wpdb; |
|
1256 | + |
|
1257 | + $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1258 | + |
|
1259 | + if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1260 | + $listing_slug = 'places'; |
|
1261 | + |
|
1262 | + /** |
|
1263 | + * Taxonomies |
|
1264 | + **/ |
|
1265 | + //if ( ! taxonomy_exists('gd_place_tags') ) |
|
1266 | + { |
|
1267 | + |
|
1268 | + $gd_placetags = array(); |
|
1269 | + $gd_placetags['object_type'] = 'gd_place'; |
|
1270 | + $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1271 | + $gd_placetags['args'] = array( |
|
1272 | + 'public' => true, |
|
1273 | + 'hierarchical' => false, |
|
1274 | + 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1275 | + 'query_var' => true, |
|
1276 | + |
|
1277 | + 'labels' => array( |
|
1278 | + 'name' => __('Place Tags', 'geodirectory'), |
|
1279 | + 'singular_name' => __('Place Tag', 'geodirectory'), |
|
1280 | + 'search_items' => __('Search Place Tags', 'geodirectory'), |
|
1281 | + 'popular_items' => __('Popular Place Tags', 'geodirectory'), |
|
1282 | + 'all_items' => __('All Place Tags', 'geodirectory'), |
|
1283 | + 'edit_item' => __('Edit Place Tag', 'geodirectory'), |
|
1284 | + 'update_item' => __('Update Place Tag', 'geodirectory'), |
|
1285 | + 'add_new_item' => __('Add New Place Tag', 'geodirectory'), |
|
1286 | + 'new_item_name' => __('New Place Tag Name', 'geodirectory'), |
|
1287 | + 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'), |
|
1288 | + 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'), |
|
1289 | + 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'), |
|
1290 | + ), |
|
1291 | + ); |
|
1292 | + |
|
1293 | + |
|
1294 | + $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1295 | + $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
1296 | + update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1297 | + |
|
1298 | + |
|
1299 | + // Update post types and delete tmp options |
|
1300 | + flush_rewrite_rules(); |
|
1301 | + |
|
1302 | + } |
|
1303 | + |
|
1304 | + //if ( ! taxonomy_exists('gd_placecategory') ) |
|
1305 | + { |
|
1306 | + |
|
1307 | + $gd_placecategory = array(); |
|
1308 | + $gd_placecategory['object_type'] = 'gd_place'; |
|
1309 | + $gd_placecategory['listing_slug'] = $listing_slug; |
|
1310 | + $gd_placecategory['args'] = array( |
|
1311 | + 'public' => true, |
|
1312 | + 'hierarchical' => true, |
|
1313 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), |
|
1314 | + 'query_var' => true, |
|
1315 | + 'labels' => array( |
|
1316 | + 'name' => __('Place Categories', 'geodirectory'), |
|
1317 | + 'singular_name' => __('Place Category', 'geodirectory'), |
|
1318 | + 'search_items' => __('Search Place Categories', 'geodirectory'), |
|
1319 | + 'popular_items' => __('Popular Place Categories', 'geodirectory'), |
|
1320 | + 'all_items' => __('All Place Categories', 'geodirectory'), |
|
1321 | + 'edit_item' => __('Edit Place Category', 'geodirectory'), |
|
1322 | + 'update_item' => __('Update Place Category', 'geodirectory'), |
|
1323 | + 'add_new_item' => __('Add New Place Category', 'geodirectory'), |
|
1324 | + 'new_item_name' => __('New Place Category', 'geodirectory'), |
|
1325 | + 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'), |
|
1326 | + ), |
|
1327 | + ); |
|
1328 | + |
|
1329 | + |
|
1330 | + $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1331 | + $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
1332 | + update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1333 | + |
|
1334 | + |
|
1335 | + flush_rewrite_rules(); |
|
1336 | + } |
|
1337 | + |
|
1338 | + /** |
|
1339 | + * Post Types |
|
1340 | + **/ |
|
1341 | + |
|
1342 | + //if ( ! post_type_exists('gd_place') ) |
|
1343 | + { |
|
1344 | + |
|
1345 | + $labels = array( |
|
1346 | + 'name' => __('Places', 'geodirectory'), |
|
1347 | + 'singular_name' => __('Place', 'geodirectory'), |
|
1348 | + 'add_new' => __('Add New', 'geodirectory'), |
|
1349 | + 'add_new_item' => __('Add New Place', 'geodirectory'), |
|
1350 | + 'edit_item' => __('Edit Place', 'geodirectory'), |
|
1351 | + 'new_item' => __('New Place', 'geodirectory'), |
|
1352 | + 'view_item' => __('View Place', 'geodirectory'), |
|
1353 | + 'search_items' => __('Search Places', 'geodirectory'), |
|
1354 | + 'not_found' => __('No Place Found', 'geodirectory'), |
|
1355 | + 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory')); |
|
1356 | + |
|
1357 | + $place_default = array( |
|
1358 | + 'labels' => $labels, |
|
1359 | + 'can_export' => true, |
|
1360 | + 'capability_type' => 'post', |
|
1361 | + 'description' => 'Place post type.', |
|
1362 | + 'has_archive' => $listing_slug, |
|
1363 | + 'hierarchical' => false, |
|
1364 | + 'map_meta_cap' => true, |
|
1365 | + 'menu_icon' => $menu_icon, |
|
1366 | + 'public' => true, |
|
1367 | + 'query_var' => true, |
|
1368 | + 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1369 | + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
|
1370 | + 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
|
1371 | + |
|
1372 | + //Update custom post types |
|
1373 | + $geodir_post_types = get_option('geodir_post_types'); |
|
1374 | + $geodir_post_types['gd_place'] = $place_default; |
|
1375 | + update_option('geodir_post_types', $geodir_post_types); |
|
1376 | + |
|
1377 | + // Update post types and delete tmp options |
|
1378 | + flush_rewrite_rules(); |
|
1379 | + } |
|
1380 | + |
|
1381 | + |
|
1382 | + geodir_register_taxonomies(); |
|
1383 | + geodir_register_post_types(); |
|
1384 | + |
|
1385 | + //die; |
|
1386 | 1386 | |
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | $gd_wpml_get_languages = ""; |
1390 | 1390 | function gd_wpml_get_lang_from_url($url) { |
1391 | - global $sitepress, $gd_wpml_get_languages; |
|
1391 | + global $sitepress, $gd_wpml_get_languages; |
|
1392 | 1392 | |
1393 | - if (geodir_is_wpml()) { |
|
1394 | - return $sitepress->get_language_from_url($url); |
|
1395 | - } |
|
1393 | + if (geodir_is_wpml()) { |
|
1394 | + return $sitepress->get_language_from_url($url); |
|
1395 | + } |
|
1396 | 1396 | |
1397 | - if (isset($_REQUEST['lang']) && $_REQUEST['lang']) { |
|
1398 | - return $_REQUEST['lang']; |
|
1399 | - } |
|
1397 | + if (isset($_REQUEST['lang']) && $_REQUEST['lang']) { |
|
1398 | + return $_REQUEST['lang']; |
|
1399 | + } |
|
1400 | 1400 | |
1401 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1401 | + $url = str_replace(array("http://","https://"),"",$url); |
|
1402 | 1402 | |
1403 | - // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang. |
|
1404 | - $site_url = str_replace(array("http://","https://"),"",site_url()); |
|
1403 | + // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang. |
|
1404 | + $site_url = str_replace(array("http://","https://"),"",site_url()); |
|
1405 | 1405 | |
1406 | - $url = str_replace($site_url,"",$url); |
|
1406 | + $url = str_replace($site_url,"",$url); |
|
1407 | 1407 | |
1408 | - $segments = explode('/', trim($url, '/')); |
|
1408 | + $segments = explode('/', trim($url, '/')); |
|
1409 | 1409 | |
1410 | - if ($gd_wpml_get_languages) { |
|
1411 | - $langs = $gd_wpml_get_languages; |
|
1412 | - } else { |
|
1413 | - $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
1414 | - } |
|
1410 | + if ($gd_wpml_get_languages) { |
|
1411 | + $langs = $gd_wpml_get_languages; |
|
1412 | + } else { |
|
1413 | + $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
1414 | + } |
|
1415 | 1415 | |
1416 | - if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) { |
|
1417 | - return $segments[0]; |
|
1418 | - } |
|
1416 | + if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) { |
|
1417 | + return $segments[0]; |
|
1418 | + } |
|
1419 | 1419 | |
1420 | - return false; |
|
1420 | + return false; |
|
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | function gd_wpml_slug_translation_turned_on($post_type) { |
1424 | 1424 | |
1425 | - global $sitepress; |
|
1426 | - $settings = $sitepress->get_settings(); |
|
1427 | - return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
1428 | - && $settings['posts_slug_translation']['types'][$post_type] |
|
1429 | - && isset($settings['posts_slug_translation']['on']) |
|
1430 | - && $settings['posts_slug_translation']['on']; |
|
1425 | + global $sitepress; |
|
1426 | + $settings = $sitepress->get_settings(); |
|
1427 | + return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
1428 | + && $settings['posts_slug_translation']['types'][$post_type] |
|
1429 | + && isset($settings['posts_slug_translation']['on']) |
|
1430 | + && $settings['posts_slug_translation']['on']; |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | |
@@ -1454,162 +1454,162 @@ discard block |
||
1454 | 1454 | */ |
1455 | 1455 | function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample) |
1456 | 1456 | { |
1457 | - //echo $post_link."<br />".$sample ; |
|
1457 | + //echo $post_link."<br />".$sample ; |
|
1458 | 1458 | |
1459 | 1459 | |
1460 | - global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache, $gd_cache_post; |
|
1461 | - if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) { |
|
1462 | - if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;} |
|
1463 | - } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) { |
|
1464 | - return $post_link; |
|
1465 | - } else { |
|
1466 | - $orig_post = $post; |
|
1467 | - $post = $post_obj; |
|
1468 | - } |
|
1460 | + global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache, $gd_cache_post; |
|
1461 | + if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) { |
|
1462 | + if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;} |
|
1463 | + } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) { |
|
1464 | + return $post_link; |
|
1465 | + } else { |
|
1466 | + $orig_post = $post; |
|
1467 | + $post = $post_obj; |
|
1468 | + } |
|
1469 | 1469 | |
1470 | 1470 | |
1471 | 1471 | |
1472 | - if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit; |
|
1472 | + if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit; |
|
1473 | 1473 | |
1474 | 1474 | |
1475 | - // if we dont have a GD post then try to grab it |
|
1476 | - if(!isset($post->default_category)){ |
|
1477 | - $gd_post = geodir_get_post_info($post->ID); |
|
1478 | - if(!empty($gd_post)){ |
|
1479 | - $post = $gd_post; |
|
1480 | - } |
|
1481 | - } |
|
1475 | + // if we dont have a GD post then try to grab it |
|
1476 | + if(!isset($post->default_category)){ |
|
1477 | + $gd_post = geodir_get_post_info($post->ID); |
|
1478 | + if(!empty($gd_post)){ |
|
1479 | + $post = $gd_post; |
|
1480 | + } |
|
1481 | + } |
|
1482 | 1482 | |
1483 | 1483 | |
1484 | - $post_types = get_option('geodir_post_types'); |
|
1485 | - $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
1484 | + $post_types = get_option('geodir_post_types'); |
|
1485 | + $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
1486 | 1486 | |
1487 | - // Alter the CPT slug if WPML is set to do so |
|
1488 | - if(geodir_wpml_is_post_type_translated($post->post_type)){ |
|
1489 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1487 | + // Alter the CPT slug if WPML is set to do so |
|
1488 | + if(geodir_wpml_is_post_type_translated($post->post_type)){ |
|
1489 | + if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1490 | 1490 | |
1491 | - $org_slug = $slug; |
|
1492 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1493 | - $slug, |
|
1494 | - 'WordPress', |
|
1495 | - 'URL slug: ' . $slug, |
|
1496 | - $language_code); |
|
1491 | + $org_slug = $slug; |
|
1492 | + $slug = apply_filters( 'wpml_translate_single_string', |
|
1493 | + $slug, |
|
1494 | + 'WordPress', |
|
1495 | + 'URL slug: ' . $slug, |
|
1496 | + $language_code); |
|
1497 | 1497 | |
1498 | - if(!$slug){$slug = $org_slug;} |
|
1498 | + if(!$slug){$slug = $org_slug;} |
|
1499 | 1499 | |
1500 | - } |
|
1501 | - } |
|
1500 | + } |
|
1501 | + } |
|
1502 | 1502 | |
1503 | - if (function_exists('geodir_location_geo_home_link')) { |
|
1504 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
1505 | - } |
|
1503 | + if (function_exists('geodir_location_geo_home_link')) { |
|
1504 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
1505 | + } |
|
1506 | 1506 | |
1507 | - // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
1508 | - $site_url = trailingslashit(get_bloginfo('url')); |
|
1507 | + // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
1508 | + $site_url = trailingslashit(get_bloginfo('url')); |
|
1509 | 1509 | |
1510 | - if (function_exists('geodir_location_geo_home_link')) { |
|
1511 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
1512 | - } |
|
1513 | - |
|
1514 | - $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
1515 | - if ($fix_url) { |
|
1516 | - $post_link = str_replace($site_url, '', $post_link); |
|
1517 | - } |
|
1518 | - |
|
1519 | - $post_link = trailingslashit( |
|
1520 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1521 | - ); |
|
1522 | - |
|
1523 | - if ($fix_url) { |
|
1524 | - $post_link = $site_url . $post_link; |
|
1525 | - } |
|
1526 | - |
|
1527 | - if (isset($comment_post_cache[$post->ID])) { |
|
1528 | - $post = $comment_post_cache[$post->ID]; |
|
1529 | - } |
|
1530 | - if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) { |
|
1531 | - $post_id = $post->ID; |
|
1532 | - if (isset($orig_post)) { |
|
1533 | - $post = $orig_post; |
|
1534 | - } |
|
1535 | - return $gd_permalink_cache[$post_id]; |
|
1536 | - } |
|
1510 | + if (function_exists('geodir_location_geo_home_link')) { |
|
1511 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
1512 | + } |
|
1537 | 1513 | |
1538 | - if (!isset($post->post_locations)) { |
|
1539 | - $post_type = $post->post_type; |
|
1540 | - $ID = $post->ID; |
|
1541 | - $post2 = $wpdb->get_row( |
|
1542 | - $wpdb->prepare( |
|
1543 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1544 | - array($post->ID) |
|
1545 | - ) |
|
1546 | - ); |
|
1514 | + $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
1515 | + if ($fix_url) { |
|
1516 | + $post_link = str_replace($site_url, '', $post_link); |
|
1517 | + } |
|
1547 | 1518 | |
1548 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1519 | + $post_link = trailingslashit( |
|
1520 | + preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1521 | + ); |
|
1549 | 1522 | |
1550 | - $comment_post_cache[$post->ID] = $post; |
|
1551 | - } |
|
1523 | + if ($fix_url) { |
|
1524 | + $post_link = $site_url . $post_link; |
|
1525 | + } |
|
1552 | 1526 | |
1527 | + if (isset($comment_post_cache[$post->ID])) { |
|
1528 | + $post = $comment_post_cache[$post->ID]; |
|
1529 | + } |
|
1530 | + if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) { |
|
1531 | + $post_id = $post->ID; |
|
1532 | + if (isset($orig_post)) { |
|
1533 | + $post = $orig_post; |
|
1534 | + } |
|
1535 | + return $gd_permalink_cache[$post_id]; |
|
1536 | + } |
|
1553 | 1537 | |
1538 | + if (!isset($post->post_locations)) { |
|
1539 | + $post_type = $post->post_type; |
|
1540 | + $ID = $post->ID; |
|
1541 | + $post2 = $wpdb->get_row( |
|
1542 | + $wpdb->prepare( |
|
1543 | + "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1544 | + array($post->ID) |
|
1545 | + ) |
|
1546 | + ); |
|
1554 | 1547 | |
1555 | - if (false !== strpos($post_link, '%gd_taxonomy%')) { |
|
1548 | + $post = (object)array_merge((array)$post, (array)$post2); |
|
1556 | 1549 | |
1557 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1558 | - $location_request = ''; |
|
1550 | + $comment_post_cache[$post->ID] = $post; |
|
1551 | + } |
|
1559 | 1552 | |
1560 | 1553 | |
1561 | - if (!empty($post->post_locations)) { |
|
1562 | - $geodir_arr_locations = explode(',', $post->post_locations); |
|
1563 | - if (count($geodir_arr_locations) == 3) { |
|
1564 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1565 | - $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1566 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1567 | - $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1568 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1569 | - $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1570 | 1554 | |
1571 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1572 | - 'region_slug' => $post->region_slug, |
|
1573 | - 'city_slug' => $post->city_slug |
|
1574 | - ); |
|
1555 | + if (false !== strpos($post_link, '%gd_taxonomy%')) { |
|
1575 | 1556 | |
1576 | - } else |
|
1577 | - $post_location = geodir_get_location(); |
|
1557 | + if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1558 | + $location_request = ''; |
|
1578 | 1559 | |
1579 | 1560 | |
1580 | - } else { |
|
1561 | + if (!empty($post->post_locations)) { |
|
1562 | + $geodir_arr_locations = explode(',', $post->post_locations); |
|
1563 | + if (count($geodir_arr_locations) == 3) { |
|
1564 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1565 | + $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1566 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1567 | + $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1568 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1569 | + $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1581 | 1570 | |
1582 | - $post_location_sql = $wpdb->get_results( |
|
1583 | - $wpdb->prepare( |
|
1584 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1585 | - array($post->ID) |
|
1586 | - ) |
|
1587 | - ); |
|
1588 | - |
|
1589 | - if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) { |
|
1590 | - |
|
1591 | - $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations); |
|
1592 | - if (count($geodir_arr_locations) == 3) { |
|
1593 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1594 | - $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1595 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1596 | - $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1597 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1598 | - $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1599 | - |
|
1600 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1601 | - 'region_slug' => $post->region_slug, |
|
1602 | - 'city_slug' => $post->city_slug |
|
1603 | - ); |
|
1571 | + $post_location = (object)array('country_slug' => $post->country_slug, |
|
1572 | + 'region_slug' => $post->region_slug, |
|
1573 | + 'city_slug' => $post->city_slug |
|
1574 | + ); |
|
1604 | 1575 | |
1605 | - } |
|
1606 | - } else |
|
1607 | - $post_location = geodir_get_location(); |
|
1608 | - } |
|
1576 | + } else |
|
1577 | + $post_location = geodir_get_location(); |
|
1578 | + |
|
1579 | + |
|
1580 | + } else { |
|
1581 | + |
|
1582 | + $post_location_sql = $wpdb->get_results( |
|
1583 | + $wpdb->prepare( |
|
1584 | + "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1585 | + array($post->ID) |
|
1586 | + ) |
|
1587 | + ); |
|
1588 | + |
|
1589 | + if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) { |
|
1590 | + |
|
1591 | + $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations); |
|
1592 | + if (count($geodir_arr_locations) == 3) { |
|
1593 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1594 | + $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1595 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1596 | + $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1597 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1598 | + $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1599 | + |
|
1600 | + $post_location = (object)array('country_slug' => $post->country_slug, |
|
1601 | + 'region_slug' => $post->region_slug, |
|
1602 | + 'city_slug' => $post->city_slug |
|
1603 | + ); |
|
1604 | + |
|
1605 | + } |
|
1606 | + } else |
|
1607 | + $post_location = geodir_get_location(); |
|
1608 | + } |
|
1609 | 1609 | |
1610 | 1610 | |
1611 | - if (!empty($post_location)) { |
|
1612 | - $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
1611 | + if (!empty($post_location)) { |
|
1612 | + $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
1613 | 1613 | $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
1614 | 1614 | $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
1615 | 1615 | |
@@ -1627,89 +1627,89 @@ discard block |
||
1627 | 1627 | $location_slug[] = $city_slug; |
1628 | 1628 | |
1629 | 1629 | $location_request .= implode('/', $location_slug) . '/'; |
1630 | - } |
|
1631 | - } |
|
1630 | + } |
|
1631 | + } |
|
1632 | 1632 | |
1633 | - if (get_option('geodir_add_categories_url')) { |
|
1633 | + if (get_option('geodir_add_categories_url')) { |
|
1634 | 1634 | |
1635 | - $term_request = ''; |
|
1636 | - $taxonomies = geodir_get_taxonomies($post->post_type); |
|
1637 | - $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : ''; |
|
1635 | + $term_request = ''; |
|
1636 | + $taxonomies = geodir_get_taxonomies($post->post_type); |
|
1637 | + $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : ''; |
|
1638 | 1638 | |
1639 | - if (!empty($post->default_category)) { |
|
1640 | - $post_terms = $post->default_category; |
|
1641 | - } else { |
|
1642 | - $post_terms = ''; |
|
1643 | - |
|
1644 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
|
1645 | - $post_terms = absint($_POST['post_default_category']); |
|
1646 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1647 | - $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
|
1648 | - $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
|
1649 | - }elseif (isset($post->{$taxonomies})) { |
|
1650 | - $post_terms = explode(",", trim($post->{$taxonomies}, ",")); |
|
1651 | - $post_terms = $post_terms[0]; |
|
1652 | - } |
|
1639 | + if (!empty($post->default_category)) { |
|
1640 | + $post_terms = $post->default_category; |
|
1641 | + } else { |
|
1642 | + $post_terms = ''; |
|
1643 | + |
|
1644 | + if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
|
1645 | + $post_terms = absint($_POST['post_default_category']); |
|
1646 | + }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1647 | + $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
|
1648 | + $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
|
1649 | + }elseif (isset($post->{$taxonomies})) { |
|
1650 | + $post_terms = explode(",", trim($post->{$taxonomies}, ",")); |
|
1651 | + $post_terms = $post_terms[0]; |
|
1652 | + } |
|
1653 | 1653 | |
1654 | - if (!$post_terms) |
|
1655 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1654 | + if (!$post_terms) |
|
1655 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1656 | 1656 | |
1657 | - if (!$post_terms) { |
|
1658 | - $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
1657 | + if (!$post_terms) { |
|
1658 | + $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
1659 | 1659 | |
1660 | - if ($post_terms) { |
|
1661 | - $post_terms = explode(",", trim($post_terms, ",")); |
|
1662 | - $post_terms = $post_terms[0]; |
|
1663 | - } |
|
1664 | - } |
|
1665 | - } |
|
1660 | + if ($post_terms) { |
|
1661 | + $post_terms = explode(",", trim($post_terms, ",")); |
|
1662 | + $post_terms = $post_terms[0]; |
|
1663 | + } |
|
1664 | + } |
|
1665 | + } |
|
1666 | 1666 | |
1667 | - $term = get_term_by('id', $post_terms, $taxonomies); |
|
1667 | + $term = get_term_by('id', $post_terms, $taxonomies); |
|
1668 | 1668 | |
1669 | - if (!empty($term)) |
|
1670 | - $term_request = $term->slug; |
|
1671 | - //$term_request = $term->slug.'/'; |
|
1672 | - } |
|
1669 | + if (!empty($term)) |
|
1670 | + $term_request = $term->slug; |
|
1671 | + //$term_request = $term->slug.'/'; |
|
1672 | + } |
|
1673 | 1673 | |
1674 | - $request_term = ''; |
|
1675 | - $listingurl_separator = ''; |
|
1676 | - //$detailurl_separator = get_option('geodir_detailurl_separator'); |
|
1677 | - $detailurl_separator = ''; |
|
1678 | - if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') { |
|
1679 | - $request_term = $location_request; |
|
1680 | - //$listingurl_separator = get_option('geodir_listingurl_separator'); |
|
1681 | - //$request_term .= $listingurl_separator.'/'.$term_request; |
|
1682 | - $request_term .= $term_request; |
|
1674 | + $request_term = ''; |
|
1675 | + $listingurl_separator = ''; |
|
1676 | + //$detailurl_separator = get_option('geodir_detailurl_separator'); |
|
1677 | + $detailurl_separator = ''; |
|
1678 | + if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') { |
|
1679 | + $request_term = $location_request; |
|
1680 | + //$listingurl_separator = get_option('geodir_listingurl_separator'); |
|
1681 | + //$request_term .= $listingurl_separator.'/'.$term_request; |
|
1682 | + $request_term .= $term_request; |
|
1683 | 1683 | |
1684 | - } else { |
|
1685 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1684 | + } else { |
|
1685 | + if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1686 | 1686 | |
1687 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1688 | - } |
|
1689 | - $request_term = trim($request_term, '/'); |
|
1687 | + if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1688 | + } |
|
1689 | + $request_term = trim($request_term, '/'); |
|
1690 | 1690 | |
1691 | - // Fix with WPML the location terms added twice when CPT slug is translated. |
|
1692 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) { |
|
1693 | - $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
|
1694 | - } |
|
1691 | + // Fix with WPML the location terms added twice when CPT slug is translated. |
|
1692 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) { |
|
1693 | + $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
|
1694 | + } |
|
1695 | 1695 | |
1696 | - if (!empty($request_term)) |
|
1697 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1698 | - else |
|
1699 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1700 | - //echo $post_link ; |
|
1701 | - } |
|
1702 | - // temp cache the permalink |
|
1703 | - if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) { |
|
1704 | - $gd_permalink_cache[$post->ID] = $post_link; |
|
1705 | - } |
|
1706 | - } |
|
1707 | - if (isset($orig_post)) { |
|
1708 | - $post = $orig_post; |
|
1709 | - } |
|
1696 | + if (!empty($request_term)) |
|
1697 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1698 | + else |
|
1699 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1700 | + //echo $post_link ; |
|
1701 | + } |
|
1702 | + // temp cache the permalink |
|
1703 | + if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) { |
|
1704 | + $gd_permalink_cache[$post->ID] = $post_link; |
|
1705 | + } |
|
1706 | + } |
|
1707 | + if (isset($orig_post)) { |
|
1708 | + $post = $orig_post; |
|
1709 | + } |
|
1710 | 1710 | $gd_cache_post = $post; |
1711 | 1711 | |
1712 | - return $post_link; |
|
1712 | + return $post_link; |
|
1713 | 1713 | } |
1714 | 1714 | |
1715 | 1715 | /** |
@@ -1725,73 +1725,73 @@ discard block |
||
1725 | 1725 | * @return string The term link. |
1726 | 1726 | */ |
1727 | 1727 | function geodir_term_link($termlink, $term, $taxonomy) { |
1728 | - $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1728 | + $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1729 | 1729 | |
1730 | - if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) { |
|
1731 | - global $geodir_add_location_url, $gd_session; |
|
1732 | - $orig_termlink = $termlink; |
|
1730 | + if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) { |
|
1731 | + global $geodir_add_location_url, $gd_session; |
|
1732 | + $orig_termlink = $termlink; |
|
1733 | 1733 | $include_location = false; |
1734 | - $request_term = array(); |
|
1735 | - $add_location_url = get_option('geodir_add_location_url'); |
|
1736 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1734 | + $request_term = array(); |
|
1735 | + $add_location_url = get_option('geodir_add_location_url'); |
|
1736 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1737 | 1737 | |
1738 | - $listing_slug = geodir_get_listing_slug($taxonomy); |
|
1738 | + $listing_slug = geodir_get_listing_slug($taxonomy); |
|
1739 | 1739 | |
1740 | - if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') { |
|
1741 | - if ($geodir_add_location_url && $add_location_url) { |
|
1742 | - $include_location = true; |
|
1743 | - } |
|
1744 | - } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) { |
|
1745 | - $include_location = true; |
|
1746 | - } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) { |
|
1747 | - $include_location = true; |
|
1748 | - } |
|
1749 | - |
|
1750 | - if ($include_location) { |
|
1751 | - global $post; |
|
1752 | - $location_terms = array(); |
|
1740 | + if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') { |
|
1741 | + if ($geodir_add_location_url && $add_location_url) { |
|
1742 | + $include_location = true; |
|
1743 | + } |
|
1744 | + } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) { |
|
1745 | + $include_location = true; |
|
1746 | + } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) { |
|
1747 | + $include_location = true; |
|
1748 | + } |
|
1749 | + |
|
1750 | + if ($include_location) { |
|
1751 | + global $post; |
|
1752 | + $location_terms = array(); |
|
1753 | 1753 | |
1754 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1754 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1755 | 1755 | |
1756 | - if (geodir_is_page('detail')) { |
|
1757 | - if (!isset($post->country_slug) && !empty($post->post_locations)) { |
|
1758 | - $post_locations = explode(',', $post->post_locations); |
|
1759 | - |
|
1760 | - if (count($post_locations) == 3) { |
|
1761 | - $post->city_slug = str_replace('[', '', $post_locations[0]); |
|
1762 | - $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1763 | - $post->region_slug = str_replace('[', '', $post_locations[1]); |
|
1764 | - $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1765 | - $post->country_slug = str_replace('[', '', $post_locations[2]); |
|
1766 | - $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1767 | - } |
|
1768 | - } |
|
1756 | + if (geodir_is_page('detail')) { |
|
1757 | + if (!isset($post->country_slug) && !empty($post->post_locations)) { |
|
1758 | + $post_locations = explode(',', $post->post_locations); |
|
1759 | + |
|
1760 | + if (count($post_locations) == 3) { |
|
1761 | + $post->city_slug = str_replace('[', '', $post_locations[0]); |
|
1762 | + $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1763 | + $post->region_slug = str_replace('[', '', $post_locations[1]); |
|
1764 | + $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1765 | + $post->country_slug = str_replace('[', '', $post_locations[2]); |
|
1766 | + $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1767 | + } |
|
1768 | + } |
|
1769 | 1769 | |
1770 | - if (isset($post->country_slug)) { |
|
1771 | - $location_terms = array( |
|
1772 | - 'gd_country' => $post->country_slug, |
|
1773 | - 'gd_region' => $post->region_slug, |
|
1774 | - 'gd_city' => $post->city_slug |
|
1775 | - ); |
|
1770 | + if (isset($post->country_slug)) { |
|
1771 | + $location_terms = array( |
|
1772 | + 'gd_country' => $post->country_slug, |
|
1773 | + 'gd_region' => $post->region_slug, |
|
1774 | + 'gd_city' => $post->city_slug |
|
1775 | + ); |
|
1776 | 1776 | |
1777 | - if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1778 | - $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
1779 | - } |
|
1780 | - } |
|
1781 | - } |
|
1777 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1778 | + $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
1779 | + } |
|
1780 | + } |
|
1781 | + } |
|
1782 | 1782 | |
1783 | - if (empty($location_terms)) { |
|
1784 | - $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1785 | - } |
|
1783 | + if (empty($location_terms)) { |
|
1784 | + $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1785 | + } |
|
1786 | 1786 | |
1787 | - $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1788 | - $location_terms = geodir_remove_location_terms($location_terms); |
|
1787 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1788 | + $location_terms = geodir_remove_location_terms($location_terms); |
|
1789 | 1789 | |
1790 | - if (!empty($location_terms)) { |
|
1791 | - $url_separator = ''; |
|
1790 | + if (!empty($location_terms)) { |
|
1791 | + $url_separator = ''; |
|
1792 | 1792 | |
1793 | - if (get_option('permalink_structure') != '') { |
|
1794 | - $found = false; |
|
1793 | + if (get_option('permalink_structure') != '') { |
|
1794 | + $found = false; |
|
1795 | 1795 | $request_term = implode("/", $location_terms); |
1796 | 1796 | if (geodir_is_wpml()) { |
1797 | 1797 | $post_types = get_option('geodir_post_types'); |
@@ -1827,47 +1827,47 @@ discard block |
||
1827 | 1827 | |
1828 | 1828 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
1829 | 1829 | } |
1830 | - } else { |
|
1831 | - $termlink = geodir_getlink($termlink, $request_term); |
|
1832 | - } |
|
1833 | - } |
|
1834 | - } |
|
1830 | + } else { |
|
1831 | + $termlink = geodir_getlink($termlink, $request_term); |
|
1832 | + } |
|
1833 | + } |
|
1834 | + } |
|
1835 | 1835 | |
1836 | - // Alter the CPT slug is WPML is set to do so |
|
1837 | - /* we can replace this with the below function |
|
1836 | + // Alter the CPT slug is WPML is set to do so |
|
1837 | + /* we can replace this with the below function |
|
1838 | 1838 | if(geodir_is_wpml()){ |
1839 | 1839 | global $sitepress; |
1840 | 1840 | $post_type = str_replace("category","",$taxonomy); |
1841 | 1841 | $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type); |
1842 | 1842 | }*/ |
1843 | 1843 | |
1844 | - // Alter the CPT slug if WPML is set to do so |
|
1845 | - if (geodir_is_wpml()) { |
|
1846 | - $post_types = get_option('geodir_post_types'); |
|
1847 | - $post_type = str_replace("category","",$taxonomy); |
|
1848 | - $post_type = str_replace("_tags","",$post_type); |
|
1849 | - $slug = $post_types[$post_type]['rewrite']['slug']; |
|
1850 | - if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
|
1851 | - global $sitepress; |
|
1852 | - $default_lang = $sitepress->get_default_language(); |
|
1853 | - $language_code = gd_wpml_get_lang_from_url($orig_termlink); |
|
1854 | - if (!$language_code ) { |
|
1855 | - $language_code = $default_lang; |
|
1856 | - } |
|
1844 | + // Alter the CPT slug if WPML is set to do so |
|
1845 | + if (geodir_is_wpml()) { |
|
1846 | + $post_types = get_option('geodir_post_types'); |
|
1847 | + $post_type = str_replace("category","",$taxonomy); |
|
1848 | + $post_type = str_replace("_tags","",$post_type); |
|
1849 | + $slug = $post_types[$post_type]['rewrite']['slug']; |
|
1850 | + if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
|
1851 | + global $sitepress; |
|
1852 | + $default_lang = $sitepress->get_default_language(); |
|
1853 | + $language_code = gd_wpml_get_lang_from_url($orig_termlink); |
|
1854 | + if (!$language_code ) { |
|
1855 | + $language_code = $default_lang; |
|
1856 | + } |
|
1857 | 1857 | |
1858 | - $org_slug = $slug; |
|
1859 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code); |
|
1858 | + $org_slug = $slug; |
|
1859 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code); |
|
1860 | 1860 | |
1861 | - if (!$slug) { |
|
1862 | - $slug = $org_slug; |
|
1863 | - } |
|
1861 | + if (!$slug) { |
|
1862 | + $slug = $org_slug; |
|
1863 | + } |
|
1864 | 1864 | |
1865 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1)); |
|
1866 | - } |
|
1867 | - } |
|
1868 | - } |
|
1865 | + $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1)); |
|
1866 | + } |
|
1867 | + } |
|
1868 | + } |
|
1869 | 1869 | |
1870 | - return $termlink; |
|
1870 | + return $termlink; |
|
1871 | 1871 | } |
1872 | 1872 | |
1873 | 1873 | /** |
@@ -1893,14 +1893,14 @@ discard block |
||
1893 | 1893 | if (in_array($post_type, geodir_get_posttypes())) { |
1894 | 1894 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1895 | 1895 | if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
1896 | - $location_terms = array( |
|
1897 | - 'gd_country' => $post->country_slug, |
|
1898 | - 'gd_region' => $post->region_slug, |
|
1899 | - 'gd_city' => $post->city_slug |
|
1900 | - ); |
|
1901 | - } else { |
|
1902 | - $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1903 | - } |
|
1896 | + $location_terms = array( |
|
1897 | + 'gd_country' => $post->country_slug, |
|
1898 | + 'gd_region' => $post->region_slug, |
|
1899 | + 'gd_city' => $post->city_slug |
|
1900 | + ); |
|
1901 | + } else { |
|
1902 | + $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1903 | + } |
|
1904 | 1904 | |
1905 | 1905 | $location_terms = geodir_remove_location_terms($location_terms); |
1906 | 1906 | |
@@ -1932,17 +1932,17 @@ discard block |
||
1932 | 1932 | * @return void|string Label. |
1933 | 1933 | */ |
1934 | 1934 | function get_post_type_singular_label($post_type, $echo = false, $translate = false) { |
1935 | - $obj_post_type = get_post_type_object($post_type); |
|
1936 | - if (!is_object($obj_post_type)) { |
|
1937 | - return; |
|
1938 | - } |
|
1935 | + $obj_post_type = get_post_type_object($post_type); |
|
1936 | + if (!is_object($obj_post_type)) { |
|
1937 | + return; |
|
1938 | + } |
|
1939 | 1939 | |
1940 | - $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
1940 | + $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
1941 | 1941 | |
1942 | - if ($echo) |
|
1943 | - echo $label; |
|
1944 | - else |
|
1945 | - return $label; |
|
1942 | + if ($echo) |
|
1943 | + echo $label; |
|
1944 | + else |
|
1945 | + return $label; |
|
1946 | 1946 | } |
1947 | 1947 | |
1948 | 1948 | /** |
@@ -1957,19 +1957,19 @@ discard block |
||
1957 | 1957 | * @return void|string Label. |
1958 | 1958 | */ |
1959 | 1959 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) { |
1960 | - $all_postypes = geodir_get_posttypes(); |
|
1960 | + $all_postypes = geodir_get_posttypes(); |
|
1961 | 1961 | |
1962 | - if (!in_array($post_type, $all_postypes)) |
|
1963 | - return false; |
|
1962 | + if (!in_array($post_type, $all_postypes)) |
|
1963 | + return false; |
|
1964 | 1964 | |
1965 | - $obj_post_type = get_post_type_object($post_type); |
|
1965 | + $obj_post_type = get_post_type_object($post_type); |
|
1966 | 1966 | |
1967 | - $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
1967 | + $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
1968 | 1968 | |
1969 | - if ($echo) |
|
1970 | - echo $label; |
|
1971 | - else |
|
1972 | - return $label; |
|
1969 | + if ($echo) |
|
1970 | + echo $label; |
|
1971 | + else |
|
1972 | + return $label; |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | 1975 | /** |
@@ -1987,51 +1987,51 @@ discard block |
||
1987 | 1987 | */ |
1988 | 1988 | function geodir_term_exists($term, $taxonomy = '', $parent = 0) |
1989 | 1989 | { |
1990 | - global $wpdb; |
|
1991 | - |
|
1992 | - $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
1993 | - $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
1994 | - |
|
1995 | - if (is_int($term)) { |
|
1996 | - if (0 == $term) |
|
1997 | - return 0; |
|
1998 | - $where = 't.term_id = %d'; |
|
1999 | - if (!empty($taxonomy)) |
|
2000 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2001 | - else |
|
2002 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2003 | - } |
|
1990 | + global $wpdb; |
|
1991 | + |
|
1992 | + $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
1993 | + $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
1994 | + |
|
1995 | + if (is_int($term)) { |
|
1996 | + if (0 == $term) |
|
1997 | + return 0; |
|
1998 | + $where = 't.term_id = %d'; |
|
1999 | + if (!empty($taxonomy)) |
|
2000 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2001 | + else |
|
2002 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2003 | + } |
|
2004 | 2004 | |
2005 | - $term = trim(wp_unslash($term)); |
|
2005 | + $term = trim(wp_unslash($term)); |
|
2006 | 2006 | |
2007 | - if ('' === $slug = sanitize_title($term)) |
|
2008 | - return 0; |
|
2007 | + if ('' === $slug = sanitize_title($term)) |
|
2008 | + return 0; |
|
2009 | 2009 | |
2010 | - $where = 't.slug = %s'; |
|
2010 | + $where = 't.slug = %s'; |
|
2011 | 2011 | |
2012 | - $where_fields = array($slug); |
|
2013 | - if (!empty($taxonomy)) { |
|
2014 | - $parent = (int)$parent; |
|
2015 | - if ($parent > 0) { |
|
2016 | - $where_fields[] = $parent; |
|
2017 | - $else_where_fields[] = $parent; |
|
2018 | - $where .= ' AND tt.parent = %d'; |
|
2012 | + $where_fields = array($slug); |
|
2013 | + if (!empty($taxonomy)) { |
|
2014 | + $parent = (int)$parent; |
|
2015 | + if ($parent > 0) { |
|
2016 | + $where_fields[] = $parent; |
|
2017 | + $else_where_fields[] = $parent; |
|
2018 | + $where .= ' AND tt.parent = %d'; |
|
2019 | 2019 | |
2020 | - } |
|
2020 | + } |
|
2021 | 2021 | |
2022 | - $where_fields[] = $taxonomy; |
|
2022 | + $where_fields[] = $taxonomy; |
|
2023 | 2023 | |
2024 | 2024 | |
2025 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
2026 | - return $result; |
|
2025 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
2026 | + return $result; |
|
2027 | 2027 | |
2028 | - return false; |
|
2029 | - } |
|
2028 | + return false; |
|
2029 | + } |
|
2030 | 2030 | |
2031 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
2032 | - return $result; |
|
2031 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
2032 | + return $result; |
|
2033 | 2033 | |
2034 | - return false; |
|
2034 | + return false; |
|
2035 | 2035 | } |
2036 | 2036 | |
2037 | 2037 | /** |
@@ -2043,7 +2043,7 @@ discard block |
||
2043 | 2043 | function geodir_get_term_icon_rebuild() |
2044 | 2044 | { |
2045 | 2045 | |
2046 | - update_option('gd_term_icons', ''); |
|
2046 | + update_option('gd_term_icons', ''); |
|
2047 | 2047 | |
2048 | 2048 | } |
2049 | 2049 | |
@@ -2061,61 +2061,61 @@ discard block |
||
2061 | 2061 | */ |
2062 | 2062 | function geodir_get_term_icon($term_id = false, $rebuild = false) |
2063 | 2063 | { |
2064 | - global $wpdb; |
|
2065 | - if (!$rebuild) { |
|
2066 | - $terms_icons = get_option('gd_term_icons'); |
|
2067 | - } else { |
|
2068 | - $terms_icons = array(); |
|
2069 | - } |
|
2070 | - |
|
2071 | - if (empty($terms_icons)) { |
|
2072 | - $terms_icons = array(); |
|
2073 | - $default_icon_url = get_option('geodir_default_marker_icon'); |
|
2074 | - $taxonomy = geodir_get_taxonomies(); |
|
2075 | - $post_types = geodir_get_posttypes(); |
|
2076 | - $tax_arr = array(); |
|
2077 | - foreach ($post_types as $post_type) { |
|
2078 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
2079 | - } |
|
2080 | - $tax_c = implode(',', $tax_arr); |
|
2081 | - $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
|
2082 | - //$terms = get_terms( $taxonomy ); |
|
2083 | - |
|
2084 | - if($terms) { |
|
2085 | - foreach ($terms as $term) { |
|
2086 | - $post_type = str_replace("category", "", $term->taxonomy); |
|
2087 | - $a_terms[$post_type][] = $term; |
|
2064 | + global $wpdb; |
|
2065 | + if (!$rebuild) { |
|
2066 | + $terms_icons = get_option('gd_term_icons'); |
|
2067 | + } else { |
|
2068 | + $terms_icons = array(); |
|
2069 | + } |
|
2088 | 2070 | |
2089 | - } |
|
2090 | - } |
|
2071 | + if (empty($terms_icons)) { |
|
2072 | + $terms_icons = array(); |
|
2073 | + $default_icon_url = get_option('geodir_default_marker_icon'); |
|
2074 | + $taxonomy = geodir_get_taxonomies(); |
|
2075 | + $post_types = geodir_get_posttypes(); |
|
2076 | + $tax_arr = array(); |
|
2077 | + foreach ($post_types as $post_type) { |
|
2078 | + $tax_arr[] = "'" . $post_type . "category'"; |
|
2079 | + } |
|
2080 | + $tax_c = implode(',', $tax_arr); |
|
2081 | + $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
|
2082 | + //$terms = get_terms( $taxonomy ); |
|
2091 | 2083 | |
2092 | - if($a_terms) { |
|
2093 | - foreach ($a_terms as $pt => $t2) { |
|
2084 | + if($terms) { |
|
2085 | + foreach ($terms as $term) { |
|
2086 | + $post_type = str_replace("category", "", $term->taxonomy); |
|
2087 | + $a_terms[$post_type][] = $term; |
|
2094 | 2088 | |
2095 | - foreach ($t2 as $term) { |
|
2096 | - $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
2097 | - if ($term_icon) { |
|
2098 | - $term_icon_url = $term_icon["src"]; |
|
2099 | - } else { |
|
2100 | - $term_icon_url = $default_icon_url; |
|
2101 | - } |
|
2102 | - $terms_icons[$term->term_id] = $term_icon_url; |
|
2103 | - } |
|
2104 | - } |
|
2105 | - } |
|
2089 | + } |
|
2090 | + } |
|
2106 | 2091 | |
2107 | - update_option('gd_term_icons', $terms_icons); |
|
2108 | - } |
|
2092 | + if($a_terms) { |
|
2093 | + foreach ($a_terms as $pt => $t2) { |
|
2109 | 2094 | |
2110 | - if ($term_id && isset($terms_icons[$term_id])) { |
|
2111 | - return $terms_icons[$term_id]; |
|
2112 | - } elseif ($term_id && !isset($terms_icons[$term_id])) { |
|
2113 | - return get_option('geodir_default_marker_icon'); |
|
2114 | - } |
|
2095 | + foreach ($t2 as $term) { |
|
2096 | + $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
2097 | + if ($term_icon) { |
|
2098 | + $term_icon_url = $term_icon["src"]; |
|
2099 | + } else { |
|
2100 | + $term_icon_url = $default_icon_url; |
|
2101 | + } |
|
2102 | + $terms_icons[$term->term_id] = $term_icon_url; |
|
2103 | + } |
|
2104 | + } |
|
2105 | + } |
|
2106 | + |
|
2107 | + update_option('gd_term_icons', $terms_icons); |
|
2108 | + } |
|
2109 | + |
|
2110 | + if ($term_id && isset($terms_icons[$term_id])) { |
|
2111 | + return $terms_icons[$term_id]; |
|
2112 | + } elseif ($term_id && !isset($terms_icons[$term_id])) { |
|
2113 | + return get_option('geodir_default_marker_icon'); |
|
2114 | + } |
|
2115 | 2115 | |
2116 | - if (is_ssl()) { |
|
2117 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
2118 | - } |
|
2116 | + if (is_ssl()) { |
|
2117 | + $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
2118 | + } |
|
2119 | 2119 | |
2120 | - return apply_filters('geodir_get_term_icons', $terms_icons, $term_id); |
|
2120 | + return apply_filters('geodir_get_term_icons', $terms_icons, $term_id); |
|
2121 | 2121 | } |
2122 | 2122 | \ No newline at end of file |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | * @since 1.0.0 |
61 | 61 | * @param string $menu_class The menu HTML class. |
62 | 62 | */ |
63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
64 | 64 | /** |
65 | 65 | * Filter the menu a class. |
66 | 66 | * |
67 | 67 | * @since 1.0.0 |
68 | 68 | */ |
69 | 69 | $a_class = apply_filters('geodir_menu_a_class', ''); |
70 | - $items .= '<li class="' . $li_class . '"> |
|
71 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
|
72 | - ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
|
70 | + $items .= '<li class="'.$li_class.'"> |
|
71 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'"> |
|
72 | + ' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').' |
|
73 | 73 | </a> |
74 | 74 | </li>'; |
75 | 75 | } |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * @since 1.0.0 |
89 | 89 | * @param string $menu_class The menu HTML class. |
90 | 90 | */ |
91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class); |
|
92 | 92 | /** |
93 | 93 | * Filter the sub menu li class. |
94 | 94 | * |
95 | 95 | * @since 1.0.0 |
96 | 96 | * @param string $menu_class The menu HTML class. |
97 | 97 | */ |
98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class); |
|
99 | 99 | /** |
100 | 100 | * Filter the sub menu ul class. |
101 | 101 | * |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * @since 1.0.0 |
115 | 115 | */ |
116 | 116 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
117 | - $items .= '<li class="' . $li_class . '"> |
|
118 | - <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a> |
|
119 | - <ul class="' . $sub_ul_class . '">'; |
|
117 | + $items .= '<li class="'.$li_class.'"> |
|
118 | + <a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a> |
|
119 | + <ul class="' . $sub_ul_class.'">'; |
|
120 | 120 | $post_types = geodir_get_posttypes('object'); |
121 | 121 | |
122 | 122 | $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
134 | 134 | $menu_class = 'current-menu-item'; |
135 | 135 | |
136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
137 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
|
138 | - ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
|
136 | + $items .= '<li class="'.$sub_li_class.'"> |
|
137 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'"> |
|
138 | + ' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').' |
|
139 | 139 | </a> |
140 | 140 | </li>'; |
141 | 141 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.5.9 |
153 | 153 | */ |
154 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
154 | + $items .= apply_filters('geodir_menu_after_sub_ul', ''); |
|
155 | 155 | $items .= '</li>'; |
156 | 156 | } |
157 | 157 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @since 1.0.0 |
185 | 185 | * @param string $menu_class The menu HTML class. |
186 | 186 | */ |
187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
188 | 188 | /** |
189 | 189 | * Filter the menu a class. |
190 | 190 | * |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | */ |
193 | 193 | $a_class = apply_filters('geodir_menu_a_class', ''); |
194 | 194 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
195 | - $items .= '<li class="' . $li_class . '"> |
|
196 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
|
197 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
195 | + $items .= '<li class="'.$li_class.'"> |
|
196 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'"> |
|
197 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).' |
|
198 | 198 | </a> |
199 | 199 | </li>'; |
200 | 200 | } |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * @since 1.0.0 |
219 | 219 | * @param string $menu_class The menu HTML class. |
220 | 220 | */ |
221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class); |
|
222 | 222 | /** |
223 | 223 | * Filter the sub menu li class. |
224 | 224 | * |
225 | 225 | * @since 1.0.0 |
226 | 226 | * @param string $menu_class The menu HTML class. |
227 | 227 | */ |
228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class); |
|
229 | 229 | /** |
230 | 230 | * Filter the sub menu ul class. |
231 | 231 | * |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @since 1.0.0 |
245 | 245 | */ |
246 | 246 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
247 | - $items .= '<li class="' . $li_class . '"> |
|
248 | - <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a> |
|
249 | - <ul class="' . $sub_ul_class . '">'; |
|
247 | + $items .= '<li class="'.$li_class.'"> |
|
248 | + <a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a> |
|
249 | + <ul class="' . $sub_ul_class.'">'; |
|
250 | 250 | |
251 | 251 | $post_types = geodir_get_posttypes('object'); |
252 | 252 | |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @since 1.0.0 |
270 | 270 | * @param string $menu_class The menu HTML class. |
271 | 271 | */ |
272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
273 | 273 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
274 | - $items .= '<li class="' . $sub_li_class . '"> |
|
275 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
|
276 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
274 | + $items .= '<li class="'.$sub_li_class.'"> |
|
275 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'"> |
|
276 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).' |
|
277 | 277 | </a> |
278 | 278 | </li>'; |
279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | $items .= ' </ul> '; |
288 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
288 | + $items .= apply_filters('geodir_menu_after_sub_ul', ''); |
|
289 | 289 | $items .= '</li>'; |
290 | 290 | |
291 | 291 | } |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | $geodir_theme_location = get_option('geodir_theme_location_nav'); |
314 | 314 | $geodir_theme_location_nav = array(); |
315 | 315 | if (empty($locations) && empty($geodir_theme_location)) { |
316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu); |
|
317 | 317 | $geodir_theme_location_nav[] = $args['theme_location']; |
318 | 318 | update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
319 | 319 | } |
320 | 320 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
322 | 322 | else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu); |
|
324 | 324 | |
325 | 325 | return $menu; |
326 | 326 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
350 | 350 | |
351 | - $items = $items . geodir_add_nav_menu_items(); |
|
351 | + $items = $items.geodir_add_nav_menu_items(); |
|
352 | 352 | return $items; |
353 | 353 | |
354 | 354 | } else { |
@@ -373,12 +373,12 @@ discard block |
||
373 | 373 | |
374 | 374 | $taxonomies = geodir_get_taxonomies(); |
375 | 375 | $taxonomies = implode("','", $taxonomies); |
376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
376 | + $taxonomies = "'".$taxonomies."'"; |
|
377 | 377 | |
378 | 378 | $pn_categories = $wpdb->get_results( |
379 | 379 | $wpdb->prepare( |
380 | 380 | "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
381 | - array($wpdb->terms . term_id) |
|
381 | + array($wpdb->terms.term_id) |
|
382 | 382 | ) |
383 | 383 | ); |
384 | 384 | |
@@ -405,13 +405,13 @@ discard block |
||
405 | 405 | global $wp_query, $post, $geodir_post_type; |
406 | 406 | |
407 | 407 | $geodir_post_type = get_query_var('post_type'); |
408 | - if (is_array($geodir_post_type) && ! empty($geodir_post_type[0])) { |
|
408 | + if (is_array($geodir_post_type) && !empty($geodir_post_type[0])) { |
|
409 | 409 | $geodir_post_type = $geodir_post_type[0]; |
410 | 410 | } |
411 | 411 | |
412 | 412 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
413 | 413 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
414 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
414 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
415 | 415 | elseif (isset($_REQUEST['listing_type'])) |
416 | 416 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
417 | 417 | } |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
438 | 438 | $geodir_post_type = ''; |
439 | 439 | |
440 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
|
440 | + if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) { |
|
441 | 441 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
442 | 442 | } |
443 | 443 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * |
448 | 448 | * @since 1.6.9 |
449 | 449 | */ |
450 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type); |
|
450 | + return apply_filters('geodir_get_current_posttype', $geodir_post_type); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -461,18 +461,18 @@ discard block |
||
461 | 461 | */ |
462 | 462 | function geodir_get_default_posttype() |
463 | 463 | { |
464 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
464 | + $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object')); |
|
465 | 465 | |
466 | 466 | $stype = false; |
467 | - foreach ( $post_types as $post_type => $info ) { |
|
467 | + foreach ($post_types as $post_type => $info) { |
|
468 | 468 | global $wpdb; |
469 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
470 | - if ( $has_posts ) { |
|
469 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type)); |
|
470 | + if ($has_posts) { |
|
471 | 471 | $stype = $post_type; break; |
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | - if(!$stype){ |
|
475 | + if (!$stype) { |
|
476 | 476 | $stype = 'gd_place'; |
477 | 477 | } |
478 | 478 | |
@@ -497,14 +497,14 @@ discard block |
||
497 | 497 | switch ($output): |
498 | 498 | case 'object': |
499 | 499 | case 'Object': |
500 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
500 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
501 | 501 | break; |
502 | 502 | case 'array': |
503 | 503 | case 'Array': |
504 | - $post_types = (array)$post_types; |
|
504 | + $post_types = (array) $post_types; |
|
505 | 505 | break; |
506 | 506 | case 'options': |
507 | - $post_types = (array)$post_types; |
|
507 | + $post_types = (array) $post_types; |
|
508 | 508 | |
509 | 509 | $options = array(); |
510 | 510 | if (!empty($post_types)) { |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $gd_taxonomies[] = $taxonomy; |
573 | 573 | } |
574 | 574 | |
575 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') { |
|
575 | + if ($tages_taxonomies === false && substr($taxonomy, -5) == '_tags') { |
|
576 | 576 | if (array_search($taxonomy, $gd_taxonomies) !== false) { |
577 | 577 | unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
578 | 578 | } |
@@ -618,15 +618,15 @@ discard block |
||
618 | 618 | |
619 | 619 | $categories = get_terms($taxonomies); |
620 | 620 | |
621 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
621 | + $html .= '<option value="0">'.__('All', 'geodirectory').'</option>'; |
|
622 | 622 | |
623 | 623 | foreach ($categories as $category_obj) { |
624 | 624 | $select_opt = ''; |
625 | 625 | if ($selected == $category_obj->term_id) { |
626 | 626 | $select_opt = 'selected="selected"'; |
627 | 627 | } |
628 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
629 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
628 | + $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">' |
|
629 | + . geodir_utf8_ucfirst($category_obj->name).'</option>'; |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | if ($echo) |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | } elseif (isset($wp_query->tax_query->queries)) { |
695 | 695 | $tax_arr = $wp_query->tax_query->queries; |
696 | 696 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
697 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
697 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); } |
|
698 | 698 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
699 | 699 | } |
700 | 700 | |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | |
749 | 749 | if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
750 | 750 | if ($cat_parent == 0) { |
751 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
751 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display; |
|
752 | 752 | $main_list_class = 'class="main_list_selecter"'; |
753 | 753 | } else { |
754 | 754 | //$display = 'display:none'; |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | |
759 | 759 | if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
760 | 760 | $p = 0; |
761 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
761 | + $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | foreach ($cat_terms as $cat_term) { |
@@ -773,12 +773,12 @@ discard block |
||
773 | 773 | } |
774 | 774 | |
775 | 775 | if ($cat_display == 'radio') |
776 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
776 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
777 | 777 | elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
778 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
778 | + $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
779 | 779 | |
780 | 780 | else { |
781 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
781 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | // Call recurson to print sub cats |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | $cat_exclude = serialize($exclude_cats); |
818 | 818 | |
819 | 819 | if (isset($_REQUEST['backandedit'])) { |
820 | - $post = (object)$gd_session->get('listing'); |
|
820 | + $post = (object) $gd_session->get('listing'); |
|
821 | 821 | |
822 | 822 | if (!is_array($post->post_category[$cat_taxonomy])) |
823 | 823 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | |
850 | 850 | if (!empty($post_category)) { |
851 | 851 | $cat1 = array_filter(explode(',', $post_category)); |
852 | - $post_category = ',' . implode(',', $cat1) . ','; |
|
852 | + $post_category = ','.implode(',', $cat1).','; |
|
853 | 853 | |
854 | 854 | } |
855 | 855 | |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | foreach ($post_category_upd as $cat) { |
861 | 861 | |
862 | 862 | if (!in_array($cat, $exclude_cats) && $cat != '') { |
863 | - $post_category_change .= ',' . $cat; |
|
863 | + $post_category_change .= ','.$cat; |
|
864 | 864 | } |
865 | 865 | } |
866 | 866 | $post_category = $post_category_change; |
@@ -872,11 +872,11 @@ discard block |
||
872 | 872 | } |
873 | 873 | } |
874 | 874 | |
875 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
875 | + echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']" />'; |
|
876 | 876 | |
877 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
877 | + echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']" />'; |
|
878 | 878 | |
879 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
879 | + echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']" />'; |
|
880 | 880 | |
881 | 881 | |
882 | 882 | ?> |
@@ -895,14 +895,14 @@ discard block |
||
895 | 895 | |
896 | 896 | function show_subcatlist(main_cat, catObj) { |
897 | 897 | if (main_cat != '') { |
898 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
899 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
900 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
898 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
899 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
900 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
901 | 901 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val(); |
902 | - <?php if ((int)$cat_limit > 0) { ?> |
|
902 | + <?php if ((int) $cat_limit > 0) { ?> |
|
903 | 903 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length); |
904 | 904 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) { |
905 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>"); |
|
905 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>"); |
|
906 | 906 | return false; |
907 | 907 | } |
908 | 908 | <?php } ?> |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | } |
942 | 942 | |
943 | 943 | function update_listing_cat(el) { |
944 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
944 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
945 | 945 | var cat_ids = ''; |
946 | 946 | var main_cat = ''; |
947 | 947 | var sub_cat = ''; |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
1023 | 1023 | echo $style; |
1024 | 1024 | }?> "> |
1025 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
1025 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
1026 | 1026 | ?> |
1027 | 1027 | </div> |
1028 | 1028 | <?php |
@@ -1049,9 +1049,9 @@ discard block |
||
1049 | 1049 | if ($exclude != '') { |
1050 | 1050 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
1051 | 1051 | |
1052 | - if(is_array( $exclude_cats)){ |
|
1053 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1054 | - }else{ |
|
1052 | + if (is_array($exclude_cats)) { |
|
1053 | + $exclude_cats = array_map('intval', $exclude_cats); |
|
1054 | + } else { |
|
1055 | 1055 | $exclude_cats = intval($exclude_cats); |
1056 | 1056 | } |
1057 | 1057 | |
@@ -1065,25 +1065,25 @@ discard block |
||
1065 | 1065 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1066 | 1066 | |
1067 | 1067 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
1068 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
1068 | + <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>" |
|
1069 | 1069 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/> |
1070 | 1070 | <?php /* ?> |
1071 | 1071 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> |
1072 | 1072 | <?php */ ?> |
1073 | 1073 | |
1074 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
1074 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
1075 | 1075 | onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()" |
1076 | 1076 | checked="checked" disabled="disabled"/> |
1077 | 1077 | <span> |
1078 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1078 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1079 | 1079 | </span> |
1080 | 1080 | <br/> |
1081 | 1081 | |
1082 | 1082 | <div class="post_default_category"> |
1083 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
1084 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1083 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
1084 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
1085 | 1085 | <span> |
1086 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1086 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1087 | 1087 | </span> |
1088 | 1088 | </div> |
1089 | 1089 | |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | $post_cat_str = $post_categories[$request_taxonomy]; |
1117 | 1117 | $post_cat_array = explode("#", $post_cat_str); |
1118 | 1118 | if (is_array($post_cat_array)) { |
1119 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1119 | + $post_cat_array = array_unique($post_cat_array); |
|
1120 | 1120 | |
1121 | 1121 | foreach ($post_cat_array as $post_cat_html) { |
1122 | 1122 | |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | } |
1132 | 1132 | $post_sub_catid = ''; |
1133 | 1133 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1134 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1134 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1155 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1155 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1184,9 +1184,9 @@ discard block |
||
1184 | 1184 | if (!$selected) |
1185 | 1185 | $option_slected = ' selected="selected" '; |
1186 | 1186 | |
1187 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1187 | + echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >'; |
|
1188 | 1188 | |
1189 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1189 | + echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>'; |
|
1190 | 1190 | |
1191 | 1191 | foreach ($cat_terms as $cat_term) { |
1192 | 1192 | $option_selected = ''; |
@@ -1194,10 +1194,10 @@ discard block |
||
1194 | 1194 | $option_selected = ' selected="selected" '; |
1195 | 1195 | |
1196 | 1196 | // Count child terms |
1197 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1198 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1197 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1)); |
|
1198 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
1199 | 1199 | |
1200 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
1200 | + echo '<option '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
1201 | 1201 | } |
1202 | 1202 | echo '</select>'; |
1203 | 1203 | } |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | 2 => __('Custom field updated.', 'geodirectory'), |
1229 | 1229 | 3 => __('Custom field deleted.', 'geodirectory'), |
1230 | 1230 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
1231 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1231 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
1232 | 1232 | 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
1233 | 1233 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
1234 | 1234 | 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
@@ -1254,7 +1254,7 @@ discard block |
||
1254 | 1254 | |
1255 | 1255 | global $wpdb; |
1256 | 1256 | |
1257 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1257 | + $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico'; |
|
1258 | 1258 | |
1259 | 1259 | if (!$listing_slug = get_option('geodir_listing_prefix')) |
1260 | 1260 | $listing_slug = 'places'; |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | |
1268 | 1268 | $gd_placetags = array(); |
1269 | 1269 | $gd_placetags['object_type'] = 'gd_place'; |
1270 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1270 | + $gd_placetags['listing_slug'] = $listing_slug.'/tags'; |
|
1271 | 1271 | $gd_placetags['args'] = array( |
1272 | 1272 | 'public' => true, |
1273 | 1273 | 'hierarchical' => false, |
1274 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1274 | + 'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true), |
|
1275 | 1275 | 'query_var' => true, |
1276 | 1276 | |
1277 | 1277 | 'labels' => array( |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | 'menu_icon' => $menu_icon, |
1366 | 1366 | 'public' => true, |
1367 | 1367 | 'query_var' => true, |
1368 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1368 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1369 | 1369 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
1370 | 1370 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
1371 | 1371 | |
@@ -1398,12 +1398,12 @@ discard block |
||
1398 | 1398 | return $_REQUEST['lang']; |
1399 | 1399 | } |
1400 | 1400 | |
1401 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1401 | + $url = str_replace(array("http://", "https://"), "", $url); |
|
1402 | 1402 | |
1403 | 1403 | // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang. |
1404 | - $site_url = str_replace(array("http://","https://"),"",site_url()); |
|
1404 | + $site_url = str_replace(array("http://", "https://"), "", site_url()); |
|
1405 | 1405 | |
1406 | - $url = str_replace($site_url,"",$url); |
|
1406 | + $url = str_replace($site_url, "", $url); |
|
1407 | 1407 | |
1408 | 1408 | $segments = explode('/', trim($url, '/')); |
1409 | 1409 | |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | |
1460 | 1460 | global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache, $gd_cache_post; |
1461 | 1461 | if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) { |
1462 | - if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;} |
|
1462 | + if ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending') {return $post_link; } |
|
1463 | 1463 | } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) { |
1464 | 1464 | return $post_link; |
1465 | 1465 | } else { |
@@ -1473,9 +1473,9 @@ discard block |
||
1473 | 1473 | |
1474 | 1474 | |
1475 | 1475 | // if we dont have a GD post then try to grab it |
1476 | - if(!isset($post->default_category)){ |
|
1476 | + if (!isset($post->default_category)) { |
|
1477 | 1477 | $gd_post = geodir_get_post_info($post->ID); |
1478 | - if(!empty($gd_post)){ |
|
1478 | + if (!empty($gd_post)) { |
|
1479 | 1479 | $post = $gd_post; |
1480 | 1480 | } |
1481 | 1481 | } |
@@ -1485,17 +1485,17 @@ discard block |
||
1485 | 1485 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
1486 | 1486 | |
1487 | 1487 | // Alter the CPT slug if WPML is set to do so |
1488 | - if(geodir_wpml_is_post_type_translated($post->post_type)){ |
|
1489 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1488 | + if (geodir_wpml_is_post_type_translated($post->post_type)) { |
|
1489 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1490 | 1490 | |
1491 | 1491 | $org_slug = $slug; |
1492 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1492 | + $slug = apply_filters('wpml_translate_single_string', |
|
1493 | 1493 | $slug, |
1494 | 1494 | 'WordPress', |
1495 | - 'URL slug: ' . $slug, |
|
1495 | + 'URL slug: '.$slug, |
|
1496 | 1496 | $language_code); |
1497 | 1497 | |
1498 | - if(!$slug){$slug = $org_slug;} |
|
1498 | + if (!$slug) {$slug = $org_slug; } |
|
1499 | 1499 | |
1500 | 1500 | } |
1501 | 1501 | } |
@@ -1517,11 +1517,11 @@ discard block |
||
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | $post_link = trailingslashit( |
1520 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1520 | + preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1) |
|
1521 | 1521 | ); |
1522 | 1522 | |
1523 | 1523 | if ($fix_url) { |
1524 | - $post_link = $site_url . $post_link; |
|
1524 | + $post_link = $site_url.$post_link; |
|
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | if (isset($comment_post_cache[$post->ID])) { |
@@ -1540,12 +1540,12 @@ discard block |
||
1540 | 1540 | $ID = $post->ID; |
1541 | 1541 | $post2 = $wpdb->get_row( |
1542 | 1542 | $wpdb->prepare( |
1543 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1543 | + "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
1544 | 1544 | array($post->ID) |
1545 | 1545 | ) |
1546 | 1546 | ); |
1547 | 1547 | |
1548 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1548 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
1549 | 1549 | |
1550 | 1550 | $comment_post_cache[$post->ID] = $post; |
1551 | 1551 | } |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | |
1555 | 1555 | if (false !== strpos($post_link, '%gd_taxonomy%')) { |
1556 | 1556 | |
1557 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1557 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) { |
|
1558 | 1558 | $location_request = ''; |
1559 | 1559 | |
1560 | 1560 | |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1569 | 1569 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1570 | 1570 | |
1571 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1571 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1572 | 1572 | 'region_slug' => $post->region_slug, |
1573 | 1573 | 'city_slug' => $post->city_slug |
1574 | 1574 | ); |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | |
1582 | 1582 | $post_location_sql = $wpdb->get_results( |
1583 | 1583 | $wpdb->prepare( |
1584 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1584 | + "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
1585 | 1585 | array($post->ID) |
1586 | 1586 | ) |
1587 | 1587 | ); |
@@ -1597,7 +1597,7 @@ discard block |
||
1597 | 1597 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1598 | 1598 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1599 | 1599 | |
1600 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1600 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1601 | 1601 | 'region_slug' => $post->region_slug, |
1602 | 1602 | 'city_slug' => $post->city_slug |
1603 | 1603 | ); |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | } |
1627 | 1627 | $location_slug[] = $city_slug; |
1628 | 1628 | |
1629 | - $location_request .= implode('/', $location_slug) . '/'; |
|
1629 | + $location_request .= implode('/', $location_slug).'/'; |
|
1630 | 1630 | } |
1631 | 1631 | } |
1632 | 1632 | |
@@ -1641,9 +1641,9 @@ discard block |
||
1641 | 1641 | } else { |
1642 | 1642 | $post_terms = ''; |
1643 | 1643 | |
1644 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
|
1644 | + if (isset($_POST['post_default_category']) && $_POST['post_default_category']) { |
|
1645 | 1645 | $post_terms = absint($_POST['post_default_category']); |
1646 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1646 | + }elseif (isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1647 | 1647 | $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
1648 | 1648 | $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
1649 | 1649 | }elseif (isset($post->{$taxonomies})) { |
@@ -1689,14 +1689,14 @@ discard block |
||
1689 | 1689 | $request_term = trim($request_term, '/'); |
1690 | 1690 | |
1691 | 1691 | // Fix with WPML the location terms added twice when CPT slug is translated. |
1692 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) { |
|
1692 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/'.$request_term.$detailurl_separator) !== false) { |
|
1693 | 1693 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | if (!empty($request_term)) |
1697 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1697 | + $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link); |
|
1698 | 1698 | else |
1699 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1699 | + $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link); |
|
1700 | 1700 | //echo $post_link ; |
1701 | 1701 | } |
1702 | 1702 | // temp cache the permalink |
@@ -1795,35 +1795,35 @@ discard block |
||
1795 | 1795 | $request_term = implode("/", $location_terms); |
1796 | 1796 | if (geodir_is_wpml()) { |
1797 | 1797 | $post_types = get_option('geodir_post_types'); |
1798 | - $post_type = str_replace("category","",$taxonomy); |
|
1799 | - $post_type = str_replace("_tags","",$post_type); |
|
1798 | + $post_type = str_replace("category", "", $taxonomy); |
|
1799 | + $post_type = str_replace("_tags", "", $post_type); |
|
1800 | 1800 | $org_slug = $post_types[$post_type]['rewrite']['slug']; |
1801 | 1801 | if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
1802 | 1802 | global $sitepress; |
1803 | 1803 | $default_lang = $sitepress->get_default_language(); |
1804 | 1804 | $language_code = gd_wpml_get_lang_from_url($orig_termlink); |
1805 | - if (!$language_code ) { |
|
1806 | - $language_code = $default_lang; |
|
1805 | + if (!$language_code) { |
|
1806 | + $language_code = $default_lang; |
|
1807 | 1807 | } |
1808 | 1808 | |
1809 | - $slug = apply_filters('wpml_translate_single_string', $org_slug, 'WordPress', 'URL slug: ' . $org_slug, $language_code); |
|
1809 | + $slug = apply_filters('wpml_translate_single_string', $org_slug, 'WordPress', 'URL slug: '.$org_slug, $language_code); |
|
1810 | 1810 | |
1811 | 1811 | if ($slug && $slug != $org_slug && $slug != $listing_slug) { |
1812 | - $old_listing_slug = '/' . $slug . '/'; |
|
1813 | - $new_listing_slug = '/' . $slug . '/' . $request_term . '/'; |
|
1812 | + $old_listing_slug = '/'.$slug.'/'; |
|
1813 | + $new_listing_slug = '/'.$slug.'/'.$request_term.'/'; |
|
1814 | 1814 | |
1815 | - if ( strpos( $termlink, $old_listing_slug ) !== false ) { |
|
1815 | + if (strpos($termlink, $old_listing_slug) !== false) { |
|
1816 | 1816 | $found = true; |
1817 | - $termlink = preg_replace( "/" . preg_quote( $old_listing_slug, "/" ) . "/", $new_listing_slug, $termlink, 1 ); |
|
1817 | + $termlink = preg_replace("/".preg_quote($old_listing_slug, "/")."/", $new_listing_slug, $termlink, 1); |
|
1818 | 1818 | } |
1819 | 1819 | } |
1820 | 1820 | } |
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | if (!$found) { |
1824 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
1824 | + $old_listing_slug = '/'.$listing_slug.'/'; |
|
1825 | 1825 | $request_term = implode("/", $location_terms); |
1826 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
1826 | + $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/'; |
|
1827 | 1827 | |
1828 | 1828 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
1829 | 1829 | } |
@@ -1844,25 +1844,25 @@ discard block |
||
1844 | 1844 | // Alter the CPT slug if WPML is set to do so |
1845 | 1845 | if (geodir_is_wpml()) { |
1846 | 1846 | $post_types = get_option('geodir_post_types'); |
1847 | - $post_type = str_replace("category","",$taxonomy); |
|
1848 | - $post_type = str_replace("_tags","",$post_type); |
|
1847 | + $post_type = str_replace("category", "", $taxonomy); |
|
1848 | + $post_type = str_replace("_tags", "", $post_type); |
|
1849 | 1849 | $slug = $post_types[$post_type]['rewrite']['slug']; |
1850 | 1850 | if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
1851 | 1851 | global $sitepress; |
1852 | 1852 | $default_lang = $sitepress->get_default_language(); |
1853 | 1853 | $language_code = gd_wpml_get_lang_from_url($orig_termlink); |
1854 | - if (!$language_code ) { |
|
1855 | - $language_code = $default_lang; |
|
1854 | + if (!$language_code) { |
|
1855 | + $language_code = $default_lang; |
|
1856 | 1856 | } |
1857 | 1857 | |
1858 | 1858 | $org_slug = $slug; |
1859 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code); |
|
1859 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code); |
|
1860 | 1860 | |
1861 | 1861 | if (!$slug) { |
1862 | 1862 | $slug = $org_slug; |
1863 | 1863 | } |
1864 | 1864 | |
1865 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1)); |
|
1865 | + $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1)); |
|
1866 | 1866 | } |
1867 | 1867 | } |
1868 | 1868 | } |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | |
1893 | 1893 | if (in_array($post_type, geodir_get_posttypes())) { |
1894 | 1894 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1895 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1895 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1896 | 1896 | $location_terms = array( |
1897 | 1897 | 'gd_country' => $post->country_slug, |
1898 | 1898 | 'gd_region' => $post->region_slug, |
@@ -1909,7 +1909,7 @@ discard block |
||
1909 | 1909 | $location_terms = implode("/", $location_terms); |
1910 | 1910 | $location_terms = rtrim($location_terms, '/'); |
1911 | 1911 | |
1912 | - $link .= urldecode($location_terms) . '/'; |
|
1912 | + $link .= urldecode($location_terms).'/'; |
|
1913 | 1913 | } else { |
1914 | 1914 | $link = geodir_getlink($link, $location_terms); |
1915 | 1915 | } |
@@ -1997,9 +1997,9 @@ discard block |
||
1997 | 1997 | return 0; |
1998 | 1998 | $where = 't.term_id = %d'; |
1999 | 1999 | if (!empty($taxonomy)) |
2000 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2000 | + return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2001 | 2001 | else |
2002 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2002 | + return $wpdb->get_var($wpdb->prepare($select.$where, $term)); |
|
2003 | 2003 | } |
2004 | 2004 | |
2005 | 2005 | $term = trim(wp_unslash($term)); |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | |
2012 | 2012 | $where_fields = array($slug); |
2013 | 2013 | if (!empty($taxonomy)) { |
2014 | - $parent = (int)$parent; |
|
2014 | + $parent = (int) $parent; |
|
2015 | 2015 | if ($parent > 0) { |
2016 | 2016 | $where_fields[] = $parent; |
2017 | 2017 | $else_where_fields[] = $parent; |
@@ -2075,13 +2075,13 @@ discard block |
||
2075 | 2075 | $post_types = geodir_get_posttypes(); |
2076 | 2076 | $tax_arr = array(); |
2077 | 2077 | foreach ($post_types as $post_type) { |
2078 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
2078 | + $tax_arr[] = "'".$post_type."category'"; |
|
2079 | 2079 | } |
2080 | 2080 | $tax_c = implode(',', $tax_arr); |
2081 | 2081 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
2082 | 2082 | //$terms = get_terms( $taxonomy ); |
2083 | 2083 | |
2084 | - if($terms) { |
|
2084 | + if ($terms) { |
|
2085 | 2085 | foreach ($terms as $term) { |
2086 | 2086 | $post_type = str_replace("category", "", $term->taxonomy); |
2087 | 2087 | $a_terms[$post_type][] = $term; |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | } |
2090 | 2090 | } |
2091 | 2091 | |
2092 | - if($a_terms) { |
|
2092 | + if ($a_terms) { |
|
2093 | 2093 | foreach ($a_terms as $pt => $t2) { |
2094 | 2094 | |
2095 | 2095 | foreach ($t2 as $term) { |
@@ -2114,7 +2114,7 @@ discard block |
||
2114 | 2114 | } |
2115 | 2115 | |
2116 | 2116 | if (is_ssl()) { |
2117 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
2117 | + $terms_icons = str_replace("http:", "https:", $terms_icons); |
|
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | return apply_filters('geodir_get_term_icons', $terms_icons, $term_id); |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | if (get_option('geodir_show_listing_nav')) { |
40 | 40 | |
41 | 41 | $menu_class = ''; |
42 | - if (geodir_is_page('listing')) |
|
43 | - $menu_class = 'current-menu-item'; |
|
42 | + if (geodir_is_page('listing')) { |
|
43 | + $menu_class = 'current-menu-item'; |
|
44 | + } |
|
44 | 45 | |
45 | 46 | |
46 | 47 | //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | if (in_array($post_type, $show_post_type_main_nav)) { |
53 | 54 | if (get_post_type_archive_link($post_type)) { |
54 | 55 | $menu_class = ''; |
55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | - $menu_class = 'current-menu-item'; |
|
56 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
57 | + $menu_class = 'current-menu-item'; |
|
58 | + } |
|
57 | 59 | /** |
58 | 60 | * Filter the menu li class. |
59 | 61 | * |
@@ -130,8 +132,9 @@ discard block |
||
130 | 132 | if (get_post_type_archive_link($post_type)) { |
131 | 133 | |
132 | 134 | $menu_class = ''; |
133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | - $menu_class = 'current-menu-item'; |
|
135 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
136 | + $menu_class = 'current-menu-item'; |
|
137 | + } |
|
135 | 138 | |
136 | 139 | $items .= '<li class="' . $sub_li_class . '"> |
137 | 140 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
@@ -159,8 +162,9 @@ discard block |
||
159 | 162 | if (get_option('geodir_show_addlisting_nav')) { |
160 | 163 | |
161 | 164 | $menu_class = ''; |
162 | - if (geodir_is_page('add-listing')) |
|
163 | - $menu_class = 'current-menu-item'; |
|
165 | + if (geodir_is_page('add-listing')) { |
|
166 | + $menu_class = 'current-menu-item'; |
|
167 | + } |
|
164 | 168 | |
165 | 169 | //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
166 | 170 | $post_types = geodir_get_posttypes('object'); |
@@ -176,8 +180,9 @@ discard block |
||
176 | 180 | if (geodir_get_addlisting_link($post_type)) { |
177 | 181 | |
178 | 182 | $menu_class = ''; |
179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
180 | - $menu_class = 'current-menu-item'; |
|
183 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
184 | + $menu_class = 'current-menu-item'; |
|
185 | + } |
|
181 | 186 | /** |
182 | 187 | * Filter the menu li class. |
183 | 188 | * |
@@ -261,8 +266,9 @@ discard block |
||
261 | 266 | if (geodir_get_addlisting_link($post_type)) { |
262 | 267 | |
263 | 268 | $menu_class = ''; |
264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
265 | - $menu_class = 'current-menu-item'; |
|
269 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
270 | + $menu_class = 'current-menu-item'; |
|
271 | + } |
|
266 | 272 | /** |
267 | 273 | * Filter the menu li class. |
268 | 274 | * |
@@ -319,8 +325,9 @@ discard block |
||
319 | 325 | } |
320 | 326 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
321 | 327 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
322 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
328 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) { |
|
329 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
330 | + } |
|
324 | 331 | |
325 | 332 | return $menu; |
326 | 333 | |
@@ -410,17 +417,20 @@ discard block |
||
410 | 417 | } |
411 | 418 | |
412 | 419 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
413 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
414 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
415 | - elseif (isset($_REQUEST['listing_type'])) |
|
416 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
420 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
421 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
422 | + } elseif (isset($_REQUEST['listing_type'])) { |
|
423 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
424 | + } |
|
417 | 425 | } |
418 | 426 | |
419 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
420 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
427 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) { |
|
428 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
429 | + } |
|
421 | 430 | |
422 | - if (is_tax()) |
|
423 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
431 | + if (is_tax()) { |
|
432 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
433 | + } |
|
424 | 434 | |
425 | 435 | // Retrive post type for map marker html ajax request on preview page. |
426 | 436 | if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) { |
@@ -434,8 +444,9 @@ discard block |
||
434 | 444 | $all_postypes = geodir_get_posttypes(); |
435 | 445 | $all_postypes = stripslashes_deep($all_postypes); |
436 | 446 | |
437 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
438 | - $geodir_post_type = ''; |
|
447 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) { |
|
448 | + $geodir_post_type = ''; |
|
449 | + } |
|
439 | 450 | |
440 | 451 | if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
441 | 452 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
@@ -520,11 +531,12 @@ discard block |
||
520 | 531 | endswitch; |
521 | 532 | } |
522 | 533 | |
523 | - if (!empty($post_types)) |
|
524 | - return $post_types; |
|
525 | - else |
|
526 | - return array(); |
|
527 | -} |
|
534 | + if (!empty($post_types)) { |
|
535 | + return $post_types; |
|
536 | + } else { |
|
537 | + return array(); |
|
538 | + } |
|
539 | + } |
|
528 | 540 | |
529 | 541 | /** |
530 | 542 | * Get Custom Post Type info. |
@@ -541,9 +553,10 @@ discard block |
||
541 | 553 | $post_types = stripslashes_deep($post_types); |
542 | 554 | if (!empty($post_types) && $post_type != '') { |
543 | 555 | return $post_types[$post_type]; |
544 | - } else |
|
545 | - return false; |
|
546 | -} |
|
556 | + } else { |
|
557 | + return false; |
|
558 | + } |
|
559 | + } |
|
547 | 560 | |
548 | 561 | if (!function_exists('geodir_get_taxonomies')) { |
549 | 562 | /** |
@@ -629,10 +642,11 @@ discard block |
||
629 | 642 | . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
630 | 643 | } |
631 | 644 | |
632 | - if ($echo) |
|
633 | - echo $html; |
|
634 | - else |
|
635 | - return $html; |
|
645 | + if ($echo) { |
|
646 | + echo $html; |
|
647 | + } else { |
|
648 | + return $html; |
|
649 | + } |
|
636 | 650 | } |
637 | 651 | } |
638 | 652 | |
@@ -666,11 +680,12 @@ discard block |
||
666 | 680 | |
667 | 681 | } |
668 | 682 | |
669 | - if (!empty($listing_slug)) |
|
670 | - return $listing_slug; |
|
671 | - else |
|
672 | - return false; |
|
673 | -} |
|
683 | + if (!empty($listing_slug)) { |
|
684 | + return $listing_slug; |
|
685 | + } else { |
|
686 | + return false; |
|
687 | + } |
|
688 | + } |
|
674 | 689 | |
675 | 690 | |
676 | 691 | /** |
@@ -701,16 +716,18 @@ discard block |
||
701 | 716 | if (!empty($taxonomies)) { |
702 | 717 | foreach (geodir_get_posttypes() as $pt) { |
703 | 718 | $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
704 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
705 | - $post_type[] = $pt; |
|
719 | + if (array_intersect($taxonomies, $object_taxonomies)) { |
|
720 | + $post_type[] = $pt; |
|
721 | + } |
|
706 | 722 | } |
707 | 723 | } |
708 | 724 | |
709 | - if (!empty($post_type)) |
|
710 | - return $post_type[0]; |
|
711 | - else |
|
712 | - return false; |
|
713 | -} |
|
725 | + if (!empty($post_type)) { |
|
726 | + return $post_type[0]; |
|
727 | + } else { |
|
728 | + return false; |
|
729 | + } |
|
730 | + } |
|
714 | 731 | |
715 | 732 | if (!function_exists('geodir_custom_taxonomy_walker')) { |
716 | 733 | /** |
@@ -766,18 +783,18 @@ discard block |
||
766 | 783 | $checked = ''; |
767 | 784 | |
768 | 785 | if (in_array($cat_term->term_id, $search_terms)) { |
769 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
770 | - $checked = 'selected="selected"'; |
|
771 | - else |
|
772 | - $checked = 'checked="checked"'; |
|
786 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
787 | + $checked = 'selected="selected"'; |
|
788 | + } else { |
|
789 | + $checked = 'checked="checked"'; |
|
790 | + } |
|
773 | 791 | } |
774 | 792 | |
775 | - if ($cat_display == 'radio') |
|
776 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
777 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
778 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
779 | - |
|
780 | - else { |
|
793 | + if ($cat_display == 'radio') { |
|
794 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
795 | + } elseif ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
796 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
797 | + } else { |
|
781 | 798 | $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
782 | 799 | } |
783 | 800 | |
@@ -786,8 +803,9 @@ discard block |
||
786 | 803 | |
787 | 804 | } |
788 | 805 | |
789 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
790 | - $out .= '</div>'; |
|
806 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
807 | + $out .= '</div>'; |
|
808 | + } |
|
791 | 809 | |
792 | 810 | return $out; |
793 | 811 | } |
@@ -813,18 +831,21 @@ discard block |
||
813 | 831 | global $exclude_cats, $gd_session; |
814 | 832 | |
815 | 833 | $cat_exclude = ''; |
816 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
817 | - $cat_exclude = serialize($exclude_cats); |
|
834 | + if (is_array($exclude_cats) && !empty($exclude_cats)) { |
|
835 | + $cat_exclude = serialize($exclude_cats); |
|
836 | + } |
|
818 | 837 | |
819 | 838 | if (isset($_REQUEST['backandedit'])) { |
820 | 839 | $post = (object)$gd_session->get('listing'); |
821 | 840 | |
822 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
823 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
841 | + if (!is_array($post->post_category[$cat_taxonomy])) { |
|
842 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
843 | + } |
|
824 | 844 | |
825 | 845 | $post_categories = $post->post_category_str; |
826 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
827 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
846 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
847 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
848 | + } |
|
828 | 849 | |
829 | 850 | } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
830 | 851 | global $post; |
@@ -1015,8 +1036,9 @@ discard block |
||
1015 | 1036 | if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
1016 | 1037 | $post_cat_str = $post_categories[$cat_taxonomy]; |
1017 | 1038 | $post_cat_array = explode("#", $post_cat_str); |
1018 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
1019 | - $style = "display:none;"; |
|
1039 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) { |
|
1040 | + $style = "display:none;"; |
|
1041 | + } |
|
1020 | 1042 | } |
1021 | 1043 | ?> |
1022 | 1044 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
@@ -1051,7 +1073,7 @@ discard block |
||
1051 | 1073 | |
1052 | 1074 | if(is_array( $exclude_cats)){ |
1053 | 1075 | $exclude_cats = array_map( 'intval', $exclude_cats ); |
1054 | - }else{ |
|
1076 | + } else{ |
|
1055 | 1077 | $exclude_cats = intval($exclude_cats); |
1056 | 1078 | } |
1057 | 1079 | |
@@ -1081,7 +1103,10 @@ discard block |
||
1081 | 1103 | |
1082 | 1104 | <div class="post_default_category"> |
1083 | 1105 | <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
1084 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1106 | + onchange="update_listing_cat()" <?php if ($default) { |
|
1107 | + echo ' checked="checked" '; |
|
1108 | +} |
|
1109 | +?> /> |
|
1085 | 1110 | <span> |
1086 | 1111 | <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
1087 | 1112 | </span> |
@@ -1181,8 +1206,9 @@ discard block |
||
1181 | 1206 | $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
1182 | 1207 | |
1183 | 1208 | $option_selected = ''; |
1184 | - if (!$selected) |
|
1185 | - $option_slected = ' selected="selected" '; |
|
1209 | + if (!$selected) { |
|
1210 | + $option_slected = ' selected="selected" '; |
|
1211 | + } |
|
1186 | 1212 | |
1187 | 1213 | echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
1188 | 1214 | |
@@ -1190,8 +1216,9 @@ discard block |
||
1190 | 1216 | |
1191 | 1217 | foreach ($cat_terms as $cat_term) { |
1192 | 1218 | $option_selected = ''; |
1193 | - if ($selected == $cat_term->term_id) |
|
1194 | - $option_selected = ' selected="selected" '; |
|
1219 | + if ($selected == $cat_term->term_id) { |
|
1220 | + $option_selected = ' selected="selected" '; |
|
1221 | + } |
|
1195 | 1222 | |
1196 | 1223 | // Count child terms |
1197 | 1224 | $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
@@ -1256,8 +1283,9 @@ discard block |
||
1256 | 1283 | |
1257 | 1284 | $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
1258 | 1285 | |
1259 | - if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1260 | - $listing_slug = 'places'; |
|
1286 | + if (!$listing_slug = get_option('geodir_listing_prefix')) { |
|
1287 | + $listing_slug = 'places'; |
|
1288 | + } |
|
1261 | 1289 | |
1262 | 1290 | /** |
1263 | 1291 | * Taxonomies |
@@ -1573,8 +1601,9 @@ discard block |
||
1573 | 1601 | 'city_slug' => $post->city_slug |
1574 | 1602 | ); |
1575 | 1603 | |
1576 | - } else |
|
1577 | - $post_location = geodir_get_location(); |
|
1604 | + } else { |
|
1605 | + $post_location = geodir_get_location(); |
|
1606 | + } |
|
1578 | 1607 | |
1579 | 1608 | |
1580 | 1609 | } else { |
@@ -1603,8 +1632,9 @@ discard block |
||
1603 | 1632 | ); |
1604 | 1633 | |
1605 | 1634 | } |
1606 | - } else |
|
1607 | - $post_location = geodir_get_location(); |
|
1635 | + } else { |
|
1636 | + $post_location = geodir_get_location(); |
|
1637 | + } |
|
1608 | 1638 | } |
1609 | 1639 | |
1610 | 1640 | |
@@ -1643,16 +1673,17 @@ discard block |
||
1643 | 1673 | |
1644 | 1674 | if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
1645 | 1675 | $post_terms = absint($_POST['post_default_category']); |
1646 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1676 | + } elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1647 | 1677 | $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
1648 | 1678 | $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
1649 | - }elseif (isset($post->{$taxonomies})) { |
|
1679 | + } elseif (isset($post->{$taxonomies})) { |
|
1650 | 1680 | $post_terms = explode(",", trim($post->{$taxonomies}, ",")); |
1651 | 1681 | $post_terms = $post_terms[0]; |
1652 | 1682 | } |
1653 | 1683 | |
1654 | - if (!$post_terms) |
|
1655 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1684 | + if (!$post_terms) { |
|
1685 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1686 | + } |
|
1656 | 1687 | |
1657 | 1688 | if (!$post_terms) { |
1658 | 1689 | $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
@@ -1666,8 +1697,9 @@ discard block |
||
1666 | 1697 | |
1667 | 1698 | $term = get_term_by('id', $post_terms, $taxonomies); |
1668 | 1699 | |
1669 | - if (!empty($term)) |
|
1670 | - $term_request = $term->slug; |
|
1700 | + if (!empty($term)) { |
|
1701 | + $term_request = $term->slug; |
|
1702 | + } |
|
1671 | 1703 | //$term_request = $term->slug.'/'; |
1672 | 1704 | } |
1673 | 1705 | |
@@ -1682,9 +1714,13 @@ discard block |
||
1682 | 1714 | $request_term .= $term_request; |
1683 | 1715 | |
1684 | 1716 | } else { |
1685 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1717 | + if (isset($location_request) && $location_request != '') { |
|
1718 | + $request_term = $location_request; |
|
1719 | + } |
|
1686 | 1720 | |
1687 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1721 | + if (isset($term_request) && $term_request != '') { |
|
1722 | + $request_term .= $term_request; |
|
1723 | + } |
|
1688 | 1724 | } |
1689 | 1725 | $request_term = trim($request_term, '/'); |
1690 | 1726 | |
@@ -1693,10 +1729,11 @@ discard block |
||
1693 | 1729 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
1694 | 1730 | } |
1695 | 1731 | |
1696 | - if (!empty($request_term)) |
|
1697 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1698 | - else |
|
1699 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1732 | + if (!empty($request_term)) { |
|
1733 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1734 | + } else { |
|
1735 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1736 | + } |
|
1700 | 1737 | //echo $post_link ; |
1701 | 1738 | } |
1702 | 1739 | // temp cache the permalink |
@@ -1939,11 +1976,12 @@ discard block |
||
1939 | 1976 | |
1940 | 1977 | $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
1941 | 1978 | |
1942 | - if ($echo) |
|
1943 | - echo $label; |
|
1944 | - else |
|
1945 | - return $label; |
|
1946 | -} |
|
1979 | + if ($echo) { |
|
1980 | + echo $label; |
|
1981 | + } else { |
|
1982 | + return $label; |
|
1983 | + } |
|
1984 | + } |
|
1947 | 1985 | |
1948 | 1986 | /** |
1949 | 1987 | * Print or Get post type plural label. |
@@ -1959,18 +1997,20 @@ discard block |
||
1959 | 1997 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) { |
1960 | 1998 | $all_postypes = geodir_get_posttypes(); |
1961 | 1999 | |
1962 | - if (!in_array($post_type, $all_postypes)) |
|
1963 | - return false; |
|
2000 | + if (!in_array($post_type, $all_postypes)) { |
|
2001 | + return false; |
|
2002 | + } |
|
1964 | 2003 | |
1965 | 2004 | $obj_post_type = get_post_type_object($post_type); |
1966 | 2005 | |
1967 | 2006 | $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
1968 | 2007 | |
1969 | - if ($echo) |
|
1970 | - echo $label; |
|
1971 | - else |
|
1972 | - return $label; |
|
1973 | -} |
|
2008 | + if ($echo) { |
|
2009 | + echo $label; |
|
2010 | + } else { |
|
2011 | + return $label; |
|
2012 | + } |
|
2013 | + } |
|
1974 | 2014 | |
1975 | 2015 | /** |
1976 | 2016 | * Checks whether a term exists or not. |
@@ -1993,19 +2033,22 @@ discard block |
||
1993 | 2033 | $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
1994 | 2034 | |
1995 | 2035 | if (is_int($term)) { |
1996 | - if (0 == $term) |
|
1997 | - return 0; |
|
2036 | + if (0 == $term) { |
|
2037 | + return 0; |
|
2038 | + } |
|
1998 | 2039 | $where = 't.term_id = %d'; |
1999 | - if (!empty($taxonomy)) |
|
2000 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2001 | - else |
|
2002 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2040 | + if (!empty($taxonomy)) { |
|
2041 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2042 | + } else { |
|
2043 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2044 | + } |
|
2003 | 2045 | } |
2004 | 2046 | |
2005 | 2047 | $term = trim(wp_unslash($term)); |
2006 | 2048 | |
2007 | - if ('' === $slug = sanitize_title($term)) |
|
2008 | - return 0; |
|
2049 | + if ('' === $slug = sanitize_title($term)) { |
|
2050 | + return 0; |
|
2051 | + } |
|
2009 | 2052 | |
2010 | 2053 | $where = 't.slug = %s'; |
2011 | 2054 | |
@@ -2022,14 +2065,16 @@ discard block |
||
2022 | 2065 | $where_fields[] = $taxonomy; |
2023 | 2066 | |
2024 | 2067 | |
2025 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
2026 | - return $result; |
|
2068 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) { |
|
2069 | + return $result; |
|
2070 | + } |
|
2027 | 2071 | |
2028 | 2072 | return false; |
2029 | 2073 | } |
2030 | 2074 | |
2031 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
2032 | - return $result; |
|
2075 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) { |
|
2076 | + return $result; |
|
2077 | + } |
|
2033 | 2078 | |
2034 | 2079 | return false; |
2035 | 2080 | } |
@@ -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; |
@@ -349,8 +354,9 @@ discard block |
||
349 | 354 | $sort_by = ''; |
350 | 355 | $orderby = ' '; |
351 | 356 | |
352 | - if (get_query_var('order_by')) |
|
353 | - $sort_by = get_query_var('order_by'); |
|
357 | + if (get_query_var('order_by')) { |
|
358 | + $sort_by = get_query_var('order_by'); |
|
359 | + } |
|
354 | 360 | |
355 | 361 | /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){ |
356 | 362 | $current_term = $wp_query->get_queried_object(); |
@@ -370,14 +376,16 @@ discard block |
||
370 | 376 | $orderby .= " distance,"; |
371 | 377 | } |
372 | 378 | |
373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
379 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) { |
|
380 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
381 | + } |
|
375 | 382 | |
376 | 383 | |
377 | 384 | if ($sort_by == '') { |
378 | 385 | $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
379 | - if (!empty($default_sort)) |
|
380 | - $sort_by = $default_sort; |
|
386 | + if (!empty($default_sort)) { |
|
387 | + $sort_by = $default_sort; |
|
388 | + } |
|
381 | 389 | } |
382 | 390 | |
383 | 391 | /* |
@@ -562,7 +570,7 @@ discard block |
||
562 | 570 | $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )) / ( $avg_num_votes + " . $table . ".rating_count ) $order , "; |
563 | 571 | |
564 | 572 | //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ) / ( " . $table . ".rating_count + " . $table . ".rating_count ) $order , "; // seems to work mostly with no extra overheads |
565 | - }else{ |
|
573 | + } else{ |
|
566 | 574 | $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
567 | 575 | } |
568 | 576 | |
@@ -607,8 +615,9 @@ discard block |
||
607 | 615 | |
608 | 616 | add_filter('posts_where', 'searching_filter_where', 1); |
609 | 617 | |
610 | - if ($snear != '') |
|
611 | - add_filter('posts_where', 'searching_filter_where', 1); |
|
618 | + if ($snear != '') { |
|
619 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
620 | + } |
|
612 | 621 | |
613 | 622 | add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
614 | 623 | add_filter( 'posts_where', 'geodir_posts_having', 10000, 2 ); // make sure its the last WHERE param |
@@ -763,10 +772,11 @@ discard block |
||
763 | 772 | |
764 | 773 | $where = ''; |
765 | 774 | $better_search_terms = ''; |
766 | - if (isset($_REQUEST['stype'])) |
|
767 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
768 | - else |
|
769 | - $post_types = 'gd_place'; |
|
775 | + if (isset($_REQUEST['stype'])) { |
|
776 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
777 | + } else { |
|
778 | + $post_types = 'gd_place'; |
|
779 | + } |
|
770 | 780 | |
771 | 781 | if ($s != '') { |
772 | 782 | $keywords = explode(" ", $s); |
@@ -803,7 +813,7 @@ discard block |
||
803 | 813 | if($taxonomies) { |
804 | 814 | $taxonomies = implode("','", $taxonomies); |
805 | 815 | $taxonomies = "'" . $taxonomies . "'"; |
806 | - }else{$taxonomies='';} |
|
816 | + } else{$taxonomies='';} |
|
807 | 817 | |
808 | 818 | $content_where = $terms_where = ''; |
809 | 819 | $terms_sql = ''; |
@@ -944,8 +954,9 @@ discard block |
||
944 | 954 | $user_fav_posts = geodir_get_user_favourites($user_id); |
945 | 955 | $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
946 | 956 | $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
947 | - } else |
|
948 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
957 | + } else { |
|
958 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
959 | + } |
|
949 | 960 | |
950 | 961 | if ($user_id == (int)get_current_user_id()) { |
951 | 962 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
@@ -1208,7 +1219,7 @@ discard block |
||
1208 | 1219 | |
1209 | 1220 | if(isset($query->query->gd_is_geodir_page) && $query->query->gd_is_geodir_page) { |
1210 | 1221 | $is_main_query = true; |
1211 | - }elseif(isset($query->query['gd_is_geodir_page']) && $query->query['gd_is_geodir_page']) { |
|
1222 | + } elseif(isset($query->query['gd_is_geodir_page']) && $query->query['gd_is_geodir_page']) { |
|
1212 | 1223 | $is_main_query = true; |
1213 | 1224 | } |
1214 | 1225 |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function geodir_session_start() |
18 | 18 | { |
19 | - if (!session_id()) session_start(); |
|
20 | - global $geodir_add_location_url; |
|
19 | + if (!session_id()) session_start(); |
|
20 | + global $geodir_add_location_url; |
|
21 | 21 | |
22 | - $geodir_add_location_url = NULL; |
|
22 | + $geodir_add_location_url = NULL; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function geodir_modified_query($query) |
35 | 35 | { |
36 | - if ($query->is_main_query() && ( |
|
37 | - (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
38 | - || geodir_is_page('listing') |
|
39 | - || geodir_is_page('author') |
|
40 | - || geodir_is_page('search') |
|
41 | - || geodir_is_page('detail')) |
|
42 | - ) { |
|
43 | - |
|
44 | - $query->set('is_geodir_loop', true); |
|
45 | - } |
|
36 | + if ($query->is_main_query() && ( |
|
37 | + (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
38 | + || geodir_is_page('listing') |
|
39 | + || geodir_is_page('author') |
|
40 | + || geodir_is_page('search') |
|
41 | + || geodir_is_page('detail')) |
|
42 | + ) { |
|
43 | + |
|
44 | + $query->set('is_geodir_loop', true); |
|
45 | + } |
|
46 | 46 | |
47 | - return $query; |
|
47 | + return $query; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -67,81 +67,81 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function set_listing_request($query ) |
69 | 69 | { |
70 | - global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
70 | + global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
71 | 71 | |
72 | 72 | |
73 | - // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
74 | - if (!geodir_is_geodir_page()) { |
|
75 | - return; |
|
76 | - } |
|
73 | + // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
74 | + if (!geodir_is_geodir_page()) { |
|
75 | + return; |
|
76 | + } |
|
77 | 77 | |
78 | - /* remove all pre filters */ |
|
79 | - remove_all_filters('query'); |
|
80 | - remove_all_filters('posts_search'); |
|
81 | - remove_all_filters('posts_fields'); |
|
82 | - remove_all_filters('posts_join'); |
|
83 | - remove_all_filters('posts_orderby'); |
|
84 | - remove_all_filters('posts_where'); |
|
78 | + /* remove all pre filters */ |
|
79 | + remove_all_filters('query'); |
|
80 | + remove_all_filters('posts_search'); |
|
81 | + remove_all_filters('posts_fields'); |
|
82 | + remove_all_filters('posts_join'); |
|
83 | + remove_all_filters('posts_orderby'); |
|
84 | + remove_all_filters('posts_where'); |
|
85 | 85 | |
86 | 86 | |
87 | - if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
87 | + if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
88 | 88 | |
89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
90 | - //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
89 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
90 | + //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
91 | 91 | |
92 | - if (isset($_REQUEST['sdist'])) { |
|
93 | - ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
94 | - } elseif (get_option('geodir_search_dist') != '') { |
|
95 | - $dist = get_option('geodir_search_dist'); |
|
92 | + if (isset($_REQUEST['sdist'])) { |
|
93 | + ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
94 | + } elseif (get_option('geodir_search_dist') != '') { |
|
95 | + $dist = get_option('geodir_search_dist'); |
|
96 | 96 | |
97 | - } else { |
|
98 | - $dist = 25000; |
|
99 | - } // Distance |
|
97 | + } else { |
|
98 | + $dist = 25000; |
|
99 | + } // Distance |
|
100 | 100 | |
101 | - if (isset($_REQUEST['sgeo_lat'])) { |
|
102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
103 | - } else { |
|
104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
105 | - } // Latitude |
|
101 | + if (isset($_REQUEST['sgeo_lat'])) { |
|
102 | + $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
103 | + } else { |
|
104 | + $mylat = (float)geodir_get_current_city_lat(); |
|
105 | + } // Latitude |
|
106 | 106 | |
107 | - if (isset($_REQUEST['sgeo_lon'])) { |
|
108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
109 | - } else { |
|
110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
111 | - } // Distance |
|
107 | + if (isset($_REQUEST['sgeo_lon'])) { |
|
108 | + $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
109 | + } else { |
|
110 | + $mylon = (float)geodir_get_current_city_lng(); |
|
111 | + } // Distance |
|
112 | 112 | |
113 | - if (isset($_REQUEST['snear'])) { |
|
114 | - $snear = trim(esc_attr($_REQUEST['snear'])); |
|
115 | - } |
|
113 | + if (isset($_REQUEST['snear'])) { |
|
114 | + $snear = trim(esc_attr($_REQUEST['snear'])); |
|
115 | + } |
|
116 | 116 | |
117 | - if (isset($_REQUEST['s'])) { |
|
118 | - $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
119 | - } |
|
117 | + if (isset($_REQUEST['s'])) { |
|
118 | + $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
119 | + } |
|
120 | 120 | |
121 | - if ($snear == 'NEAR ME') { |
|
122 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip)); |
|
124 | - $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude])); |
|
125 | - $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude])); |
|
126 | - } |
|
121 | + if ($snear == 'NEAR ME') { |
|
122 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip)); |
|
124 | + $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude])); |
|
125 | + $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude])); |
|
126 | + } |
|
127 | 127 | |
128 | 128 | |
129 | - if (strstr($s, ',')) { |
|
130 | - $s_AA = str_replace(" ", "", $s); |
|
131 | - $s_A = explode(",", $s_AA); |
|
132 | - $s_A = implode('","', $s_A); |
|
133 | - $s_A = '"' . $s_A . '"'; |
|
134 | - } else { |
|
135 | - $s_A = '"' . $s . '"'; |
|
136 | - } |
|
129 | + if (strstr($s, ',')) { |
|
130 | + $s_AA = str_replace(" ", "", $s); |
|
131 | + $s_A = explode(",", $s_AA); |
|
132 | + $s_A = implode('","', $s_A); |
|
133 | + $s_A = '"' . $s_A . '"'; |
|
134 | + } else { |
|
135 | + $s_A = '"' . $s . '"'; |
|
136 | + } |
|
137 | 137 | |
138 | - if (strstr($s, ' ')) { |
|
139 | - $s_SA = explode(" ", $s); |
|
140 | - } else { |
|
141 | - $s_SA = ''; |
|
142 | - } |
|
138 | + if (strstr($s, ' ')) { |
|
139 | + $s_SA = explode(" ", $s); |
|
140 | + } else { |
|
141 | + $s_SA = ''; |
|
142 | + } |
|
143 | 143 | |
144 | - endif; |
|
144 | + endif; |
|
145 | 145 | |
146 | 146 | |
147 | 147 | |
@@ -162,56 +162,56 @@ discard block |
||
162 | 162 | */ |
163 | 163 | function geodir_listing_loop_filter($query) |
164 | 164 | { |
165 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
165 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
166 | 166 | |
167 | - // fix wp_reset_query for popular post view widget |
|
168 | - if (!geodir_is_geodir_page()) { |
|
169 | - return; |
|
170 | - } |
|
167 | + // fix wp_reset_query for popular post view widget |
|
168 | + if (!geodir_is_geodir_page()) { |
|
169 | + return; |
|
170 | + } |
|
171 | 171 | |
172 | - $geodir_post_type = geodir_get_current_posttype(); |
|
173 | - |
|
174 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
175 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
176 | - |
|
177 | - if (isset($wp_query->query[$taxonomies[0]])) { |
|
178 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
179 | - $request_term = end($request_term); |
|
180 | - if (!term_exists($request_term)) { |
|
181 | - $args = array('number' => '1',); |
|
182 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
183 | - foreach ($terms_arr as $location_term) { |
|
184 | - $term_arr = $location_term; |
|
185 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
186 | - } |
|
187 | - $wp_query->queried_object_id = 1; |
|
188 | - $wp_query->queried_object = $term_arr; |
|
189 | - //print_r($wp_query) ; |
|
190 | - } |
|
191 | - } |
|
172 | + $geodir_post_type = geodir_get_current_posttype(); |
|
192 | 173 | |
193 | - } |
|
194 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
195 | - |
|
196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
197 | - |
|
198 | - add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
199 | - add_filter('posts_join', 'geodir_posts_join', 1); |
|
200 | - geodir_post_where(); |
|
201 | - if (!is_admin()) |
|
202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
203 | - |
|
204 | - // advanced filter for popular post view widget |
|
205 | - global $wp_query; |
|
206 | - if (!is_admin()) { |
|
207 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
208 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
209 | - } |
|
210 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
211 | - } |
|
174 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
175 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
212 | 176 | |
213 | - } |
|
214 | - return $query; |
|
177 | + if (isset($wp_query->query[$taxonomies[0]])) { |
|
178 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
179 | + $request_term = end($request_term); |
|
180 | + if (!term_exists($request_term)) { |
|
181 | + $args = array('number' => '1',); |
|
182 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
183 | + foreach ($terms_arr as $location_term) { |
|
184 | + $term_arr = $location_term; |
|
185 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
186 | + } |
|
187 | + $wp_query->queried_object_id = 1; |
|
188 | + $wp_query->queried_object = $term_arr; |
|
189 | + //print_r($wp_query) ; |
|
190 | + } |
|
191 | + } |
|
192 | + |
|
193 | + } |
|
194 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
195 | + |
|
196 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
197 | + |
|
198 | + add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
199 | + add_filter('posts_join', 'geodir_posts_join', 1); |
|
200 | + geodir_post_where(); |
|
201 | + if (!is_admin()) |
|
202 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
203 | + |
|
204 | + // advanced filter for popular post view widget |
|
205 | + global $wp_query; |
|
206 | + if (!is_admin()) { |
|
207 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
208 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
209 | + } |
|
210 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
211 | + } |
|
212 | + |
|
213 | + } |
|
214 | + return $query; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -230,67 +230,67 @@ discard block |
||
230 | 230 | * @return string Modified fields query string. |
231 | 231 | */ |
232 | 232 | function geodir_posts_fields($fields) { |
233 | - global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
233 | + global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
234 | 234 | |
235 | - // Filter-Location-Manager to add location table. |
|
236 | - $fields .= ", " . $table . ".* "; |
|
235 | + // Filter-Location-Manager to add location table. |
|
236 | + $fields .= ", " . $table . ".* "; |
|
237 | 237 | |
238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) { |
239 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
239 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
240 | 240 | |
241 | 241 | if ($gd_session->get('all_near_me')) { |
242 | - $mylat = $gd_session->get('user_lat'); |
|
243 | - $mylon = $gd_session->get('user_lon'); |
|
244 | - } |
|
242 | + $mylat = $gd_session->get('user_lat'); |
|
243 | + $mylon = $gd_session->get('user_lon'); |
|
244 | + } |
|
245 | 245 | |
246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
247 | - } |
|
246 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
247 | + } |
|
248 | 248 | |
249 | - global $s; |
|
250 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
251 | - $keywords = explode(" ", $s); |
|
249 | + global $s; |
|
250 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
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(geodir_utf8_strlen($kword)<=$klimit){ |
|
256 | - unset($keywords[$kkey]); |
|
257 | - } |
|
258 | - } |
|
259 | - } |
|
253 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
254 | + foreach($keywords as $kkey=>$kword){ |
|
255 | + if(geodir_utf8_strlen($kword)<=$klimit){ |
|
256 | + unset($keywords[$kkey]); |
|
257 | + } |
|
258 | + } |
|
259 | + } |
|
260 | 260 | |
261 | 261 | |
262 | - if (count($keywords) > 1) { |
|
263 | - $parts = array( |
|
264 | - 'AND' => 'gd_alltitlematch_part', |
|
265 | - 'OR' => 'gd_titlematch_part' |
|
266 | - ); |
|
267 | - $gd_titlematch_part = ""; |
|
268 | - foreach ($parts as $key => $part) { |
|
269 | - $gd_titlematch_part .= " CASE WHEN "; |
|
270 | - $count = 0; |
|
271 | - foreach ($keywords as $keyword) { |
|
272 | - $keyword = trim($keyword); |
|
273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
262 | + if (count($keywords) > 1) { |
|
263 | + $parts = array( |
|
264 | + 'AND' => 'gd_alltitlematch_part', |
|
265 | + 'OR' => 'gd_titlematch_part' |
|
266 | + ); |
|
267 | + $gd_titlematch_part = ""; |
|
268 | + foreach ($parts as $key => $part) { |
|
269 | + $gd_titlematch_part .= " CASE WHEN "; |
|
270 | + $count = 0; |
|
271 | + foreach ($keywords as $keyword) { |
|
272 | + $keyword = trim($keyword); |
|
273 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
274 | 274 | $count++; |
275 | - if ($count < count($keywords)) { |
|
276 | - // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
275 | + if ($count < count($keywords)) { |
|
276 | + // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
277 | 277 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
278 | - } else { |
|
279 | - //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
278 | + } else { |
|
279 | + //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
280 | 280 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
281 | - } |
|
282 | - } |
|
283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
284 | - } |
|
285 | - } else { |
|
286 | - $gd_titlematch_part = ""; |
|
287 | - } |
|
288 | - $s = stripslashes_deep( $s ); |
|
289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
281 | + } |
|
282 | + } |
|
283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
284 | + } |
|
285 | + } else { |
|
286 | + $gd_titlematch_part = ""; |
|
287 | + } |
|
288 | + $s = stripslashes_deep( $s ); |
|
289 | + $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
290 | 290 | $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 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,'%>' . $s . '%','% ' . $s . ',')); |
291 | - } |
|
291 | + } |
|
292 | 292 | |
293 | - return $fields; |
|
293 | + return $fields; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | |
@@ -307,26 +307,26 @@ discard block |
||
307 | 307 | */ |
308 | 308 | function geodir_posts_join($join) |
309 | 309 | { |
310 | - global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
310 | + global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
311 | 311 | |
312 | - ########### WPML ########### |
|
312 | + ########### WPML ########### |
|
313 | 313 | |
314 | - if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) { |
|
315 | - global $sitepress; |
|
316 | - $lang_code = ICL_LANGUAGE_CODE; |
|
317 | - $default_lang_code = $sitepress->get_default_language(); |
|
318 | - if ($lang_code) { |
|
319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
320 | - } |
|
314 | + if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) { |
|
315 | + global $sitepress; |
|
316 | + $lang_code = ICL_LANGUAGE_CODE; |
|
317 | + $default_lang_code = $sitepress->get_default_language(); |
|
318 | + if ($lang_code) { |
|
319 | + $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
320 | + } |
|
321 | 321 | |
322 | - } |
|
323 | - ########### WPML ########### |
|
322 | + } |
|
323 | + ########### WPML ########### |
|
324 | 324 | |
325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) "; |
|
326 | - //===old code start |
|
327 | - //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end |
|
325 | + $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) "; |
|
326 | + //===old code start |
|
327 | + //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end |
|
328 | 328 | |
329 | - return $join; |
|
329 | + return $join; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -344,15 +344,15 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function geodir_posts_orderby($orderby) |
346 | 346 | { |
347 | - global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
347 | + global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
348 | 348 | |
349 | - $sort_by = ''; |
|
350 | - $orderby = ' '; |
|
349 | + $sort_by = ''; |
|
350 | + $orderby = ' '; |
|
351 | 351 | |
352 | - if (get_query_var('order_by')) |
|
353 | - $sort_by = get_query_var('order_by'); |
|
352 | + if (get_query_var('order_by')) |
|
353 | + $sort_by = get_query_var('order_by'); |
|
354 | 354 | |
355 | - /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){ |
|
355 | + /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){ |
|
356 | 356 | $current_term = $wp_query->get_queried_object(); |
357 | 357 | } |
358 | 358 | |
@@ -366,133 +366,133 @@ discard block |
||
366 | 366 | }*/ |
367 | 367 | |
368 | 368 | |
369 | - if ($snear != '') { |
|
370 | - $orderby .= " distance,"; |
|
371 | - } |
|
369 | + if ($snear != '') { |
|
370 | + $orderby .= " distance,"; |
|
371 | + } |
|
372 | 372 | |
373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
373 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
374 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
375 | 375 | |
376 | 376 | |
377 | - if ($sort_by == '') { |
|
378 | - $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
379 | - if (!empty($default_sort)) |
|
380 | - $sort_by = $default_sort; |
|
381 | - } |
|
377 | + if ($sort_by == '') { |
|
378 | + $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
379 | + if (!empty($default_sort)) |
|
380 | + $sort_by = $default_sort; |
|
381 | + } |
|
382 | 382 | |
383 | - /* |
|
383 | + /* |
|
384 | 384 | if search by term & no location then order always "relevance" |
385 | 385 | if search by location then order always "nearest" |
386 | 386 | */ |
387 | - if (is_main_query() && geodir_is_page('search')) { |
|
388 | - $search_term = get_query_var('s'); |
|
387 | + if (is_main_query() && geodir_is_page('search')) { |
|
388 | + $search_term = get_query_var('s'); |
|
389 | 389 | |
390 | - if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) { |
|
391 | - $sort_by = 'az'; |
|
392 | - } |
|
390 | + if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) { |
|
391 | + $sort_by = 'az'; |
|
392 | + } |
|
393 | 393 | |
394 | - if ($snear != '' && $sort_by!='farthest') { |
|
395 | - $sort_by = 'nearest'; |
|
396 | - } |
|
397 | - } |
|
394 | + if ($snear != '' && $sort_by!='farthest') { |
|
395 | + $sort_by = 'nearest'; |
|
396 | + } |
|
397 | + } |
|
398 | 398 | |
399 | - switch ($sort_by): |
|
400 | - case 'newest': |
|
401 | - $orderby = "$wpdb->posts.post_date desc, "; |
|
402 | - break; |
|
403 | - case 'oldest': |
|
404 | - $orderby = "$wpdb->posts.post_date asc, "; |
|
405 | - break; |
|
406 | - case 'low_review': |
|
407 | - case 'rating_count_asc': |
|
408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
409 | - break; |
|
410 | - case 'high_review': |
|
411 | - case 'rating_count_desc': |
|
412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
413 | - break; |
|
414 | - case 'low_rating': |
|
415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
416 | - break; |
|
417 | - case 'high_rating': |
|
418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
419 | - break; |
|
420 | - case 'featured': |
|
421 | - $orderby = $table . ".is_featured asc, "; |
|
422 | - break; |
|
423 | - case 'nearest': |
|
424 | - $orderby = " distance asc, "; |
|
425 | - break; |
|
426 | - case 'farthest': |
|
427 | - $orderby = " distance desc, "; |
|
428 | - break; |
|
429 | - case 'random': |
|
430 | - $orderby = " rand(), "; |
|
431 | - break; |
|
432 | - case 'az': |
|
433 | - $orderby = "$wpdb->posts.post_title asc, "; |
|
434 | - break; |
|
435 | - // sort by rating |
|
436 | - case 'overall_rating_desc': |
|
437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
438 | - break; |
|
439 | - case 'overall_rating_asc': |
|
440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
441 | - break; |
|
442 | - default: |
|
443 | - |
|
444 | - break; |
|
445 | - endswitch; |
|
446 | - |
|
447 | - if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) { |
|
448 | - if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) { |
|
449 | - $orderby = "$wpdb->posts.comment_count DESC, "; |
|
450 | - $sort_by = 'comment_count_desc'; |
|
451 | - } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) { |
|
452 | - $orderby = "$wpdb->posts.comment_count ASC, "; |
|
453 | - $sort_by = 'comment_count_asc'; |
|
454 | - } |
|
455 | - } |
|
399 | + switch ($sort_by): |
|
400 | + case 'newest': |
|
401 | + $orderby = "$wpdb->posts.post_date desc, "; |
|
402 | + break; |
|
403 | + case 'oldest': |
|
404 | + $orderby = "$wpdb->posts.post_date asc, "; |
|
405 | + break; |
|
406 | + case 'low_review': |
|
407 | + case 'rating_count_asc': |
|
408 | + $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
409 | + break; |
|
410 | + case 'high_review': |
|
411 | + case 'rating_count_desc': |
|
412 | + $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
413 | + break; |
|
414 | + case 'low_rating': |
|
415 | + $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
416 | + break; |
|
417 | + case 'high_rating': |
|
418 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
419 | + break; |
|
420 | + case 'featured': |
|
421 | + $orderby = $table . ".is_featured asc, "; |
|
422 | + break; |
|
423 | + case 'nearest': |
|
424 | + $orderby = " distance asc, "; |
|
425 | + break; |
|
426 | + case 'farthest': |
|
427 | + $orderby = " distance desc, "; |
|
428 | + break; |
|
429 | + case 'random': |
|
430 | + $orderby = " rand(), "; |
|
431 | + break; |
|
432 | + case 'az': |
|
433 | + $orderby = "$wpdb->posts.post_title asc, "; |
|
434 | + break; |
|
435 | + // sort by rating |
|
436 | + case 'overall_rating_desc': |
|
437 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
438 | + break; |
|
439 | + case 'overall_rating_asc': |
|
440 | + $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
441 | + break; |
|
442 | + default: |
|
443 | + |
|
444 | + break; |
|
445 | + endswitch; |
|
446 | + |
|
447 | + if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) { |
|
448 | + if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) { |
|
449 | + $orderby = "$wpdb->posts.comment_count DESC, "; |
|
450 | + $sort_by = 'comment_count_desc'; |
|
451 | + } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) { |
|
452 | + $orderby = "$wpdb->posts.comment_count ASC, "; |
|
453 | + $sort_by = 'comment_count_asc'; |
|
454 | + } |
|
455 | + } |
|
456 | 456 | |
457 | - global $s; |
|
457 | + global $s; |
|
458 | 458 | |
459 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
460 | - $keywords = explode(" ", $s); |
|
461 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
462 | - foreach($keywords as $kkey=>$kword){ |
|
463 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
464 | - unset($keywords[$kkey]); |
|
465 | - } |
|
466 | - } |
|
467 | - } |
|
468 | - if ($sort_by == 'nearest' || $sort_by == 'farthest') { |
|
469 | - if (count($keywords) > 1) { |
|
470 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
471 | - } else { |
|
472 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
473 | - } |
|
474 | - } else { |
|
475 | - if (count($keywords) > 1) { |
|
476 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
477 | - } else { |
|
478 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
479 | - } |
|
480 | - } |
|
481 | - } |
|
459 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
460 | + $keywords = explode(" ", $s); |
|
461 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
462 | + foreach($keywords as $kkey=>$kword){ |
|
463 | + if(geodir_utf8_strlen($kword)<=$klimit){ |
|
464 | + unset($keywords[$kkey]); |
|
465 | + } |
|
466 | + } |
|
467 | + } |
|
468 | + if ($sort_by == 'nearest' || $sort_by == 'farthest') { |
|
469 | + if (count($keywords) > 1) { |
|
470 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
471 | + } else { |
|
472 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
473 | + } |
|
474 | + } else { |
|
475 | + if (count($keywords) > 1) { |
|
476 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
477 | + } else { |
|
478 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
479 | + } |
|
480 | + } |
|
481 | + } |
|
482 | 482 | |
483 | - /** |
|
484 | - * Filter order by SQL. |
|
485 | - * |
|
486 | - * @since 1.0.0 |
|
487 | - * @param string $orderby The orderby query string. |
|
488 | - * @param string $sort_by Sortby query string. |
|
489 | - * @param string $table Listing table name. |
|
490 | - */ |
|
491 | - $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table); |
|
483 | + /** |
|
484 | + * Filter order by SQL. |
|
485 | + * |
|
486 | + * @since 1.0.0 |
|
487 | + * @param string $orderby The orderby query string. |
|
488 | + * @param string $sort_by Sortby query string. |
|
489 | + * @param string $table Listing table name. |
|
490 | + */ |
|
491 | + $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table); |
|
492 | 492 | |
493 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
493 | + $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
494 | 494 | |
495 | - return $orderby; |
|
495 | + return $orderby; |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | |
@@ -510,78 +510,78 @@ discard block |
||
510 | 510 | function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table) |
511 | 511 | { |
512 | 512 | |
513 | - global $wpdb; |
|
513 | + global $wpdb; |
|
514 | 514 | |
515 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) { |
|
515 | + if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) { |
|
516 | 516 | |
517 | - $sort_array = explode('_', $sort_by); |
|
517 | + $sort_array = explode('_', $sort_by); |
|
518 | 518 | |
519 | - $sort_by_count = count($sort_array); |
|
519 | + $sort_by_count = count($sort_array); |
|
520 | 520 | |
521 | - $order = $sort_array[$sort_by_count - 1]; |
|
521 | + $order = $sort_array[$sort_by_count - 1]; |
|
522 | 522 | |
523 | - if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) { |
|
523 | + if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) { |
|
524 | 524 | |
525 | - $sort_by = str_replace('_' . $order, '', $sort_by); |
|
525 | + $sort_by = str_replace('_' . $order, '', $sort_by); |
|
526 | 526 | |
527 | - switch ($sort_by): |
|
527 | + switch ($sort_by): |
|
528 | 528 | |
529 | - case 'post_date': |
|
530 | - case 'comment_count': |
|
529 | + case 'post_date': |
|
530 | + case 'comment_count': |
|
531 | 531 | |
532 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
533 | - break; |
|
532 | + $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
533 | + break; |
|
534 | 534 | |
535 | - case 'distance': |
|
536 | - $orderby = $sort_by . " " . $order . ", "; |
|
537 | - break; |
|
535 | + case 'distance': |
|
536 | + $orderby = $sort_by . " " . $order . ", "; |
|
537 | + break; |
|
538 | 538 | |
539 | 539 | |
540 | - // sort by rating |
|
541 | - case 'overall_rating': |
|
540 | + // sort by rating |
|
541 | + case 'overall_rating': |
|
542 | 542 | |
543 | - $use_bayesian = apply_filters('gd_use_bayesian',true,$table); |
|
544 | - $avg_rating = 0; |
|
545 | - if($use_bayesian){ |
|
546 | - $avg_num_votes = get_transient( 'gd_avg_num_votes_'.$table ); |
|
547 | - if(!$avg_num_votes){ |
|
548 | - $avg_num_votes = $wpdb->get_var("SELECT SUM(rating_count) FROM $table"); |
|
549 | - if($avg_num_votes){ |
|
543 | + $use_bayesian = apply_filters('gd_use_bayesian',true,$table); |
|
544 | + $avg_rating = 0; |
|
545 | + if($use_bayesian){ |
|
546 | + $avg_num_votes = get_transient( 'gd_avg_num_votes_'.$table ); |
|
547 | + if(!$avg_num_votes){ |
|
548 | + $avg_num_votes = $wpdb->get_var("SELECT SUM(rating_count) FROM $table"); |
|
549 | + if($avg_num_votes){ |
|
550 | 550 | |
551 | - $avg_rating = get_transient( 'gd_avg_rating_'.$table ); |
|
552 | - if(!$avg_rating){ |
|
553 | - $avg_rating = $wpdb->get_var("SELECT SUM(overall_rating) FROM $table")/$avg_num_votes; |
|
554 | - } |
|
555 | - set_transient( 'gd_avg_num_votes_'.$table, $avg_num_votes, 12 * HOUR_IN_SECONDS ); |
|
556 | - set_transient( 'gd_avg_rating_'.$table, $avg_rating , 12 * HOUR_IN_SECONDS ); |
|
557 | - } |
|
558 | - } |
|
551 | + $avg_rating = get_transient( 'gd_avg_rating_'.$table ); |
|
552 | + if(!$avg_rating){ |
|
553 | + $avg_rating = $wpdb->get_var("SELECT SUM(overall_rating) FROM $table")/$avg_num_votes; |
|
554 | + } |
|
555 | + set_transient( 'gd_avg_num_votes_'.$table, $avg_num_votes, 12 * HOUR_IN_SECONDS ); |
|
556 | + set_transient( 'gd_avg_rating_'.$table, $avg_rating , 12 * HOUR_IN_SECONDS ); |
|
557 | + } |
|
558 | + } |
|
559 | 559 | |
560 | - if(!$avg_num_votes){ $avg_num_votes = 0;} |
|
560 | + if(!$avg_num_votes){ $avg_num_votes = 0;} |
|
561 | 561 | |
562 | - $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )) / ( $avg_num_votes + " . $table . ".rating_count ) $order , "; |
|
562 | + $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )) / ( $avg_num_votes + " . $table . ".rating_count ) $order , "; |
|
563 | 563 | |
564 | - //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ) / ( " . $table . ".rating_count + " . $table . ".rating_count ) $order , "; // seems to work mostly with no extra overheads |
|
565 | - }else{ |
|
566 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
567 | - } |
|
564 | + //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ) / ( " . $table . ".rating_count + " . $table . ".rating_count ) $order , "; // seems to work mostly with no extra overheads |
|
565 | + }else{ |
|
566 | + $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
567 | + } |
|
568 | 568 | |
569 | - break; |
|
569 | + break; |
|
570 | 570 | |
571 | 571 | |
572 | - default: |
|
573 | - if (geodir_column_exist($table, $sort_by)) { |
|
572 | + default: |
|
573 | + if (geodir_column_exist($table, $sort_by)) { |
|
574 | 574 | $orderby = $table . "." . $sort_by . " " . $order . ", "; |
575 | 575 | } |
576 | - break; |
|
576 | + break; |
|
577 | 577 | |
578 | - endswitch; |
|
578 | + endswitch; |
|
579 | 579 | |
580 | - } |
|
580 | + } |
|
581 | 581 | |
582 | - } |
|
582 | + } |
|
583 | 583 | |
584 | - return $orderby; |
|
584 | + return $orderby; |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -596,35 +596,35 @@ discard block |
||
596 | 596 | { |
597 | 597 | |
598 | 598 | |
599 | - global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
599 | + global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
600 | 600 | |
601 | - if (!is_admin()) { |
|
601 | + if (!is_admin()) { |
|
602 | 602 | |
603 | - if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
604 | - add_filter('posts_where', 'geodir_edit_listing_where', 1); |
|
603 | + if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
604 | + add_filter('posts_where', 'geodir_edit_listing_where', 1); |
|
605 | 605 | |
606 | - } elseif ((is_search() && $_REQUEST['geodir_search'])) { |
|
606 | + } elseif ((is_search() && $_REQUEST['geodir_search'])) { |
|
607 | 607 | |
608 | - add_filter('posts_where', 'searching_filter_where', 1); |
|
608 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
609 | 609 | |
610 | - if ($snear != '') |
|
611 | - add_filter('posts_where', 'searching_filter_where', 1); |
|
610 | + if ($snear != '') |
|
611 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
612 | 612 | |
613 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
613 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
614 | 614 | add_filter( 'posts_where', 'geodir_posts_having', 10000, 2 ); // make sure its the last WHERE param |
615 | 615 | |
616 | - } elseif (geodir_is_page('author')) { |
|
616 | + } elseif (geodir_is_page('author')) { |
|
617 | 617 | |
618 | - add_filter('posts_where', 'author_filter_where', 1); |
|
618 | + add_filter('posts_where', 'author_filter_where', 1); |
|
619 | 619 | |
620 | - } |
|
620 | + } |
|
621 | 621 | |
622 | - //if (!geodir_is_page('detail')) |
|
623 | - add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
622 | + //if (!geodir_is_page('detail')) |
|
623 | + add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
624 | 624 | |
625 | - //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
625 | + //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
626 | 626 | |
627 | - } |
|
627 | + } |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | /** |
@@ -639,13 +639,13 @@ discard block |
||
639 | 639 | */ |
640 | 640 | function geodir_preview_post_cap($allcaps, $caps, $args) |
641 | 641 | { |
642 | - $user_id = get_current_user_id(); |
|
643 | - if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) { |
|
642 | + $user_id = get_current_user_id(); |
|
643 | + if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) { |
|
644 | 644 | |
645 | - $allcaps['edit_posts'] = true; |
|
646 | - } |
|
647 | - //print_r($allcaps); |
|
648 | - return $allcaps; |
|
645 | + $allcaps['edit_posts'] = true; |
|
646 | + } |
|
647 | + //print_r($allcaps); |
|
648 | + return $allcaps; |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | |
@@ -660,9 +660,9 @@ discard block |
||
660 | 660 | */ |
661 | 661 | function geodir_edit_listing_where($where) |
662 | 662 | { |
663 | - global $wpdb; |
|
664 | - $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']); |
|
665 | - return $where; |
|
663 | + global $wpdb; |
|
664 | + $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']); |
|
665 | + return $where; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | |
@@ -679,29 +679,29 @@ discard block |
||
679 | 679 | */ |
680 | 680 | function geodir_default_where($where) |
681 | 681 | { |
682 | - global $wp_query, $wpdb; |
|
683 | - |
|
684 | - //print_r($wp_query); |
|
685 | - ########### WPML ########### |
|
686 | - |
|
687 | - if (geodir_is_wpml()) { |
|
688 | - global $sitepress, $table_prefix; |
|
689 | - $lang_code = ICL_LANGUAGE_CODE; |
|
690 | - $default_lang_code = $sitepress->get_default_language(); |
|
691 | - $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
692 | - //echo '##########'.$q_post_type; |
|
693 | - if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) { |
|
694 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') "; |
|
695 | - //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
696 | - } |
|
682 | + global $wp_query, $wpdb; |
|
697 | 683 | |
698 | - } |
|
699 | - ########### WPML ########### |
|
684 | + //print_r($wp_query); |
|
685 | + ########### WPML ########### |
|
686 | + |
|
687 | + if (geodir_is_wpml()) { |
|
688 | + global $sitepress, $table_prefix; |
|
689 | + $lang_code = ICL_LANGUAGE_CODE; |
|
690 | + $default_lang_code = $sitepress->get_default_language(); |
|
691 | + $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
692 | + //echo '##########'.$q_post_type; |
|
693 | + if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) { |
|
694 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') "; |
|
695 | + //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
696 | + } |
|
697 | + |
|
698 | + } |
|
699 | + ########### WPML ########### |
|
700 | 700 | |
701 | 701 | |
702 | - return $where = str_replace("0 = 1", "1=1", $where); |
|
702 | + return $where = str_replace("0 = 1", "1=1", $where); |
|
703 | 703 | |
704 | - /* ====== old code start === |
|
704 | + /* ====== old code start === |
|
705 | 705 | $where = str_replace("0 = 1", "1=1", $where); |
706 | 706 | $country = get_query_var('gd_country'); |
707 | 707 | $region = get_query_var('gd_region'); |
@@ -742,94 +742,94 @@ discard block |
||
742 | 742 | * @return string Modified where query string. |
743 | 743 | */ |
744 | 744 | function searching_filter_where($where) { |
745 | - global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
745 | + global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
746 | 746 | |
747 | - $search_term = 'OR'; |
|
748 | - $search_term = 'AND'; |
|
749 | - $geodir_custom_search = ''; |
|
750 | - $category_search_range = ''; |
|
747 | + $search_term = 'OR'; |
|
748 | + $search_term = 'AND'; |
|
749 | + $geodir_custom_search = ''; |
|
750 | + $category_search_range = ''; |
|
751 | 751 | |
752 | - if (is_single() && get_query_var('post_type')) { |
|
752 | + if (is_single() && get_query_var('post_type')) { |
|
753 | 753 | return $where; |
754 | 754 | } |
755 | 755 | |
756 | - if (is_tax()) { |
|
756 | + if (is_tax()) { |
|
757 | 757 | return $where; |
758 | 758 | } |
759 | 759 | |
760 | 760 | $s = trim($s); |
761 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
762 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
763 | - |
|
764 | - $where = ''; |
|
765 | - $better_search_terms = ''; |
|
766 | - if (isset($_REQUEST['stype'])) |
|
767 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
768 | - else |
|
769 | - $post_types = 'gd_place'; |
|
770 | - |
|
771 | - if ($s != '') { |
|
772 | - $keywords = explode(" ", $s); |
|
773 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
774 | - foreach($keywords as $kkey=>$kword){ |
|
775 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
776 | - unset($keywords[$kkey]); |
|
777 | - } |
|
778 | - } |
|
779 | - } |
|
761 | + $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
762 | + $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
763 | + |
|
764 | + $where = ''; |
|
765 | + $better_search_terms = ''; |
|
766 | + if (isset($_REQUEST['stype'])) |
|
767 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
768 | + else |
|
769 | + $post_types = 'gd_place'; |
|
770 | + |
|
771 | + if ($s != '') { |
|
772 | + $keywords = explode(" ", $s); |
|
773 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
774 | + foreach($keywords as $kkey=>$kword){ |
|
775 | + if(geodir_utf8_strlen($kword)<=$klimit){ |
|
776 | + unset($keywords[$kkey]); |
|
777 | + } |
|
778 | + } |
|
779 | + } |
|
780 | 780 | |
781 | - if (!empty($keywords)) { |
|
782 | - foreach ($keywords as $keyword) { |
|
783 | - $keyword = trim($keyword); |
|
784 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
785 | - if ($keyword != '') { |
|
786 | - /** |
|
787 | - * Filter the search query keywords SQL. |
|
788 | - * |
|
789 | - * @since 1.5.9 |
|
790 | - * @package GeoDirectory |
|
791 | - * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
792 | - * @param array $keywords The array of keywords for the query. |
|
793 | - * @param string $keyword The single keyword being searched. |
|
794 | - */ |
|
781 | + if (!empty($keywords)) { |
|
782 | + foreach ($keywords as $keyword) { |
|
783 | + $keyword = trim($keyword); |
|
784 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
785 | + if ($keyword != '') { |
|
786 | + /** |
|
787 | + * Filter the search query keywords SQL. |
|
788 | + * |
|
789 | + * @since 1.5.9 |
|
790 | + * @package GeoDirectory |
|
791 | + * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
792 | + * @param array $keywords The array of keywords for the query. |
|
793 | + * @param string $keyword The single keyword being searched. |
|
794 | + */ |
|
795 | 795 | $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword); |
796 | - } |
|
797 | - } |
|
798 | - } |
|
799 | - } |
|
796 | + } |
|
797 | + } |
|
798 | + } |
|
799 | + } |
|
800 | 800 | |
801 | - /* get taxonomy */ |
|
802 | - $taxonomies = geodir_get_taxonomies($post_types, true); |
|
803 | - if($taxonomies) { |
|
804 | - $taxonomies = implode("','", $taxonomies); |
|
805 | - $taxonomies = "'" . $taxonomies . "'"; |
|
806 | - }else{$taxonomies='';} |
|
801 | + /* get taxonomy */ |
|
802 | + $taxonomies = geodir_get_taxonomies($post_types, true); |
|
803 | + if($taxonomies) { |
|
804 | + $taxonomies = implode("','", $taxonomies); |
|
805 | + $taxonomies = "'" . $taxonomies . "'"; |
|
806 | + }else{$taxonomies='';} |
|
807 | 807 | |
808 | - $content_where = $terms_where = ''; |
|
809 | - $terms_sql = ''; |
|
808 | + $content_where = $terms_where = ''; |
|
809 | + $terms_sql = ''; |
|
810 | 810 | if ($s != '') { |
811 | - /** |
|
812 | - * Filter the search query content where values. |
|
813 | - * |
|
814 | - * @since 1.5.0 |
|
815 | - * @package GeoDirectory |
|
816 | - * |
|
817 | - * @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%\") ") "`. |
|
818 | - */ |
|
819 | - $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%\") " ); |
|
820 | - /** |
|
821 | - * Filter the search query term values. |
|
822 | - * |
|
823 | - * @since 1.5.0 |
|
824 | - * @package GeoDirectory |
|
825 | - * |
|
826 | - * @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)) "`. |
|
827 | - */ |
|
828 | - $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)) " ); |
|
829 | - |
|
830 | - |
|
831 | - // get term sql |
|
832 | - $term_sql = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->terms.name, $wpdb->term_taxonomy.taxonomy |
|
811 | + /** |
|
812 | + * Filter the search query content where values. |
|
813 | + * |
|
814 | + * @since 1.5.0 |
|
815 | + * @package GeoDirectory |
|
816 | + * |
|
817 | + * @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%\") ") "`. |
|
818 | + */ |
|
819 | + $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%\") " ); |
|
820 | + /** |
|
821 | + * Filter the search query term values. |
|
822 | + * |
|
823 | + * @since 1.5.0 |
|
824 | + * @package GeoDirectory |
|
825 | + * |
|
826 | + * @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)) "`. |
|
827 | + */ |
|
828 | + $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)) " ); |
|
829 | + |
|
830 | + |
|
831 | + // get term sql |
|
832 | + $term_sql = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->terms.name, $wpdb->term_taxonomy.taxonomy |
|
833 | 833 | FROM $wpdb->term_taxonomy, $wpdb->terms, $wpdb->term_relationships |
834 | 834 | WHERE $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id |
835 | 835 | AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id |
@@ -837,46 +837,46 @@ discard block |
||
837 | 837 | $terms_where |
838 | 838 | GROUP BY $wpdb->term_taxonomy.term_id"; |
839 | 839 | |
840 | - $term_results = $wpdb->get_results( $term_sql ); |
|
841 | - $term_ids = array(); |
|
842 | - $terms_sql = ''; |
|
843 | - |
|
844 | - if ( ! empty( $term_results ) ) { |
|
845 | - foreach ( $term_results as $term_id ) { |
|
846 | - $term_ids[] = $term_id; |
|
847 | - } |
|
848 | - if ( ! empty( $term_ids ) ) { |
|
849 | - foreach ( $term_ids as $term ) { |
|
850 | - if ( $term->taxonomy == $post_types . '_tags' ) { |
|
851 | - $terms_sql .= $wpdb->prepare( " OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name ); |
|
852 | - } else { |
|
853 | - $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
854 | - } |
|
855 | - } |
|
856 | - } |
|
857 | - } |
|
840 | + $term_results = $wpdb->get_results( $term_sql ); |
|
841 | + $term_ids = array(); |
|
842 | + $terms_sql = ''; |
|
858 | 843 | |
859 | - } |
|
844 | + if ( ! empty( $term_results ) ) { |
|
845 | + foreach ( $term_results as $term_id ) { |
|
846 | + $term_ids[] = $term_id; |
|
847 | + } |
|
848 | + if ( ! empty( $term_ids ) ) { |
|
849 | + foreach ( $term_ids as $term ) { |
|
850 | + if ( $term->taxonomy == $post_types . '_tags' ) { |
|
851 | + $terms_sql .= $wpdb->prepare( " OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name ); |
|
852 | + } else { |
|
853 | + $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
854 | + } |
|
855 | + } |
|
856 | + } |
|
857 | + } |
|
860 | 858 | |
861 | - if ($snear != '') { |
|
859 | + } |
|
862 | 860 | |
861 | + if ($snear != '') { |
|
863 | 862 | |
864 | - if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) { |
|
865 | - $dist = $gd_session->get('near_me_range'); |
|
866 | - } |
|
867 | - $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
868 | - $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
869 | - $lat1 = $mylat - ($dist / 69); |
|
870 | - $lat2 = $mylat + ($dist / 69); |
|
871 | 863 | |
872 | - $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
873 | - $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
874 | - $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
875 | - $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
864 | + if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) { |
|
865 | + $dist = $gd_session->get('near_me_range'); |
|
866 | + } |
|
867 | + $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
868 | + $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
869 | + $lat1 = $mylat - ($dist / 69); |
|
870 | + $lat2 = $mylat + ($dist / 69); |
|
871 | + |
|
872 | + $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
873 | + $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
874 | + $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
875 | + $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
876 | 876 | |
877 | 877 | |
878 | 878 | $post_title_where = $s != "" ? "{$wpdb->posts}.post_title LIKE \"$s\"" : "1=1"; |
879 | - $where .= " AND ( ( $post_title_where $better_search_terms) |
|
879 | + $where .= " AND ( ( $post_title_where $better_search_terms) |
|
880 | 880 | $content_where |
881 | 881 | $terms_sql |
882 | 882 | ) |
@@ -885,35 +885,35 @@ discard block |
||
885 | 885 | AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
886 | 886 | AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
887 | 887 | |
888 | - if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
|
889 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
890 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist; |
|
891 | - } |
|
888 | + if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
|
889 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
890 | + $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist; |
|
891 | + } |
|
892 | 892 | |
893 | - } else { |
|
893 | + } else { |
|
894 | 894 | |
895 | 895 | |
896 | - $post_title_where = $s != "" ? "{$wpdb->posts}.post_title LIKE \"$s\"" : "1=1"; |
|
897 | - $where .= " AND ( ( $post_title_where $better_search_terms) |
|
896 | + $post_title_where = $s != "" ? "{$wpdb->posts}.post_title LIKE \"$s\"" : "1=1"; |
|
897 | + $where .= " AND ( ( $post_title_where $better_search_terms) |
|
898 | 898 | $content_where |
899 | 899 | $terms_sql |
900 | 900 | ) |
901 | 901 | |
902 | 902 | AND $wpdb->posts.post_type in ('$post_types') |
903 | 903 | AND ($wpdb->posts.post_status = 'publish') "; |
904 | - } |
|
904 | + } |
|
905 | 905 | |
906 | 906 | ########### WPML ########### |
907 | - if ( geodir_wpml_is_post_type_translated( $post_types ) ) { |
|
907 | + if ( geodir_wpml_is_post_type_translated( $post_types ) ) { |
|
908 | 908 | $lang_code = ICL_LANGUAGE_CODE; |
909 | 909 | |
910 | 910 | if ($lang_code && $post_types) { |
911 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
912 | - } |
|
913 | - } |
|
914 | - ########### WPML ########### |
|
911 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
912 | + } |
|
913 | + } |
|
914 | + ########### WPML ########### |
|
915 | 915 | |
916 | - return $where; |
|
916 | + return $where; |
|
917 | 917 | } |
918 | 918 | |
919 | 919 | |
@@ -928,45 +928,45 @@ discard block |
||
928 | 928 | * @return string Modified where query string. |
929 | 929 | */ |
930 | 930 | function author_filter_where($where) { |
931 | - global $wpdb, $geodir_post_type, $table, $curr; |
|
931 | + global $wpdb, $geodir_post_type, $table, $curr; |
|
932 | 932 | |
933 | - $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
934 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
933 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
934 | + $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
935 | 935 | |
936 | - if (isset($_REQUEST['stype'])) { |
|
937 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
938 | - } else { |
|
939 | - $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
|
940 | - } |
|
936 | + if (isset($_REQUEST['stype'])) { |
|
937 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
938 | + } else { |
|
939 | + $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
|
940 | + } |
|
941 | 941 | |
942 | - if ($user_id > 0) { |
|
943 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
|
944 | - $user_fav_posts = geodir_get_user_favourites($user_id); |
|
945 | - $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
|
946 | - $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
|
947 | - } else |
|
948 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
949 | - |
|
950 | - if ($user_id == (int)get_current_user_id()) { |
|
951 | - $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
|
952 | - } else { |
|
953 | - $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
954 | - } |
|
955 | - } else { |
|
956 | - $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
957 | - } |
|
942 | + if ($user_id > 0) { |
|
943 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
|
944 | + $user_fav_posts = geodir_get_user_favourites($user_id); |
|
945 | + $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
|
946 | + $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
|
947 | + } else |
|
948 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
949 | + |
|
950 | + if ($user_id == (int)get_current_user_id()) { |
|
951 | + $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
|
952 | + } else { |
|
953 | + $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
954 | + } |
|
955 | + } else { |
|
956 | + $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
957 | + } |
|
958 | 958 | |
959 | - ########### WPML ########### |
|
960 | - if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) { |
|
961 | - $lang_code = ICL_LANGUAGE_CODE; |
|
962 | - if ($lang_code) { |
|
963 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
964 | - } |
|
959 | + ########### WPML ########### |
|
960 | + if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) { |
|
961 | + $lang_code = ICL_LANGUAGE_CODE; |
|
962 | + if ($lang_code) { |
|
963 | + $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
964 | + } |
|
965 | 965 | |
966 | - } |
|
967 | - ########### WPML ########### |
|
966 | + } |
|
967 | + ########### WPML ########### |
|
968 | 968 | |
969 | - return $where; |
|
969 | + return $where; |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | /** |
@@ -981,11 +981,11 @@ discard block |
||
981 | 981 | */ |
982 | 982 | function geodir_filter_widget_join($join) |
983 | 983 | { |
984 | - global $wp_query, $table; |
|
985 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
986 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
987 | - } |
|
988 | - return $join; |
|
984 | + global $wp_query, $table; |
|
985 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
986 | + $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
987 | + } |
|
988 | + return $join; |
|
989 | 989 | } |
990 | 990 | |
991 | 991 | /** |
@@ -1000,43 +1000,43 @@ discard block |
||
1000 | 1000 | */ |
1001 | 1001 | function geodir_filter_widget_where($where) |
1002 | 1002 | { |
1003 | - global $wp_query, $table; |
|
1004 | - if (!empty($wp_query->query['show_featured_only'])) { |
|
1005 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
1006 | - } |
|
1007 | - if (!empty($wp_query->query['show_special_only'])) { |
|
1008 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
1009 | - } |
|
1010 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
1011 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
1012 | - } |
|
1013 | - if (!empty($wp_query->query['with_videos_only'])) { |
|
1014 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
1015 | - } |
|
1016 | - return $where; |
|
1003 | + global $wp_query, $table; |
|
1004 | + if (!empty($wp_query->query['show_featured_only'])) { |
|
1005 | + $where .= " AND " . $table . ".is_featured = '1'"; |
|
1006 | + } |
|
1007 | + if (!empty($wp_query->query['show_special_only'])) { |
|
1008 | + $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
1009 | + } |
|
1010 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
1011 | + $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
1012 | + } |
|
1013 | + if (!empty($wp_query->query['with_videos_only'])) { |
|
1014 | + $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
1015 | + } |
|
1016 | + return $where; |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | |
1020 | 1020 | function geodir_related_posts_fields($fields) { |
1021 | - global $wp_query, $wpdb, $table, $post; |
|
1021 | + global $wp_query, $wpdb, $table, $post; |
|
1022 | 1022 | |
1023 | - $fields .= ", " . $table . ".* "; |
|
1023 | + $fields .= ", " . $table . ".* "; |
|
1024 | 1024 | |
1025 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
1025 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
1026 | 1026 | |
1027 | - $mylat = $post->post_latitude; |
|
1028 | - $mylon = $post->post_longitude; |
|
1027 | + $mylat = $post->post_latitude; |
|
1028 | + $mylon = $post->post_longitude; |
|
1029 | 1029 | |
1030 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
1031 | - return $fields; |
|
1030 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
1031 | + return $fields; |
|
1032 | 1032 | } |
1033 | 1033 | function geodir_related_posts_fields_filter($query) { |
1034 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1035 | - && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
1036 | - && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
1037 | - ) { |
|
1038 | - add_filter('posts_fields', 'geodir_related_posts_fields', 1); |
|
1039 | - } |
|
1034 | + if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1035 | + && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
1036 | + && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
1037 | + ) { |
|
1038 | + add_filter('posts_fields', 'geodir_related_posts_fields', 1); |
|
1039 | + } |
|
1040 | 1040 | } |
1041 | 1041 | add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1); |
1042 | 1042 | |
@@ -1051,30 +1051,30 @@ discard block |
||
1051 | 1051 | * @return string|null If field exists in table returns order by clause else returns empty. |
1052 | 1052 | */ |
1053 | 1053 | function geodir_prepare_custom_sorting( $sorting, $table ) { |
1054 | - $orderby = ''; |
|
1054 | + $orderby = ''; |
|
1055 | 1055 | |
1056 | - if ( empty( $sorting ) || empty( $table ) ) { |
|
1057 | - return $orderby; |
|
1058 | - } |
|
1056 | + if ( empty( $sorting ) || empty( $table ) ) { |
|
1057 | + return $orderby; |
|
1058 | + } |
|
1059 | 1059 | |
1060 | - if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) { |
|
1061 | - $sorting_array = explode( '_', $sorting ); |
|
1060 | + if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) { |
|
1061 | + $sorting_array = explode( '_', $sorting ); |
|
1062 | 1062 | |
1063 | - if ( ( $count = count( $sorting_array ) ) > 1 ) { |
|
1064 | - $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
1065 | - array_pop( $sorting_array ); |
|
1063 | + if ( ( $count = count( $sorting_array ) ) > 1 ) { |
|
1064 | + $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
1065 | + array_pop( $sorting_array ); |
|
1066 | 1066 | |
1067 | - if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) { |
|
1068 | - $sort_by = implode( '_', $sorting_array ); |
|
1067 | + if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) { |
|
1068 | + $sort_by = implode( '_', $sorting_array ); |
|
1069 | 1069 | |
1070 | - if ( geodir_column_exist( $table, $sort_by ) ) { |
|
1071 | - $orderby = $table . "." . $sort_by . " " . $order; |
|
1072 | - } |
|
1073 | - } |
|
1074 | - } |
|
1075 | - } |
|
1070 | + if ( geodir_column_exist( $table, $sort_by ) ) { |
|
1071 | + $orderby = $table . "." . $sort_by . " " . $order; |
|
1072 | + } |
|
1073 | + } |
|
1074 | + } |
|
1075 | + } |
|
1076 | 1076 | |
1077 | - return $orderby; |
|
1077 | + return $orderby; |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | /** |
@@ -1094,21 +1094,21 @@ discard block |
||
1094 | 1094 | * @return string Modified fields SQL. |
1095 | 1095 | */ |
1096 | 1096 | function geodir_search_widget_location_filter_fields( $fields, $table, $post_type ) { |
1097 | - global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
|
1097 | + global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
|
1098 | 1098 | |
1099 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1100 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1099 | + if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1100 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1101 | 1101 | |
1102 | - if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1103 | - $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
1104 | - $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
1105 | - $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
1102 | + if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1103 | + $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
1104 | + $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
1105 | + $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
1106 | 1106 | |
1107 | - $fields .= $wpdb->prepare( ", (" . $radius . " * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(" . $table . ".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(" . $table . ".post_latitude) * PI() / 180) * POWER(SIN((%s - " . $table . ".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude ); |
|
1108 | - } |
|
1109 | - } |
|
1107 | + $fields .= $wpdb->prepare( ", (" . $radius . " * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(" . $table . ".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(" . $table . ".post_latitude) * PI() / 180) * POWER(SIN((%s - " . $table . ".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude ); |
|
1108 | + } |
|
1109 | + } |
|
1110 | 1110 | |
1111 | - return $fields; |
|
1111 | + return $fields; |
|
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | /** |
@@ -1127,17 +1127,17 @@ discard block |
||
1127 | 1127 | * @return string Modified fields SQL. |
1128 | 1128 | */ |
1129 | 1129 | function geodir_search_widget_location_filter_orderby( $orderby, $table, $post_type ) { |
1130 | - global $gd_query_args_widgets, $snear, $gd_session; |
|
1130 | + global $gd_query_args_widgets, $snear, $gd_session; |
|
1131 | 1131 | |
1132 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1133 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1132 | + if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1133 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1134 | 1134 | |
1135 | - if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1136 | - $orderby = "distance ASC, " . $orderby; |
|
1137 | - } |
|
1138 | - } |
|
1135 | + if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1136 | + $orderby = "distance ASC, " . $orderby; |
|
1137 | + } |
|
1138 | + } |
|
1139 | 1139 | |
1140 | - return $orderby; |
|
1140 | + return $orderby; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | /** |
@@ -1148,23 +1148,23 @@ discard block |
||
1148 | 1148 | * @return string Filtered url. |
1149 | 1149 | */ |
1150 | 1150 | function geodir_search_page_base_url() { |
1151 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1152 | - remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
1153 | - } |
|
1151 | + if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1152 | + remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
1153 | + } |
|
1154 | 1154 | |
1155 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) { |
|
1156 | - $url = icl_get_home_url(); |
|
1157 | - } else { |
|
1158 | - $url = get_home_url(); |
|
1159 | - } |
|
1155 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) { |
|
1156 | + $url = icl_get_home_url(); |
|
1157 | + } else { |
|
1158 | + $url = get_home_url(); |
|
1159 | + } |
|
1160 | 1160 | |
1161 | - $url = trailingslashit( $url ); |
|
1161 | + $url = trailingslashit( $url ); |
|
1162 | 1162 | |
1163 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1164 | - add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
1165 | - } |
|
1163 | + if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1164 | + add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
1165 | + } |
|
1166 | 1166 | |
1167 | - return apply_filters( 'geodir_search_page_base_url', $url ); |
|
1167 | + return apply_filters( 'geodir_search_page_base_url', $url ); |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | /** |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | function geodir_jetpack_fix_post_types_search(){ |
1176 | 1176 | if ( defined( 'JETPACK__VERSION' ) && ! empty( $_REQUEST['geodir_search'] ) ) { |
1177 | 1177 | add_filter( 'jetpack_search_should_handle_query', '__return_false', 999, 1 ); |
1178 | - } |
|
1178 | + } |
|
1179 | 1179 | } |
1180 | 1180 | add_action( 'plugins_loaded','geodir_jetpack_fix_post_types_search', 10 ); |
1181 | 1181 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @global string $s_A Extra parameters. |
66 | 66 | * @global string $s_SA Extra parameters. |
67 | 67 | */ |
68 | -function set_listing_request($query ) |
|
68 | +function set_listing_request($query) |
|
69 | 69 | { |
70 | 70 | global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
71 | 71 | |
@@ -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 | } // Latitude |
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'])) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | if ($snear == 'NEAR ME') { |
122 | 122 | $ip = $_SERVER['REMOTE_ADDR']; |
123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip)); |
|
123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip)); |
|
124 | 124 | $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude])); |
125 | 125 | $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude])); |
126 | 126 | } |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | $s_AA = str_replace(" ", "", $s); |
131 | 131 | $s_A = explode(",", $s_AA); |
132 | 132 | $s_A = implode('","', $s_A); |
133 | - $s_A = '"' . $s_A . '"'; |
|
133 | + $s_A = '"'.$s_A.'"'; |
|
134 | 134 | } else { |
135 | - $s_A = '"' . $s . '"'; |
|
135 | + $s_A = '"'.$s.'"'; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | if (strstr($s, ' ')) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
195 | 195 | |
196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
196 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
197 | 197 | |
198 | 198 | add_filter('posts_fields', 'geodir_posts_fields', 1); |
199 | 199 | add_filter('posts_join', 'geodir_posts_join', 1); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
234 | 234 | |
235 | 235 | // Filter-Location-Manager to add location table. |
236 | - $fields .= ", " . $table . ".* "; |
|
236 | + $fields .= ", ".$table.".* "; |
|
237 | 237 | |
238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) { |
239 | 239 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | $mylon = $gd_session->get('user_lon'); |
244 | 244 | } |
245 | 245 | |
246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
246 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | global $s; |
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(geodir_utf8_strlen($kword)<=$klimit){ |
|
253 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
254 | + foreach ($keywords as $kkey=>$kword) { |
|
255 | + if (geodir_utf8_strlen($kword) <= $klimit) { |
|
256 | 256 | unset($keywords[$kkey]); |
257 | 257 | } |
258 | 258 | } |
@@ -270,24 +270,24 @@ discard block |
||
270 | 270 | $count = 0; |
271 | 271 | foreach ($keywords as $keyword) { |
272 | 272 | $keyword = trim($keyword); |
273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
273 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
274 | 274 | $count++; |
275 | 275 | if ($count < count($keywords)) { |
276 | 276 | // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
277 | - $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 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." "; |
|
278 | 278 | } else { |
279 | 279 | //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
280 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
|
280 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) "; |
|
281 | 281 | } |
282 | 282 | } |
283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.","; |
|
284 | 284 | } |
285 | 285 | } else { |
286 | 286 | $gd_titlematch_part = ""; |
287 | 287 | } |
288 | - $s = stripslashes_deep( $s ); |
|
289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
290 | - $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 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,'%>' . $s . '%','% ' . $s . ',')); |
|
288 | + $s = stripslashes_deep($s); |
|
289 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
290 | + $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 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, '%>'.$s.'%', '% '.$s.',')); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | return $fields; |
@@ -311,18 +311,18 @@ discard block |
||
311 | 311 | |
312 | 312 | ########### WPML ########### |
313 | 313 | |
314 | - if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) { |
|
314 | + if (geodir_wpml_is_post_type_translated($geodir_post_type)) { |
|
315 | 315 | global $sitepress; |
316 | 316 | $lang_code = ICL_LANGUAGE_CODE; |
317 | 317 | $default_lang_code = $sitepress->get_default_language(); |
318 | 318 | if ($lang_code) { |
319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
319 | + $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | } |
323 | 323 | ########### WPML ########### |
324 | 324 | |
325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) "; |
|
325 | + $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID) "; |
|
326 | 326 | //===old code start |
327 | 327 | //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end |
328 | 328 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $sort_by = 'az'; |
392 | 392 | } |
393 | 393 | |
394 | - if ($snear != '' && $sort_by!='farthest') { |
|
394 | + if ($snear != '' && $sort_by != 'farthest') { |
|
395 | 395 | $sort_by = 'nearest'; |
396 | 396 | } |
397 | 397 | } |
@@ -405,20 +405,20 @@ discard block |
||
405 | 405 | break; |
406 | 406 | case 'low_review': |
407 | 407 | case 'rating_count_asc': |
408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
408 | + $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, "; |
|
409 | 409 | break; |
410 | 410 | case 'high_review': |
411 | 411 | case 'rating_count_desc': |
412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
412 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
413 | 413 | break; |
414 | 414 | case 'low_rating': |
415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
415 | + $orderby = "( ".$table.".overall_rating ) ASC, ".$table.".rating_count ASC, "; |
|
416 | 416 | break; |
417 | 417 | case 'high_rating': |
418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
418 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
419 | 419 | break; |
420 | 420 | case 'featured': |
421 | - $orderby = $table . ".is_featured asc, "; |
|
421 | + $orderby = $table.".is_featured asc, "; |
|
422 | 422 | break; |
423 | 423 | case 'nearest': |
424 | 424 | $orderby = " distance asc, "; |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | break; |
435 | 435 | // sort by rating |
436 | 436 | case 'overall_rating_desc': |
437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
437 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
438 | 438 | break; |
439 | 439 | case 'overall_rating_asc': |
440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
440 | + $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, "; |
|
441 | 441 | break; |
442 | 442 | default: |
443 | 443 | |
@@ -458,24 +458,24 @@ discard block |
||
458 | 458 | |
459 | 459 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
460 | 460 | $keywords = explode(" ", $s); |
461 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
462 | - foreach($keywords as $kkey=>$kword){ |
|
463 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
461 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
462 | + foreach ($keywords as $kkey=>$kword) { |
|
463 | + if (geodir_utf8_strlen($kword) <= $klimit) { |
|
464 | 464 | unset($keywords[$kkey]); |
465 | 465 | } |
466 | 466 | } |
467 | 467 | } |
468 | 468 | if ($sort_by == 'nearest' || $sort_by == 'farthest') { |
469 | 469 | if (count($keywords) > 1) { |
470 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
470 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
471 | 471 | } else { |
472 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
472 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
473 | 473 | } |
474 | 474 | } else { |
475 | 475 | if (count($keywords) > 1) { |
476 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
476 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby; |
|
477 | 477 | } else { |
478 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
478 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby; |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table); |
492 | 492 | |
493 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
493 | + $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
494 | 494 | |
495 | 495 | return $orderby; |
496 | 496 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | global $wpdb; |
514 | 514 | |
515 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) { |
|
515 | + if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) { |
|
516 | 516 | |
517 | 517 | $sort_array = explode('_', $sort_by); |
518 | 518 | |
@@ -522,48 +522,48 @@ discard block |
||
522 | 522 | |
523 | 523 | if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) { |
524 | 524 | |
525 | - $sort_by = str_replace('_' . $order, '', $sort_by); |
|
525 | + $sort_by = str_replace('_'.$order, '', $sort_by); |
|
526 | 526 | |
527 | 527 | switch ($sort_by): |
528 | 528 | |
529 | 529 | case 'post_date': |
530 | 530 | case 'comment_count': |
531 | 531 | |
532 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
532 | + $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", "; |
|
533 | 533 | break; |
534 | 534 | |
535 | 535 | case 'distance': |
536 | - $orderby = $sort_by . " " . $order . ", "; |
|
536 | + $orderby = $sort_by." ".$order.", "; |
|
537 | 537 | break; |
538 | 538 | |
539 | 539 | |
540 | 540 | // sort by rating |
541 | 541 | case 'overall_rating': |
542 | 542 | |
543 | - $use_bayesian = apply_filters('gd_use_bayesian',true,$table); |
|
543 | + $use_bayesian = apply_filters('gd_use_bayesian', true, $table); |
|
544 | 544 | $avg_rating = 0; |
545 | - if($use_bayesian){ |
|
546 | - $avg_num_votes = get_transient( 'gd_avg_num_votes_'.$table ); |
|
547 | - if(!$avg_num_votes){ |
|
545 | + if ($use_bayesian) { |
|
546 | + $avg_num_votes = get_transient('gd_avg_num_votes_'.$table); |
|
547 | + if (!$avg_num_votes) { |
|
548 | 548 | $avg_num_votes = $wpdb->get_var("SELECT SUM(rating_count) FROM $table"); |
549 | - if($avg_num_votes){ |
|
549 | + if ($avg_num_votes) { |
|
550 | 550 | |
551 | - $avg_rating = get_transient( 'gd_avg_rating_'.$table ); |
|
552 | - if(!$avg_rating){ |
|
553 | - $avg_rating = $wpdb->get_var("SELECT SUM(overall_rating) FROM $table")/$avg_num_votes; |
|
551 | + $avg_rating = get_transient('gd_avg_rating_'.$table); |
|
552 | + if (!$avg_rating) { |
|
553 | + $avg_rating = $wpdb->get_var("SELECT SUM(overall_rating) FROM $table") / $avg_num_votes; |
|
554 | 554 | } |
555 | - set_transient( 'gd_avg_num_votes_'.$table, $avg_num_votes, 12 * HOUR_IN_SECONDS ); |
|
556 | - set_transient( 'gd_avg_rating_'.$table, $avg_rating , 12 * HOUR_IN_SECONDS ); |
|
555 | + set_transient('gd_avg_num_votes_'.$table, $avg_num_votes, 12 * HOUR_IN_SECONDS); |
|
556 | + set_transient('gd_avg_rating_'.$table, $avg_rating, 12 * HOUR_IN_SECONDS); |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
560 | - if(!$avg_num_votes){ $avg_num_votes = 0;} |
|
560 | + if (!$avg_num_votes) { $avg_num_votes = 0; } |
|
561 | 561 | |
562 | - $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )) / ( $avg_num_votes + " . $table . ".rating_count ) $order , "; |
|
562 | + $orderby = " (( $avg_num_votes * $avg_rating ) + (".$table.".rating_count * ".$table.".overall_rating )) / ( $avg_num_votes + ".$table.".rating_count ) $order , "; |
|
563 | 563 | |
564 | 564 | //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ) / ( " . $table . ".rating_count + " . $table . ".rating_count ) $order , "; // seems to work mostly with no extra overheads |
565 | - }else{ |
|
566 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
565 | + } else { |
|
566 | + $orderby = " ".$table.".".$sort_by." ".$order.", ".$table.".rating_count ".$order.", "; |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | break; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | |
572 | 572 | default: |
573 | 573 | if (geodir_column_exist($table, $sort_by)) { |
574 | - $orderby = $table . "." . $sort_by . " " . $order . ", "; |
|
574 | + $orderby = $table.".".$sort_by." ".$order.", "; |
|
575 | 575 | } |
576 | 576 | break; |
577 | 577 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | add_filter('posts_where', 'searching_filter_where', 1); |
612 | 612 | |
613 | 613 | add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
614 | - add_filter( 'posts_where', 'geodir_posts_having', 10000, 2 ); // make sure its the last WHERE param |
|
614 | + add_filter('posts_where', 'geodir_posts_having', 10000, 2); // make sure its the last WHERE param |
|
615 | 615 | |
616 | 616 | } elseif (geodir_is_page('author')) { |
617 | 617 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | } |
621 | 621 | |
622 | 622 | //if (!geodir_is_page('detail')) |
623 | - add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
623 | + add_filter('posts_where', 'geodir_default_where', 1); /**/ |
|
624 | 624 | |
625 | 625 | //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
626 | 626 | |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
692 | 692 | //echo '##########'.$q_post_type; |
693 | 693 | if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) { |
694 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') "; |
|
694 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') "; |
|
695 | 695 | //$where .= " AND icl_t.language_code = '$lang_code' "; |
696 | 696 | } |
697 | 697 | |
@@ -758,8 +758,8 @@ discard block |
||
758 | 758 | } |
759 | 759 | |
760 | 760 | $s = trim($s); |
761 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
762 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
761 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
762 | + $s_A = wp_specialchars_decode($s_A, ENT_QUOTES); |
|
763 | 763 | |
764 | 764 | $where = ''; |
765 | 765 | $better_search_terms = ''; |
@@ -770,9 +770,9 @@ discard block |
||
770 | 770 | |
771 | 771 | if ($s != '') { |
772 | 772 | $keywords = explode(" ", $s); |
773 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
774 | - foreach($keywords as $kkey=>$kword){ |
|
775 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
773 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
774 | + foreach ($keywords as $kkey=>$kword) { |
|
775 | + if (geodir_utf8_strlen($kword) <= $klimit) { |
|
776 | 776 | unset($keywords[$kkey]); |
777 | 777 | } |
778 | 778 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | if (!empty($keywords)) { |
782 | 782 | foreach ($keywords as $keyword) { |
783 | 783 | $keyword = trim($keyword); |
784 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
784 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
785 | 785 | if ($keyword != '') { |
786 | 786 | /** |
787 | 787 | * Filter the search query keywords SQL. |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | * @param array $keywords The array of keywords for the query. |
793 | 793 | * @param string $keyword The single keyword being searched. |
794 | 794 | */ |
795 | - $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword); |
|
795 | + $better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword); |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | } |
@@ -800,13 +800,13 @@ discard block |
||
800 | 800 | |
801 | 801 | /* get taxonomy */ |
802 | 802 | $taxonomies = geodir_get_taxonomies($post_types, true); |
803 | - if($taxonomies) { |
|
803 | + if ($taxonomies) { |
|
804 | 804 | $taxonomies = implode("','", $taxonomies); |
805 | - $taxonomies = "'" . $taxonomies . "'"; |
|
806 | - }else{$taxonomies='';} |
|
805 | + $taxonomies = "'".$taxonomies."'"; |
|
806 | + } else {$taxonomies = ''; } |
|
807 | 807 | |
808 | 808 | $content_where = $terms_where = ''; |
809 | - $terms_sql = ''; |
|
809 | + $terms_sql = ''; |
|
810 | 810 | if ($s != '') { |
811 | 811 | /** |
812 | 812 | * Filter the search query content where values. |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @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%\") ") "`. |
818 | 818 | */ |
819 | - $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%\") " ); |
|
819 | + $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%\") "); |
|
820 | 820 | /** |
821 | 821 | * Filter the search query term values. |
822 | 822 | * |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | * |
826 | 826 | * @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)) "`. |
827 | 827 | */ |
828 | - $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)) " ); |
|
828 | + $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)) "); |
|
829 | 829 | |
830 | 830 | |
831 | 831 | // get term sql |
@@ -837,20 +837,20 @@ discard block |
||
837 | 837 | $terms_where |
838 | 838 | GROUP BY $wpdb->term_taxonomy.term_id"; |
839 | 839 | |
840 | - $term_results = $wpdb->get_results( $term_sql ); |
|
840 | + $term_results = $wpdb->get_results($term_sql); |
|
841 | 841 | $term_ids = array(); |
842 | 842 | $terms_sql = ''; |
843 | 843 | |
844 | - if ( ! empty( $term_results ) ) { |
|
845 | - foreach ( $term_results as $term_id ) { |
|
844 | + if (!empty($term_results)) { |
|
845 | + foreach ($term_results as $term_id) { |
|
846 | 846 | $term_ids[] = $term_id; |
847 | 847 | } |
848 | - if ( ! empty( $term_ids ) ) { |
|
849 | - foreach ( $term_ids as $term ) { |
|
850 | - if ( $term->taxonomy == $post_types . '_tags' ) { |
|
851 | - $terms_sql .= $wpdb->prepare( " OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name ); |
|
848 | + if (!empty($term_ids)) { |
|
849 | + foreach ($term_ids as $term) { |
|
850 | + if ($term->taxonomy == $post_types.'_tags') { |
|
851 | + $terms_sql .= $wpdb->prepare(" OR FIND_IN_SET(%s , ".$table.".post_tags) ", $term->name); |
|
852 | 852 | } else { |
853 | - $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
853 | + $terms_sql .= " OR FIND_IN_SET($term->term_id , ".$table.".".$post_types."category) "; |
|
854 | 854 | } |
855 | 855 | } |
856 | 856 | } |
@@ -882,12 +882,12 @@ discard block |
||
882 | 882 | ) |
883 | 883 | AND $wpdb->posts.post_type in ('{$post_types}') |
884 | 884 | AND ($wpdb->posts.post_status = 'publish') |
885 | - AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
|
886 | - AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
|
885 | + AND ( ".$table.".post_latitude between $rlat1 and $rlat2 ) |
|
886 | + AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) "; |
|
887 | 887 | |
888 | 888 | if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
889 | 889 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
890 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist; |
|
890 | + $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist; |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | } else { |
@@ -904,11 +904,11 @@ discard block |
||
904 | 904 | } |
905 | 905 | |
906 | 906 | ########### WPML ########### |
907 | - if ( geodir_wpml_is_post_type_translated( $post_types ) ) { |
|
907 | + if (geodir_wpml_is_post_type_translated($post_types)) { |
|
908 | 908 | $lang_code = ICL_LANGUAGE_CODE; |
909 | 909 | |
910 | 910 | if ($lang_code && $post_types) { |
911 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
911 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') "; |
|
912 | 912 | } |
913 | 913 | } |
914 | 914 | ########### WPML ########### |
@@ -931,10 +931,10 @@ discard block |
||
931 | 931 | global $wpdb, $geodir_post_type, $table, $curr; |
932 | 932 | |
933 | 933 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
934 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
934 | + $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0; |
|
935 | 935 | |
936 | 936 | if (isset($_REQUEST['stype'])) { |
937 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
937 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']); |
|
938 | 938 | } else { |
939 | 939 | $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
940 | 940 | } |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | } else |
948 | 948 | $where .= " AND $wpdb->posts.post_author = $user_id"; |
949 | 949 | |
950 | - if ($user_id == (int)get_current_user_id()) { |
|
950 | + if ($user_id == (int) get_current_user_id()) { |
|
951 | 951 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
952 | 952 | } else { |
953 | 953 | $where .= " AND $wpdb->posts.post_status = 'publish' "; |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) { |
961 | 961 | $lang_code = ICL_LANGUAGE_CODE; |
962 | 962 | if ($lang_code) { |
963 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
963 | + $where .= " AND icl_t.language_code='".$lang_code."' "; |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | } |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | { |
984 | 984 | global $wp_query, $table; |
985 | 985 | if (!empty($wp_query->query['with_pics_only'])) { |
986 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
986 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
987 | 987 | } |
988 | 988 | return $join; |
989 | 989 | } |
@@ -1002,16 +1002,16 @@ discard block |
||
1002 | 1002 | { |
1003 | 1003 | global $wp_query, $table; |
1004 | 1004 | if (!empty($wp_query->query['show_featured_only'])) { |
1005 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
1005 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
1006 | 1006 | } |
1007 | 1007 | if (!empty($wp_query->query['show_special_only'])) { |
1008 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
1008 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
1009 | 1009 | } |
1010 | 1010 | if (!empty($wp_query->query['with_pics_only'])) { |
1011 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
1011 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id"; |
|
1012 | 1012 | } |
1013 | 1013 | if (!empty($wp_query->query['with_videos_only'])) { |
1014 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
1014 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
1015 | 1015 | } |
1016 | 1016 | return $where; |
1017 | 1017 | } |
@@ -1020,18 +1020,18 @@ discard block |
||
1020 | 1020 | function geodir_related_posts_fields($fields) { |
1021 | 1021 | global $wp_query, $wpdb, $table, $post; |
1022 | 1022 | |
1023 | - $fields .= ", " . $table . ".* "; |
|
1023 | + $fields .= ", ".$table.".* "; |
|
1024 | 1024 | |
1025 | 1025 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
1026 | 1026 | |
1027 | 1027 | $mylat = $post->post_latitude; |
1028 | 1028 | $mylon = $post->post_longitude; |
1029 | 1029 | |
1030 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
1030 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
1031 | 1031 | return $fields; |
1032 | 1032 | } |
1033 | 1033 | function geodir_related_posts_fields_filter($query) { |
1034 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1034 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1035 | 1035 | && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
1036 | 1036 | && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
1037 | 1037 | ) { |
@@ -1050,25 +1050,25 @@ discard block |
||
1050 | 1050 | * @param string $table Listing table name. |
1051 | 1051 | * @return string|null If field exists in table returns order by clause else returns empty. |
1052 | 1052 | */ |
1053 | -function geodir_prepare_custom_sorting( $sorting, $table ) { |
|
1053 | +function geodir_prepare_custom_sorting($sorting, $table) { |
|
1054 | 1054 | $orderby = ''; |
1055 | 1055 | |
1056 | - if ( empty( $sorting ) || empty( $table ) ) { |
|
1056 | + if (empty($sorting) || empty($table)) { |
|
1057 | 1057 | return $orderby; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | - if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) { |
|
1061 | - $sorting_array = explode( '_', $sorting ); |
|
1060 | + if (strpos(strtoupper($sorting), '_ASC') !== false || strpos(strtoupper($sorting), '_DESC') !== false) { |
|
1061 | + $sorting_array = explode('_', $sorting); |
|
1062 | 1062 | |
1063 | - if ( ( $count = count( $sorting_array ) ) > 1 ) { |
|
1064 | - $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
1065 | - array_pop( $sorting_array ); |
|
1063 | + if (($count = count($sorting_array)) > 1) { |
|
1064 | + $order = !empty($sorting_array[$count - 1]) ? strtoupper($sorting_array[$count - 1]) : ''; |
|
1065 | + array_pop($sorting_array); |
|
1066 | 1066 | |
1067 | - if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) { |
|
1068 | - $sort_by = implode( '_', $sorting_array ); |
|
1067 | + if (!empty($sorting_array) && ($order == 'ASC' || $order == 'DESC')) { |
|
1068 | + $sort_by = implode('_', $sorting_array); |
|
1069 | 1069 | |
1070 | - if ( geodir_column_exist( $table, $sort_by ) ) { |
|
1071 | - $orderby = $table . "." . $sort_by . " " . $order; |
|
1070 | + if (geodir_column_exist($table, $sort_by)) { |
|
1071 | + $orderby = $table.".".$sort_by." ".$order; |
|
1072 | 1072 | } |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1093,18 +1093,18 @@ discard block |
||
1093 | 1093 | * |
1094 | 1094 | * @return string Modified fields SQL. |
1095 | 1095 | */ |
1096 | -function geodir_search_widget_location_filter_fields( $fields, $table, $post_type ) { |
|
1096 | +function geodir_search_widget_location_filter_fields($fields, $table, $post_type) { |
|
1097 | 1097 | global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
1098 | 1098 | |
1099 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1100 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1099 | + if (!empty($gd_query_args_widgets['gd_location']) && geodir_is_page('search') && !empty($_REQUEST['sgeo_lat']) && !empty($_REQUEST['sgeo_lon'])) { |
|
1100 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true; |
|
1101 | 1101 | |
1102 | - if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1103 | - $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
1104 | - $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
1105 | - $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
1102 | + if ($location_allowed && strpos(strtolower($fields), ' as distance ') === false && ($snear != '' || $gd_session->get('all_near_me'))) { |
|
1103 | + $latitude = sanitize_text_field($_REQUEST['sgeo_lat']); |
|
1104 | + $longitude = sanitize_text_field($_REQUEST['sgeo_lon']); |
|
1105 | + $radius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
1106 | 1106 | |
1107 | - $fields .= $wpdb->prepare( ", (" . $radius . " * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(" . $table . ".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(" . $table . ".post_latitude) * PI() / 180) * POWER(SIN((%s - " . $table . ".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude ); |
|
1107 | + $fields .= $wpdb->prepare(", (".$radius." * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(".$table.".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(".$table.".post_latitude) * PI() / 180) * POWER(SIN((%s - ".$table.".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude); |
|
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | |
@@ -1126,14 +1126,14 @@ discard block |
||
1126 | 1126 | * |
1127 | 1127 | * @return string Modified fields SQL. |
1128 | 1128 | */ |
1129 | -function geodir_search_widget_location_filter_orderby( $orderby, $table, $post_type ) { |
|
1129 | +function geodir_search_widget_location_filter_orderby($orderby, $table, $post_type) { |
|
1130 | 1130 | global $gd_query_args_widgets, $snear, $gd_session; |
1131 | 1131 | |
1132 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1133 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1132 | + if (!empty($gd_query_args_widgets['gd_location']) && geodir_is_page('search') && !empty($_REQUEST['sgeo_lat']) && !empty($_REQUEST['sgeo_lon'])) { |
|
1133 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true; |
|
1134 | 1134 | |
1135 | - if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1136 | - $orderby = "distance ASC, " . $orderby; |
|
1135 | + if ($location_allowed && ($snear != '' || $gd_session->get('all_near_me'))) { |
|
1136 | + $orderby = "distance ASC, ".$orderby; |
|
1137 | 1137 | } |
1138 | 1138 | } |
1139 | 1139 | |
@@ -1148,23 +1148,23 @@ discard block |
||
1148 | 1148 | * @return string Filtered url. |
1149 | 1149 | */ |
1150 | 1150 | function geodir_search_page_base_url() { |
1151 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1152 | - remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
1151 | + if (function_exists('geodir_location_geo_home_link')) { |
|
1152 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) { |
|
1155 | + if (defined('DOING_AJAX') && DOING_AJAX && geodir_is_wpml()) { |
|
1156 | 1156 | $url = icl_get_home_url(); |
1157 | 1157 | } else { |
1158 | 1158 | $url = get_home_url(); |
1159 | 1159 | } |
1160 | 1160 | |
1161 | - $url = trailingslashit( $url ); |
|
1161 | + $url = trailingslashit($url); |
|
1162 | 1162 | |
1163 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1164 | - add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
1163 | + if (function_exists('geodir_location_geo_home_link')) { |
|
1164 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | - return apply_filters( 'geodir_search_page_base_url', $url ); |
|
1167 | + return apply_filters('geodir_search_page_base_url', $url); |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | /** |
@@ -1172,30 +1172,30 @@ discard block |
||
1172 | 1172 | * |
1173 | 1173 | * @since 1.6.31 |
1174 | 1174 | */ |
1175 | -function geodir_jetpack_fix_post_types_search(){ |
|
1176 | - if ( defined( 'JETPACK__VERSION' ) && ! empty( $_REQUEST['geodir_search'] ) ) { |
|
1177 | - add_filter( 'jetpack_search_should_handle_query', '__return_false', 999, 1 ); |
|
1175 | +function geodir_jetpack_fix_post_types_search() { |
|
1176 | + if (defined('JETPACK__VERSION') && !empty($_REQUEST['geodir_search'])) { |
|
1177 | + add_filter('jetpack_search_should_handle_query', '__return_false', 999, 1); |
|
1178 | 1178 | } |
1179 | 1179 | } |
1180 | -add_action( 'plugins_loaded','geodir_jetpack_fix_post_types_search', 10 ); |
|
1180 | +add_action('plugins_loaded', 'geodir_jetpack_fix_post_types_search', 10); |
|
1181 | 1181 | |
1182 | -function geodir_posts_having( $where, $query = array() ) { |
|
1182 | +function geodir_posts_having($where, $query = array()) { |
|
1183 | 1183 | global $wpdb, $gd_session, $geodir_post_type, $dist, $mylat, $mylon, $snear; |
1184 | 1184 | |
1185 | - if ( geodir_is_gd_main_query( $query ) ) { |
|
1186 | - $support_location = $geodir_post_type && function_exists( 'geodir_cpt_no_location' ) && ! geodir_cpt_no_location( $geodir_post_type ); |
|
1185 | + if (geodir_is_gd_main_query($query)) { |
|
1186 | + $support_location = $geodir_post_type && function_exists('geodir_cpt_no_location') && !geodir_cpt_no_location($geodir_post_type); |
|
1187 | 1187 | |
1188 | - if ( $support_location && $dist && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1189 | - if ( $gd_session->get( 'near_me_range' ) && ! isset( $_REQUEST['sdist'] ) ) { |
|
1190 | - $dist = $gd_session->get( 'near_me_range' ); |
|
1188 | + if ($support_location && $dist && ($snear != '' || $gd_session->get('all_near_me'))) { |
|
1189 | + if ($gd_session->get('near_me_range') && !isset($_REQUEST['sdist'])) { |
|
1190 | + $dist = $gd_session->get('near_me_range'); |
|
1191 | 1191 | |
1192 | - if ( get_option( 'geodir_search_dist_1' ) == 'km' ) { |
|
1192 | + if (get_option('geodir_search_dist_1') == 'km') { |
|
1193 | 1193 | $dist = $dist * 1.6093440001; |
1194 | 1194 | } |
1195 | 1195 | } |
1196 | 1196 | |
1197 | - if ( strpos( $where, ' HAVING ') === false ) { |
|
1198 | - $where .= $wpdb->prepare( " HAVING distance <= %f ", $dist ); |
|
1197 | + if (strpos($where, ' HAVING ') === false) { |
|
1198 | + $where .= $wpdb->prepare(" HAVING distance <= %f ", $dist); |
|
1199 | 1199 | } |
1200 | 1200 | } |
1201 | 1201 | } |
@@ -1203,12 +1203,12 @@ discard block |
||
1203 | 1203 | return $where; |
1204 | 1204 | } |
1205 | 1205 | |
1206 | -function geodir_is_gd_main_query( $query ){ |
|
1206 | +function geodir_is_gd_main_query($query) { |
|
1207 | 1207 | $is_main_query = false; |
1208 | 1208 | |
1209 | - if(isset($query->query->gd_is_geodir_page) && $query->query->gd_is_geodir_page) { |
|
1209 | + if (isset($query->query->gd_is_geodir_page) && $query->query->gd_is_geodir_page) { |
|
1210 | 1210 | $is_main_query = true; |
1211 | - }elseif(isset($query->query['gd_is_geodir_page']) && $query->query['gd_is_geodir_page']) { |
|
1211 | + }elseif (isset($query->query['gd_is_geodir_page']) && $query->query['gd_is_geodir_page']) { |
|
1212 | 1212 | $is_main_query = true; |
1213 | 1213 | } |
1214 | 1214 |
@@ -20,72 +20,72 @@ discard block |
||
20 | 20 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
21 | 21 | $grid_view_class = apply_filters('geodir_grid_view_widget_columns', $gridview_columns_widget); |
22 | 22 | if ($gd_session->get('gd_listing_view') && !isset($before_widget)) { |
23 | - $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view')); |
|
23 | + $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view')); |
|
24 | 24 | } |
25 | 25 | ?> |
26 | 26 | <ul class="geodir_category_list_view clearfix <?php echo apply_filters('geodir_listing_listview_ul_extra_class', '', 'widget'); ?>"> |
27 | 27 | <?php |
28 | - if (!empty($widget_listings)) { |
|
29 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
30 | - do_action('geodir_before_listing_post_listview'); |
|
31 | - $all_postypes = geodir_get_posttypes(); |
|
32 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
33 | - foreach ($widget_listings as $widget_listing) { |
|
34 | - global $gd_widget_listing_type; |
|
35 | - $post = $widget_listing; |
|
28 | + if (!empty($widget_listings)) { |
|
29 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
30 | + do_action('geodir_before_listing_post_listview'); |
|
31 | + $all_postypes = geodir_get_posttypes(); |
|
32 | + $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
33 | + foreach ($widget_listings as $widget_listing) { |
|
34 | + global $gd_widget_listing_type; |
|
35 | + $post = $widget_listing; |
|
36 | 36 | |
37 | - $GLOBALS['post'] = $post; |
|
38 | - setup_postdata($post); |
|
37 | + $GLOBALS['post'] = $post; |
|
38 | + setup_postdata($post); |
|
39 | 39 | |
40 | - $gd_widget_listing_type = $post->post_type; |
|
40 | + $gd_widget_listing_type = $post->post_type; |
|
41 | 41 | |
42 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
43 | - $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes); |
|
42 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
43 | + $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes); |
|
44 | 44 | |
45 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
46 | - $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
47 | - ?> |
|
45 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
46 | + $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
47 | + ?> |
|
48 | 48 | <li class="clearfix <?php if ($grid_view_class) { |
49 | - echo 'geodir-gridview ' . $grid_view_class; |
|
50 | - } else { |
|
51 | - echo ' geodir-listview '; |
|
52 | - } ?> <?php if ($post_view_class) { |
|
53 | - echo $post_view_class; |
|
54 | - } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
55 | - echo "style='width:{$listing_width}%;'"; |
|
56 | - } |
|
49 | + echo 'geodir-gridview ' . $grid_view_class; |
|
50 | + } else { |
|
51 | + echo ' geodir-listview '; |
|
52 | + } ?> <?php if ($post_view_class) { |
|
53 | + echo $post_view_class; |
|
54 | + } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
55 | + echo "style='width:{$listing_width}%;'"; |
|
56 | + } |
|
57 | 57 | |
58 | - echo " data-post-id='$post->ID' "; |
|
59 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
60 | - do_action('geodir_listview_inside_li', $post, 'widget'); |
|
61 | - ?>> |
|
58 | + echo " data-post-id='$post->ID' "; |
|
59 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
60 | + do_action('geodir_listview_inside_li', $post, 'widget'); |
|
61 | + ?>> |
|
62 | 62 | <article class="geodir-category-listing <?php if ($post_view_article_class) { |
63 | - echo $post_view_article_class; |
|
64 | - } ?>"> |
|
63 | + echo $post_view_article_class; |
|
64 | + } ?>"> |
|
65 | 65 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'widget'); ?>"> |
66 | 66 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?> |
67 | 67 | <a href="<?php the_permalink(); ?>"><?php echo $fimage; ?></a> |
68 | 68 | <?php |
69 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
70 | - do_action('geodir_before_badge_on_image', $post); |
|
71 | - if ($post->is_featured) { |
|
72 | - echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
73 | - } |
|
69 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
70 | + do_action('geodir_before_badge_on_image', $post); |
|
71 | + if ($post->is_featured) { |
|
72 | + echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
77 | - echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
78 | - } |
|
76 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
77 | + echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
78 | + } |
|
79 | 79 | |
80 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
81 | - do_action('geodir_after_badge_on_image', $post); |
|
82 | - } |
|
83 | - ?> |
|
80 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
81 | + do_action('geodir_after_badge_on_image', $post); |
|
82 | + } |
|
83 | + ?> |
|
84 | 84 | </div> |
85 | 85 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'widget'); ?>"> |
86 | 86 | <?php |
87 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
88 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
87 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
88 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
89 | 89 | <header class="geodir-entry-header"> |
90 | 90 | <?php $title_tag = !empty($title_tag) ? $title_tag : 'h3'; ?> |
91 | 91 | <<?php echo esc_attr($title_tag); ?> class="geodir-entry-title"> |
@@ -95,162 +95,162 @@ discard block |
||
95 | 95 | </header> |
96 | 96 | <!-- .entry-header --> |
97 | 97 | <?php |
98 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
99 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
98 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
99 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
100 | 100 | <?php /// Print Distance |
101 | - if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
102 | - if ( $related_nearest && $related_parent_lat ) { |
|
103 | - $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
104 | - } else { |
|
105 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
106 | - } |
|
101 | + if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
102 | + if ( $related_nearest && $related_parent_lat ) { |
|
103 | + $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
104 | + } else { |
|
105 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
106 | + } |
|
107 | 107 | |
108 | - $endLat = $post->post_latitude; |
|
109 | - $endLon = $post->post_longitude; |
|
110 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
111 | - $uom = get_option('geodir_search_dist_1'); |
|
112 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
113 | - ?> |
|
108 | + $endLat = $post->post_latitude; |
|
109 | + $endLon = $post->post_longitude; |
|
110 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
111 | + $uom = get_option('geodir_search_dist_1'); |
|
112 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
113 | + ?> |
|
114 | 114 | <h3> |
115 | 115 | <?php |
116 | - if (round($distance, 2) == 0) { |
|
117 | - $uom = get_option('geodir_search_dist_2'); |
|
118 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
119 | - if ($uom == 'feet') { |
|
120 | - $uom = __('feet', 'geodirectory'); |
|
121 | - } else { |
|
122 | - $uom = __('meters', 'geodirectory'); |
|
123 | - } |
|
124 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
116 | + if (round($distance, 2) == 0) { |
|
117 | + $uom = get_option('geodir_search_dist_2'); |
|
118 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
119 | + if ($uom == 'feet') { |
|
120 | + $uom = __('feet', 'geodirectory'); |
|
121 | + } else { |
|
122 | + $uom = __('meters', 'geodirectory'); |
|
123 | + } |
|
124 | + echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
125 | 125 | <br /> |
126 | 126 | '; |
127 | - } else { |
|
128 | - if ($uom == 'miles') { |
|
129 | - $uom = __('miles', 'geodirectory'); |
|
130 | - } else { |
|
131 | - $uom = __('km', 'geodirectory'); |
|
132 | - } |
|
133 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
127 | + } else { |
|
128 | + if ($uom == 'miles') { |
|
129 | + $uom = __('miles', 'geodirectory'); |
|
130 | + } else { |
|
131 | + $uom = __('km', 'geodirectory'); |
|
132 | + } |
|
133 | + echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
134 | 134 | <br /> |
135 | 135 | '; |
136 | - } |
|
137 | - ?> |
|
136 | + } |
|
137 | + ?> |
|
138 | 138 | </h3> |
139 | 139 | <?php } ?> |
140 | 140 | <?php |
141 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
142 | - do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
141 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
142 | + do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
143 | 143 | <?php echo geodir_show_listing_info('listing'); ?> |
144 | 144 | <?php if (isset($character_count) && $character_count == '0') { |
145 | - } else { ?> |
|
145 | + } else { ?> |
|
146 | 146 | <div class="geodir-entry-content"> |
147 | 147 | <?php |
148 | - /** |
|
149 | - * Filter to hide the listing excerpt |
|
150 | - * |
|
151 | - * @since 1.5.3 |
|
152 | - * @param bool $display Display the excerpt or not. Default true. |
|
153 | - * @param object $post The post object. |
|
154 | - */ |
|
155 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
|
156 | - if ($show_listing_excerpt) { |
|
157 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
158 | - $content_out = geodir_max_excerpt( $character_count ); |
|
159 | - } else { |
|
160 | - $content_out = get_the_excerpt(); |
|
161 | - } |
|
162 | - if ( ! empty( $content_out ) ) { |
|
163 | - echo "<p>" . $content_out . "</p>"; |
|
164 | - } |
|
165 | - } |
|
166 | - ?> |
|
148 | + /** |
|
149 | + * Filter to hide the listing excerpt |
|
150 | + * |
|
151 | + * @since 1.5.3 |
|
152 | + * @param bool $display Display the excerpt or not. Default true. |
|
153 | + * @param object $post The post object. |
|
154 | + */ |
|
155 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
|
156 | + if ($show_listing_excerpt) { |
|
157 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
158 | + $content_out = geodir_max_excerpt( $character_count ); |
|
159 | + } else { |
|
160 | + $content_out = get_the_excerpt(); |
|
161 | + } |
|
162 | + if ( ! empty( $content_out ) ) { |
|
163 | + echo "<p>" . $content_out . "</p>"; |
|
164 | + } |
|
165 | + } |
|
166 | + ?> |
|
167 | 167 | </div> |
168 | 168 | <?php } ?> |
169 | 169 | <?php |
170 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
171 | - do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
170 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
171 | + do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
172 | 172 | </div> |
173 | 173 | <!-- gd-content ends here--> |
174 | 174 | <?php |
175 | - /** |
|
176 | - * Called after printing listing content. |
|
177 | - * |
|
178 | - * @since 1.5.3 |
|
179 | - * @param object $post The post object. |
|
180 | - * @param string $view The view type, default 'widget'. |
|
181 | - */ |
|
182 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
175 | + /** |
|
176 | + * Called after printing listing content. |
|
177 | + * |
|
178 | + * @since 1.5.3 |
|
179 | + * @param object $post The post object. |
|
180 | + * @param string $view The view type, default 'widget'. |
|
181 | + */ |
|
182 | + do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
183 | 183 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>"> |
184 | 184 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>"> |
185 | 185 | <?php |
186 | - /** |
|
187 | - * Called before printing review stars html. |
|
188 | - * |
|
189 | - * @since 1.5.3 |
|
190 | - * @param object $post The post object. |
|
191 | - * @param string $view The view type, default 'widget'. |
|
192 | - */ |
|
193 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
194 | - $review_show = geodir_is_reviews_show('listview'); |
|
195 | - if ($review_show) { |
|
186 | + /** |
|
187 | + * Called before printing review stars html. |
|
188 | + * |
|
189 | + * @since 1.5.3 |
|
190 | + * @param object $post The post object. |
|
191 | + * @param string $view The view type, default 'widget'. |
|
192 | + */ |
|
193 | + do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
194 | + $review_show = geodir_is_reviews_show('listview'); |
|
195 | + if ($review_show) { |
|
196 | 196 | |
197 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
197 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
198 | 198 | |
199 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
200 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
199 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
200 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
201 | 201 | |
202 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
202 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
203 | 203 | |
204 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
205 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
206 | - ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
204 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
205 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
206 | + ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
207 | 207 | class="fas fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?> |
208 | 208 | </a> |
209 | 209 | <?php |
210 | - } |
|
210 | + } |
|
211 | 211 | |
212 | 212 | |
213 | - /** |
|
214 | - * Called after printing favorite html. |
|
215 | - * |
|
216 | - * @since 1.0.0 |
|
217 | - */ |
|
218 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
213 | + /** |
|
214 | + * Called after printing favorite html. |
|
215 | + * |
|
216 | + * @since 1.0.0 |
|
217 | + */ |
|
218 | + do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
219 | 219 | |
220 | - if ($post->post_author == get_current_user_id()) { |
|
221 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
222 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
223 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
220 | + if ($post->post_author == get_current_user_id()) { |
|
221 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
222 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
223 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
224 | 224 | |
225 | - $ajaxlink = geodir_get_ajax_url(); |
|
226 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
227 | - ?> |
|
225 | + $ajaxlink = geodir_get_ajax_url(); |
|
226 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
227 | + ?> |
|
228 | 228 | <span class="geodir-authorlink clearfix"> |
229 | 229 | <?php |
230 | - if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
|
231 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
232 | - do_action('geodir_before_edit_post_link_on_listing'); |
|
233 | - ?> |
|
230 | + if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
|
231 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
232 | + do_action('geodir_before_edit_post_link_on_listing'); |
|
233 | + ?> |
|
234 | 234 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
235 | 235 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
236 | 236 | <?php |
237 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
|
238 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
239 | - ?> |
|
237 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
|
238 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
239 | + ?> |
|
240 | 240 | <?php _e('Edit', 'geodirectory'); ?> |
241 | 241 | </a> |
242 | 242 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
243 | 243 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
244 | 244 | <?php |
245 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
|
246 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
247 | - ?> |
|
245 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
|
246 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
247 | + ?> |
|
248 | 248 | <?php _e('Delete', 'geodirectory'); ?> |
249 | 249 | </a> |
250 | 250 | <?php |
251 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
252 | - do_action('geodir_after_edit_post_link_on_listing'); |
|
253 | - } ?> |
|
251 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
252 | + do_action('geodir_after_edit_post_link_on_listing'); |
|
253 | + } ?> |
|
254 | 254 | </span> |
255 | 255 | <?php } ?> |
256 | 256 | </div> |
@@ -260,17 +260,17 @@ discard block |
||
260 | 260 | </article> |
261 | 261 | </li> |
262 | 262 | <?php |
263 | - unset($gd_widget_listing_type); |
|
264 | - } |
|
265 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
266 | - do_action('geodir_after_listing_post_listview'); |
|
267 | - } else { |
|
263 | + unset($gd_widget_listing_type); |
|
264 | + } |
|
265 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
266 | + do_action('geodir_after_listing_post_listview'); |
|
267 | + } else { |
|
268 | 268 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
269 | 269 | |
270 | 270 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
271 | - do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite); |
|
272 | - } |
|
273 | - ?> |
|
271 | + do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite); |
|
272 | + } |
|
273 | + ?> |
|
274 | 274 | </ul> <!-- geodir_category_list_view ends here--> |
275 | 275 | <div class="clear"></div> |
276 | 276 | <?php |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
30 | 30 | do_action('geodir_before_listing_post_listview'); |
31 | 31 | $all_postypes = geodir_get_posttypes(); |
32 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
32 | + $geodir_days_new = (int) get_option('geodir_listing_new_days'); |
|
33 | 33 | foreach ($widget_listings as $widget_listing) { |
34 | 34 | global $gd_widget_listing_type; |
35 | 35 | $post = $widget_listing; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
47 | 47 | ?> |
48 | 48 | <li class="clearfix <?php if ($grid_view_class) { |
49 | - echo 'geodir-gridview ' . $grid_view_class; |
|
49 | + echo 'geodir-gridview '.$grid_view_class; |
|
50 | 50 | } else { |
51 | 51 | echo ' geodir-listview '; |
52 | 52 | } ?> <?php if ($post_view_class) { |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
99 | 99 | do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
100 | 100 | <?php /// Print Distance |
101 | - if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
102 | - if ( $related_nearest && $related_parent_lat ) { |
|
101 | + if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || ($related_nearest && $related_parent_lat)) { |
|
102 | + if ($related_nearest && $related_parent_lat) { |
|
103 | 103 | $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
104 | 104 | } else { |
105 | 105 | $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } else { |
122 | 122 | $uom = __('meters', 'geodirectory'); |
123 | 123 | } |
124 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
124 | + echo round($distance).' '.__($uom, 'geodirectory').' |
|
125 | 125 | <br /> |
126 | 126 | '; |
127 | 127 | } else { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } else { |
131 | 131 | $uom = __('km', 'geodirectory'); |
132 | 132 | } |
133 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
133 | + echo round($distance, 2).' '.__($uom, 'geodirectory').' |
|
134 | 134 | <br /> |
135 | 135 | '; |
136 | 136 | } |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | */ |
155 | 155 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
156 | 156 | if ($show_listing_excerpt) { |
157 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
158 | - $content_out = geodir_max_excerpt( $character_count ); |
|
157 | + if (isset($character_count) && ($character_count || $character_count == '0')) { |
|
158 | + $content_out = geodir_max_excerpt($character_count); |
|
159 | 159 | } else { |
160 | 160 | $content_out = get_the_excerpt(); |
161 | 161 | } |
162 | - if ( ! empty( $content_out ) ) { |
|
163 | - echo "<p>" . $content_out . "</p>"; |
|
162 | + if (!empty($content_out)) { |
|
163 | + echo "<p>".$content_out."</p>"; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | ?> |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param object $post The post object. |
180 | 180 | * @param string $view The view type, default 'widget'. |
181 | 181 | */ |
182 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
182 | + do_action('geodir_after_listing_content', $post, 'widget'); ?> |
|
183 | 183 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>"> |
184 | 184 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>"> |
185 | 185 | <?php |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param object $post The post object. |
191 | 191 | * @param string $view The view type, default 'widget'. |
192 | 192 | */ |
193 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
193 | + do_action('geodir_before_review_html', $post, 'widget'); |
|
194 | 194 | $review_show = geodir_is_reviews_show('listview'); |
195 | 195 | if ($review_show) { |
196 | 196 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @since 1.0.0 |
217 | 217 | */ |
218 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
218 | + do_action('geodir_after_favorite_html', $post->ID, 'widget'); |
|
219 | 219 | |
220 | 220 | if ($post->post_author == get_current_user_id()) { |
221 | 221 | $addplacelink = get_permalink(geodir_add_listing_page_id()); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
236 | 236 | <?php |
237 | 237 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
238 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
238 | + echo '<i class="'.$geodir_listing_edit_icon.'"></i>'; |
|
239 | 239 | ?> |
240 | 240 | <?php _e('Edit', 'geodirectory'); ?> |
241 | 241 | </a> |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
244 | 244 | <?php |
245 | 245 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
246 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
246 | + echo '<i class="'.$geodir_listing_delete_icon.'"></i>'; |
|
247 | 247 | ?> |
248 | 248 | <?php _e('Delete', 'geodirectory'); ?> |
249 | 249 | </a> |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | global $post_type; |
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
21 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
22 | 22 | } else |
23 | - $post_type = $field_info->post_type; |
|
23 | + $post_type = $field_info->post_type; |
|
24 | 24 | |
25 | 25 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){ |
26 | 26 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $field_admin_title = ''; |
50 | 50 | if (isset($field_info->admin_title)) |
51 | - $field_admin_title = $field_info->admin_title; |
|
51 | + $field_admin_title = $field_info->admin_title; |
|
52 | 52 | |
53 | 53 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
54 | 54 | |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | //print_r($field_info); |
69 | 69 | |
70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], ' fa-') !== false) { |
71 | - $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
71 | + $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
72 | 72 | }elseif(isset($cf['icon']) && $cf['icon']){ |
73 | - $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
|
73 | + $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
|
74 | 74 | }else{ |
75 | - $field_icon = '<i class="fas fa-cog" aria-hidden="true"></i>'; |
|
75 | + $field_icon = '<i class="fas fa-cog" aria-hidden="true"></i>'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | if(isset($cf['name']) && $cf['name']){ |
79 | - $field_type_name = $cf['name']; |
|
79 | + $field_type_name = $cf['name']; |
|
80 | 80 | }else{ |
81 | - $field_type_name = $field_type; |
|
81 | + $field_type_name = $field_type; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') { |
85 | - $field_info->data_type = 'XVARCHAR'; |
|
85 | + $field_info->data_type = 'XVARCHAR'; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | ?> |
@@ -92,45 +92,45 @@ discard block |
||
92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" > |
93 | 93 | <?php |
94 | 94 | |
95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
96 | - ?> |
|
95 | + $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
96 | + ?> |
|
97 | 97 | |
98 | 98 | <?php if (!$default): ?> |
99 | 99 | <div title="<?php _e('Click to remove field', 'geodirectory'); ?>" |
100 | 100 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')" |
101 | 101 | class="handlediv close"><i class="fas fa-times" aria-hidden="true"></i></div> |
102 | 102 | <?php endif; |
103 | - if ($field_type == 'fieldset') { |
|
104 | - ?> |
|
103 | + if ($field_type == 'fieldset') { |
|
104 | + ?> |
|
105 | 105 | <i class="fas fa-long-arrow-alt-left " aria-hidden="true"></i> |
106 | 106 | <i class="fas fa-long-arrow-alt-right " aria-hidden="true"></i> |
107 | 107 | <b style="cursor:pointer;" |
108 | 108 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
109 | 109 | <?php |
110 | - } else {echo $field_icon; |
|
111 | - ?> |
|
110 | + } else {echo $field_icon; |
|
111 | + ?> |
|
112 | 112 | <b style="cursor:pointer;" |
113 | 113 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b> |
114 | 114 | <?php |
115 | - } |
|
116 | - ?> |
|
115 | + } |
|
116 | + ?> |
|
117 | 117 | </div> |
118 | 118 | |
119 | 119 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
120 | 120 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
121 | 121 | style="display:<?php if ($field_ins_upd == 'submit') { |
122 | - echo 'block;'; |
|
123 | - } else { |
|
124 | - echo 'none;'; |
|
125 | - } ?>"> |
|
122 | + echo 'block;'; |
|
123 | + } else { |
|
124 | + echo 'none;'; |
|
125 | + } ?>"> |
|
126 | 126 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/> |
127 | 127 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
128 | 128 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
129 | 129 | <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/> |
130 | 130 | <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/> |
131 | 131 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) { |
132 | - echo $field_info->data_type; |
|
133 | - } ?>"/> |
|
132 | + echo $field_info->data_type; |
|
133 | + } ?>"/> |
|
134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
135 | 135 | |
136 | 136 | <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
@@ -142,37 +142,37 @@ discard block |
||
142 | 142 | |
143 | 143 | <?php |
144 | 144 | |
145 | - // data_type |
|
146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
145 | + // data_type |
|
146 | + if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
147 | 147 | |
148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
149 | 149 | |
150 | - }else{ |
|
151 | - $value = ''; |
|
152 | - if (isset($field_info->data_type)) { |
|
153 | - $value = esc_attr($field_info->data_type); |
|
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | - $value = $cf['defaults']['data_type']; |
|
156 | - } |
|
157 | - ?> |
|
150 | + }else{ |
|
151 | + $value = ''; |
|
152 | + if (isset($field_info->data_type)) { |
|
153 | + $value = esc_attr($field_info->data_type); |
|
154 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | + $value = $cf['defaults']['data_type']; |
|
156 | + } |
|
157 | + ?> |
|
158 | 158 | <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
159 | 159 | <?php |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | - // admin_title |
|
164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
163 | + // admin_title |
|
164 | + if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
165 | 165 | |
166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
167 | 167 | |
168 | - }else{ |
|
169 | - $value = ''; |
|
170 | - if (isset($field_info->admin_title)) { |
|
171 | - $value = esc_attr($field_info->admin_title); |
|
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | - $value = $cf['defaults']['admin_title']; |
|
174 | - } |
|
175 | - ?> |
|
168 | + }else{ |
|
169 | + $value = ''; |
|
170 | + if (isset($field_info->admin_title)) { |
|
171 | + $value = esc_attr($field_info->admin_title); |
|
172 | + }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | + $value = $cf['defaults']['admin_title']; |
|
174 | + } |
|
175 | + ?> |
|
176 | 176 | <li> |
177 | 177 | <label for="admin_title" class="gd-cf-tooltip-wrap"> |
178 | 178 | <i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?> |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | </div> |
187 | 187 | </li> |
188 | 188 | <?php |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | 191 | |
192 | - // site_title |
|
193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
192 | + // site_title |
|
193 | + if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
194 | 194 | |
195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
196 | 196 | |
197 | - }else{ |
|
198 | - $value = ''; |
|
199 | - if (isset($field_info->site_title)) { |
|
200 | - $value = esc_attr($field_info->site_title); |
|
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | - $value = $cf['defaults']['site_title']; |
|
203 | - } |
|
204 | - ?> |
|
197 | + }else{ |
|
198 | + $value = ''; |
|
199 | + if (isset($field_info->site_title)) { |
|
200 | + $value = esc_attr($field_info->site_title); |
|
201 | + }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | + $value = $cf['defaults']['site_title']; |
|
203 | + } |
|
204 | + ?> |
|
205 | 205 | <li> |
206 | 206 | <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?> |
207 | 207 | <div class="gdcf-tooltip"> |
@@ -214,22 +214,22 @@ discard block |
||
214 | 214 | </div> |
215 | 215 | </li> |
216 | 216 | <?php |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | - // admin_desc |
|
221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
220 | + // admin_desc |
|
221 | + if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
222 | 222 | |
223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
224 | 224 | |
225 | - }else{ |
|
226 | - $value = ''; |
|
227 | - if (isset($field_info->admin_desc)) { |
|
228 | - $value = esc_attr($field_info->admin_desc); |
|
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | - $value = $cf['defaults']['admin_desc']; |
|
231 | - } |
|
232 | - ?> |
|
225 | + }else{ |
|
226 | + $value = ''; |
|
227 | + if (isset($field_info->admin_desc)) { |
|
228 | + $value = esc_attr($field_info->admin_desc); |
|
229 | + }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | + $value = $cf['defaults']['admin_desc']; |
|
231 | + } |
|
232 | + ?> |
|
233 | 233 | <li> |
234 | 234 | <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?> |
235 | 235 | <div class="gdcf-tooltip"> |
@@ -241,23 +241,23 @@ discard block |
||
241 | 241 | </div> |
242 | 242 | </li> |
243 | 243 | <?php |
244 | - } |
|
244 | + } |
|
245 | 245 | |
246 | 246 | |
247 | 247 | |
248 | - // htmlvar_name |
|
249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
248 | + // htmlvar_name |
|
249 | + if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
250 | 250 | |
251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
252 | 252 | |
253 | - }else{ |
|
254 | - $value = ''; |
|
255 | - if (isset($field_info->htmlvar_name)) { |
|
256 | - $value = esc_attr($field_info->htmlvar_name); |
|
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | - $value = $cf['defaults']['htmlvar_name']; |
|
259 | - } |
|
260 | - ?> |
|
253 | + }else{ |
|
254 | + $value = ''; |
|
255 | + if (isset($field_info->htmlvar_name)) { |
|
256 | + $value = esc_attr($field_info->htmlvar_name); |
|
257 | + }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | + $value = $cf['defaults']['htmlvar_name']; |
|
259 | + } |
|
260 | + ?> |
|
261 | 261 | <li> |
262 | 262 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?> |
263 | 263 | <div class="gdcf-tooltip"> |
@@ -267,29 +267,29 @@ discard block |
||
267 | 267 | <div class="gd-cf-input-wrap"> |
268 | 268 | <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>" |
269 | 269 | value="<?php if ($value) { |
270 | - echo preg_replace('/geodir_/', '', $value, 1); |
|
271 | - }?>" <?php if ($default) { |
|
272 | - echo 'readonly="readonly"'; |
|
273 | - }?> /> |
|
270 | + echo preg_replace('/geodir_/', '', $value, 1); |
|
271 | + }?>" <?php if ($default) { |
|
272 | + echo 'readonly="readonly"'; |
|
273 | + }?> /> |
|
274 | 274 | </div> |
275 | 275 | </li> |
276 | 276 | <?php |
277 | - } |
|
277 | + } |
|
278 | 278 | |
279 | 279 | |
280 | - // is_active |
|
281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
280 | + // is_active |
|
281 | + if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
282 | 282 | |
283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
284 | 284 | |
285 | - }else{ |
|
286 | - $value = ''; |
|
287 | - if (isset($field_info->is_active)) { |
|
288 | - $value = esc_attr($field_info->is_active); |
|
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | - $value = $cf['defaults']['is_active']; |
|
291 | - } |
|
292 | - ?> |
|
285 | + }else{ |
|
286 | + $value = ''; |
|
287 | + if (isset($field_info->is_active)) { |
|
288 | + $value = esc_attr($field_info->is_active); |
|
289 | + }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | + $value = $cf['defaults']['is_active']; |
|
291 | + } |
|
292 | + ?> |
|
293 | 293 | <li <?php echo $field_display; ?>> |
294 | 294 | <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?> |
295 | 295 | <div class="gdcf-tooltip"> |
@@ -300,35 +300,35 @@ discard block |
||
300 | 300 | |
301 | 301 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
302 | 302 | <?php if ($value == '1') { |
303 | - echo 'checked'; |
|
304 | - } ?>/> |
|
303 | + echo 'checked'; |
|
304 | + } ?>/> |
|
305 | 305 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
306 | 306 | |
307 | 307 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
308 | 308 | <?php if ($value == '0' || !$value) { |
309 | - echo 'checked'; |
|
310 | - } ?>/> |
|
309 | + echo 'checked'; |
|
310 | + } ?>/> |
|
311 | 311 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
312 | 312 | |
313 | 313 | </div> |
314 | 314 | </li> |
315 | 315 | <?php |
316 | - } |
|
316 | + } |
|
317 | 317 | |
318 | 318 | |
319 | - // for_admin_use |
|
320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
319 | + // for_admin_use |
|
320 | + if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
321 | 321 | |
322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
323 | 323 | |
324 | - }else{ |
|
325 | - $value = ''; |
|
326 | - if (isset($field_info->for_admin_use)) { |
|
327 | - $value = esc_attr($field_info->for_admin_use); |
|
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | - $value = $cf['defaults']['for_admin_use']; |
|
330 | - } |
|
331 | - ?> |
|
324 | + }else{ |
|
325 | + $value = ''; |
|
326 | + if (isset($field_info->for_admin_use)) { |
|
327 | + $value = esc_attr($field_info->for_admin_use); |
|
328 | + }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | + $value = $cf['defaults']['for_admin_use']; |
|
330 | + } |
|
331 | + ?> |
|
332 | 332 | <li> |
333 | 333 | <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?> |
334 | 334 | <div class="gdcf-tooltip"> |
@@ -339,47 +339,47 @@ discard block |
||
339 | 339 | |
340 | 340 | <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
341 | 341 | <?php if ($value == '1') { |
342 | - echo 'checked'; |
|
343 | - } ?>/> |
|
342 | + echo 'checked'; |
|
343 | + } ?>/> |
|
344 | 344 | <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
345 | 345 | |
346 | 346 | <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
347 | 347 | <?php if ($value == '0' || !$value) { |
348 | - echo 'checked'; |
|
349 | - } ?>/> |
|
348 | + echo 'checked'; |
|
349 | + } ?>/> |
|
350 | 350 | <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
351 | 351 | |
352 | 352 | </div> |
353 | 353 | </li> |
354 | 354 | <?php |
355 | - } |
|
355 | + } |
|
356 | 356 | |
357 | 357 | |
358 | - // default_value |
|
359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
358 | + // default_value |
|
359 | + if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
360 | 360 | |
361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
362 | 362 | |
363 | - }else{ |
|
364 | - $value = ''; |
|
365 | - if (isset($field_info->default_value)) { |
|
366 | - $value = esc_attr($field_info->default_value); |
|
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | - $value = $cf['defaults']['default_value']; |
|
369 | - } |
|
370 | - ?> |
|
363 | + }else{ |
|
364 | + $value = ''; |
|
365 | + if (isset($field_info->default_value)) { |
|
366 | + $value = esc_attr($field_info->default_value); |
|
367 | + }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | + $value = $cf['defaults']['default_value']; |
|
369 | + } |
|
370 | + ?> |
|
371 | 371 | <li> |
372 | 372 | <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?> |
373 | 373 | <div class="gdcf-tooltip"> |
374 | 374 | <?php |
375 | - if ($field_type == 'checkbox') { |
|
376 | - _e('Should the checkbox be checked by default?', 'geodirectory'); |
|
377 | - } else if ($field_type == 'email') { |
|
378 | - _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory'); |
|
379 | - } else { |
|
380 | - _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory'); |
|
381 | - } |
|
382 | - ?> |
|
375 | + if ($field_type == 'checkbox') { |
|
376 | + _e('Should the checkbox be checked by default?', 'geodirectory'); |
|
377 | + } else if ($field_type == 'email') { |
|
378 | + _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory'); |
|
379 | + } else { |
|
380 | + _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory'); |
|
381 | + } |
|
382 | + ?> |
|
383 | 383 | </div> |
384 | 384 | </label> |
385 | 385 | <div class="gd-cf-input-wrap"> |
@@ -396,22 +396,22 @@ discard block |
||
396 | 396 | </div> |
397 | 397 | </li> |
398 | 398 | <?php |
399 | - } |
|
399 | + } |
|
400 | 400 | |
401 | 401 | |
402 | - // show_in |
|
403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
402 | + // show_in |
|
403 | + if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
404 | 404 | |
405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
406 | 406 | |
407 | - }else{ |
|
408 | - $value = ''; |
|
409 | - if (isset($field_info->show_in)) { |
|
410 | - $value = esc_attr($field_info->show_in); |
|
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | - $value = esc_attr($cf['defaults']['show_in']); |
|
413 | - } |
|
414 | - ?> |
|
407 | + }else{ |
|
408 | + $value = ''; |
|
409 | + if (isset($field_info->show_in)) { |
|
410 | + $value = esc_attr($field_info->show_in); |
|
411 | + }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | + $value = esc_attr($cf['defaults']['show_in']); |
|
413 | + } |
|
414 | + ?> |
|
415 | 415 | <li> |
416 | 416 | <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?> |
417 | 417 | <div class="gdcf-tooltip"> |
@@ -422,41 +422,41 @@ discard block |
||
422 | 422 | |
423 | 423 | <?php |
424 | 424 | |
425 | - /* |
|
425 | + /* |
|
426 | 426 | * We wrap the key values in [] so we can search the DB easier with a LIKE query. |
427 | 427 | */ |
428 | - $show_in_locations = array( |
|
429 | - "[detail]" => __("Details page sidebar", 'geodirectory'), |
|
430 | - "[moreinfo]" => __("More info tab", 'geodirectory'), |
|
431 | - "[listing]" => __("Listings page", 'geodirectory'), |
|
432 | - "[owntab]" => __("Details page own tab", 'geodirectory'), |
|
433 | - "[mapbubble]" => __("Map bubble", 'geodirectory'), |
|
434 | - ); |
|
435 | - |
|
436 | - /** |
|
437 | - * Filter the locations array for where to display custom fields. |
|
438 | - * |
|
439 | - * @since 1.6.6 |
|
440 | - * @param array $show_in_locations The array of locations and descriptions. |
|
441 | - * @param object $field_info The field being displayed info. |
|
442 | - * @param string $field_info The type of field. |
|
443 | - */ |
|
444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
445 | - |
|
446 | - |
|
447 | - // remove some locations for some field types |
|
448 | - |
|
449 | - // don't show new tab option for some types |
|
450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | - }else{ |
|
452 | - unset($show_in_locations['[owntab]']); |
|
453 | - } |
|
454 | - |
|
455 | - if(!$display_on_listing){ |
|
456 | - unset($show_in_locations['[listings]']); |
|
457 | - } |
|
458 | - |
|
459 | - ?> |
|
428 | + $show_in_locations = array( |
|
429 | + "[detail]" => __("Details page sidebar", 'geodirectory'), |
|
430 | + "[moreinfo]" => __("More info tab", 'geodirectory'), |
|
431 | + "[listing]" => __("Listings page", 'geodirectory'), |
|
432 | + "[owntab]" => __("Details page own tab", 'geodirectory'), |
|
433 | + "[mapbubble]" => __("Map bubble", 'geodirectory'), |
|
434 | + ); |
|
435 | + |
|
436 | + /** |
|
437 | + * Filter the locations array for where to display custom fields. |
|
438 | + * |
|
439 | + * @since 1.6.6 |
|
440 | + * @param array $show_in_locations The array of locations and descriptions. |
|
441 | + * @param object $field_info The field being displayed info. |
|
442 | + * @param string $field_info The type of field. |
|
443 | + */ |
|
444 | + $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
445 | + |
|
446 | + |
|
447 | + // remove some locations for some field types |
|
448 | + |
|
449 | + // don't show new tab option for some types |
|
450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | + }else{ |
|
452 | + unset($show_in_locations['[owntab]']); |
|
453 | + } |
|
454 | + |
|
455 | + if(!$display_on_listing){ |
|
456 | + unset($show_in_locations['[listings]']); |
|
457 | + } |
|
458 | + |
|
459 | + ?> |
|
460 | 460 | |
461 | 461 | <select multiple="multiple" name="show_in[]" |
462 | 462 | id="show_in" |
@@ -466,38 +466,38 @@ discard block |
||
466 | 466 | option-ajaxchosen="false"> |
467 | 467 | <?php |
468 | 468 | |
469 | - $show_in_values = explode(',',$value); |
|
469 | + $show_in_values = explode(',',$value); |
|
470 | 470 | |
471 | - foreach( $show_in_locations as $key => $val){ |
|
472 | - $selected = ''; |
|
471 | + foreach( $show_in_locations as $key => $val){ |
|
472 | + $selected = ''; |
|
473 | 473 | |
474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
475 | - $selected = 'selected'; |
|
476 | - } |
|
474 | + if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
475 | + $selected = 'selected'; |
|
476 | + } |
|
477 | 477 | |
478 | - ?> |
|
478 | + ?> |
|
479 | 479 | <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
480 | 480 | <?php |
481 | - } |
|
482 | - ?> |
|
481 | + } |
|
482 | + ?> |
|
483 | 483 | </select> |
484 | 484 | </div> |
485 | 485 | </li> |
486 | 486 | <?php |
487 | - } |
|
487 | + } |
|
488 | 488 | |
489 | 489 | |
490 | - // advanced_editor |
|
491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
490 | + // advanced_editor |
|
491 | + if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
492 | 492 | |
493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
494 | 494 | |
495 | - } |
|
495 | + } |
|
496 | 496 | |
497 | 497 | |
498 | 498 | |
499 | 499 | |
500 | - ?> |
|
500 | + ?> |
|
501 | 501 | |
502 | 502 | |
503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
@@ -510,38 +510,38 @@ discard block |
||
510 | 510 | |
511 | 511 | <?php |
512 | 512 | |
513 | - $pricearr = array(); |
|
514 | - if (isset($field_info->packages) && $field_info->packages != '') { |
|
515 | - $pricearr = explode(',', trim($field_info->packages, ',')); |
|
516 | - } else { |
|
517 | - $package_info = array(); |
|
513 | + $pricearr = array(); |
|
514 | + if (isset($field_info->packages) && $field_info->packages != '') { |
|
515 | + $pricearr = explode(',', trim($field_info->packages, ',')); |
|
516 | + } else { |
|
517 | + $package_info = array(); |
|
518 | 518 | |
519 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
520 | - $pricearr[] = $package_info->pid; |
|
521 | - } |
|
519 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
520 | + $pricearr[] = $package_info->pid; |
|
521 | + } |
|
522 | 522 | |
523 | - ob_start() |
|
524 | - ?> |
|
523 | + ob_start() |
|
524 | + ?> |
|
525 | 525 | |
526 | 526 | <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple"> |
527 | 527 | <?php |
528 | - if (!empty($pricearr)) { |
|
529 | - foreach ($pricearr as $val) { |
|
530 | - ?> |
|
528 | + if (!empty($pricearr)) { |
|
529 | + foreach ($pricearr as $val) { |
|
530 | + ?> |
|
531 | 531 | <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php |
532 | - } |
|
533 | - } |
|
534 | - ?> |
|
532 | + } |
|
533 | + } |
|
534 | + ?> |
|
535 | 535 | </select> |
536 | 536 | |
537 | 537 | <?php |
538 | - $html = ob_get_clean(); |
|
538 | + $html = ob_get_clean(); |
|
539 | 539 | |
540 | 540 | /** |
541 | 541 | * Filter the price packages list. |
542 | 542 | * |
543 | 543 | * Filter the price packages list in custom field form in admin |
544 | - * custom fields settings. |
|
544 | + * custom fields settings. |
|
545 | 545 | * |
546 | 546 | * @since 1.0.0 |
547 | 547 | * |
@@ -550,25 +550,25 @@ discard block |
||
550 | 550 | */ |
551 | 551 | echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info); |
552 | 552 | |
553 | - ?> |
|
553 | + ?> |
|
554 | 554 | |
555 | 555 | |
556 | 556 | |
557 | 557 | <?php |
558 | 558 | |
559 | - // is_required |
|
560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
559 | + // is_required |
|
560 | + if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
561 | 561 | |
562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
563 | 563 | |
564 | - }else{ |
|
565 | - $value = ''; |
|
566 | - if (isset($field_info->is_required)) { |
|
567 | - $value = esc_attr($field_info->is_required); |
|
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | - $value = $cf['defaults']['is_required']; |
|
570 | - } |
|
571 | - ?> |
|
564 | + }else{ |
|
565 | + $value = ''; |
|
566 | + if (isset($field_info->is_required)) { |
|
567 | + $value = esc_attr($field_info->is_required); |
|
568 | + }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | + $value = $cf['defaults']['is_required']; |
|
570 | + } |
|
571 | + ?> |
|
572 | 572 | <li> |
573 | 573 | <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?> |
574 | 574 | <div class="gdcf-tooltip"> |
@@ -580,14 +580,14 @@ discard block |
||
580 | 580 | |
581 | 581 | <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
582 | 582 | <?php if ($value == '1') { |
583 | - echo 'checked'; |
|
584 | - } ?>/> |
|
583 | + echo 'checked'; |
|
584 | + } ?>/> |
|
585 | 585 | <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
586 | 586 | |
587 | 587 | <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
588 | 588 | <?php if ($value == '0' || !$value) { |
589 | - echo 'checked'; |
|
590 | - } ?>/> |
|
589 | + echo 'checked'; |
|
590 | + } ?>/> |
|
591 | 591 | <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
592 | 592 | |
593 | 593 | </div> |
@@ -595,21 +595,21 @@ discard block |
||
595 | 595 | </li> |
596 | 596 | |
597 | 597 | <?php |
598 | - } |
|
598 | + } |
|
599 | 599 | |
600 | - // required_msg |
|
601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
600 | + // required_msg |
|
601 | + if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
602 | 602 | |
603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
604 | 604 | |
605 | - }else{ |
|
606 | - $value = ''; |
|
607 | - if (isset($field_info->required_msg)) { |
|
608 | - $value = esc_attr($field_info->required_msg); |
|
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | - $value = $cf['defaults']['required_msg']; |
|
611 | - } |
|
612 | - ?> |
|
605 | + }else{ |
|
606 | + $value = ''; |
|
607 | + if (isset($field_info->required_msg)) { |
|
608 | + $value = esc_attr($field_info->required_msg); |
|
609 | + }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | + $value = $cf['defaults']['required_msg']; |
|
611 | + } |
|
612 | + ?> |
|
613 | 613 | <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>> |
614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
615 | 615 | <i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?> |
@@ -623,38 +623,38 @@ discard block |
||
623 | 623 | </div> |
624 | 624 | </li> |
625 | 625 | <?php |
626 | - } |
|
626 | + } |
|
627 | 627 | |
628 | 628 | |
629 | - // required_msg |
|
630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
629 | + // required_msg |
|
630 | + if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
631 | 631 | |
632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
633 | 633 | |
634 | - } |
|
634 | + } |
|
635 | 635 | |
636 | 636 | |
637 | - // extra_fields |
|
638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
637 | + // extra_fields |
|
638 | + if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
639 | 639 | |
640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
641 | 641 | |
642 | - } |
|
642 | + } |
|
643 | 643 | |
644 | 644 | |
645 | - // field_icon |
|
646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
645 | + // field_icon |
|
646 | + if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
647 | 647 | |
648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
649 | 649 | |
650 | - }else{ |
|
651 | - $value = ''; |
|
652 | - if (isset($field_info->field_icon)) { |
|
653 | - $value = esc_attr($field_info->field_icon); |
|
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | - $value = $cf['defaults']['field_icon']; |
|
656 | - } |
|
657 | - ?> |
|
650 | + }else{ |
|
651 | + $value = ''; |
|
652 | + if (isset($field_info->field_icon)) { |
|
653 | + $value = esc_attr($field_info->field_icon); |
|
654 | + }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | + $value = $cf['defaults']['field_icon']; |
|
656 | + } |
|
657 | + ?> |
|
658 | 658 | <li> |
659 | 659 | <h3><?php echo __('Custom css', 'geodirectory'); ?></h3> |
660 | 660 | |
@@ -672,22 +672,22 @@ discard block |
||
672 | 672 | |
673 | 673 | </li> |
674 | 674 | <?php |
675 | - } |
|
675 | + } |
|
676 | 676 | |
677 | 677 | |
678 | - // css_class |
|
679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
678 | + // css_class |
|
679 | + if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
680 | 680 | |
681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
682 | 682 | |
683 | - }else{ |
|
684 | - $value = ''; |
|
685 | - if (isset($field_info->css_class)) { |
|
686 | - $value = esc_attr($field_info->css_class); |
|
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | - $value = $cf['defaults']['css_class']; |
|
689 | - } |
|
690 | - ?> |
|
683 | + }else{ |
|
684 | + $value = ''; |
|
685 | + if (isset($field_info->css_class)) { |
|
686 | + $value = esc_attr($field_info->css_class); |
|
687 | + }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | + $value = $cf['defaults']['css_class']; |
|
689 | + } |
|
690 | + ?> |
|
691 | 691 | <li> |
692 | 692 | |
693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
@@ -700,47 +700,47 @@ discard block |
||
700 | 700 | <div class="gd-cf-input-wrap"> |
701 | 701 | <input type="text" name="css_class" id="css_class" |
702 | 702 | value="<?php if (isset($field_info->css_class)) { |
703 | - echo esc_attr($field_info->css_class); |
|
704 | - }?>"/> |
|
703 | + echo esc_attr($field_info->css_class); |
|
704 | + }?>"/> |
|
705 | 705 | </div> |
706 | 706 | </li> |
707 | 707 | <?php |
708 | - } |
|
708 | + } |
|
709 | 709 | |
710 | 710 | |
711 | - // cat_sort |
|
712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
711 | + // cat_sort |
|
712 | + if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
713 | 713 | |
714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
715 | 715 | |
716 | - }else{ |
|
717 | - $value = ''; |
|
718 | - $hide_cat_sort =''; |
|
719 | - if (isset($field_info->cat_sort)) { |
|
720 | - $value = esc_attr($field_info->cat_sort); |
|
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | - $value = $cf['defaults']['cat_sort']; |
|
723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
724 | - } |
|
716 | + }else{ |
|
717 | + $value = ''; |
|
718 | + $hide_cat_sort =''; |
|
719 | + if (isset($field_info->cat_sort)) { |
|
720 | + $value = esc_attr($field_info->cat_sort); |
|
721 | + }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | + $value = $cf['defaults']['cat_sort']; |
|
723 | + $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
724 | + } |
|
725 | 725 | |
726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
727 | - ?> |
|
726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
727 | + ?> |
|
728 | 728 | <li <?php echo $hide_cat_sort ;?>> |
729 | 729 | <h3><?php |
730 | - /** |
|
731 | - * Filter the section title. |
|
732 | - * |
|
733 | - * Filter the section title in custom field form in admin |
|
734 | - * custom fields settings. |
|
735 | - * |
|
736 | - * @since 1.0.0 |
|
737 | - * |
|
738 | - * @param string $title Title of the section. |
|
739 | - * @param string $field_type Current field type. |
|
740 | - */ |
|
741 | - echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
742 | - |
|
743 | - ?></h3> |
|
730 | + /** |
|
731 | + * Filter the section title. |
|
732 | + * |
|
733 | + * Filter the section title in custom field form in admin |
|
734 | + * custom fields settings. |
|
735 | + * |
|
736 | + * @since 1.0.0 |
|
737 | + * |
|
738 | + * @param string $title Title of the section. |
|
739 | + * @param string $field_type Current field type. |
|
740 | + */ |
|
741 | + echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type); |
|
742 | + |
|
743 | + ?></h3> |
|
744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
745 | 745 | <i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?> |
746 | 746 | <div class="gdcf-tooltip"> |
@@ -752,42 +752,42 @@ discard block |
||
752 | 752 | |
753 | 753 | <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
754 | 754 | <?php if ($value == '1') { |
755 | - echo 'checked'; |
|
756 | - } ?>/> |
|
755 | + echo 'checked'; |
|
756 | + } ?>/> |
|
757 | 757 | <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
758 | 758 | |
759 | 759 | <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
760 | 760 | <?php if (!$value) { |
761 | - echo 'checked'; |
|
762 | - } ?>/> |
|
761 | + echo 'checked'; |
|
762 | + } ?>/> |
|
763 | 763 | <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
764 | 764 | |
765 | 765 | </div> |
766 | 766 | </li> |
767 | 767 | <?php |
768 | - } |
|
769 | - |
|
770 | - |
|
771 | - |
|
772 | - switch ($field_type): |
|
773 | - case 'html': |
|
774 | - case 'file': |
|
775 | - case 'url': |
|
776 | - case 'fieldset': |
|
777 | - break; |
|
778 | - default: |
|
779 | - |
|
780 | - /** |
|
781 | - * Called at the end of the advanced custom fields settings page loop. |
|
782 | - * |
|
783 | - * Can be used to add or deal with different settings types. |
|
784 | - * |
|
785 | - * @since 1.0.0 |
|
786 | - * @since 1.6.6 $cf param added. |
|
787 | - * @param object $field_info The current fields info. |
|
788 | - * @param array $cf The custom field settings |
|
789 | - */ |
|
790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
768 | + } |
|
769 | + |
|
770 | + |
|
771 | + |
|
772 | + switch ($field_type): |
|
773 | + case 'html': |
|
774 | + case 'file': |
|
775 | + case 'url': |
|
776 | + case 'fieldset': |
|
777 | + break; |
|
778 | + default: |
|
779 | + |
|
780 | + /** |
|
781 | + * Called at the end of the advanced custom fields settings page loop. |
|
782 | + * |
|
783 | + * Can be used to add or deal with different settings types. |
|
784 | + * |
|
785 | + * @since 1.0.0 |
|
786 | + * @since 1.6.6 $cf param added. |
|
787 | + * @param object $field_info The current fields info. |
|
788 | + * @param array $cf The custom field settings |
|
789 | + */ |
|
790 | + do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
791 | 791 | |
792 | 792 | |
793 | 793 | <?php endswitch; ?> |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
40 | 40 | |
41 | 41 | |
42 | -if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;} |
|
42 | +if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; } |
|
43 | 43 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
44 | -if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;} |
|
44 | +if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; } |
|
45 | 45 | |
46 | 46 | |
47 | -$nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
47 | +$nonce = wp_create_nonce('custom_fields_'.$result_str); |
|
48 | 48 | |
49 | 49 | $field_admin_title = ''; |
50 | 50 | if (isset($field_info->admin_title)) |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], ' fa-') !== false) { |
71 | 71 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
72 | -}elseif(isset($cf['icon']) && $cf['icon']){ |
|
72 | +}elseif (isset($cf['icon']) && $cf['icon']) { |
|
73 | 73 | $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
74 | -}else{ |
|
74 | +} else { |
|
75 | 75 | $field_icon = '<i class="fas fa-cog" aria-hidden="true"></i>'; |
76 | 76 | } |
77 | 77 | |
78 | -if(isset($cf['name']) && $cf['name']){ |
|
78 | +if (isset($cf['name']) && $cf['name']) { |
|
79 | 79 | $field_type_name = $cf['name']; |
80 | -}else{ |
|
80 | +} else { |
|
81 | 81 | $field_type_name = $field_type; |
82 | 82 | } |
83 | 83 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" > |
93 | 93 | <?php |
94 | 94 | |
95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str); |
|
95 | + $nonce = wp_create_nonce('custom_fields_'.$result_str); |
|
96 | 96 | ?> |
97 | 97 | |
98 | 98 | <?php if (!$default): ?> |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | <i class="fas fa-long-arrow-alt-left " aria-hidden="true"></i> |
106 | 106 | <i class="fas fa-long-arrow-alt-right " aria-hidden="true"></i> |
107 | 107 | <b style="cursor:pointer;" |
108 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b> |
|
108 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b> |
|
109 | 109 | <?php |
110 | 110 | } else {echo $field_icon; |
111 | 111 | ?> |
112 | 112 | <b style="cursor:pointer;" |
113 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b> |
|
113 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b> |
|
114 | 114 | <?php |
115 | 115 | } |
116 | 116 | ?> |
@@ -133,43 +133,43 @@ discard block |
||
133 | 133 | } ?>"/> |
134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
135 | 135 | |
136 | - <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
|
137 | - <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
138 | - <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
139 | - <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" /> |
|
136 | + <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?> |
|
137 | + <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
138 | + <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
139 | + <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" /> |
|
140 | 140 | |
141 | 141 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
142 | 142 | |
143 | 143 | <?php |
144 | 144 | |
145 | 145 | // data_type |
146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){ |
|
146 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) { |
|
147 | 147 | |
148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
|
148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info); |
|
149 | 149 | |
150 | - }else{ |
|
150 | + } else { |
|
151 | 151 | $value = ''; |
152 | 152 | if (isset($field_info->data_type)) { |
153 | 153 | $value = esc_attr($field_info->data_type); |
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
154 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) { |
|
155 | 155 | $value = $cf['defaults']['data_type']; |
156 | 156 | } |
157 | 157 | ?> |
158 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
158 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
159 | 159 | <?php |
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | 163 | // admin_title |
164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){ |
|
164 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) { |
|
165 | 165 | |
166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info); |
|
167 | 167 | |
168 | - }else{ |
|
168 | + } else { |
|
169 | 169 | $value = ''; |
170 | 170 | if (isset($field_info->admin_title)) { |
171 | 171 | $value = esc_attr($field_info->admin_title); |
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
172 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) { |
|
173 | 173 | $value = $cf['defaults']['admin_title']; |
174 | 174 | } |
175 | 175 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | </label> |
183 | 183 | <div class="gd-cf-input-wrap"> |
184 | 184 | <input type="text" name="admin_title" id="admin_title" |
185 | - value="<?php echo $value;?>"/> |
|
185 | + value="<?php echo $value; ?>"/> |
|
186 | 186 | </div> |
187 | 187 | </li> |
188 | 188 | <?php |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | |
191 | 191 | |
192 | 192 | // site_title |
193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){ |
|
193 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) { |
|
194 | 194 | |
195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
|
195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info); |
|
196 | 196 | |
197 | - }else{ |
|
197 | + } else { |
|
198 | 198 | $value = ''; |
199 | 199 | if (isset($field_info->site_title)) { |
200 | 200 | $value = esc_attr($field_info->site_title); |
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
201 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) { |
|
202 | 202 | $value = $cf['defaults']['site_title']; |
203 | 203 | } |
204 | 204 | ?> |
@@ -218,15 +218,15 @@ discard block |
||
218 | 218 | |
219 | 219 | |
220 | 220 | // admin_desc |
221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){ |
|
221 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) { |
|
222 | 222 | |
223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
|
223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info); |
|
224 | 224 | |
225 | - }else{ |
|
225 | + } else { |
|
226 | 226 | $value = ''; |
227 | 227 | if (isset($field_info->admin_desc)) { |
228 | 228 | $value = esc_attr($field_info->admin_desc); |
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
229 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) { |
|
230 | 230 | $value = $cf['defaults']['admin_desc']; |
231 | 231 | } |
232 | 232 | ?> |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | </div> |
238 | 238 | </label> |
239 | 239 | <div class="gd-cf-input-wrap"> |
240 | - <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/> |
|
240 | + <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/> |
|
241 | 241 | </div> |
242 | 242 | </li> |
243 | 243 | <?php |
@@ -246,26 +246,26 @@ discard block |
||
246 | 246 | |
247 | 247 | |
248 | 248 | // htmlvar_name |
249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){ |
|
249 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) { |
|
250 | 250 | |
251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
|
251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info); |
|
252 | 252 | |
253 | - }else{ |
|
253 | + } else { |
|
254 | 254 | $value = ''; |
255 | 255 | if (isset($field_info->htmlvar_name)) { |
256 | 256 | $value = esc_attr($field_info->htmlvar_name); |
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
257 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) { |
|
258 | 258 | $value = $cf['defaults']['htmlvar_name']; |
259 | 259 | } |
260 | 260 | ?> |
261 | 261 | <li> |
262 | - <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?> |
|
262 | + <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?> |
|
263 | 263 | <div class="gdcf-tooltip"> |
264 | 264 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?> |
265 | 265 | </div> |
266 | 266 | </label> |
267 | 267 | <div class="gd-cf-input-wrap"> |
268 | - <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>" |
|
268 | + <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>" |
|
269 | 269 | value="<?php if ($value) { |
270 | 270 | echo preg_replace('/geodir_/', '', $value, 1); |
271 | 271 | }?>" <?php if ($default) { |
@@ -278,15 +278,15 @@ discard block |
||
278 | 278 | |
279 | 279 | |
280 | 280 | // is_active |
281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){ |
|
281 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) { |
|
282 | 282 | |
283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
|
283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info); |
|
284 | 284 | |
285 | - }else{ |
|
285 | + } else { |
|
286 | 286 | $value = ''; |
287 | 287 | if (isset($field_info->is_active)) { |
288 | 288 | $value = esc_attr($field_info->is_active); |
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
289 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) { |
|
290 | 290 | $value = $cf['defaults']['is_active']; |
291 | 291 | } |
292 | 292 | ?> |
@@ -298,17 +298,17 @@ discard block |
||
298 | 298 | </label> |
299 | 299 | <div class="gd-cf-input-wrap gd-switch"> |
300 | 300 | |
301 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
301 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
302 | 302 | <?php if ($value == '1') { |
303 | 303 | echo 'checked'; |
304 | 304 | } ?>/> |
305 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
305 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
306 | 306 | |
307 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
307 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
308 | 308 | <?php if ($value == '0' || !$value) { |
309 | 309 | echo 'checked'; |
310 | 310 | } ?>/> |
311 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
311 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
312 | 312 | |
313 | 313 | </div> |
314 | 314 | </li> |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | |
318 | 318 | |
319 | 319 | // for_admin_use |
320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){ |
|
320 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) { |
|
321 | 321 | |
322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
|
322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info); |
|
323 | 323 | |
324 | - }else{ |
|
324 | + } else { |
|
325 | 325 | $value = ''; |
326 | 326 | if (isset($field_info->for_admin_use)) { |
327 | 327 | $value = esc_attr($field_info->for_admin_use); |
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
328 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) { |
|
329 | 329 | $value = $cf['defaults']['for_admin_use']; |
330 | 330 | } |
331 | 331 | ?> |
@@ -337,17 +337,17 @@ discard block |
||
337 | 337 | </label> |
338 | 338 | <div class="gd-cf-input-wrap gd-switch"> |
339 | 339 | |
340 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
340 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
341 | 341 | <?php if ($value == '1') { |
342 | 342 | echo 'checked'; |
343 | 343 | } ?>/> |
344 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
344 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
345 | 345 | |
346 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
346 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
347 | 347 | <?php if ($value == '0' || !$value) { |
348 | 348 | echo 'checked'; |
349 | 349 | } ?>/> |
350 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
350 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
351 | 351 | |
352 | 352 | </div> |
353 | 353 | </li> |
@@ -356,20 +356,20 @@ discard block |
||
356 | 356 | |
357 | 357 | |
358 | 358 | // default_value |
359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){ |
|
359 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) { |
|
360 | 360 | |
361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
|
361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info); |
|
362 | 362 | |
363 | - }else{ |
|
363 | + } else { |
|
364 | 364 | $value = ''; |
365 | 365 | if (isset($field_info->default_value)) { |
366 | 366 | $value = esc_attr($field_info->default_value); |
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
367 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) { |
|
368 | 368 | $value = $cf['defaults']['default_value']; |
369 | 369 | } |
370 | 370 | ?> |
371 | 371 | <li> |
372 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?> |
|
372 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?> |
|
373 | 373 | <div class="gdcf-tooltip"> |
374 | 374 | <?php |
375 | 375 | if ($field_type == 'checkbox') { |
@@ -386,12 +386,12 @@ discard block |
||
386 | 386 | <?php if ($field_type == 'checkbox') { ?> |
387 | 387 | <select name="default_value" id="default_value"> |
388 | 388 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option> |
389 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
389 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option> |
|
390 | 390 | </select> |
391 | 391 | <?php } else if ($field_type == 'email') { ?> |
392 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
392 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
393 | 393 | <?php } else { ?> |
394 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
394 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
395 | 395 | <?php } ?> |
396 | 396 | </div> |
397 | 397 | </li> |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | |
401 | 401 | |
402 | 402 | // show_in |
403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){ |
|
403 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) { |
|
404 | 404 | |
405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
|
405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info); |
|
406 | 406 | |
407 | - }else{ |
|
407 | + } else { |
|
408 | 408 | $value = ''; |
409 | 409 | if (isset($field_info->show_in)) { |
410 | 410 | $value = esc_attr($field_info->show_in); |
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
411 | + }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) { |
|
412 | 412 | $value = esc_attr($cf['defaults']['show_in']); |
413 | 413 | } |
414 | 414 | ?> |
@@ -441,18 +441,18 @@ discard block |
||
441 | 441 | * @param object $field_info The field being displayed info. |
442 | 442 | * @param string $field_info The type of field. |
443 | 443 | */ |
444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type); |
|
444 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type); |
|
445 | 445 | |
446 | 446 | |
447 | 447 | // remove some locations for some field types |
448 | 448 | |
449 | 449 | // don't show new tab option for some types |
450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
451 | - }else{ |
|
450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) { |
|
451 | + } else { |
|
452 | 452 | unset($show_in_locations['[owntab]']); |
453 | 453 | } |
454 | 454 | |
455 | - if(!$display_on_listing){ |
|
455 | + if (!$display_on_listing) { |
|
456 | 456 | unset($show_in_locations['[listings]']); |
457 | 457 | } |
458 | 458 | |
@@ -466,17 +466,17 @@ discard block |
||
466 | 466 | option-ajaxchosen="false"> |
467 | 467 | <?php |
468 | 468 | |
469 | - $show_in_values = explode(',',$value); |
|
469 | + $show_in_values = explode(',', $value); |
|
470 | 470 | |
471 | - foreach( $show_in_locations as $key => $val){ |
|
471 | + foreach ($show_in_locations as $key => $val) { |
|
472 | 472 | $selected = ''; |
473 | 473 | |
474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){ |
|
474 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) { |
|
475 | 475 | $selected = 'selected'; |
476 | 476 | } |
477 | 477 | |
478 | 478 | ?> |
479 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
479 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
480 | 480 | <?php |
481 | 481 | } |
482 | 482 | ?> |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | |
489 | 489 | |
490 | 490 | // advanced_editor |
491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){ |
|
491 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) { |
|
492 | 492 | |
493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info); |
|
493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info); |
|
494 | 494 | |
495 | 495 | } |
496 | 496 | |
@@ -501,10 +501,10 @@ discard block |
||
501 | 501 | |
502 | 502 | |
503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
504 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/> |
|
504 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/> |
|
505 | 505 | |
506 | 506 | <?php // we dont need to show the sort order ?> |
507 | - <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/> |
|
507 | + <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/> |
|
508 | 508 | |
509 | 509 | |
510 | 510 | |
@@ -557,15 +557,15 @@ discard block |
||
557 | 557 | <?php |
558 | 558 | |
559 | 559 | // is_required |
560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){ |
|
560 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) { |
|
561 | 561 | |
562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
|
562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info); |
|
563 | 563 | |
564 | - }else{ |
|
564 | + } else { |
|
565 | 565 | $value = ''; |
566 | 566 | if (isset($field_info->is_required)) { |
567 | 567 | $value = esc_attr($field_info->is_required); |
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
568 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) { |
|
569 | 569 | $value = $cf['defaults']['is_required']; |
570 | 570 | } |
571 | 571 | ?> |
@@ -578,17 +578,17 @@ discard block |
||
578 | 578 | |
579 | 579 | <div class="gd-cf-input-wrap gd-switch"> |
580 | 580 | |
581 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
581 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
582 | 582 | <?php if ($value == '1') { |
583 | 583 | echo 'checked'; |
584 | 584 | } ?>/> |
585 | - <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
585 | + <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
586 | 586 | |
587 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
587 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
588 | 588 | <?php if ($value == '0' || !$value) { |
589 | 589 | echo 'checked'; |
590 | 590 | } ?>/> |
591 | - <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
591 | + <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
592 | 592 | |
593 | 593 | </div> |
594 | 594 | |
@@ -598,19 +598,19 @@ discard block |
||
598 | 598 | } |
599 | 599 | |
600 | 600 | // required_msg |
601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){ |
|
601 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) { |
|
602 | 602 | |
603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
|
603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info); |
|
604 | 604 | |
605 | - }else{ |
|
605 | + } else { |
|
606 | 606 | $value = ''; |
607 | 607 | if (isset($field_info->required_msg)) { |
608 | 608 | $value = esc_attr($field_info->required_msg); |
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
609 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) { |
|
610 | 610 | $value = $cf['defaults']['required_msg']; |
611 | 611 | } |
612 | 612 | ?> |
613 | - <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>> |
|
613 | + <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>> |
|
614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
615 | 615 | <i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?> |
616 | 616 | <div class="gdcf-tooltip"> |
@@ -627,31 +627,31 @@ discard block |
||
627 | 627 | |
628 | 628 | |
629 | 629 | // required_msg |
630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){ |
|
630 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) { |
|
631 | 631 | |
632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info); |
|
632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info); |
|
633 | 633 | |
634 | 634 | } |
635 | 635 | |
636 | 636 | |
637 | 637 | // extra_fields |
638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){ |
|
638 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) { |
|
639 | 639 | |
640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info); |
|
640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info); |
|
641 | 641 | |
642 | 642 | } |
643 | 643 | |
644 | 644 | |
645 | 645 | // field_icon |
646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){ |
|
646 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) { |
|
647 | 647 | |
648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
|
648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info); |
|
649 | 649 | |
650 | - }else{ |
|
650 | + } else { |
|
651 | 651 | $value = ''; |
652 | 652 | if (isset($field_info->field_icon)) { |
653 | 653 | $value = esc_attr($field_info->field_icon); |
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
654 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) { |
|
655 | 655 | $value = $cf['defaults']['field_icon']; |
656 | 656 | } |
657 | 657 | ?> |
@@ -662,12 +662,12 @@ discard block |
||
662 | 662 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
663 | 663 | <i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?> |
664 | 664 | <div class="gdcf-tooltip"> |
665 | - <?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:"fas fa-home"', 'geodirectory');?> |
|
665 | + <?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:"fas fa-home"', 'geodirectory'); ?> |
|
666 | 666 | </div> |
667 | 667 | </label> |
668 | 668 | <div class="gd-cf-input-wrap"> |
669 | 669 | <input type="text" name="field_icon" id="field_icon" |
670 | - value="<?php echo $value;?>"/> |
|
670 | + value="<?php echo $value; ?>"/> |
|
671 | 671 | </div> |
672 | 672 | |
673 | 673 | </li> |
@@ -676,15 +676,15 @@ discard block |
||
676 | 676 | |
677 | 677 | |
678 | 678 | // css_class |
679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){ |
|
679 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) { |
|
680 | 680 | |
681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
|
681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info); |
|
682 | 682 | |
683 | - }else{ |
|
683 | + } else { |
|
684 | 684 | $value = ''; |
685 | 685 | if (isset($field_info->css_class)) { |
686 | 686 | $value = esc_attr($field_info->css_class); |
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
687 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) { |
|
688 | 688 | $value = $cf['defaults']['css_class']; |
689 | 689 | } |
690 | 690 | ?> |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
694 | 694 | <i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?> |
695 | 695 | <div class="gdcf-tooltip"> |
696 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?> |
|
697 | - <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?> |
|
696 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?> |
|
697 | + <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?> |
|
698 | 698 | </div> |
699 | 699 | </label> |
700 | 700 | <div class="gd-cf-input-wrap"> |
@@ -709,23 +709,23 @@ discard block |
||
709 | 709 | |
710 | 710 | |
711 | 711 | // cat_sort |
712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){ |
|
712 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) { |
|
713 | 713 | |
714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
|
714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info); |
|
715 | 715 | |
716 | - }else{ |
|
716 | + } else { |
|
717 | 717 | $value = ''; |
718 | - $hide_cat_sort =''; |
|
718 | + $hide_cat_sort = ''; |
|
719 | 719 | if (isset($field_info->cat_sort)) { |
720 | 720 | $value = esc_attr($field_info->cat_sort); |
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
721 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) { |
|
722 | 722 | $value = $cf['defaults']['cat_sort']; |
723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
723 | + $hide_cat_sort = ($value === false) ? "style='display:none;'" : ''; |
|
724 | 724 | } |
725 | 725 | |
726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : ''; |
|
727 | 727 | ?> |
728 | - <li <?php echo $hide_cat_sort ;?>> |
|
728 | + <li <?php echo $hide_cat_sort; ?>> |
|
729 | 729 | <h3><?php |
730 | 730 | /** |
731 | 731 | * Filter the section title. |
@@ -744,23 +744,23 @@ discard block |
||
744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
745 | 745 | <i class="fas fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?> |
746 | 746 | <div class="gdcf-tooltip"> |
747 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?> |
|
747 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?> |
|
748 | 748 | </div> |
749 | 749 | </label> |
750 | 750 | |
751 | 751 | <div class="gd-cf-input-wrap gd-switch"> |
752 | 752 | |
753 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
753 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
754 | 754 | <?php if ($value == '1') { |
755 | 755 | echo 'checked'; |
756 | 756 | } ?>/> |
757 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
757 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label> |
|
758 | 758 | |
759 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
759 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
760 | 760 | <?php if (!$value) { |
761 | 761 | echo 'checked'; |
762 | 762 | } ?>/> |
763 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
763 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label> |
|
764 | 764 | |
765 | 765 | </div> |
766 | 766 | </li> |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | * @param object $field_info The current fields info. |
788 | 788 | * @param array $cf The custom field settings |
789 | 789 | */ |
790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?> |
|
790 | + do_action('geodir_advance_custom_fields', $field_info, $cf); ?> |
|
791 | 791 | |
792 | 792 | |
793 | 793 | <?php endswitch; ?> |
@@ -799,10 +799,10 @@ discard block |
||
799 | 799 | <h3></h3> |
800 | 800 | </label> |
801 | 801 | <div class="gd-cf-input-wrap"> |
802 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>" |
|
802 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>" |
|
803 | 803 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/> |
804 | 804 | <?php if (!$default): ?> |
805 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>" |
|
805 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>" |
|
806 | 806 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')" |
807 | 807 | class="button"/></a> |
808 | 808 | <?php endif; ?> |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | if (!isset($field_info->post_type)) { |
21 | 21 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
22 | -} else |
|
23 | - $post_type = $field_info->post_type; |
|
22 | +} else { |
|
23 | + $post_type = $field_info->post_type; |
|
24 | +} |
|
24 | 25 | |
25 | 26 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){ |
26 | 27 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -47,8 +48,9 @@ discard block |
||
47 | 48 | $nonce = wp_create_nonce('custom_fields_' . $result_str); |
48 | 49 | |
49 | 50 | $field_admin_title = ''; |
50 | -if (isset($field_info->admin_title)) |
|
51 | - $field_admin_title = $field_info->admin_title; |
|
51 | +if (isset($field_info->admin_title)) { |
|
52 | + $field_admin_title = $field_info->admin_title; |
|
53 | +} |
|
52 | 54 | |
53 | 55 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
54 | 56 | |
@@ -69,15 +71,15 @@ discard block |
||
69 | 71 | |
70 | 72 | if (isset($cf['icon']) && strpos($cf['icon'], ' fa-') !== false) { |
71 | 73 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
72 | -}elseif(isset($cf['icon']) && $cf['icon']){ |
|
74 | +} elseif(isset($cf['icon']) && $cf['icon']){ |
|
73 | 75 | $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
74 | -}else{ |
|
76 | +} else{ |
|
75 | 77 | $field_icon = '<i class="fas fa-cog" aria-hidden="true"></i>'; |
76 | 78 | } |
77 | 79 | |
78 | 80 | if(isset($cf['name']) && $cf['name']){ |
79 | 81 | $field_type_name = $cf['name']; |
80 | -}else{ |
|
82 | +} else{ |
|
81 | 83 | $field_type_name = $field_type; |
82 | 84 | } |
83 | 85 | |
@@ -147,11 +149,11 @@ discard block |
||
147 | 149 | |
148 | 150 | echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info); |
149 | 151 | |
150 | - }else{ |
|
152 | + } else{ |
|
151 | 153 | $value = ''; |
152 | 154 | if (isset($field_info->data_type)) { |
153 | 155 | $value = esc_attr($field_info->data_type); |
154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
156 | + } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){ |
|
155 | 157 | $value = $cf['defaults']['data_type']; |
156 | 158 | } |
157 | 159 | ?> |
@@ -165,11 +167,11 @@ discard block |
||
165 | 167 | |
166 | 168 | echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info); |
167 | 169 | |
168 | - }else{ |
|
170 | + } else{ |
|
169 | 171 | $value = ''; |
170 | 172 | if (isset($field_info->admin_title)) { |
171 | 173 | $value = esc_attr($field_info->admin_title); |
172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
174 | + } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){ |
|
173 | 175 | $value = $cf['defaults']['admin_title']; |
174 | 176 | } |
175 | 177 | ?> |
@@ -194,11 +196,11 @@ discard block |
||
194 | 196 | |
195 | 197 | echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info); |
196 | 198 | |
197 | - }else{ |
|
199 | + } else{ |
|
198 | 200 | $value = ''; |
199 | 201 | if (isset($field_info->site_title)) { |
200 | 202 | $value = esc_attr($field_info->site_title); |
201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
203 | + } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){ |
|
202 | 204 | $value = $cf['defaults']['site_title']; |
203 | 205 | } |
204 | 206 | ?> |
@@ -222,11 +224,11 @@ discard block |
||
222 | 224 | |
223 | 225 | echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info); |
224 | 226 | |
225 | - }else{ |
|
227 | + } else{ |
|
226 | 228 | $value = ''; |
227 | 229 | if (isset($field_info->admin_desc)) { |
228 | 230 | $value = esc_attr($field_info->admin_desc); |
229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
231 | + } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){ |
|
230 | 232 | $value = $cf['defaults']['admin_desc']; |
231 | 233 | } |
232 | 234 | ?> |
@@ -250,11 +252,11 @@ discard block |
||
250 | 252 | |
251 | 253 | echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info); |
252 | 254 | |
253 | - }else{ |
|
255 | + } else{ |
|
254 | 256 | $value = ''; |
255 | 257 | if (isset($field_info->htmlvar_name)) { |
256 | 258 | $value = esc_attr($field_info->htmlvar_name); |
257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
259 | + } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){ |
|
258 | 260 | $value = $cf['defaults']['htmlvar_name']; |
259 | 261 | } |
260 | 262 | ?> |
@@ -282,11 +284,11 @@ discard block |
||
282 | 284 | |
283 | 285 | echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info); |
284 | 286 | |
285 | - }else{ |
|
287 | + } else{ |
|
286 | 288 | $value = ''; |
287 | 289 | if (isset($field_info->is_active)) { |
288 | 290 | $value = esc_attr($field_info->is_active); |
289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
291 | + } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){ |
|
290 | 292 | $value = $cf['defaults']['is_active']; |
291 | 293 | } |
292 | 294 | ?> |
@@ -321,11 +323,11 @@ discard block |
||
321 | 323 | |
322 | 324 | echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info); |
323 | 325 | |
324 | - }else{ |
|
326 | + } else{ |
|
325 | 327 | $value = ''; |
326 | 328 | if (isset($field_info->for_admin_use)) { |
327 | 329 | $value = esc_attr($field_info->for_admin_use); |
328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
330 | + } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){ |
|
329 | 331 | $value = $cf['defaults']['for_admin_use']; |
330 | 332 | } |
331 | 333 | ?> |
@@ -360,11 +362,11 @@ discard block |
||
360 | 362 | |
361 | 363 | echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info); |
362 | 364 | |
363 | - }else{ |
|
365 | + } else{ |
|
364 | 366 | $value = ''; |
365 | 367 | if (isset($field_info->default_value)) { |
366 | 368 | $value = esc_attr($field_info->default_value); |
367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
369 | + } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){ |
|
368 | 370 | $value = $cf['defaults']['default_value']; |
369 | 371 | } |
370 | 372 | ?> |
@@ -404,11 +406,11 @@ discard block |
||
404 | 406 | |
405 | 407 | echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info); |
406 | 408 | |
407 | - }else{ |
|
409 | + } else{ |
|
408 | 410 | $value = ''; |
409 | 411 | if (isset($field_info->show_in)) { |
410 | 412 | $value = esc_attr($field_info->show_in); |
411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
413 | + } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){ |
|
412 | 414 | $value = esc_attr($cf['defaults']['show_in']); |
413 | 415 | } |
414 | 416 | ?> |
@@ -448,7 +450,7 @@ discard block |
||
448 | 450 | |
449 | 451 | // don't show new tab option for some types |
450 | 452 | if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
451 | - }else{ |
|
453 | + } else{ |
|
452 | 454 | unset($show_in_locations['[owntab]']); |
453 | 455 | } |
454 | 456 | |
@@ -561,11 +563,11 @@ discard block |
||
561 | 563 | |
562 | 564 | echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info); |
563 | 565 | |
564 | - }else{ |
|
566 | + } else{ |
|
565 | 567 | $value = ''; |
566 | 568 | if (isset($field_info->is_required)) { |
567 | 569 | $value = esc_attr($field_info->is_required); |
568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
570 | + } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){ |
|
569 | 571 | $value = $cf['defaults']['is_required']; |
570 | 572 | } |
571 | 573 | ?> |
@@ -602,11 +604,11 @@ discard block |
||
602 | 604 | |
603 | 605 | echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info); |
604 | 606 | |
605 | - }else{ |
|
607 | + } else{ |
|
606 | 608 | $value = ''; |
607 | 609 | if (isset($field_info->required_msg)) { |
608 | 610 | $value = esc_attr($field_info->required_msg); |
609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
611 | + } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){ |
|
610 | 612 | $value = $cf['defaults']['required_msg']; |
611 | 613 | } |
612 | 614 | ?> |
@@ -647,11 +649,11 @@ discard block |
||
647 | 649 | |
648 | 650 | echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info); |
649 | 651 | |
650 | - }else{ |
|
652 | + } else{ |
|
651 | 653 | $value = ''; |
652 | 654 | if (isset($field_info->field_icon)) { |
653 | 655 | $value = esc_attr($field_info->field_icon); |
654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
656 | + } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){ |
|
655 | 657 | $value = $cf['defaults']['field_icon']; |
656 | 658 | } |
657 | 659 | ?> |
@@ -680,11 +682,11 @@ discard block |
||
680 | 682 | |
681 | 683 | echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info); |
682 | 684 | |
683 | - }else{ |
|
685 | + } else{ |
|
684 | 686 | $value = ''; |
685 | 687 | if (isset($field_info->css_class)) { |
686 | 688 | $value = esc_attr($field_info->css_class); |
687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
689 | + } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){ |
|
688 | 690 | $value = $cf['defaults']['css_class']; |
689 | 691 | } |
690 | 692 | ?> |
@@ -713,12 +715,12 @@ discard block |
||
713 | 715 | |
714 | 716 | echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info); |
715 | 717 | |
716 | - }else{ |
|
718 | + } else{ |
|
717 | 719 | $value = ''; |
718 | 720 | $hide_cat_sort =''; |
719 | 721 | if (isset($field_info->cat_sort)) { |
720 | 722 | $value = esc_attr($field_info->cat_sort); |
721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
723 | + } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){ |
|
722 | 724 | $value = $cf['defaults']['cat_sort']; |
723 | 725 | $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
724 | 726 | } |