@@ -136,7 +136,7 @@ |
||
136 | 136 | |
137 | 137 | global $wp_version; |
138 | 138 | // If curent WP Version >= 4.9.6. |
139 | -if ( version_compare( $wp_version, '4.9.6', '>=' ) ) { |
|
140 | - include_once( 'geodirectory-functions/privacy/abstract-geodir-privacy.php' ); |
|
141 | - include_once( 'geodirectory-functions/privacy/class-geodir-privacy.php' ); |
|
139 | +if (version_compare($wp_version, '4.9.6', '>=')) { |
|
140 | + include_once('geodirectory-functions/privacy/abstract-geodir-privacy.php'); |
|
141 | + include_once('geodirectory-functions/privacy/class-geodir-privacy.php'); |
|
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @package GeoDirectory |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if (!defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -18,22 +18,22 @@ discard block |
||
18 | 18 | <!DOCTYPE html> |
19 | 19 | <html dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>"> |
20 | 20 | <head> |
21 | - <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" /> |
|
21 | + <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" /> |
|
22 | 22 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
23 | 23 | <meta name="robots" content="noindex,nofollow"> |
24 | - <title><?php echo wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); ?></title> |
|
24 | + <title><?php echo wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); ?></title> |
|
25 | 25 | </head> |
26 | 26 | <body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> |
27 | 27 | |
28 | - <?php do_action( 'geodir_email_content_before' ); ?> |
|
28 | + <?php do_action('geodir_email_content_before'); ?> |
|
29 | 29 | |
30 | 30 | <?php |
31 | - if ( ! empty( $geodir_email_content ) ) { |
|
32 | - echo wpautop( wptexturize( $geodir_email_content ) ); |
|
31 | + if (!empty($geodir_email_content)) { |
|
32 | + echo wpautop(wptexturize($geodir_email_content)); |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | |
36 | - <?php do_action( 'geodir_email_content_after' ); ?> |
|
36 | + <?php do_action('geodir_email_content_after'); ?> |
|
37 | 37 | |
38 | 38 | </body> |
39 | 39 | </html> |
40 | 40 | \ No newline at end of file |
@@ -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 |
@@ -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="fa 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', 'fa fa-edit'); |
|
238 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
239 | - ?> |
|
237 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa 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', 'fa fa-close'); |
|
246 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
247 | - ?> |
|
245 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
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', 'fa 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', 'fa fa-close'); |
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> |
@@ -36,175 +36,175 @@ 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 | - } |
|
45 | - |
|
46 | - wp_enqueue_script('jquery'); |
|
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'); |
|
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 |
|
58 | - ); |
|
59 | - |
|
60 | - /** |
|
61 | - * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
62 | - * |
|
63 | - * This is used by addons to add JS translatable variables. |
|
64 | - * |
|
65 | - * @since 1.4.4 |
|
66 | - * @param array $geodir_vars_data { |
|
67 | - * geodir var data used by addons to add JS translatable variables. |
|
68 | - * |
|
69 | - * @type string $siteurl Site url. |
|
70 | - * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
71 | - * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
72 | - * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
73 | - * @type int $is_rtl Checks if current locale is RTL. |
|
74 | - * |
|
75 | - * } |
|
76 | - */ |
|
77 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
78 | - |
|
79 | - wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
80 | - |
|
81 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
82 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
83 | - |
|
84 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
85 | - wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
42 | + if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
43 | + $is_detail_page = true; |
|
44 | + } |
|
86 | 45 | |
87 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
88 | - if ($is_detail_page) { |
|
89 | - wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
90 | - } |
|
46 | + wp_enqueue_script('jquery'); |
|
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'); |
|
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 |
|
58 | + ); |
|
59 | + |
|
60 | + /** |
|
61 | + * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
62 | + * |
|
63 | + * This is used by addons to add JS translatable variables. |
|
64 | + * |
|
65 | + * @since 1.4.4 |
|
66 | + * @param array $geodir_vars_data { |
|
67 | + * geodir var data used by addons to add JS translatable variables. |
|
68 | + * |
|
69 | + * @type string $siteurl Site url. |
|
70 | + * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
71 | + * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
72 | + * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
73 | + * @type int $is_rtl Checks if current locale is RTL. |
|
74 | + * |
|
75 | + * } |
|
76 | + */ |
|
77 | + $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
78 | + |
|
79 | + wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
80 | + |
|
81 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
82 | + if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
83 | + |
|
84 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
85 | + wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
86 | + |
|
87 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
88 | + if ($is_detail_page) { |
|
89 | + wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
90 | + } |
|
91 | 91 | |
92 | - if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
93 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
94 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
95 | - /** |
|
96 | - * Filter the variables that are added to the end of the google maps script call. |
|
97 | - * |
|
98 | - * This i used to change things like google maps language etc. |
|
99 | - * |
|
100 | - * @since 1.0.0 |
|
101 | - * @param string $var The string to filter, default is empty string. |
|
102 | - */ |
|
103 | - $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
104 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
92 | + if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
93 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
94 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
95 | + /** |
|
96 | + * Filter the variables that are added to the end of the google maps script call. |
|
97 | + * |
|
98 | + * This i used to change things like google maps language etc. |
|
99 | + * |
|
100 | + * @since 1.0.0 |
|
101 | + * @param string $var The string to filter, default is empty string. |
|
102 | + */ |
|
103 | + $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
104 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
105 | 105 | |
106 | - // Overlapping Marker Spiderfier |
|
107 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
108 | - wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
109 | - } |
|
106 | + // Overlapping Marker Spiderfier |
|
107 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
108 | + wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
109 | + } |
|
110 | 110 | |
111 | - if ($geodir_map_name == 'osm') { |
|
112 | - // Leaflet OpenStreetMap |
|
113 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
114 | - wp_enqueue_style('geodirectory-leaflet-style'); |
|
111 | + if ($geodir_map_name == 'osm') { |
|
112 | + // Leaflet OpenStreetMap |
|
113 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
114 | + wp_enqueue_style('geodirectory-leaflet-style'); |
|
115 | 115 | |
116 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
117 | - wp_enqueue_script('geodirectory-leaflet-script'); |
|
116 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
117 | + wp_enqueue_script('geodirectory-leaflet-script'); |
|
118 | 118 | |
119 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
120 | - wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
119 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
120 | + wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
121 | 121 | |
122 | - if ($is_detail_page) { |
|
123 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
124 | - wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
122 | + if ($is_detail_page) { |
|
123 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
124 | + wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
125 | 125 | |
126 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
127 | - wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
128 | - } |
|
126 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
127 | + wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
128 | + } |
|
129 | 129 | |
130 | - // Overlapping Marker Spiderfier Leaflet |
|
131 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | - wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
133 | - } |
|
134 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
130 | + // Overlapping Marker Spiderfier Leaflet |
|
131 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | + wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
133 | + } |
|
134 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
135 | 135 | |
136 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
137 | - wp_enqueue_script('geodirectory-goMap-script'); |
|
138 | - |
|
139 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
140 | - wp_enqueue_script('chosen'); |
|
141 | - |
|
142 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
143 | - wp_enqueue_script('geodirectory-choose-ajax'); |
|
144 | - |
|
145 | - 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); |
|
146 | - |
|
147 | - if (is_page() && geodir_is_page('add-listing')) { |
|
148 | - // SCRIPT FOR UPLOAD |
|
149 | - wp_enqueue_script('plupload-all'); |
|
150 | - wp_enqueue_script('jquery-ui-sortable'); |
|
151 | - |
|
152 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
153 | - wp_enqueue_script('geodirectory-plupload-script'); |
|
154 | - // SCRIPT FOR UPLOAD END |
|
155 | - |
|
156 | - // 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 |
|
157 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
158 | - $ajax_url = admin_url('admin-ajax.php'); |
|
159 | - } elseif (!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 = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
163 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
164 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
165 | - } else { |
|
166 | - $ajax_url = admin_url('admin-ajax.php'); |
|
167 | - } |
|
136 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
137 | + wp_enqueue_script('geodirectory-goMap-script'); |
|
138 | + |
|
139 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
140 | + wp_enqueue_script('chosen'); |
|
141 | + |
|
142 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
143 | + wp_enqueue_script('geodirectory-choose-ajax'); |
|
144 | + |
|
145 | + 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); |
|
146 | + |
|
147 | + if (is_page() && geodir_is_page('add-listing')) { |
|
148 | + // SCRIPT FOR UPLOAD |
|
149 | + wp_enqueue_script('plupload-all'); |
|
150 | + wp_enqueue_script('jquery-ui-sortable'); |
|
151 | + |
|
152 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
153 | + wp_enqueue_script('geodirectory-plupload-script'); |
|
154 | + // SCRIPT FOR UPLOAD END |
|
155 | + |
|
156 | + // 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 |
|
157 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
158 | + $ajax_url = admin_url('admin-ajax.php'); |
|
159 | + } elseif (!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 = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
163 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
164 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
165 | + } else { |
|
166 | + $ajax_url = admin_url('admin-ajax.php'); |
|
167 | + } |
|
168 | 168 | |
169 | - // place js config array for plupload |
|
170 | - $plupload_init = array( |
|
171 | - 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
172 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
173 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
174 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
175 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
176 | - 'multiple_queues' => true, |
|
177 | - 'max_file_size' => geodir_max_upload_size(), |
|
178 | - 'url' => $ajax_url, |
|
179 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
180 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
181 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
182 | - 'multipart' => true, |
|
183 | - 'urlstream_upload' => true, |
|
184 | - 'multi_selection' => false, // will be added per uploader |
|
185 | - // additional post data to send to our ajax hook |
|
186 | - 'multipart_params' => array( |
|
187 | - '_ajax_nonce' => "", // will be added per uploader |
|
188 | - 'action' => 'plupload_action', // the ajax action name |
|
189 | - 'imgid' => 0 // will be added per uploader |
|
190 | - ) |
|
191 | - ); |
|
192 | - $base_plupload_config = json_encode($plupload_init); |
|
193 | - |
|
194 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
195 | - 'upload_img_size' => geodir_max_upload_size()); |
|
196 | - |
|
197 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
198 | - |
|
199 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
200 | - } // End if for add place page |
|
201 | - |
|
202 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
203 | - if ($is_detail_page) { |
|
169 | + // place js config array for plupload |
|
170 | + $plupload_init = array( |
|
171 | + 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
172 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
173 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
174 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
175 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
176 | + 'multiple_queues' => true, |
|
177 | + 'max_file_size' => geodir_max_upload_size(), |
|
178 | + 'url' => $ajax_url, |
|
179 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
180 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
181 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
182 | + 'multipart' => true, |
|
183 | + 'urlstream_upload' => true, |
|
184 | + 'multi_selection' => false, // will be added per uploader |
|
185 | + // additional post data to send to our ajax hook |
|
186 | + 'multipart_params' => array( |
|
187 | + '_ajax_nonce' => "", // will be added per uploader |
|
188 | + 'action' => 'plupload_action', // the ajax action name |
|
189 | + 'imgid' => 0 // will be added per uploader |
|
190 | + ) |
|
191 | + ); |
|
192 | + $base_plupload_config = json_encode($plupload_init); |
|
193 | + |
|
194 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
195 | + 'upload_img_size' => geodir_max_upload_size()); |
|
196 | + |
|
197 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
198 | + |
|
199 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
200 | + } // End if for add place page |
|
201 | + |
|
202 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
203 | + if ($is_detail_page) { |
|
204 | 204 | wp_enqueue_script('geodirectory-post-custom-js'); |
205 | 205 | } |
206 | 206 | |
207 | - // font awesome rating script |
|
207 | + // font awesome rating script |
|
208 | 208 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
209 | 209 | wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
210 | 210 | wp_enqueue_script('geodir-barrating-js'); |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | wp_enqueue_script('geodir-jRating-js'); |
214 | 214 | } |
215 | 215 | |
216 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
217 | - wp_enqueue_script('geodir-on-document-load'); |
|
216 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
217 | + wp_enqueue_script('geodir-on-document-load'); |
|
218 | 218 | |
219 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
220 | - wp_enqueue_script('google-geometa'); |
|
219 | + wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
220 | + wp_enqueue_script('google-geometa'); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | */ |
232 | 232 | function geodir_header_scripts() |
233 | 233 | { |
234 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
235 | - echo stripslashes(get_option('geodir_header_scripts')); |
|
234 | + echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
235 | + echo stripslashes(get_option('geodir_header_scripts')); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function geodir_google_analytics_tracking_code() |
247 | 247 | { |
248 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
248 | + if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
249 | 249 | |
250 | 250 | <script> |
251 | 251 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -260,9 +260,9 @@ 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')){ |
|
264 | - echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
265 | - } |
|
263 | + }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
264 | + echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
265 | + } |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -276,16 +276,16 @@ discard block |
||
276 | 276 | function geodir_footer_scripts() |
277 | 277 | { |
278 | 278 | |
279 | - echo stripslashes(get_option('geodir_footer_scripts')); |
|
279 | + echo stripslashes(get_option('geodir_footer_scripts')); |
|
280 | 280 | |
281 | - /* |
|
281 | + /* |
|
282 | 282 | * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041 |
283 | 283 | * |
284 | 284 | * Flexbox wont wrap on ios for search form items |
285 | 285 | */ |
286 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
287 | - 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>"; |
|
288 | - } |
|
286 | + if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
287 | + 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>"; |
|
288 | + } |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -299,12 +299,12 @@ 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"; |
|
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 | 308 | } |
309 | 309 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
310 | 310 | |
@@ -317,17 +317,17 @@ discard block |
||
317 | 317 | function geodir_templates_styles() |
318 | 318 | { |
319 | 319 | |
320 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
321 | - wp_enqueue_style('geodir-core-scss'); |
|
322 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
320 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
321 | + wp_enqueue_style('geodir-core-scss'); |
|
322 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
323 | 323 | |
324 | - if(is_rtl()){ |
|
325 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
326 | - wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
327 | - } |
|
324 | + if(is_rtl()){ |
|
325 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
326 | + wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
327 | + } |
|
328 | 328 | |
329 | - wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
330 | - wp_enqueue_style('font-awesome'); |
|
329 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
330 | + wp_enqueue_style('font-awesome'); |
|
331 | 331 | |
332 | 332 | |
333 | 333 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function geodir_get_sidebar() |
343 | 343 | { |
344 | - get_sidebar('geodirectory'); |
|
344 | + get_sidebar('geodirectory'); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -360,122 +360,122 @@ discard block |
||
360 | 360 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
361 | 361 | */ |
362 | 362 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
363 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
363 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
364 | 364 | |
365 | - if (empty($prelabel)) { |
|
366 | - $prelabel = '<strong><</strong>'; |
|
367 | - } |
|
365 | + if (empty($prelabel)) { |
|
366 | + $prelabel = '<strong><</strong>'; |
|
367 | + } |
|
368 | 368 | |
369 | - if (empty($nxtlabel)) { |
|
370 | - $nxtlabel = '<strong>></strong>'; |
|
371 | - } |
|
369 | + if (empty($nxtlabel)) { |
|
370 | + $nxtlabel = '<strong>></strong>'; |
|
371 | + } |
|
372 | 372 | |
373 | - $half_pages_to_show = round($pages_to_show / 2); |
|
373 | + $half_pages_to_show = round($pages_to_show / 2); |
|
374 | 374 | |
375 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
376 | - return; |
|
375 | + if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
376 | + return; |
|
377 | 377 | |
378 | - if (!is_single()) { |
|
379 | - if (function_exists('geodir_location_geo_home_link')) { |
|
380 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
381 | - } |
|
382 | - $numposts = $wp_query->found_posts; |
|
378 | + if (!is_single()) { |
|
379 | + if (function_exists('geodir_location_geo_home_link')) { |
|
380 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
381 | + } |
|
382 | + $numposts = $wp_query->found_posts; |
|
383 | 383 | |
384 | - $max_page = ceil($numposts / $posts_per_page); |
|
384 | + $max_page = ceil($numposts / $posts_per_page); |
|
385 | 385 | |
386 | - if (empty($paged)) { |
|
387 | - $paged = 1; |
|
388 | - } |
|
386 | + if (empty($paged)) { |
|
387 | + $paged = 1; |
|
388 | + } |
|
389 | 389 | |
390 | - $post_type = geodir_get_current_posttype(); |
|
391 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
392 | - if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
393 | - $term = array(); |
|
390 | + $post_type = geodir_get_current_posttype(); |
|
391 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
392 | + if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
393 | + $term = array(); |
|
394 | 394 | |
395 | - if (is_tax()) { |
|
396 | - $term_id = get_queried_object_id(); |
|
397 | - $taxonomy = get_query_var('taxonomy'); |
|
395 | + if (is_tax()) { |
|
396 | + $term_id = get_queried_object_id(); |
|
397 | + $taxonomy = get_query_var('taxonomy'); |
|
398 | 398 | |
399 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
400 | - $term = get_term($term_id, $post_type . 'category'); |
|
401 | - } |
|
402 | - } |
|
399 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
400 | + $term = get_term($term_id, $post_type . 'category'); |
|
401 | + } |
|
402 | + } |
|
403 | 403 | |
404 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
405 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
404 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
405 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
406 | 406 | |
407 | - if (!is_array($taxonomy_search)) { |
|
408 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
409 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
410 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
411 | - } |
|
412 | - } |
|
407 | + if (!is_array($taxonomy_search)) { |
|
408 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
409 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
410 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
411 | + } |
|
412 | + } |
|
413 | 413 | |
414 | - if (!empty($term) && !is_wp_error($term)) { |
|
415 | - $listing_type_name = $term->name; |
|
416 | - } |
|
417 | - } |
|
414 | + if (!empty($term) && !is_wp_error($term)) { |
|
415 | + $listing_type_name = $term->name; |
|
416 | + } |
|
417 | + } |
|
418 | 418 | |
419 | - if ($max_page > 1 || $always_show) { |
|
420 | - // Extra pagination info |
|
421 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
422 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
423 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
419 | + if ($max_page > 1 || $always_show) { |
|
420 | + // Extra pagination info |
|
421 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
422 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
423 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
424 | 424 | |
425 | - if ($geodir_pagination_more_info != '') { |
|
426 | - if ($listing_type_name) { |
|
427 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
428 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
429 | - } else { |
|
430 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
431 | - } |
|
432 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
433 | - /** |
|
434 | - * Adds an extra pagination info above/under pagination. |
|
435 | - * |
|
436 | - * @since 1.5.9 |
|
437 | - * |
|
438 | - * @param string $pagination_info Extra pagination info content. |
|
439 | - * @param string $listing_type_name Listing results type. |
|
440 | - * @param string $start_no First result number. |
|
441 | - * @param string $end_no Last result number. |
|
442 | - * @param string $numposts Total number of listings. |
|
443 | - * @param string $post_type The post type. |
|
444 | - */ |
|
445 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
425 | + if ($geodir_pagination_more_info != '') { |
|
426 | + if ($listing_type_name) { |
|
427 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
428 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
429 | + } else { |
|
430 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
431 | + } |
|
432 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
433 | + /** |
|
434 | + * Adds an extra pagination info above/under pagination. |
|
435 | + * |
|
436 | + * @since 1.5.9 |
|
437 | + * |
|
438 | + * @param string $pagination_info Extra pagination info content. |
|
439 | + * @param string $listing_type_name Listing results type. |
|
440 | + * @param string $start_no First result number. |
|
441 | + * @param string $end_no Last result number. |
|
442 | + * @param string $numposts Total number of listings. |
|
443 | + * @param string $post_type The post type. |
|
444 | + */ |
|
445 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
446 | 446 | |
447 | - if ($geodir_pagination_more_info == 'before') { |
|
448 | - $before = $before . $pagination_info; |
|
449 | - } else if ($geodir_pagination_more_info == 'after') { |
|
450 | - $after = $pagination_info . $after; |
|
451 | - } |
|
452 | - } |
|
447 | + if ($geodir_pagination_more_info == 'before') { |
|
448 | + $before = $before . $pagination_info; |
|
449 | + } else if ($geodir_pagination_more_info == 'after') { |
|
450 | + $after = $pagination_info . $after; |
|
451 | + } |
|
452 | + } |
|
453 | 453 | |
454 | - echo "$before <div class='Navi gd-navi'>"; |
|
455 | - if ($paged >= ($pages_to_show - 1)) { |
|
456 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
457 | - } |
|
458 | - previous_posts_link($prelabel); |
|
459 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
460 | - if ($i >= 1 && $i <= $max_page) { |
|
461 | - if ($i == $paged) { |
|
462 | - echo "<strong class='on'>$i</strong>"; |
|
463 | - } else { |
|
464 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
465 | - } |
|
466 | - } |
|
467 | - } |
|
468 | - next_posts_link($nxtlabel, $max_page); |
|
469 | - if (($paged + $half_pages_to_show) < ($max_page)) { |
|
470 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
471 | - } |
|
472 | - echo "</div> $after"; |
|
473 | - } |
|
454 | + echo "$before <div class='Navi gd-navi'>"; |
|
455 | + if ($paged >= ($pages_to_show - 1)) { |
|
456 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
457 | + } |
|
458 | + previous_posts_link($prelabel); |
|
459 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
460 | + if ($i >= 1 && $i <= $max_page) { |
|
461 | + if ($i == $paged) { |
|
462 | + echo "<strong class='on'>$i</strong>"; |
|
463 | + } else { |
|
464 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
465 | + } |
|
466 | + } |
|
467 | + } |
|
468 | + next_posts_link($nxtlabel, $max_page); |
|
469 | + if (($paged + $half_pages_to_show) < ($max_page)) { |
|
470 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
471 | + } |
|
472 | + echo "</div> $after"; |
|
473 | + } |
|
474 | 474 | |
475 | - if (function_exists('geodir_location_geo_home_link')) { |
|
476 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
477 | - } |
|
478 | - } |
|
475 | + if (function_exists('geodir_location_geo_home_link')) { |
|
476 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
477 | + } |
|
478 | + } |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -486,20 +486,20 @@ discard block |
||
486 | 486 | */ |
487 | 487 | function geodir_listingsearch_scripts() |
488 | 488 | { |
489 | - if (get_option('gd_search_dist') != '') { |
|
490 | - $dist = get_option('gd_search_dist'); |
|
491 | - } else { |
|
492 | - $dist = 500; |
|
493 | - } |
|
494 | - $dist_dif = 1000; |
|
495 | - |
|
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; |
|
501 | - |
|
502 | - ?> |
|
489 | + if (get_option('gd_search_dist') != '') { |
|
490 | + $dist = get_option('gd_search_dist'); |
|
491 | + } else { |
|
492 | + $dist = 500; |
|
493 | + } |
|
494 | + $dist_dif = 1000; |
|
495 | + |
|
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; |
|
501 | + |
|
502 | + ?> |
|
503 | 503 | <script type="text/javascript"> |
504 | 504 | |
505 | 505 | jQuery(function ($) { |
@@ -557,20 +557,20 @@ discard block |
||
557 | 557 | * @package GeoDirectory |
558 | 558 | */ |
559 | 559 | function geodir_add_sharelocation_scripts() { |
560 | - $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'); |
|
560 | + $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'); |
|
563 | 563 | |
564 | - $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'); |
|
564 | + $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'); |
|
567 | 567 | |
568 | - $search_location = geodir_get_default_location(); |
|
568 | + $search_location = geodir_get_default_location(); |
|
569 | 569 | |
570 | - $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
571 | - $default_near_text = addslashes(stripslashes($default_near_text)); |
|
572 | - $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
573 | - ?> |
|
570 | + $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
571 | + $default_near_text = addslashes(stripslashes($default_near_text)); |
|
572 | + $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
573 | + ?> |
|
574 | 574 | <script type="text/javascript"> |
575 | 575 | var default_location = '<?php echo $city ;?>'; |
576 | 576 | var latlng; |
@@ -651,14 +651,14 @@ discard block |
||
651 | 651 | initialise2(); |
652 | 652 | } else { |
653 | 653 | <?php |
654 | - $near_add = get_option('geodir_search_near_addition'); |
|
655 | - /** |
|
656 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
657 | - * |
|
658 | - * @since 1.0.0 |
|
659 | - */ |
|
660 | - $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
661 | - ?> |
|
654 | + $near_add = get_option('geodir_search_near_addition'); |
|
655 | + /** |
|
656 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
657 | + * |
|
658 | + * @since 1.0.0 |
|
659 | + */ |
|
660 | + $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
661 | + ?> |
|
662 | 662 | if (window.gdMaps === 'google') { |
663 | 663 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
664 | 664 | function (results, status) { |
@@ -772,32 +772,32 @@ discard block |
||
772 | 772 | */ |
773 | 773 | function geodir_show_badges_on_image($which, $post, $link) |
774 | 774 | { |
775 | - $return = ''; |
|
776 | - switch ($which) { |
|
777 | - case 'featured': |
|
778 | - /** |
|
779 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
780 | - * |
|
781 | - * @since 1.0.0 |
|
782 | - * @param object $post The post object. |
|
783 | - * @param string $link The link to the post. |
|
784 | - */ |
|
785 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
786 | - break; |
|
787 | - case 'new' : |
|
788 | - /** |
|
789 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
790 | - * |
|
791 | - * @since 1.0.0 |
|
792 | - * @param object $post The post object. |
|
793 | - * @param string $link The link to the post. |
|
794 | - */ |
|
795 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
796 | - break; |
|
797 | - |
|
798 | - } |
|
775 | + $return = ''; |
|
776 | + switch ($which) { |
|
777 | + case 'featured': |
|
778 | + /** |
|
779 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
780 | + * |
|
781 | + * @since 1.0.0 |
|
782 | + * @param object $post The post object. |
|
783 | + * @param string $link The link to the post. |
|
784 | + */ |
|
785 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
786 | + break; |
|
787 | + case 'new' : |
|
788 | + /** |
|
789 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
790 | + * |
|
791 | + * @since 1.0.0 |
|
792 | + * @param object $post The post object. |
|
793 | + * @param string $link The link to the post. |
|
794 | + */ |
|
795 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
796 | + break; |
|
797 | + |
|
798 | + } |
|
799 | 799 | |
800 | - return $return; |
|
800 | + return $return; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | /** |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | * @since 1.6.22 |
807 | 807 | */ |
808 | 808 | function geodir_fix_script_conflict() { |
809 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
810 | - wp_dequeue_script( 'flexslider' ); |
|
811 | - } |
|
809 | + if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
810 | + wp_dequeue_script( 'flexslider' ); |
|
811 | + } |
|
812 | 812 | } |
813 | 813 | add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
814 | 814 | \ No newline at end of file |
@@ -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 |
@@ -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 | ); |
59 | 59 | |
@@ -74,24 +74,24 @@ discard block |
||
74 | 74 | * |
75 | 75 | * } |
76 | 76 | */ |
77 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
77 | + $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data); |
|
78 | 78 | |
79 | 79 | wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
80 | 80 | |
81 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
82 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
81 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true); |
|
82 | + if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); } |
|
83 | 83 | |
84 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true); |
|
85 | 85 | wp_enqueue_script('geodirectory-lightbox-jquery'); |
86 | 86 | |
87 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true); |
|
88 | 88 | if ($is_detail_page) { |
89 | 89 | wp_enqueue_script('geodirectory-jquery-simplemodal'); |
90 | 90 | } |
91 | 91 | |
92 | 92 | if (in_array($geodir_map_name, array('auto', 'google'))) { |
93 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
94 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
93 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
94 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
95 | 95 | /** |
96 | 96 | * Filter the variables that are added to the end of the google maps script call. |
97 | 97 | * |
@@ -101,55 +101,55 @@ discard block |
||
101 | 101 | * @param string $var The string to filter, default is empty string. |
102 | 102 | */ |
103 | 103 | $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
104 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
104 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL); |
|
105 | 105 | |
106 | 106 | // Overlapping Marker Spiderfier |
107 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
107 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
108 | 108 | wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
109 | 109 | } |
110 | 110 | |
111 | 111 | if ($geodir_map_name == 'osm') { |
112 | 112 | // Leaflet OpenStreetMap |
113 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
113 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
114 | 114 | wp_enqueue_style('geodirectory-leaflet-style'); |
115 | 115 | |
116 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
116 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
117 | 117 | wp_enqueue_script('geodirectory-leaflet-script'); |
118 | 118 | |
119 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
120 | 120 | wp_enqueue_script('geodirectory-leaflet-geo-script'); |
121 | 121 | |
122 | 122 | if ($is_detail_page) { |
123 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
123 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
124 | 124 | wp_enqueue_style('geodirectory-leaflet-routing-style'); |
125 | 125 | |
126 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
126 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
127 | 127 | wp_enqueue_script('geodirectory-leaflet-routing-script'); |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Overlapping Marker Spiderfier Leaflet |
131 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
131 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | 132 | wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
133 | 133 | } |
134 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
134 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
135 | 135 | |
136 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
136 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
137 | 137 | wp_enqueue_script('geodirectory-goMap-script'); |
138 | 138 | |
139 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
139 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
140 | 140 | wp_enqueue_script('chosen'); |
141 | 141 | |
142 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
143 | 143 | wp_enqueue_script('geodirectory-choose-ajax'); |
144 | 144 | |
145 | - 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); |
|
145 | + 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); |
|
146 | 146 | |
147 | 147 | if (is_page() && geodir_is_page('add-listing')) { |
148 | 148 | // SCRIPT FOR UPLOAD |
149 | 149 | wp_enqueue_script('plupload-all'); |
150 | 150 | wp_enqueue_script('jquery-ui-sortable'); |
151 | 151 | |
152 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
152 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
153 | 153 | wp_enqueue_script('geodirectory-plupload-script'); |
154 | 154 | // SCRIPT FOR UPLOAD END |
155 | 155 | |
@@ -196,27 +196,27 @@ discard block |
||
196 | 196 | |
197 | 197 | wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
198 | 198 | |
199 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
199 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
200 | 200 | } // End if for add place page |
201 | 201 | |
202 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
202 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
203 | 203 | if ($is_detail_page) { |
204 | 204 | wp_enqueue_script('geodirectory-post-custom-js'); |
205 | 205 | } |
206 | 206 | |
207 | 207 | // font awesome rating script |
208 | 208 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
209 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
209 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
210 | 210 | wp_enqueue_script('geodir-barrating-js'); |
211 | 211 | } else { // default rating script |
212 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
212 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
213 | 213 | wp_enqueue_script('geodir-jRating-js'); |
214 | 214 | } |
215 | 215 | |
216 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
216 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
217 | 217 | wp_enqueue_script('geodir-on-document-load'); |
218 | 218 | |
219 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | + wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
220 | 220 | wp_enqueue_script('google-geometa'); |
221 | 221 | } |
222 | 222 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | function geodir_header_scripts() |
233 | 233 | { |
234 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
234 | + echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>'; |
|
235 | 235 | echo stripslashes(get_option('geodir_header_scripts')); |
236 | 236 | } |
237 | 237 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function geodir_google_analytics_tracking_code() |
247 | 247 | { |
248 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
248 | + if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?> |
|
249 | 249 | |
250 | 250 | <script> |
251 | 251 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -253,14 +253,14 @@ discard block |
||
253 | 253 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
254 | 254 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
255 | 255 | |
256 | - ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto'); |
|
257 | - <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?> |
|
256 | + ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto'); |
|
257 | + <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?> |
|
258 | 258 | ga('send', 'pageview'); |
259 | 259 | |
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 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * |
284 | 284 | * Flexbox wont wrap on ios for search form items |
285 | 285 | */ |
286 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
286 | + if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) { |
|
287 | 287 | 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>"; |
288 | 288 | } |
289 | 289 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function geodir_add_async_forscript($url) |
301 | 301 | { |
302 | - if (strpos($url, '#asyncload')===false) |
|
302 | + if (strpos($url, '#asyncload') === false) |
|
303 | 303 | return $url; |
304 | 304 | else if (is_admin()) |
305 | 305 | return str_replace('#asyncload', '', $url); |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | function geodir_templates_styles() |
318 | 318 | { |
319 | 319 | |
320 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
320 | + wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
321 | 321 | wp_enqueue_style('geodir-core-scss'); |
322 | - 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-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
323 | 323 | |
324 | - if(is_rtl()){ |
|
325 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
324 | + if (is_rtl()) { |
|
325 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
326 | 326 | wp_enqueue_style('geodirectory-frontend-rtl-style'); |
327 | 327 | } |
328 | 328 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | $term_id = get_queried_object_id(); |
397 | 397 | $taxonomy = get_query_var('taxonomy'); |
398 | 398 | |
399 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
400 | - $term = get_term($term_id, $post_type . 'category'); |
|
399 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') { |
|
400 | + $term = get_term($term_id, $post_type.'category'); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
405 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
404 | + if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) { |
|
405 | + $taxonomy_search = $_REQUEST['s'.$post_type.'category']; |
|
406 | 406 | |
407 | 407 | if (!is_array($taxonomy_search)) { |
408 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
409 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
410 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
408 | + $term = get_term((int) $taxonomy_search, $post_type.'category'); |
|
409 | + } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
410 | + $term = get_term((int) $taxonomy_search[0], $post_type.'category'); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | if ($max_page > 1 || $always_show) { |
420 | 420 | // Extra pagination info |
421 | 421 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
422 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
422 | + $start_no = ($paged - 1) * $posts_per_page + 1; |
|
423 | 423 | $end_no = min($paged * $posts_per_page, $numposts); |
424 | 424 | |
425 | 425 | if ($geodir_pagination_more_info != '') { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } else { |
430 | 430 | $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
431 | 431 | } |
432 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
432 | + $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>'; |
|
433 | 433 | /** |
434 | 434 | * Adds an extra pagination info above/under pagination. |
435 | 435 | * |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
446 | 446 | |
447 | 447 | if ($geodir_pagination_more_info == 'before') { |
448 | - $before = $before . $pagination_info; |
|
448 | + $before = $before.$pagination_info; |
|
449 | 449 | } else if ($geodir_pagination_more_info == 'after') { |
450 | - $after = $pagination_info . $after; |
|
450 | + $after = $pagination_info.$after; |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | 454 | echo "$before <div class='Navi gd-navi'>"; |
455 | 455 | if ($paged >= ($pages_to_show - 1)) { |
456 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
456 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link()).'">«</a>'; |
|
457 | 457 | } |
458 | 458 | previous_posts_link($prelabel); |
459 | 459 | for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
@@ -461,13 +461,13 @@ discard block |
||
461 | 461 | if ($i == $paged) { |
462 | 462 | echo "<strong class='on'>$i</strong>"; |
463 | 463 | } else { |
464 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
464 | + echo ' <a href="'.str_replace('&paged', '&paged', get_pagenum_link($i)).'">'.$i.'</a> '; |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | } |
468 | 468 | next_posts_link($nxtlabel, $max_page); |
469 | 469 | if (($paged + $half_pages_to_show) < ($max_page)) { |
470 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
470 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link($max_page)).'">»</a>'; |
|
471 | 471 | } |
472 | 472 | echo "</div> $after"; |
473 | 473 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | jQuery(function ($) { |
506 | 506 | $("#distance_slider").slider({ |
507 | 507 | range: true, |
508 | - values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
508 | + values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
509 | 509 | min: 0, |
510 | 510 | max: <?php echo $dist; ?>, |
511 | 511 | step: <?php echo $dist_dif; ?>, |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
573 | 573 | ?> |
574 | 574 | <script type="text/javascript"> |
575 | - var default_location = '<?php echo $city ;?>'; |
|
575 | + var default_location = '<?php echo $city; ?>'; |
|
576 | 576 | var latlng; |
577 | 577 | var address; |
578 | 578 | var dist = 0; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | var $form = jQuery(this).closest('form'); |
589 | 589 | |
590 | 590 | if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val(); |
591 | - if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s); |
|
591 | + if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s); |
|
592 | 592 | |
593 | 593 | // Disable location based search for disabled location post type. |
594 | 594 | if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') { |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | } |
603 | 603 | } |
604 | 604 | |
605 | - 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;?>')) { |
|
605 | + 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; ?>')) { |
|
606 | 606 | |
607 | 607 | // OSM can't handel post code with no space so we test for it and add one if needed |
608 | 608 | if(window.gdMaps === 'osm'){ |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | }); |
632 | 632 | |
633 | 633 | function geodir_setsearch($form) { |
634 | - 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); |
|
634 | + 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); |
|
635 | 635 | geocodeAddress($form); |
636 | 636 | } |
637 | 637 | |
@@ -650,15 +650,15 @@ discard block |
||
650 | 650 | // Call the geocode function |
651 | 651 | Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
652 | 652 | |
653 | - if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
654 | - if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
653 | + if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
654 | + if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
655 | 655 | jQuery(".snear", $form).val(''); |
656 | 656 | } |
657 | 657 | jQuery($form).submit(); |
658 | 658 | } else { |
659 | 659 | var address = jQuery(".snear", $form).val(); |
660 | 660 | |
661 | - if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') { |
|
661 | + if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') { |
|
662 | 662 | initialise2(); |
663 | 663 | } else { |
664 | 664 | <?php |
@@ -671,12 +671,12 @@ discard block |
||
671 | 671 | $near_add2 = apply_filters('geodir_search_near_addition', ''); |
672 | 672 | ?> |
673 | 673 | if (window.gdMaps === 'google') { |
674 | - Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
|
674 | + Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>}, |
|
675 | 675 | function (results, status) { |
676 | 676 | if (status == google.maps.GeocoderStatus.OK) { |
677 | 677 | updateSearchPosition(results[0].geometry.location, $form); |
678 | 678 | } else { |
679 | - alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status); |
|
679 | + alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status); |
|
680 | 680 | } |
681 | 681 | }); |
682 | 682 | } else if (window.gdMaps === 'osm') { |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | if (typeof geo !== 'undefined' && geo.lat && geo.lon) { |
686 | 686 | updateSearchPosition(geo, $form); |
687 | 687 | } else { |
688 | - alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>"); |
|
688 | + alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>"); |
|
689 | 689 | } |
690 | 690 | }); |
691 | 691 | } else { |
@@ -731,19 +731,19 @@ discard block |
||
731 | 731 | var msg; |
732 | 732 | switch (err.code) { |
733 | 733 | case err.UNKNOWN_ERROR: |
734 | - msg = "<?php _e('Unable to find your location','geodirectory');?>"; |
|
734 | + msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>"; |
|
735 | 735 | break; |
736 | 736 | case err.PERMISSION_DENINED: |
737 | - msg = "<?php _e('Permission denied in finding your location','geodirectory');?>"; |
|
737 | + msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>"; |
|
738 | 738 | break; |
739 | 739 | case err.POSITION_UNAVAILABLE: |
740 | - msg = "<?php _e('Your location is currently unknown','geodirectory');?>"; |
|
740 | + msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>"; |
|
741 | 741 | break; |
742 | 742 | case err.BREAK: |
743 | - msg = "<?php _e('Attempt to find location took too long','geodirectory');?>"; |
|
743 | + msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>"; |
|
744 | 744 | break; |
745 | 745 | default: |
746 | - msg = "<?php _e('Location detection not supported in browser','geodirectory');?>"; |
|
746 | + msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>"; |
|
747 | 747 | } |
748 | 748 | jQuery('#info').html(msg); |
749 | 749 | } |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | * @param object $post The post object. |
794 | 794 | * @param string $link The link to the post. |
795 | 795 | */ |
796 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
796 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img"> </span></a>', $post, $link); |
|
797 | 797 | break; |
798 | 798 | case 'new' : |
799 | 799 | /** |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | * @param object $post The post object. |
804 | 804 | * @param string $link The link to the post. |
805 | 805 | */ |
806 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
806 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing"> </span></a>', $post, $link); |
|
807 | 807 | break; |
808 | 808 | |
809 | 809 | } |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | * @since 1.6.22 |
818 | 818 | */ |
819 | 819 | function geodir_fix_script_conflict() { |
820 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
821 | - wp_dequeue_script( 'flexslider' ); |
|
820 | + if (wp_script_is('flexslider', 'enqueued') && wp_script_is('geodirectory-jquery-flexslider-js', 'enqueued')) { |
|
821 | + wp_dequeue_script('flexslider'); |
|
822 | 822 | } |
823 | 823 | } |
824 | -add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
|
825 | 824 | \ No newline at end of file |
825 | +add_action('wp_enqueue_scripts', 'geodir_fix_script_conflict', 100); |
|
826 | 826 | \ No newline at end of file |
@@ -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(); |
|
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 | + } |
|
192 | 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 | - } |
|
193 | + } |
|
194 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
212 | 195 | |
213 | - } |
|
214 | - return $query; |
|
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 | - } |
|
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 | - } |
|
248 | - |
|
249 | - global $s; |
|
250 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
251 | - $keywords = explode(" ", $s); |
|
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 | - } |
|
242 | + $mylat = $gd_session->get('user_lat'); |
|
243 | + $mylon = $gd_session->get('user_lon'); |
|
244 | + } |
|
260 | 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 | + } |
|
261 | 248 | |
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); |
|
249 | + global $s; |
|
250 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
|
251 | + $keywords = explode(" ", $s); |
|
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 | + } |
|
260 | + |
|
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); |
|
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 ) THEN 1 ELSE 0 END AS gd_content", array($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 | - } |
|
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 | - } |
|
394 | + if ($snear != '' && $sort_by!='farthest') { |
|
395 | + $sort_by = 'nearest'; |
|
396 | + } |
|
397 | + } |
|
456 | 398 | |
457 | - global $s; |
|
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 | + } |
|
458 | 456 | |
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 | - } |
|
457 | + global $s; |
|
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 | + } |
|
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,34 +596,34 @@ 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 | |
615 | - } elseif (geodir_is_page('author')) { |
|
615 | + } elseif (geodir_is_page('author')) { |
|
616 | 616 | |
617 | - add_filter('posts_where', 'author_filter_where', 1); |
|
617 | + add_filter('posts_where', 'author_filter_where', 1); |
|
618 | 618 | |
619 | - } |
|
619 | + } |
|
620 | 620 | |
621 | - //if (!geodir_is_page('detail')) |
|
622 | - add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
621 | + //if (!geodir_is_page('detail')) |
|
622 | + add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
623 | 623 | |
624 | - //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
624 | + //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
625 | 625 | |
626 | - } |
|
626 | + } |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | /** |
@@ -638,13 +638,13 @@ discard block |
||
638 | 638 | */ |
639 | 639 | function geodir_preview_post_cap($allcaps, $caps, $args) |
640 | 640 | { |
641 | - $user_id = get_current_user_id(); |
|
642 | - if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) { |
|
641 | + $user_id = get_current_user_id(); |
|
642 | + if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) { |
|
643 | 643 | |
644 | - $allcaps['edit_posts'] = true; |
|
645 | - } |
|
646 | - //print_r($allcaps); |
|
647 | - return $allcaps; |
|
644 | + $allcaps['edit_posts'] = true; |
|
645 | + } |
|
646 | + //print_r($allcaps); |
|
647 | + return $allcaps; |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | |
@@ -659,9 +659,9 @@ discard block |
||
659 | 659 | */ |
660 | 660 | function geodir_edit_listing_where($where) |
661 | 661 | { |
662 | - global $wpdb; |
|
663 | - $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']); |
|
664 | - return $where; |
|
662 | + global $wpdb; |
|
663 | + $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']); |
|
664 | + return $where; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | |
@@ -678,29 +678,29 @@ discard block |
||
678 | 678 | */ |
679 | 679 | function geodir_default_where($where) |
680 | 680 | { |
681 | - global $wp_query, $wpdb; |
|
682 | - |
|
683 | - //print_r($wp_query); |
|
684 | - ########### WPML ########### |
|
685 | - |
|
686 | - if (geodir_is_wpml()) { |
|
687 | - global $sitepress, $table_prefix; |
|
688 | - $lang_code = ICL_LANGUAGE_CODE; |
|
689 | - $default_lang_code = $sitepress->get_default_language(); |
|
690 | - $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
691 | - //echo '##########'.$q_post_type; |
|
692 | - if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) { |
|
693 | - $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' "; |
|
695 | - } |
|
681 | + global $wp_query, $wpdb; |
|
696 | 682 | |
697 | - } |
|
698 | - ########### WPML ########### |
|
683 | + //print_r($wp_query); |
|
684 | + ########### WPML ########### |
|
685 | + |
|
686 | + if (geodir_is_wpml()) { |
|
687 | + global $sitepress, $table_prefix; |
|
688 | + $lang_code = ICL_LANGUAGE_CODE; |
|
689 | + $default_lang_code = $sitepress->get_default_language(); |
|
690 | + $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
691 | + //echo '##########'.$q_post_type; |
|
692 | + if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) { |
|
693 | + $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' "; |
|
695 | + } |
|
699 | 696 | |
697 | + } |
|
698 | + ########### WPML ########### |
|
700 | 699 | |
701 | - return $where = str_replace("0 = 1", "1=1", $where); |
|
702 | 700 | |
703 | - /* ====== old code start === |
|
701 | + return $where = str_replace("0 = 1", "1=1", $where); |
|
702 | + |
|
703 | + /* ====== old code start === |
|
704 | 704 | $where = str_replace("0 = 1", "1=1", $where); |
705 | 705 | $country = get_query_var('gd_country'); |
706 | 706 | $region = get_query_var('gd_region'); |
@@ -741,94 +741,94 @@ discard block |
||
741 | 741 | * @return string Modified where query string. |
742 | 742 | */ |
743 | 743 | function searching_filter_where($where) { |
744 | - global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
744 | + global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
745 | 745 | |
746 | - $search_term = 'OR'; |
|
747 | - $search_term = 'AND'; |
|
748 | - $geodir_custom_search = ''; |
|
749 | - $category_search_range = ''; |
|
746 | + $search_term = 'OR'; |
|
747 | + $search_term = 'AND'; |
|
748 | + $geodir_custom_search = ''; |
|
749 | + $category_search_range = ''; |
|
750 | 750 | |
751 | - if (is_single() && get_query_var('post_type')) { |
|
751 | + if (is_single() && get_query_var('post_type')) { |
|
752 | 752 | return $where; |
753 | 753 | } |
754 | 754 | |
755 | - if (is_tax()) { |
|
755 | + if (is_tax()) { |
|
756 | 756 | return $where; |
757 | 757 | } |
758 | 758 | |
759 | 759 | $s = trim($s); |
760 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
761 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
762 | - |
|
763 | - $where = ''; |
|
764 | - $better_search_terms = ''; |
|
765 | - if (isset($_REQUEST['stype'])) |
|
766 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
767 | - else |
|
768 | - $post_types = 'gd_place'; |
|
769 | - |
|
770 | - if ($s != '') { |
|
771 | - $keywords = explode(" ", $s); |
|
772 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
773 | - foreach($keywords as $kkey=>$kword){ |
|
774 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
775 | - unset($keywords[$kkey]); |
|
776 | - } |
|
777 | - } |
|
778 | - } |
|
760 | + $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
761 | + $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
779 | 762 | |
780 | - if (!empty($keywords)) { |
|
781 | - foreach ($keywords as $keyword) { |
|
782 | - $keyword = trim($keyword); |
|
783 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
784 | - if ($keyword != '') { |
|
785 | - /** |
|
786 | - * Filter the search query keywords SQL. |
|
787 | - * |
|
788 | - * @since 1.5.9 |
|
789 | - * @package GeoDirectory |
|
790 | - * @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 . '%" )'`. |
|
791 | - * @param array $keywords The array of keywords for the query. |
|
792 | - * @param string $keyword The single keyword being searched. |
|
793 | - */ |
|
763 | + $where = ''; |
|
764 | + $better_search_terms = ''; |
|
765 | + if (isset($_REQUEST['stype'])) |
|
766 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
767 | + else |
|
768 | + $post_types = 'gd_place'; |
|
769 | + |
|
770 | + if ($s != '') { |
|
771 | + $keywords = explode(" ", $s); |
|
772 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
773 | + foreach($keywords as $kkey=>$kword){ |
|
774 | + if(geodir_utf8_strlen($kword)<=$klimit){ |
|
775 | + unset($keywords[$kkey]); |
|
776 | + } |
|
777 | + } |
|
778 | + } |
|
779 | + |
|
780 | + if (!empty($keywords)) { |
|
781 | + foreach ($keywords as $keyword) { |
|
782 | + $keyword = trim($keyword); |
|
783 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
784 | + if ($keyword != '') { |
|
785 | + /** |
|
786 | + * Filter the search query keywords SQL. |
|
787 | + * |
|
788 | + * @since 1.5.9 |
|
789 | + * @package GeoDirectory |
|
790 | + * @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 . '%" )'`. |
|
791 | + * @param array $keywords The array of keywords for the query. |
|
792 | + * @param string $keyword The single keyword being searched. |
|
793 | + */ |
|
794 | 794 | $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 | - } |
|
796 | - } |
|
797 | - } |
|
798 | - } |
|
795 | + } |
|
796 | + } |
|
797 | + } |
|
798 | + } |
|
799 | 799 | |
800 | - /* get taxonomy */ |
|
801 | - $taxonomies = geodir_get_taxonomies($post_types, true); |
|
802 | - if($taxonomies) { |
|
803 | - $taxonomies = implode("','", $taxonomies); |
|
804 | - $taxonomies = "'" . $taxonomies . "'"; |
|
805 | - }else{$taxonomies='';} |
|
800 | + /* get taxonomy */ |
|
801 | + $taxonomies = geodir_get_taxonomies($post_types, true); |
|
802 | + if($taxonomies) { |
|
803 | + $taxonomies = implode("','", $taxonomies); |
|
804 | + $taxonomies = "'" . $taxonomies . "'"; |
|
805 | + }else{$taxonomies='';} |
|
806 | 806 | |
807 | - $content_where = $terms_where = ''; |
|
808 | - $terms_sql = ''; |
|
807 | + $content_where = $terms_where = ''; |
|
808 | + $terms_sql = ''; |
|
809 | 809 | if ($s != '') { |
810 | - /** |
|
811 | - * Filter the search query content where values. |
|
812 | - * |
|
813 | - * @since 1.5.0 |
|
814 | - * @package GeoDirectory |
|
815 | - * |
|
816 | - * @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%\") ") "`. |
|
817 | - */ |
|
818 | - $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 | - /** |
|
820 | - * Filter the search query term values. |
|
821 | - * |
|
822 | - * @since 1.5.0 |
|
823 | - * @package GeoDirectory |
|
824 | - * |
|
825 | - * @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)) "`. |
|
826 | - */ |
|
827 | - $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 | - |
|
829 | - |
|
830 | - // get term sql |
|
831 | - $term_sql = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->terms.name, $wpdb->term_taxonomy.taxonomy |
|
810 | + /** |
|
811 | + * Filter the search query content where values. |
|
812 | + * |
|
813 | + * @since 1.5.0 |
|
814 | + * @package GeoDirectory |
|
815 | + * |
|
816 | + * @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%\") ") "`. |
|
817 | + */ |
|
818 | + $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 | + /** |
|
820 | + * Filter the search query term values. |
|
821 | + * |
|
822 | + * @since 1.5.0 |
|
823 | + * @package GeoDirectory |
|
824 | + * |
|
825 | + * @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)) "`. |
|
826 | + */ |
|
827 | + $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 | + |
|
829 | + |
|
830 | + // get term sql |
|
831 | + $term_sql = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->terms.name, $wpdb->term_taxonomy.taxonomy |
|
832 | 832 | FROM $wpdb->term_taxonomy, $wpdb->terms, $wpdb->term_relationships |
833 | 833 | WHERE $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id |
834 | 834 | AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id |
@@ -836,46 +836,46 @@ discard block |
||
836 | 836 | $terms_where |
837 | 837 | GROUP BY $wpdb->term_taxonomy.term_id"; |
838 | 838 | |
839 | - $term_results = $wpdb->get_results( $term_sql ); |
|
840 | - $term_ids = array(); |
|
841 | - $terms_sql = ''; |
|
842 | - |
|
843 | - if ( ! empty( $term_results ) ) { |
|
844 | - foreach ( $term_results as $term_id ) { |
|
845 | - $term_ids[] = $term_id; |
|
846 | - } |
|
847 | - if ( ! empty( $term_ids ) ) { |
|
848 | - foreach ( $term_ids as $term ) { |
|
849 | - if ( $term->taxonomy == $post_types . '_tags' ) { |
|
850 | - $terms_sql .= $wpdb->prepare( " OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name ); |
|
851 | - } else { |
|
852 | - $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
853 | - } |
|
854 | - } |
|
855 | - } |
|
856 | - } |
|
839 | + $term_results = $wpdb->get_results( $term_sql ); |
|
840 | + $term_ids = array(); |
|
841 | + $terms_sql = ''; |
|
842 | + |
|
843 | + if ( ! empty( $term_results ) ) { |
|
844 | + foreach ( $term_results as $term_id ) { |
|
845 | + $term_ids[] = $term_id; |
|
846 | + } |
|
847 | + if ( ! empty( $term_ids ) ) { |
|
848 | + foreach ( $term_ids as $term ) { |
|
849 | + if ( $term->taxonomy == $post_types . '_tags' ) { |
|
850 | + $terms_sql .= $wpdb->prepare( " OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name ); |
|
851 | + } else { |
|
852 | + $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
853 | + } |
|
854 | + } |
|
855 | + } |
|
856 | + } |
|
857 | 857 | |
858 | - } |
|
858 | + } |
|
859 | 859 | |
860 | - if ($snear != '') { |
|
860 | + if ($snear != '') { |
|
861 | 861 | |
862 | 862 | |
863 | - if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) { |
|
864 | - $dist = $gd_session->get('near_me_range'); |
|
865 | - } |
|
866 | - $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
867 | - $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
868 | - $lat1 = $mylat - ($dist / 69); |
|
869 | - $lat2 = $mylat + ($dist / 69); |
|
863 | + if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) { |
|
864 | + $dist = $gd_session->get('near_me_range'); |
|
865 | + } |
|
866 | + $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
867 | + $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
868 | + $lat1 = $mylat - ($dist / 69); |
|
869 | + $lat2 = $mylat + ($dist / 69); |
|
870 | 870 | |
871 | - $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
872 | - $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
873 | - $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
874 | - $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
871 | + $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
872 | + $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
873 | + $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
874 | + $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
875 | 875 | |
876 | 876 | |
877 | 877 | |
878 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
878 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
879 | 879 | $content_where |
880 | 880 | $terms_sql |
881 | 881 | ) |
@@ -884,35 +884,35 @@ discard block |
||
884 | 884 | AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
885 | 885 | AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
886 | 886 | |
887 | - if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
|
888 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
889 | - $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 | - } |
|
887 | + if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
|
888 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
889 | + $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 | + } |
|
891 | 891 | |
892 | - } else { |
|
892 | + } else { |
|
893 | 893 | |
894 | 894 | |
895 | - $post_title_where = $s != "" ? "{$wpdb->posts}.post_title LIKE \"$s\"" : "1=1"; |
|
896 | - $where .= " AND ( ( $post_title_where $better_search_terms) |
|
895 | + $post_title_where = $s != "" ? "{$wpdb->posts}.post_title LIKE \"$s\"" : "1=1"; |
|
896 | + $where .= " AND ( ( $post_title_where $better_search_terms) |
|
897 | 897 | $content_where |
898 | 898 | $terms_sql |
899 | 899 | ) |
900 | 900 | |
901 | 901 | AND $wpdb->posts.post_type in ('$post_types') |
902 | 902 | AND ($wpdb->posts.post_status = 'publish') "; |
903 | - } |
|
903 | + } |
|
904 | 904 | |
905 | 905 | ########### WPML ########### |
906 | - if ( geodir_wpml_is_post_type_translated( $post_types ) ) { |
|
906 | + if ( geodir_wpml_is_post_type_translated( $post_types ) ) { |
|
907 | 907 | $lang_code = ICL_LANGUAGE_CODE; |
908 | 908 | |
909 | 909 | if ($lang_code && $post_types) { |
910 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
911 | - } |
|
912 | - } |
|
913 | - ########### WPML ########### |
|
910 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
911 | + } |
|
912 | + } |
|
913 | + ########### WPML ########### |
|
914 | 914 | |
915 | - return $where; |
|
915 | + return $where; |
|
916 | 916 | } |
917 | 917 | |
918 | 918 | |
@@ -927,45 +927,45 @@ discard block |
||
927 | 927 | * @return string Modified where query string. |
928 | 928 | */ |
929 | 929 | function author_filter_where($where) { |
930 | - global $wpdb, $geodir_post_type, $table, $curr; |
|
930 | + global $wpdb, $geodir_post_type, $table, $curr; |
|
931 | 931 | |
932 | - $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
933 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
932 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
933 | + $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
934 | 934 | |
935 | - if (isset($_REQUEST['stype'])) { |
|
936 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
937 | - } else { |
|
938 | - $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
|
939 | - } |
|
935 | + if (isset($_REQUEST['stype'])) { |
|
936 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
937 | + } else { |
|
938 | + $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
|
939 | + } |
|
940 | 940 | |
941 | - if ($user_id > 0) { |
|
942 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
|
943 | - $user_fav_posts = geodir_get_user_favourites($user_id); |
|
944 | - $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
|
945 | - $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
|
946 | - } else |
|
947 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
948 | - |
|
949 | - if ($user_id == (int)get_current_user_id()) { |
|
950 | - $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
|
951 | - } else { |
|
952 | - $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
953 | - } |
|
954 | - } else { |
|
955 | - $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
956 | - } |
|
941 | + if ($user_id > 0) { |
|
942 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
|
943 | + $user_fav_posts = geodir_get_user_favourites($user_id); |
|
944 | + $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
|
945 | + $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
|
946 | + } else |
|
947 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
948 | + |
|
949 | + if ($user_id == (int)get_current_user_id()) { |
|
950 | + $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
|
951 | + } else { |
|
952 | + $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
953 | + } |
|
954 | + } else { |
|
955 | + $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
956 | + } |
|
957 | 957 | |
958 | - ########### WPML ########### |
|
959 | - if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) { |
|
960 | - $lang_code = ICL_LANGUAGE_CODE; |
|
961 | - if ($lang_code) { |
|
962 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
963 | - } |
|
958 | + ########### WPML ########### |
|
959 | + if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) { |
|
960 | + $lang_code = ICL_LANGUAGE_CODE; |
|
961 | + if ($lang_code) { |
|
962 | + $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
963 | + } |
|
964 | 964 | |
965 | - } |
|
966 | - ########### WPML ########### |
|
965 | + } |
|
966 | + ########### WPML ########### |
|
967 | 967 | |
968 | - return $where; |
|
968 | + return $where; |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | /** |
@@ -980,11 +980,11 @@ discard block |
||
980 | 980 | */ |
981 | 981 | function geodir_filter_widget_join($join) |
982 | 982 | { |
983 | - global $wp_query, $table; |
|
984 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
985 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
986 | - } |
|
987 | - return $join; |
|
983 | + global $wp_query, $table; |
|
984 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
985 | + $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
986 | + } |
|
987 | + return $join; |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | /** |
@@ -999,43 +999,43 @@ discard block |
||
999 | 999 | */ |
1000 | 1000 | function geodir_filter_widget_where($where) |
1001 | 1001 | { |
1002 | - global $wp_query, $table; |
|
1003 | - if (!empty($wp_query->query['show_featured_only'])) { |
|
1004 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
1005 | - } |
|
1006 | - if (!empty($wp_query->query['show_special_only'])) { |
|
1007 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
1008 | - } |
|
1009 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
1010 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
1011 | - } |
|
1012 | - if (!empty($wp_query->query['with_videos_only'])) { |
|
1013 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
1014 | - } |
|
1015 | - return $where; |
|
1002 | + global $wp_query, $table; |
|
1003 | + if (!empty($wp_query->query['show_featured_only'])) { |
|
1004 | + $where .= " AND " . $table . ".is_featured = '1'"; |
|
1005 | + } |
|
1006 | + if (!empty($wp_query->query['show_special_only'])) { |
|
1007 | + $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
1008 | + } |
|
1009 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
1010 | + $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
1011 | + } |
|
1012 | + if (!empty($wp_query->query['with_videos_only'])) { |
|
1013 | + $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
1014 | + } |
|
1015 | + return $where; |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
1019 | 1019 | function geodir_related_posts_fields($fields) { |
1020 | - global $wp_query, $wpdb, $table, $post; |
|
1020 | + global $wp_query, $wpdb, $table, $post; |
|
1021 | 1021 | |
1022 | - $fields .= ", " . $table . ".* "; |
|
1022 | + $fields .= ", " . $table . ".* "; |
|
1023 | 1023 | |
1024 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
1024 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
1025 | 1025 | |
1026 | - $mylat = $post->post_latitude; |
|
1027 | - $mylon = $post->post_longitude; |
|
1026 | + $mylat = $post->post_latitude; |
|
1027 | + $mylon = $post->post_longitude; |
|
1028 | 1028 | |
1029 | - $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 | - return $fields; |
|
1029 | + $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 | + return $fields; |
|
1031 | 1031 | } |
1032 | 1032 | function geodir_related_posts_fields_filter($query) { |
1033 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1034 | - && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
1035 | - && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
1036 | - ) { |
|
1037 | - add_filter('posts_fields', 'geodir_related_posts_fields', 1); |
|
1038 | - } |
|
1033 | + if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1034 | + && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
1035 | + && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
1036 | + ) { |
|
1037 | + add_filter('posts_fields', 'geodir_related_posts_fields', 1); |
|
1038 | + } |
|
1039 | 1039 | } |
1040 | 1040 | add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1); |
1041 | 1041 | |
@@ -1050,30 +1050,30 @@ discard block |
||
1050 | 1050 | * @return string|null If field exists in table returns order by clause else returns empty. |
1051 | 1051 | */ |
1052 | 1052 | function geodir_prepare_custom_sorting( $sorting, $table ) { |
1053 | - $orderby = ''; |
|
1053 | + $orderby = ''; |
|
1054 | 1054 | |
1055 | - if ( empty( $sorting ) || empty( $table ) ) { |
|
1056 | - return $orderby; |
|
1057 | - } |
|
1055 | + if ( empty( $sorting ) || empty( $table ) ) { |
|
1056 | + return $orderby; |
|
1057 | + } |
|
1058 | 1058 | |
1059 | - if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) { |
|
1060 | - $sorting_array = explode( '_', $sorting ); |
|
1059 | + if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) { |
|
1060 | + $sorting_array = explode( '_', $sorting ); |
|
1061 | 1061 | |
1062 | - if ( ( $count = count( $sorting_array ) ) > 1 ) { |
|
1063 | - $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
1064 | - array_pop( $sorting_array ); |
|
1062 | + if ( ( $count = count( $sorting_array ) ) > 1 ) { |
|
1063 | + $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
1064 | + array_pop( $sorting_array ); |
|
1065 | 1065 | |
1066 | - if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) { |
|
1067 | - $sort_by = implode( '_', $sorting_array ); |
|
1066 | + if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) { |
|
1067 | + $sort_by = implode( '_', $sorting_array ); |
|
1068 | 1068 | |
1069 | - if ( geodir_column_exist( $table, $sort_by ) ) { |
|
1070 | - $orderby = $table . "." . $sort_by . " " . $order; |
|
1071 | - } |
|
1072 | - } |
|
1073 | - } |
|
1074 | - } |
|
1069 | + if ( geodir_column_exist( $table, $sort_by ) ) { |
|
1070 | + $orderby = $table . "." . $sort_by . " " . $order; |
|
1071 | + } |
|
1072 | + } |
|
1073 | + } |
|
1074 | + } |
|
1075 | 1075 | |
1076 | - return $orderby; |
|
1076 | + return $orderby; |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | /** |
@@ -1093,21 +1093,21 @@ discard block |
||
1093 | 1093 | * @return string Modified fields SQL. |
1094 | 1094 | */ |
1095 | 1095 | function geodir_search_widget_location_filter_fields( $fields, $table, $post_type ) { |
1096 | - global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
|
1096 | + global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
|
1097 | 1097 | |
1098 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1099 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1098 | + if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1099 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1100 | 1100 | |
1101 | - if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1102 | - $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
1103 | - $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
1104 | - $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
1101 | + if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1102 | + $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
1103 | + $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
1104 | + $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
1105 | 1105 | |
1106 | - $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 | - } |
|
1108 | - } |
|
1106 | + $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 | + } |
|
1108 | + } |
|
1109 | 1109 | |
1110 | - return $fields; |
|
1110 | + return $fields; |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | /** |
@@ -1126,17 +1126,17 @@ discard block |
||
1126 | 1126 | * @return string Modified fields SQL. |
1127 | 1127 | */ |
1128 | 1128 | function geodir_search_widget_location_filter_orderby( $orderby, $table, $post_type ) { |
1129 | - global $gd_query_args_widgets, $snear, $gd_session; |
|
1129 | + global $gd_query_args_widgets, $snear, $gd_session; |
|
1130 | 1130 | |
1131 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1132 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1131 | + if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1132 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1133 | 1133 | |
1134 | - if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1135 | - $orderby = "distance ASC, " . $orderby; |
|
1136 | - } |
|
1137 | - } |
|
1134 | + if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1135 | + $orderby = "distance ASC, " . $orderby; |
|
1136 | + } |
|
1137 | + } |
|
1138 | 1138 | |
1139 | - return $orderby; |
|
1139 | + return $orderby; |
|
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | /** |
@@ -1147,23 +1147,23 @@ discard block |
||
1147 | 1147 | * @return string Filtered url. |
1148 | 1148 | */ |
1149 | 1149 | function geodir_search_page_base_url() { |
1150 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1151 | - remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
1152 | - } |
|
1150 | + if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1151 | + remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
1152 | + } |
|
1153 | 1153 | |
1154 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) { |
|
1155 | - $url = icl_get_home_url(); |
|
1156 | - } else { |
|
1157 | - $url = get_home_url(); |
|
1158 | - } |
|
1154 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) { |
|
1155 | + $url = icl_get_home_url(); |
|
1156 | + } else { |
|
1157 | + $url = get_home_url(); |
|
1158 | + } |
|
1159 | 1159 | |
1160 | - $url = trailingslashit( $url ); |
|
1160 | + $url = trailingslashit( $url ); |
|
1161 | 1161 | |
1162 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1163 | - add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
1164 | - } |
|
1162 | + if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1163 | + add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
1164 | + } |
|
1165 | 1165 | |
1166 | - return apply_filters( 'geodir_search_page_base_url', $url ); |
|
1166 | + return apply_filters( 'geodir_search_page_base_url', $url ); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | /** |
@@ -1174,6 +1174,6 @@ discard block |
||
1174 | 1174 | function geodir_jetpack_fix_post_types_search(){ |
1175 | 1175 | if ( defined( 'JETPACK__VERSION' ) && ! empty( $_REQUEST['geodir_search'] ) ) { |
1176 | 1176 | add_filter( 'jetpack_search_should_handle_query', '__return_false', 999, 1 ); |
1177 | - } |
|
1177 | + } |
|
1178 | 1178 | } |
1179 | 1179 | add_action( 'plugins_loaded','geodir_jetpack_fix_post_types_search', 10 ); |
1180 | 1180 | \ No newline at end of file |
@@ -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 ) THEN 1 ELSE 0 END AS gd_content", array($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 ) THEN 1 ELSE 0 END AS gd_content", array($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 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | } |
620 | 620 | |
621 | 621 | //if (!geodir_is_page('detail')) |
622 | - add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
622 | + add_filter('posts_where', 'geodir_default_where', 1); /**/ |
|
623 | 623 | |
624 | 624 | //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
625 | 625 | |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
691 | 691 | //echo '##########'.$q_post_type; |
692 | 692 | if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) { |
693 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') "; |
|
693 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') "; |
|
694 | 694 | //$where .= " AND icl_t.language_code = '$lang_code' "; |
695 | 695 | } |
696 | 696 | |
@@ -757,8 +757,8 @@ discard block |
||
757 | 757 | } |
758 | 758 | |
759 | 759 | $s = trim($s); |
760 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
761 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
760 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
761 | + $s_A = wp_specialchars_decode($s_A, ENT_QUOTES); |
|
762 | 762 | |
763 | 763 | $where = ''; |
764 | 764 | $better_search_terms = ''; |
@@ -769,9 +769,9 @@ discard block |
||
769 | 769 | |
770 | 770 | if ($s != '') { |
771 | 771 | $keywords = explode(" ", $s); |
772 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
773 | - foreach($keywords as $kkey=>$kword){ |
|
774 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
772 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
773 | + foreach ($keywords as $kkey=>$kword) { |
|
774 | + if (geodir_utf8_strlen($kword) <= $klimit) { |
|
775 | 775 | unset($keywords[$kkey]); |
776 | 776 | } |
777 | 777 | } |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | if (!empty($keywords)) { |
781 | 781 | foreach ($keywords as $keyword) { |
782 | 782 | $keyword = trim($keyword); |
783 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
783 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
784 | 784 | if ($keyword != '') { |
785 | 785 | /** |
786 | 786 | * Filter the search query keywords SQL. |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @param array $keywords The array of keywords for the query. |
792 | 792 | * @param string $keyword The single keyword being searched. |
793 | 793 | */ |
794 | - $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); |
|
794 | + $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 | 795 | } |
796 | 796 | } |
797 | 797 | } |
@@ -799,13 +799,13 @@ discard block |
||
799 | 799 | |
800 | 800 | /* get taxonomy */ |
801 | 801 | $taxonomies = geodir_get_taxonomies($post_types, true); |
802 | - if($taxonomies) { |
|
802 | + if ($taxonomies) { |
|
803 | 803 | $taxonomies = implode("','", $taxonomies); |
804 | - $taxonomies = "'" . $taxonomies . "'"; |
|
805 | - }else{$taxonomies='';} |
|
804 | + $taxonomies = "'".$taxonomies."'"; |
|
805 | + } else {$taxonomies = ''; } |
|
806 | 806 | |
807 | 807 | $content_where = $terms_where = ''; |
808 | - $terms_sql = ''; |
|
808 | + $terms_sql = ''; |
|
809 | 809 | if ($s != '') { |
810 | 810 | /** |
811 | 811 | * Filter the search query content where values. |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @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%\") ") "`. |
817 | 817 | */ |
818 | - $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%\") " ); |
|
818 | + $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 | 819 | /** |
820 | 820 | * Filter the search query term values. |
821 | 821 | * |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | * |
825 | 825 | * @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)) "`. |
826 | 826 | */ |
827 | - $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)) " ); |
|
827 | + $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 | 828 | |
829 | 829 | |
830 | 830 | // get term sql |
@@ -836,20 +836,20 @@ discard block |
||
836 | 836 | $terms_where |
837 | 837 | GROUP BY $wpdb->term_taxonomy.term_id"; |
838 | 838 | |
839 | - $term_results = $wpdb->get_results( $term_sql ); |
|
839 | + $term_results = $wpdb->get_results($term_sql); |
|
840 | 840 | $term_ids = array(); |
841 | 841 | $terms_sql = ''; |
842 | 842 | |
843 | - if ( ! empty( $term_results ) ) { |
|
844 | - foreach ( $term_results as $term_id ) { |
|
843 | + if (!empty($term_results)) { |
|
844 | + foreach ($term_results as $term_id) { |
|
845 | 845 | $term_ids[] = $term_id; |
846 | 846 | } |
847 | - if ( ! empty( $term_ids ) ) { |
|
848 | - foreach ( $term_ids as $term ) { |
|
849 | - if ( $term->taxonomy == $post_types . '_tags' ) { |
|
850 | - $terms_sql .= $wpdb->prepare( " OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name ); |
|
847 | + if (!empty($term_ids)) { |
|
848 | + foreach ($term_ids as $term) { |
|
849 | + if ($term->taxonomy == $post_types.'_tags') { |
|
850 | + $terms_sql .= $wpdb->prepare(" OR FIND_IN_SET(%s , ".$table.".post_tags) ", $term->name); |
|
851 | 851 | } else { |
852 | - $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
852 | + $terms_sql .= " OR FIND_IN_SET($term->term_id , ".$table.".".$post_types."category) "; |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | } |
@@ -881,12 +881,12 @@ discard block |
||
881 | 881 | ) |
882 | 882 | AND $wpdb->posts.post_type in ('{$post_types}') |
883 | 883 | AND ($wpdb->posts.post_status = 'publish') |
884 | - AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
|
885 | - AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
|
884 | + AND ( ".$table.".post_latitude between $rlat1 and $rlat2 ) |
|
885 | + AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) "; |
|
886 | 886 | |
887 | 887 | if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
888 | 888 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
889 | - $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; |
|
889 | + $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 | 890 | } |
891 | 891 | |
892 | 892 | } else { |
@@ -903,11 +903,11 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | ########### WPML ########### |
906 | - if ( geodir_wpml_is_post_type_translated( $post_types ) ) { |
|
906 | + if (geodir_wpml_is_post_type_translated($post_types)) { |
|
907 | 907 | $lang_code = ICL_LANGUAGE_CODE; |
908 | 908 | |
909 | 909 | if ($lang_code && $post_types) { |
910 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
910 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') "; |
|
911 | 911 | } |
912 | 912 | } |
913 | 913 | ########### WPML ########### |
@@ -930,10 +930,10 @@ discard block |
||
930 | 930 | global $wpdb, $geodir_post_type, $table, $curr; |
931 | 931 | |
932 | 932 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
933 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
933 | + $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0; |
|
934 | 934 | |
935 | 935 | if (isset($_REQUEST['stype'])) { |
936 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
936 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']); |
|
937 | 937 | } else { |
938 | 938 | $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
939 | 939 | } |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | } else |
947 | 947 | $where .= " AND $wpdb->posts.post_author = $user_id"; |
948 | 948 | |
949 | - if ($user_id == (int)get_current_user_id()) { |
|
949 | + if ($user_id == (int) get_current_user_id()) { |
|
950 | 950 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
951 | 951 | } else { |
952 | 952 | $where .= " AND $wpdb->posts.post_status = 'publish' "; |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) { |
960 | 960 | $lang_code = ICL_LANGUAGE_CODE; |
961 | 961 | if ($lang_code) { |
962 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
962 | + $where .= " AND icl_t.language_code='".$lang_code."' "; |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | } |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | { |
983 | 983 | global $wp_query, $table; |
984 | 984 | if (!empty($wp_query->query['with_pics_only'])) { |
985 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
985 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
986 | 986 | } |
987 | 987 | return $join; |
988 | 988 | } |
@@ -1001,16 +1001,16 @@ discard block |
||
1001 | 1001 | { |
1002 | 1002 | global $wp_query, $table; |
1003 | 1003 | if (!empty($wp_query->query['show_featured_only'])) { |
1004 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
1004 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
1005 | 1005 | } |
1006 | 1006 | if (!empty($wp_query->query['show_special_only'])) { |
1007 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
1007 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
1008 | 1008 | } |
1009 | 1009 | if (!empty($wp_query->query['with_pics_only'])) { |
1010 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
1010 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id"; |
|
1011 | 1011 | } |
1012 | 1012 | if (!empty($wp_query->query['with_videos_only'])) { |
1013 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
1013 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
1014 | 1014 | } |
1015 | 1015 | return $where; |
1016 | 1016 | } |
@@ -1019,18 +1019,18 @@ discard block |
||
1019 | 1019 | function geodir_related_posts_fields($fields) { |
1020 | 1020 | global $wp_query, $wpdb, $table, $post; |
1021 | 1021 | |
1022 | - $fields .= ", " . $table . ".* "; |
|
1022 | + $fields .= ", ".$table.".* "; |
|
1023 | 1023 | |
1024 | 1024 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
1025 | 1025 | |
1026 | 1026 | $mylat = $post->post_latitude; |
1027 | 1027 | $mylon = $post->post_longitude; |
1028 | 1028 | |
1029 | - $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 "; |
|
1029 | + $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 | 1030 | return $fields; |
1031 | 1031 | } |
1032 | 1032 | function geodir_related_posts_fields_filter($query) { |
1033 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1033 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1034 | 1034 | && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
1035 | 1035 | && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
1036 | 1036 | ) { |
@@ -1049,25 +1049,25 @@ discard block |
||
1049 | 1049 | * @param string $table Listing table name. |
1050 | 1050 | * @return string|null If field exists in table returns order by clause else returns empty. |
1051 | 1051 | */ |
1052 | -function geodir_prepare_custom_sorting( $sorting, $table ) { |
|
1052 | +function geodir_prepare_custom_sorting($sorting, $table) { |
|
1053 | 1053 | $orderby = ''; |
1054 | 1054 | |
1055 | - if ( empty( $sorting ) || empty( $table ) ) { |
|
1055 | + if (empty($sorting) || empty($table)) { |
|
1056 | 1056 | return $orderby; |
1057 | 1057 | } |
1058 | 1058 | |
1059 | - if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) { |
|
1060 | - $sorting_array = explode( '_', $sorting ); |
|
1059 | + if (strpos(strtoupper($sorting), '_ASC') !== false || strpos(strtoupper($sorting), '_DESC') !== false) { |
|
1060 | + $sorting_array = explode('_', $sorting); |
|
1061 | 1061 | |
1062 | - if ( ( $count = count( $sorting_array ) ) > 1 ) { |
|
1063 | - $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
1064 | - array_pop( $sorting_array ); |
|
1062 | + if (($count = count($sorting_array)) > 1) { |
|
1063 | + $order = !empty($sorting_array[$count - 1]) ? strtoupper($sorting_array[$count - 1]) : ''; |
|
1064 | + array_pop($sorting_array); |
|
1065 | 1065 | |
1066 | - if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) { |
|
1067 | - $sort_by = implode( '_', $sorting_array ); |
|
1066 | + if (!empty($sorting_array) && ($order == 'ASC' || $order == 'DESC')) { |
|
1067 | + $sort_by = implode('_', $sorting_array); |
|
1068 | 1068 | |
1069 | - if ( geodir_column_exist( $table, $sort_by ) ) { |
|
1070 | - $orderby = $table . "." . $sort_by . " " . $order; |
|
1069 | + if (geodir_column_exist($table, $sort_by)) { |
|
1070 | + $orderby = $table.".".$sort_by." ".$order; |
|
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | } |
@@ -1092,18 +1092,18 @@ discard block |
||
1092 | 1092 | * |
1093 | 1093 | * @return string Modified fields SQL. |
1094 | 1094 | */ |
1095 | -function geodir_search_widget_location_filter_fields( $fields, $table, $post_type ) { |
|
1095 | +function geodir_search_widget_location_filter_fields($fields, $table, $post_type) { |
|
1096 | 1096 | global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
1097 | 1097 | |
1098 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1099 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1098 | + if (!empty($gd_query_args_widgets['gd_location']) && geodir_is_page('search') && !empty($_REQUEST['sgeo_lat']) && !empty($_REQUEST['sgeo_lon'])) { |
|
1099 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true; |
|
1100 | 1100 | |
1101 | - if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1102 | - $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
1103 | - $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
1104 | - $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
1101 | + if ($location_allowed && strpos(strtolower($fields), ' as distance ') === false && ($snear != '' || $gd_session->get('all_near_me'))) { |
|
1102 | + $latitude = sanitize_text_field($_REQUEST['sgeo_lat']); |
|
1103 | + $longitude = sanitize_text_field($_REQUEST['sgeo_lon']); |
|
1104 | + $radius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
1105 | 1105 | |
1106 | - $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 ); |
|
1106 | + $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 | 1107 | } |
1108 | 1108 | } |
1109 | 1109 | |
@@ -1125,14 +1125,14 @@ discard block |
||
1125 | 1125 | * |
1126 | 1126 | * @return string Modified fields SQL. |
1127 | 1127 | */ |
1128 | -function geodir_search_widget_location_filter_orderby( $orderby, $table, $post_type ) { |
|
1128 | +function geodir_search_widget_location_filter_orderby($orderby, $table, $post_type) { |
|
1129 | 1129 | global $gd_query_args_widgets, $snear, $gd_session; |
1130 | 1130 | |
1131 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1132 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1131 | + if (!empty($gd_query_args_widgets['gd_location']) && geodir_is_page('search') && !empty($_REQUEST['sgeo_lat']) && !empty($_REQUEST['sgeo_lon'])) { |
|
1132 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true; |
|
1133 | 1133 | |
1134 | - if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1135 | - $orderby = "distance ASC, " . $orderby; |
|
1134 | + if ($location_allowed && ($snear != '' || $gd_session->get('all_near_me'))) { |
|
1135 | + $orderby = "distance ASC, ".$orderby; |
|
1136 | 1136 | } |
1137 | 1137 | } |
1138 | 1138 | |
@@ -1147,23 +1147,23 @@ discard block |
||
1147 | 1147 | * @return string Filtered url. |
1148 | 1148 | */ |
1149 | 1149 | function geodir_search_page_base_url() { |
1150 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1151 | - remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
1150 | + if (function_exists('geodir_location_geo_home_link')) { |
|
1151 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) { |
|
1154 | + if (defined('DOING_AJAX') && DOING_AJAX && geodir_is_wpml()) { |
|
1155 | 1155 | $url = icl_get_home_url(); |
1156 | 1156 | } else { |
1157 | 1157 | $url = get_home_url(); |
1158 | 1158 | } |
1159 | 1159 | |
1160 | - $url = trailingslashit( $url ); |
|
1160 | + $url = trailingslashit($url); |
|
1161 | 1161 | |
1162 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
1163 | - add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
1162 | + if (function_exists('geodir_location_geo_home_link')) { |
|
1163 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | - return apply_filters( 'geodir_search_page_base_url', $url ); |
|
1166 | + return apply_filters('geodir_search_page_base_url', $url); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | /** |
@@ -1171,9 +1171,9 @@ discard block |
||
1171 | 1171 | * |
1172 | 1172 | * @since 1.6.31 |
1173 | 1173 | */ |
1174 | -function geodir_jetpack_fix_post_types_search(){ |
|
1175 | - if ( defined( 'JETPACK__VERSION' ) && ! empty( $_REQUEST['geodir_search'] ) ) { |
|
1176 | - add_filter( 'jetpack_search_should_handle_query', '__return_false', 999, 1 ); |
|
1174 | +function geodir_jetpack_fix_post_types_search() { |
|
1175 | + if (defined('JETPACK__VERSION') && !empty($_REQUEST['geodir_search'])) { |
|
1176 | + add_filter('jetpack_search_should_handle_query', '__return_false', 999, 1); |
|
1177 | 1177 | } |
1178 | 1178 | } |
1179 | -add_action( 'plugins_loaded','geodir_jetpack_fix_post_types_search', 10 ); |
|
1180 | 1179 | \ No newline at end of file |
1180 | +add_action('plugins_loaded', 'geodir_jetpack_fix_post_types_search', 10); |
|
1181 | 1181 | \ No newline at end of file |
@@ -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 | |
@@ -762,10 +771,11 @@ discard block |
||
762 | 771 | |
763 | 772 | $where = ''; |
764 | 773 | $better_search_terms = ''; |
765 | - if (isset($_REQUEST['stype'])) |
|
766 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
767 | - else |
|
768 | - $post_types = 'gd_place'; |
|
774 | + if (isset($_REQUEST['stype'])) { |
|
775 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
776 | + } else { |
|
777 | + $post_types = 'gd_place'; |
|
778 | + } |
|
769 | 779 | |
770 | 780 | if ($s != '') { |
771 | 781 | $keywords = explode(" ", $s); |
@@ -802,7 +812,7 @@ discard block |
||
802 | 812 | if($taxonomies) { |
803 | 813 | $taxonomies = implode("','", $taxonomies); |
804 | 814 | $taxonomies = "'" . $taxonomies . "'"; |
805 | - }else{$taxonomies='';} |
|
815 | + } else{$taxonomies='';} |
|
806 | 816 | |
807 | 817 | $content_where = $terms_where = ''; |
808 | 818 | $terms_sql = ''; |
@@ -943,8 +953,9 @@ discard block |
||
943 | 953 | $user_fav_posts = geodir_get_user_favourites($user_id); |
944 | 954 | $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1'; |
945 | 955 | $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')"; |
946 | - } else |
|
947 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
956 | + } else { |
|
957 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
958 | + } |
|
948 | 959 | |
949 | 960 | if ($user_id == (int)get_current_user_id()) { |
950 | 961 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |