@@ -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 |
@@ -159,12 +159,12 @@ |
||
159 | 159 | $messages = array(); |
160 | 160 | |
161 | 161 | $site_id = ''; |
162 | - if ( is_multisite() ) { |
|
163 | - $blog_id = get_current_blog_id(); |
|
164 | - if ( $blog_id && $blog_id != '1' ) { |
|
162 | + if ( is_multisite() ) { |
|
163 | + $blog_id = get_current_blog_id(); |
|
164 | + if ( $blog_id && $blog_id != '1' ) { |
|
165 | 165 | $site_id = '_' . $blog_id; |
166 | 166 | } |
167 | - } |
|
167 | + } |
|
168 | 168 | |
169 | 169 | if ( delete_user_meta( $user->ID, 'gd_user_favourite_post' . $site_id ) ) { |
170 | 170 | $messages[] = __( 'Removed "Favorite Listings" data from user.', 'geodirectory' ); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Erasers Class. |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param int $page Review page. |
23 | 23 | * @return array |
24 | 24 | */ |
25 | - public static function review_data_eraser( $email_address, $page ) { |
|
25 | + public static function review_data_eraser($email_address, $page) { |
|
26 | 26 | global $wpdb; |
27 | 27 | |
28 | 28 | $response = array( |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'done' => true, |
33 | 33 | ); |
34 | 34 | |
35 | - if ( empty( $email_address ) ) { |
|
35 | + if (empty($email_address)) { |
|
36 | 36 | return $response; |
37 | 37 | } |
38 | 38 | |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | $items_removed = false; |
41 | 41 | $items_retained = false; |
42 | 42 | |
43 | - $reviews = self::reviews_by_author( $email_address, $page ); |
|
43 | + $reviews = self::reviews_by_author($email_address, $page); |
|
44 | 44 | |
45 | - if ( empty( $reviews ) ) { |
|
45 | + if (empty($reviews)) { |
|
46 | 46 | return $response; |
47 | 47 | } |
48 | 48 | |
49 | - $messages = array(); |
|
49 | + $messages = array(); |
|
50 | 50 | |
51 | - foreach ( $reviews as $review ) { |
|
51 | + foreach ($reviews as $review) { |
|
52 | 52 | $anonymized_review = array(); |
53 | 53 | $anonymized_review['user_id'] = 0; |
54 | - $anonymized_review['rating_ip'] = wp_privacy_anonymize_data( 'ip', $review->rating_ip ); |
|
54 | + $anonymized_review['rating_ip'] = wp_privacy_anonymize_data('ip', $review->rating_ip); |
|
55 | 55 | |
56 | 56 | $review_id = (int) $review->id; |
57 | 57 | |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * @param object $review Review object. |
66 | 66 | * @param array $anonymized_review Anonymized review data. |
67 | 67 | */ |
68 | - $anon_message = apply_filters( 'geodir_anonymize_post_review', true, $review, $anonymized_review ); |
|
68 | + $anon_message = apply_filters('geodir_anonymize_post_review', true, $review, $anonymized_review); |
|
69 | 69 | |
70 | - if ( true !== $anon_message ) { |
|
71 | - if ( $anon_message && is_string( $anon_message ) ) { |
|
72 | - $messages[] = esc_html( $anon_message ); |
|
70 | + if (true !== $anon_message) { |
|
71 | + if ($anon_message && is_string($anon_message)) { |
|
72 | + $messages[] = esc_html($anon_message); |
|
73 | 73 | } else { |
74 | 74 | /* translators: %d: Review ID */ |
75 | - $messages[] = sprintf( __( 'Review %d contains personal data but could not be anonymized.', 'geodirectory' ), $review_id ); |
|
75 | + $messages[] = sprintf(__('Review %d contains personal data but could not be anonymized.', 'geodirectory'), $review_id); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $items_retained = true; |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | 'id' => $review_id, |
85 | 85 | ); |
86 | 86 | |
87 | - $updated = $wpdb->update( GEODIR_REVIEW_TABLE, $anonymized_review, $args ); |
|
87 | + $updated = $wpdb->update(GEODIR_REVIEW_TABLE, $anonymized_review, $args); |
|
88 | 88 | |
89 | - if ( $updated ) { |
|
89 | + if ($updated) { |
|
90 | 90 | $items_removed = true; |
91 | 91 | } else { |
92 | 92 | $items_retained = true; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - $done = count( $reviews ) < $number; |
|
96 | + $done = count($reviews) < $number; |
|
97 | 97 | |
98 | 98 | return array( |
99 | 99 | 'items_removed' => $items_removed, |
@@ -103,29 +103,29 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | - public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) { |
|
106 | + public static function reviews_by_author($email_address, $page, $posts_per_page = 10) { |
|
107 | 107 | global $wpdb; |
108 | 108 | |
109 | - if ( empty( $email_address ) || empty( $page ) ) { |
|
109 | + if (empty($email_address) || empty($page)) { |
|
110 | 110 | return array(); |
111 | 111 | } |
112 | 112 | |
113 | - $user = get_user_by( 'email', $email_address ); |
|
114 | - if ( empty( $user ) ) { |
|
113 | + $user = get_user_by('email', $email_address); |
|
114 | + if (empty($user)) { |
|
115 | 115 | return array(); |
116 | 116 | } |
117 | 117 | |
118 | - if ( absint( $page ) < 1 ) { |
|
118 | + if (absint($page) < 1) { |
|
119 | 119 | $page = 1; |
120 | 120 | } |
121 | 121 | |
122 | - $limit = absint( ( $page - 1 ) * $posts_per_page ) . ", " . $posts_per_page; |
|
122 | + $limit = absint(($page - 1) * $posts_per_page).", ".$posts_per_page; |
|
123 | 123 | |
124 | - $query = $wpdb->prepare( "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d ORDER BY comment_id ASC LIMIT " . $limit, array( $user->ID ) ); |
|
124 | + $query = $wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d ORDER BY comment_id ASC LIMIT ".$limit, array($user->ID)); |
|
125 | 125 | |
126 | - $reviews = $wpdb->get_results( $query ); |
|
126 | + $reviews = $wpdb->get_results($query); |
|
127 | 127 | |
128 | - return apply_filters( 'geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page ); |
|
128 | + return apply_filters('geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param int $page Page number. |
138 | 138 | * @return array |
139 | 139 | */ |
140 | - public static function favorites_data_eraser( $email_address, $page ) { |
|
140 | + public static function favorites_data_eraser($email_address, $page) { |
|
141 | 141 | $response = array( |
142 | 142 | 'items_removed' => false, |
143 | 143 | 'items_retained' => false, |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | 'done' => true, |
146 | 146 | ); |
147 | 147 | |
148 | - if ( empty( $email_address ) ) { |
|
148 | + if (empty($email_address)) { |
|
149 | 149 | return $response; |
150 | 150 | } |
151 | 151 | |
152 | - $user = get_user_by( 'email', $email_address ); |
|
153 | - if ( empty( $user ) ) { |
|
152 | + $user = get_user_by('email', $email_address); |
|
153 | + if (empty($user)) { |
|
154 | 154 | return $response; |
155 | 155 | } |
156 | 156 | |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | $messages = array(); |
160 | 160 | |
161 | 161 | $site_id = ''; |
162 | - if ( is_multisite() ) { |
|
162 | + if (is_multisite()) { |
|
163 | 163 | $blog_id = get_current_blog_id(); |
164 | - if ( $blog_id && $blog_id != '1' ) { |
|
165 | - $site_id = '_' . $blog_id; |
|
164 | + if ($blog_id && $blog_id != '1') { |
|
165 | + $site_id = '_'.$blog_id; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( delete_user_meta( $user->ID, 'gd_user_favourite_post' . $site_id ) ) { |
|
170 | - $messages[] = __( 'Removed "Favorite Listings" data from user.', 'geodirectory' ); |
|
169 | + if (delete_user_meta($user->ID, 'gd_user_favourite_post'.$site_id)) { |
|
170 | + $messages[] = __('Removed "Favorite Listings" data from user.', 'geodirectory'); |
|
171 | 171 | $items_removed = true; |
172 | 172 | } |
173 | 173 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Exporters Class. |
@@ -23,32 +23,32 @@ discard block |
||
23 | 23 | * @param int $page Page. |
24 | 24 | * @return array An array of personal data in name value pairs |
25 | 25 | */ |
26 | - public static function post_data_exporter( $email_address, $page ) { |
|
27 | - $post_type = GeoDir_Privacy::exporter_post_type(); |
|
26 | + public static function post_data_exporter($email_address, $page) { |
|
27 | + $post_type = GeoDir_Privacy::exporter_post_type(); |
|
28 | 28 | |
29 | 29 | $done = false; |
30 | 30 | $page = (int) $page; |
31 | 31 | $data_to_export = array(); |
32 | 32 | |
33 | - $posts = self::posts_by_author( $email_address, $post_type, $page ); |
|
33 | + $posts = self::posts_by_author($email_address, $post_type, $page); |
|
34 | 34 | |
35 | - if ( 0 < count( $posts ) ) { |
|
36 | - $obj_post_type = get_post_type_object( $post_type ); |
|
35 | + if (0 < count($posts)) { |
|
36 | + $obj_post_type = get_post_type_object($post_type); |
|
37 | 37 | |
38 | - foreach ( $posts as $post_ID ) { |
|
39 | - $gd_post = geodir_get_post_info( $post_ID ); |
|
40 | - if ( empty( $gd_post ) ) { |
|
38 | + foreach ($posts as $post_ID) { |
|
39 | + $gd_post = geodir_get_post_info($post_ID); |
|
40 | + if (empty($gd_post)) { |
|
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $data_to_export[] = array( |
45 | - 'group_id' => 'geodirectory-post-' . $post_type, |
|
46 | - 'group_label' => __( $obj_post_type->labels->name, 'geodirectory' ), |
|
47 | - 'item_id' => 'post-' . $post_ID, |
|
48 | - 'data' => self::get_post_personal_data( $gd_post ), |
|
45 | + 'group_id' => 'geodirectory-post-'.$post_type, |
|
46 | + 'group_label' => __($obj_post_type->labels->name, 'geodirectory'), |
|
47 | + 'item_id' => 'post-'.$post_ID, |
|
48 | + 'data' => self::get_post_personal_data($gd_post), |
|
49 | 49 | ); |
50 | 50 | } |
51 | - $done = 10 > count( $posts ); |
|
51 | + $done = 10 > count($posts); |
|
52 | 52 | } else { |
53 | 53 | $done = true; |
54 | 54 | } |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | * @param WP_Post $gd_post The post object. |
67 | 67 | * @return array |
68 | 68 | */ |
69 | - protected static function get_post_personal_data( $gd_post ) { |
|
69 | + protected static function get_post_personal_data($gd_post) { |
|
70 | 70 | $post_categories = array(); |
71 | 71 | $post_tags = array(); |
72 | 72 | $default_category = ''; |
73 | 73 | |
74 | - $cat_taxonomy = $gd_post->post_type . 'category'; |
|
75 | - $tag_taxonomy = $gd_post->post_type . '_tags'; |
|
74 | + $cat_taxonomy = $gd_post->post_type.'category'; |
|
75 | + $tag_taxonomy = $gd_post->post_type.'_tags'; |
|
76 | 76 | |
77 | - $post_terms = wp_get_post_terms( $gd_post->ID, array( $cat_taxonomy, $tag_taxonomy ) ); |
|
78 | - if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) { |
|
79 | - foreach ( $post_terms as $term ) { |
|
80 | - if ( $term->taxonomy == $cat_taxonomy ) { |
|
77 | + $post_terms = wp_get_post_terms($gd_post->ID, array($cat_taxonomy, $tag_taxonomy)); |
|
78 | + if (!empty($post_terms) && !is_wp_error($post_terms)) { |
|
79 | + foreach ($post_terms as $term) { |
|
80 | + if ($term->taxonomy == $cat_taxonomy) { |
|
81 | 81 | $post_categories[] = $term->name; |
82 | 82 | } else { |
83 | 83 | $post_tags[] = $term->name; |
84 | 84 | } |
85 | 85 | |
86 | - if ( $gd_post->default_category == $term->term_id ) { |
|
86 | + if ($gd_post->default_category == $term->term_id) { |
|
87 | 87 | $default_category = $term->name; |
88 | 88 | } |
89 | 89 | } |
@@ -91,189 +91,189 @@ discard block |
||
91 | 91 | |
92 | 92 | $personal_data = array(); |
93 | 93 | $personal_data[] = array( |
94 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
94 | + 'name' => __('Post ID', 'geodirectory'), |
|
95 | 95 | 'value' => $gd_post->ID, |
96 | 96 | ); |
97 | 97 | $personal_data[] = array( |
98 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
98 | + 'name' => __('Post Title', 'geodirectory'), |
|
99 | 99 | 'value' => $gd_post->post_title, |
100 | 100 | ); |
101 | 101 | $personal_data[] = array( |
102 | - 'name' => __( 'Post Description', 'geodirectory' ), |
|
102 | + 'name' => __('Post Description', 'geodirectory'), |
|
103 | 103 | 'value' => $gd_post->post_content, |
104 | 104 | ); |
105 | 105 | $personal_data[] = array( |
106 | - 'name' => __( 'Post Date', 'geodirectory' ), |
|
106 | + 'name' => __('Post Date', 'geodirectory'), |
|
107 | 107 | 'value' => $gd_post->post_date, |
108 | 108 | ); |
109 | - if ( ! empty( $gd_post->post_modified ) && $gd_post->post_modified != '0000-00-00 00:00:00' ) { |
|
109 | + if (!empty($gd_post->post_modified) && $gd_post->post_modified != '0000-00-00 00:00:00') { |
|
110 | 110 | $personal_data[] = array( |
111 | - 'name' => __( 'Post Modified Date', 'geodirectory' ), |
|
111 | + 'name' => __('Post Modified Date', 'geodirectory'), |
|
112 | 112 | 'value' => $gd_post->post_modified, |
113 | 113 | ); |
114 | 114 | } |
115 | 115 | $personal_data[] = array( |
116 | - 'name' => __( 'Post Status', 'geodirectory' ), |
|
116 | + 'name' => __('Post Status', 'geodirectory'), |
|
117 | 117 | 'value' => $gd_post->post_status, |
118 | 118 | ); |
119 | - if ( ! empty( $gd_post->submit_ip ) ) { |
|
119 | + if (!empty($gd_post->submit_ip)) { |
|
120 | 120 | $personal_data[] = array( |
121 | - 'name' => __( 'Submit IP', 'geodirectory' ), |
|
121 | + 'name' => __('Submit IP', 'geodirectory'), |
|
122 | 122 | 'value' => $gd_post->submit_ip, |
123 | 123 | ); |
124 | 124 | } |
125 | 125 | $personal_data[] = array( |
126 | - 'name' => __( 'Post Categories', 'geodirectory' ), |
|
127 | - 'value' => ( ! empty( $post_categories ) ? implode( ', ', $post_categories ) : '' ), |
|
126 | + 'name' => __('Post Categories', 'geodirectory'), |
|
127 | + 'value' => (!empty($post_categories) ? implode(', ', $post_categories) : ''), |
|
128 | 128 | ); |
129 | - if ( $default_category ) { |
|
129 | + if ($default_category) { |
|
130 | 130 | $personal_data[] = array( |
131 | - 'name' => __( 'Default Category', 'geodirectory' ), |
|
131 | + 'name' => __('Default Category', 'geodirectory'), |
|
132 | 132 | 'value' => $default_category, |
133 | 133 | ); |
134 | 134 | } |
135 | - if ( ! empty( $post_tags ) ) { |
|
135 | + if (!empty($post_tags)) { |
|
136 | 136 | $personal_data[] = array( |
137 | - 'name' => __( 'Post Tags', 'geodirectory' ), |
|
138 | - 'value' => implode( ', ', $post_tags ), |
|
137 | + 'name' => __('Post Tags', 'geodirectory'), |
|
138 | + 'value' => implode(', ', $post_tags), |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | $personal_data[] = array( |
142 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
143 | - 'value' => get_permalink( $gd_post->ID ), |
|
142 | + 'name' => __('Post URL', 'geodirectory'), |
|
143 | + 'value' => get_permalink($gd_post->ID), |
|
144 | 144 | ); |
145 | 145 | |
146 | 146 | // Post Images |
147 | - $post_images = geodir_get_images( $gd_post->ID ); |
|
148 | - if ( ! empty( $post_images ) ) { |
|
147 | + $post_images = geodir_get_images($gd_post->ID); |
|
148 | + if (!empty($post_images)) { |
|
149 | 149 | $images = array(); |
150 | - foreach ( $post_images as $key => $post_image ) { |
|
151 | - if ( ! empty( $post_image->src ) ) { |
|
150 | + foreach ($post_images as $key => $post_image) { |
|
151 | + if (!empty($post_image->src)) { |
|
152 | 152 | $images[] = $post_image->src; |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - if ( ! empty( $images ) ) { |
|
156 | + if (!empty($images)) { |
|
157 | 157 | $personal_data[] = array( |
158 | - 'name' => __( 'Post Images', 'geodirectory' ), |
|
159 | - 'value' => self::parse_files_value( $images ), |
|
158 | + 'name' => __('Post Images', 'geodirectory'), |
|
159 | + 'value' => self::parse_files_value($images), |
|
160 | 160 | ); |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | // Post Rating |
165 | - $post_rating = geodir_get_post_rating( $gd_post->ID ); |
|
166 | - if ( $post_rating > 0 ) { |
|
167 | - $post_rating = ( is_float( $post_rating) || ( strpos( $post_rating, ".", 1 ) == 1 && strlen( $post_rating ) > 3 ) ) ? number_format( $post_rating, 1, '.', '' ) : $post_rating; |
|
165 | + $post_rating = geodir_get_post_rating($gd_post->ID); |
|
166 | + if ($post_rating > 0) { |
|
167 | + $post_rating = (is_float($post_rating) || (strpos($post_rating, ".", 1) == 1 && strlen($post_rating) > 3)) ? number_format($post_rating, 1, '.', '') : $post_rating; |
|
168 | 168 | $personal_data[] = array( |
169 | - 'name' => __( 'Post Rating', 'geodirectory' ), |
|
170 | - 'value' => $post_rating . ' / 5', |
|
169 | + 'name' => __('Post Rating', 'geodirectory'), |
|
170 | + 'value' => $post_rating.' / 5', |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
174 | 174 | // Post Reviews |
175 | - $post_reviews = geodir_get_review_count_total( $gd_post->ID ); |
|
176 | - if ( $post_reviews > 0 ) { |
|
175 | + $post_reviews = geodir_get_review_count_total($gd_post->ID); |
|
176 | + if ($post_reviews > 0) { |
|
177 | 177 | $personal_data[] = array( |
178 | - 'name' => __( 'Post Reviews', 'geodirectory' ), |
|
178 | + 'name' => __('Post Reviews', 'geodirectory'), |
|
179 | 179 | 'value' => $post_reviews, |
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( $gd_post->is_featured ) ) { |
|
183 | + if (!empty($gd_post->is_featured)) { |
|
184 | 184 | $personal_data[] = array( |
185 | - 'name' => __( 'Post Featured', 'geodirectory' ), |
|
186 | - 'value' => __( 'Yes', 'geodirectory' ), |
|
185 | + 'name' => __('Post Featured', 'geodirectory'), |
|
186 | + 'value' => __('Yes', 'geodirectory'), |
|
187 | 187 | ); |
188 | 188 | } |
189 | 189 | |
190 | - $custom_fields = geodir_post_custom_fields( $gd_post->package_id, 'all', $gd_post->post_type ); |
|
191 | - $post_fields = array_keys( (array) $gd_post ); |
|
190 | + $custom_fields = geodir_post_custom_fields($gd_post->package_id, 'all', $gd_post->post_type); |
|
191 | + $post_fields = array_keys((array) $gd_post); |
|
192 | 192 | |
193 | - foreach ( $custom_fields as $key => $field ) { |
|
194 | - $field_name = ! empty( $field['htmlvar_name'] ) ? $field['htmlvar_name'] : ''; |
|
195 | - if ( empty( $field_name ) ) { |
|
193 | + foreach ($custom_fields as $key => $field) { |
|
194 | + $field_name = !empty($field['htmlvar_name']) ? $field['htmlvar_name'] : ''; |
|
195 | + if (empty($field_name)) { |
|
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | |
199 | - $field = stripslashes_deep( $field ); |
|
199 | + $field = stripslashes_deep($field); |
|
200 | 200 | |
201 | - $extra_fields = ! empty( $field['extra_fields'] ) ? $field['extra_fields'] : array(); |
|
201 | + $extra_fields = !empty($field['extra_fields']) ? $field['extra_fields'] : array(); |
|
202 | 202 | $data_type = $field['data_type']; |
203 | 203 | $field_type = $field['field_type']; |
204 | - $field_title = $field['site_title']; |
|
205 | - if ( $field_name == 'post' ) { |
|
204 | + $field_title = $field['site_title']; |
|
205 | + if ($field_name == 'post') { |
|
206 | 206 | $field_name = 'post_address'; |
207 | 207 | } |
208 | 208 | |
209 | - if ( ! in_array( $field_name, $post_fields ) ) { |
|
209 | + if (!in_array($field_name, $post_fields)) { |
|
210 | 210 | continue; |
211 | 211 | } |
212 | 212 | |
213 | 213 | $name = $field_title; |
214 | 214 | $value = ''; |
215 | - switch ( $field_type ) { |
|
215 | + switch ($field_type) { |
|
216 | 216 | case 'address': |
217 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $gd_post->post_type ) ? false : true; |
|
218 | - if ( $location_allowed && ! empty( $gd_post->post_country ) && ! empty( $gd_post->post_region ) && ! empty( $gd_post->post_city ) ) { |
|
217 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($gd_post->post_type) ? false : true; |
|
218 | + if ($location_allowed && !empty($gd_post->post_country) && !empty($gd_post->post_region) && !empty($gd_post->post_city)) { |
|
219 | 219 | $personal_data[] = array( |
220 | - 'name' => __( 'Post Address', 'geodirectory' ), |
|
220 | + 'name' => __('Post Address', 'geodirectory'), |
|
221 | 221 | 'value' => $gd_post->post_address, |
222 | 222 | ); |
223 | 223 | $personal_data[] = array( |
224 | - 'name' => __( 'Post City', 'geodirectory' ), |
|
224 | + 'name' => __('Post City', 'geodirectory'), |
|
225 | 225 | 'value' => $gd_post->post_city, |
226 | 226 | ); |
227 | 227 | $personal_data[] = array( |
228 | - 'name' => __( 'Post Region', 'geodirectory' ), |
|
228 | + 'name' => __('Post Region', 'geodirectory'), |
|
229 | 229 | 'value' => $gd_post->post_region, |
230 | 230 | ); |
231 | 231 | $personal_data[] = array( |
232 | - 'name' => __( 'Post Country', 'geodirectory' ), |
|
232 | + 'name' => __('Post Country', 'geodirectory'), |
|
233 | 233 | 'value' => $gd_post->post_country, |
234 | 234 | ); |
235 | 235 | $personal_data[] = array( |
236 | - 'name' => __( 'Post Zip', 'geodirectory' ), |
|
236 | + 'name' => __('Post Zip', 'geodirectory'), |
|
237 | 237 | 'value' => $gd_post->post_zip, |
238 | 238 | ); |
239 | 239 | $personal_data[] = array( |
240 | - 'name' => __( 'Post Latitude', 'geodirectory' ), |
|
240 | + 'name' => __('Post Latitude', 'geodirectory'), |
|
241 | 241 | 'value' => $gd_post->post_latitude, |
242 | 242 | ); |
243 | 243 | $personal_data[] = array( |
244 | - 'name' => __( 'Post Longitude', 'geodirectory' ), |
|
244 | + 'name' => __('Post Longitude', 'geodirectory'), |
|
245 | 245 | 'value' => $gd_post->post_longitude, |
246 | 246 | ); |
247 | - if ( ! empty( $gd_post->post_neighbourhood ) ) { |
|
247 | + if (!empty($gd_post->post_neighbourhood)) { |
|
248 | 248 | $personal_data[] = array( |
249 | - 'name' => __( 'Post Neighbourhood', 'geodirectory' ), |
|
249 | + 'name' => __('Post Neighbourhood', 'geodirectory'), |
|
250 | 250 | 'value' => $gd_post->post_neighbourhood, |
251 | 251 | ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | break; |
255 | 255 | case 'checkbox': |
256 | - if ( ! empty( $gd_post->{$field_name} ) ) { |
|
257 | - $value = __( 'Yes', 'geodirectory' ); |
|
256 | + if (!empty($gd_post->{$field_name} )) { |
|
257 | + $value = __('Yes', 'geodirectory'); |
|
258 | 258 | } else { |
259 | - $value = __( 'No', 'geodirectory' ); |
|
259 | + $value = __('No', 'geodirectory'); |
|
260 | 260 | } |
261 | 261 | break; |
262 | 262 | case 'datepicker': |
263 | 263 | $value = $gd_post->{$field_name} != '0000-00-00' ? $gd_post->{$field_name} : ''; |
264 | 264 | break; |
265 | 265 | case 'radio': |
266 | - if ( $gd_post->{$field_name} !== '' ) { |
|
267 | - if ( $gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
268 | - $value = __( 'No', 'geodirectory' ); |
|
269 | - } else if ( $gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
270 | - $value = __( 'Yes', 'geodirectory' ); |
|
266 | + if ($gd_post->{$field_name} !== '') { |
|
267 | + if ($gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
268 | + $value = __('No', 'geodirectory'); |
|
269 | + } else if ($gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
270 | + $value = __('Yes', 'geodirectory'); |
|
271 | 271 | } else { |
272 | - if ( !empty( $field['option_values'] ) ) { |
|
273 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
274 | - if ( ! empty( $cf_option_values ) ) { |
|
275 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
276 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
272 | + if (!empty($field['option_values'])) { |
|
273 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
274 | + if (!empty($cf_option_values)) { |
|
275 | + foreach ($cf_option_values as $cf_option_value) { |
|
276 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
277 | 277 | $value = $cf_option_value['label']; |
278 | 278 | } |
279 | 279 | } |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case 'select': |
286 | - $value = __( $gd_post->{$field_name}, 'geodirectory'); |
|
287 | - if ( !empty( $field['option_values'] ) ) { |
|
288 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
289 | - if ( ! empty( $cf_option_values ) ) { |
|
290 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
291 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
286 | + $value = __($gd_post->{$field_name}, 'geodirectory'); |
|
287 | + if (!empty($field['option_values'])) { |
|
288 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
289 | + if (!empty($cf_option_values)) { |
|
290 | + foreach ($cf_option_values as $cf_option_value) { |
|
291 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
292 | 292 | $value = $cf_option_value['label']; |
293 | 293 | } |
294 | 294 | } |
@@ -296,23 +296,23 @@ discard block |
||
296 | 296 | } |
297 | 297 | break; |
298 | 298 | case 'multiselect': |
299 | - $field_values = explode( ',', trim( $gd_post->{$field_name}, "," ) ); |
|
300 | - if ( is_array( $field_values ) ) { |
|
301 | - $field_values = array_map( 'trim', $field_values ); |
|
299 | + $field_values = explode(',', trim($gd_post->{$field_name}, ",")); |
|
300 | + if (is_array($field_values)) { |
|
301 | + $field_values = array_map('trim', $field_values); |
|
302 | 302 | } |
303 | 303 | $values = array(); |
304 | - if ( ! empty( $field['option_values'] ) ) { |
|
305 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
304 | + if (!empty($field['option_values'])) { |
|
305 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
306 | 306 | |
307 | - if ( ! empty( $cf_option_values ) ) { |
|
308 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
309 | - if ( isset( $cf_option_value['value'] ) && in_array( $cf_option_value['value'], $field_values ) ) { |
|
307 | + if (!empty($cf_option_values)) { |
|
308 | + foreach ($cf_option_values as $cf_option_value) { |
|
309 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
310 | 310 | $values[] = $cf_option_value['label']; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
315 | - $value = ! empty( $values ) ? implode( ', ', $values ) : ''; |
|
315 | + $value = !empty($values) ? implode(', ', $values) : ''; |
|
316 | 316 | break; |
317 | 317 | case 'time': |
318 | 318 | $value = $gd_post->{$field_name} != '00:00:00' ? $gd_post->{$field_name} : ''; |
@@ -326,70 +326,70 @@ discard block |
||
326 | 326 | $value = $gd_post->{$field_name} ? $gd_post->{$field_name} : ''; |
327 | 327 | break; |
328 | 328 | case 'file': |
329 | - $files = explode( ",", $gd_post->{$field_name} ); |
|
330 | - if ( ! empty( $files ) ) { |
|
331 | - $allowed_file_types = !empty( $extra_fields['gd_file_types'] ) && is_array( $extra_fields['gd_file_types'] ) && !in_array( "*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
329 | + $files = explode(",", $gd_post->{$field_name} ); |
|
330 | + if (!empty($files)) { |
|
331 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : ''; |
|
332 | 332 | |
333 | 333 | $file_urls = array(); |
334 | - foreach ( $files as $file ) { |
|
335 | - if ( ! empty( $file ) ) { |
|
336 | - $image_name_arr = explode( '/', $file ); |
|
337 | - $curr_img_dir = $image_name_arr[ count( $image_name_arr ) - 2]; |
|
334 | + foreach ($files as $file) { |
|
335 | + if (!empty($file)) { |
|
336 | + $image_name_arr = explode('/', $file); |
|
337 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
338 | 338 | $filename = end($image_name_arr); |
339 | 339 | $img_name_arr = explode('.', $filename); |
340 | 340 | |
341 | - $arr_file_type = wp_check_filetype( $filename ); |
|
342 | - if ( empty( $arr_file_type['ext'] ) || empty( $arr_file_type['type'] ) ) { |
|
341 | + $arr_file_type = wp_check_filetype($filename); |
|
342 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | |
346 | 346 | $uploaded_file_type = $arr_file_type['type']; |
347 | 347 | $uploaded_file_ext = $arr_file_type['ext']; |
348 | 348 | |
349 | - if ( ! empty( $allowed_file_types ) && !in_array( $uploaded_file_ext, $allowed_file_types ) ) { |
|
349 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
350 | 350 | continue; // Invalid file type. |
351 | 351 | } |
352 | - $image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon' ); |
|
353 | - $audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' ); |
|
352 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
353 | + $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
354 | 354 | |
355 | 355 | // If the uploaded file is image |
356 | - if ( in_array( $uploaded_file_type, $image_file_types ) ) { |
|
356 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
357 | 357 | $file_urls[] = $file; |
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
361 | - $value = ! empty( $file_urls ) ? self::parse_files_value( $file_urls ) : ''; |
|
361 | + $value = !empty($file_urls) ? self::parse_files_value($file_urls) : ''; |
|
362 | 362 | } |
363 | 363 | break; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! empty( $name ) && $value !== '' ) { |
|
366 | + if (!empty($name) && $value !== '') { |
|
367 | 367 | $personal_data[] = array( |
368 | - 'name' => __( $name, 'geodirectory' ), |
|
368 | + 'name' => __($name, 'geodirectory'), |
|
369 | 369 | 'value' => $value, |
370 | 370 | ); |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! empty( $gd_post->geodir_link_business ) && ( $post_type = get_post_type( (int)$gd_post->geodir_link_business ) ) ) { |
|
374 | + if (!empty($gd_post->geodir_link_business) && ($post_type = get_post_type((int) $gd_post->geodir_link_business))) { |
|
375 | 375 | $personal_data[] = array( |
376 | - 'name' => __( 'Link Business Title', 'geodirectory' ), |
|
377 | - 'value' => get_the_title( (int)$gd_post->geodir_link_business ), |
|
376 | + 'name' => __('Link Business Title', 'geodirectory'), |
|
377 | + 'value' => get_the_title((int) $gd_post->geodir_link_business), |
|
378 | 378 | ); |
379 | 379 | $personal_data[] = array( |
380 | - 'name' => __( 'Link Business URL', 'geodirectory' ), |
|
381 | - 'value' => get_permalink( (int)$gd_post->geodir_link_business ), |
|
380 | + 'name' => __('Link Business URL', 'geodirectory'), |
|
381 | + 'value' => get_permalink((int) $gd_post->geodir_link_business), |
|
382 | 382 | ); |
383 | 383 | } |
384 | - if ( defined( 'GEODIR_FRANCHISE_VERSION' ) ) { |
|
385 | - if ( ! empty( $gd_post->franchise ) && ( $post_type = get_post_type( (int)$gd_post->franchise ) ) ) { |
|
384 | + if (defined('GEODIR_FRANCHISE_VERSION')) { |
|
385 | + if (!empty($gd_post->franchise) && ($post_type = get_post_type((int) $gd_post->franchise))) { |
|
386 | 386 | $personal_data[] = array( |
387 | - 'name' => __( 'Main Listing Title', 'geodirectory' ), |
|
388 | - 'value' => get_the_title( (int)$gd_post->franchise ), |
|
387 | + 'name' => __('Main Listing Title', 'geodirectory'), |
|
388 | + 'value' => get_the_title((int) $gd_post->franchise), |
|
389 | 389 | ); |
390 | 390 | $personal_data[] = array( |
391 | - 'name' => __( 'Main Listing URL', 'geodirectory' ), |
|
392 | - 'value' => get_permalink( (int)$gd_post->franchise ), |
|
391 | + 'name' => __('Main Listing URL', 'geodirectory'), |
|
392 | + 'value' => get_permalink((int) $gd_post->franchise), |
|
393 | 393 | ); |
394 | 394 | } |
395 | 395 | } |
@@ -401,28 +401,28 @@ discard block |
||
401 | 401 | * @param array $personal_data Array of name value pairs to expose in the export. |
402 | 402 | * @param WP_Post $gd_post The post object. |
403 | 403 | */ |
404 | - $personal_data = apply_filters( 'geodir_privacy_export_post_personal_data', $personal_data, $gd_post ); |
|
404 | + $personal_data = apply_filters('geodir_privacy_export_post_personal_data', $personal_data, $gd_post); |
|
405 | 405 | |
406 | 406 | return $personal_data; |
407 | 407 | } |
408 | 408 | |
409 | - public static function posts_by_author( $email_address, $post_type, $page ) { |
|
410 | - if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) { |
|
409 | + public static function posts_by_author($email_address, $post_type, $page) { |
|
410 | + if (empty($email_address) || empty($post_type) || empty($page)) { |
|
411 | 411 | return array(); |
412 | 412 | } |
413 | 413 | |
414 | - $user = get_user_by( 'email', $email_address ); |
|
415 | - if ( empty( $user ) ) { |
|
414 | + $user = get_user_by('email', $email_address); |
|
415 | + if (empty($user)) { |
|
416 | 416 | return array(); |
417 | 417 | } |
418 | 418 | |
419 | - $statuses = array_keys( get_post_statuses() ); |
|
419 | + $statuses = array_keys(get_post_statuses()); |
|
420 | 420 | $skip_statuses = geodir_imex_export_skip_statuses(); |
421 | - if ( ! empty( $skip_statuses ) ) { |
|
422 | - $statuses = array_diff( $statuses, $skip_statuses ); |
|
421 | + if (!empty($skip_statuses)) { |
|
422 | + $statuses = array_diff($statuses, $skip_statuses); |
|
423 | 423 | } |
424 | 424 | |
425 | - $query_args = array( |
|
425 | + $query_args = array( |
|
426 | 426 | 'post_type' => $post_type, |
427 | 427 | 'post_status' => $statuses, |
428 | 428 | 'fields' => 'ids', |
@@ -433,66 +433,66 @@ discard block |
||
433 | 433 | 'order' => 'ASC' |
434 | 434 | ); |
435 | 435 | |
436 | - $query_args = apply_filters( 'geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page ); |
|
436 | + $query_args = apply_filters('geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page); |
|
437 | 437 | |
438 | - $posts = get_posts( $query_args ); |
|
438 | + $posts = get_posts($query_args); |
|
439 | 439 | |
440 | - return apply_filters( 'geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page ); |
|
440 | + return apply_filters('geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page); |
|
441 | 441 | } |
442 | 442 | |
443 | - public static function review_data_exporter( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) { |
|
443 | + public static function review_data_exporter($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) { |
|
444 | 444 | global $wpdb; |
445 | 445 | |
446 | 446 | $exporter_key = GeoDir_Privacy::personal_data_exporter_key(); |
447 | 447 | |
448 | - if ( $exporter_key == 'wordpress-comments' && ! empty( $response['data'] ) ) { |
|
449 | - foreach ( $response['data'] as $key => $item ) { |
|
450 | - $comment_id = str_replace( 'comment-', '', $item['item_id'] ); |
|
448 | + if ($exporter_key == 'wordpress-comments' && !empty($response['data'])) { |
|
449 | + foreach ($response['data'] as $key => $item) { |
|
450 | + $comment_id = str_replace('comment-', '', $item['item_id']); |
|
451 | 451 | $data = $item['data']; |
452 | 452 | |
453 | - $review = geodir_get_review( $comment_id ); |
|
454 | - if ( ! empty( $review ) ) { |
|
455 | - if ( ! empty( $review->overall_rating ) ) { |
|
453 | + $review = geodir_get_review($comment_id); |
|
454 | + if (!empty($review)) { |
|
455 | + if (!empty($review->overall_rating)) { |
|
456 | 456 | $data[] = array( |
457 | - 'name' => __( 'Rating (Overall)', 'geodirectory' ), |
|
458 | - 'value' => (float)$review->overall_rating . ' / 5', |
|
457 | + 'name' => __('Rating (Overall)', 'geodirectory'), |
|
458 | + 'value' => (float) $review->overall_rating.' / 5', |
|
459 | 459 | ); |
460 | 460 | } |
461 | - if ( ! empty( $review->post_city ) ) { |
|
461 | + if (!empty($review->post_city)) { |
|
462 | 462 | $data[] = array( |
463 | - 'name' => __( 'Review City', 'geodirectory' ), |
|
463 | + 'name' => __('Review City', 'geodirectory'), |
|
464 | 464 | 'value' => $review->post_city, |
465 | 465 | ); |
466 | 466 | } |
467 | - if ( ! empty( $review->post_region ) ) { |
|
467 | + if (!empty($review->post_region)) { |
|
468 | 468 | $data[] = array( |
469 | - 'name' => __( 'Review Region', 'geodirectory' ), |
|
469 | + 'name' => __('Review Region', 'geodirectory'), |
|
470 | 470 | 'value' => $review->post_region, |
471 | 471 | ); |
472 | 472 | } |
473 | - if ( ! empty( $review->post_country ) ) { |
|
473 | + if (!empty($review->post_country)) { |
|
474 | 474 | $data[] = array( |
475 | - 'name' => __( 'Review Country', 'geodirectory' ), |
|
475 | + 'name' => __('Review Country', 'geodirectory'), |
|
476 | 476 | 'value' => $review->post_country, |
477 | 477 | ); |
478 | 478 | } |
479 | - if ( ! empty( $review->post_latitude ) ) { |
|
479 | + if (!empty($review->post_latitude)) { |
|
480 | 480 | $data[] = array( |
481 | - 'name' => __( 'Review Latitude', 'geodirectory' ), |
|
481 | + 'name' => __('Review Latitude', 'geodirectory'), |
|
482 | 482 | 'value' => $review->post_latitude, |
483 | 483 | ); |
484 | 484 | } |
485 | - if ( ! empty( $review->post_longitude ) ) { |
|
485 | + if (!empty($review->post_longitude)) { |
|
486 | 486 | $data[] = array( |
487 | - 'name' => __( 'Review Longitude', 'geodirectory' ), |
|
487 | + 'name' => __('Review Longitude', 'geodirectory'), |
|
488 | 488 | 'value' => $review->post_longitude, |
489 | 489 | ); |
490 | 490 | } |
491 | 491 | |
492 | - $data = apply_filters( 'geodir_privacy_export_review_data', $data, $review, $email_address ); |
|
492 | + $data = apply_filters('geodir_privacy_export_review_data', $data, $review, $email_address); |
|
493 | 493 | |
494 | - if ( ! empty( $data ) ) { |
|
495 | - $response['data'][ $key ]['data'] = $data; |
|
494 | + if (!empty($data)) { |
|
495 | + $response['data'][$key]['data'] = $data; |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | } |
@@ -508,36 +508,36 @@ discard block |
||
508 | 508 | * @param int $page Page. |
509 | 509 | * @return array An array of personal data in name value pairs |
510 | 510 | */ |
511 | - public static function favorites_data_exporter( $email_address, $page ) { |
|
511 | + public static function favorites_data_exporter($email_address, $page) { |
|
512 | 512 | $done = true; |
513 | 513 | $page = (int) $page; |
514 | 514 | $data_to_export = array(); |
515 | 515 | |
516 | - $items = GeoDir_Privacy::favorites_by_user( $email_address, $page ); |
|
516 | + $items = GeoDir_Privacy::favorites_by_user($email_address, $page); |
|
517 | 517 | |
518 | - if ( 0 < count( $items ) ) { |
|
519 | - foreach ( $items as $item ) { |
|
520 | - $gd_post = geodir_get_post_info( $item ); |
|
521 | - if ( empty( $gd_post ) ) { |
|
518 | + if (0 < count($items)) { |
|
519 | + foreach ($items as $item) { |
|
520 | + $gd_post = geodir_get_post_info($item); |
|
521 | + if (empty($gd_post)) { |
|
522 | 522 | continue; |
523 | 523 | } |
524 | 524 | |
525 | 525 | $data_to_export[] = array( |
526 | 526 | 'group_id' => 'geodirectory-post-favorites', |
527 | - 'group_label' => __( 'GeoDirectory Favorite Listings', 'geodirectory' ), |
|
528 | - 'item_id' => 'gd-favorite-' . $gd_post->ID, |
|
527 | + 'group_label' => __('GeoDirectory Favorite Listings', 'geodirectory'), |
|
528 | + 'item_id' => 'gd-favorite-'.$gd_post->ID, |
|
529 | 529 | 'data' => array( |
530 | 530 | array( |
531 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
531 | + 'name' => __('Post ID', 'geodirectory'), |
|
532 | 532 | 'value' => $gd_post->ID, |
533 | 533 | ), |
534 | 534 | array( |
535 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
535 | + 'name' => __('Post Title', 'geodirectory'), |
|
536 | 536 | 'value' => $gd_post->post_title, |
537 | 537 | ), |
538 | 538 | array( |
539 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
540 | - 'value' => get_permalink( $gd_post->ID ), |
|
539 | + 'name' => __('Post URL', 'geodirectory'), |
|
540 | + 'value' => get_permalink($gd_post->ID), |
|
541 | 541 | ) |
542 | 542 | ), |
543 | 543 | ); |
@@ -550,27 +550,27 @@ discard block |
||
550 | 550 | ); |
551 | 551 | } |
552 | 552 | |
553 | - public static function parse_files_value( $files ) { |
|
554 | - if ( empty( $files ) ) { |
|
553 | + public static function parse_files_value($files) { |
|
554 | + if (empty($files)) { |
|
555 | 555 | return ''; |
556 | 556 | } |
557 | 557 | |
558 | - if ( ! is_array( $files ) ) { |
|
558 | + if (!is_array($files)) { |
|
559 | 559 | return $files; |
560 | 560 | } |
561 | 561 | |
562 | - if ( count( $files ) == 1 ) { |
|
562 | + if (count($files) == 1) { |
|
563 | 563 | return $files[0]; |
564 | 564 | } |
565 | 565 | |
566 | 566 | $links = array(); |
567 | - foreach ( $files as $file ) { |
|
568 | - if ( false === strpos( $file, ' ' ) && ( 0 === strpos( $file, 'http://' ) || 0 === strpos( $file, 'https://' ) ) ) { |
|
569 | - $file = '<a href="' . esc_url( $file ) . '">' . esc_html( $file ) . '</a>'; |
|
567 | + foreach ($files as $file) { |
|
568 | + if (false === strpos($file, ' ') && (0 === strpos($file, 'http://') || 0 === strpos($file, 'https://'))) { |
|
569 | + $file = '<a href="'.esc_url($file).'">'.esc_html($file).'</a>'; |
|
570 | 570 | } |
571 | 571 | $links[] = $file; |
572 | 572 | } |
573 | - $links = ! empty( $links ) ? implode( ' <br> ', $links ) : ''; |
|
573 | + $links = !empty($links) ? implode(' <br> ', $links) : ''; |
|
574 | 574 | |
575 | 575 | return $links; |
576 | 576 | } |
@@ -2389,11 +2389,11 @@ |
||
2389 | 2389 | ?> |
2390 | 2390 | <input class="search_text" name="s" |
2391 | 2391 | value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) { |
2392 | - $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
2393 | - echo $search_term; |
|
2394 | - } else { |
|
2395 | - echo $default_search_for_text; |
|
2396 | - } ?>" type="text" |
|
2392 | + $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
2393 | + echo $search_term; |
|
2394 | + } else { |
|
2395 | + echo $default_search_for_text; |
|
2396 | + } ?>" type="text" |
|
2397 | 2397 | onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}" |
2398 | 2398 | onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}" |
2399 | 2399 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
@@ -52,31 +52,31 @@ discard block |
||
52 | 52 | jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600); |
53 | 53 | } |
54 | 54 | |
55 | - jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) { |
|
55 | + jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) { |
|
56 | 56 | //alert(data ); |
57 | 57 | }); |
58 | 58 | } |
59 | 59 | </script> |
60 | 60 | <div class="geodir-list-view-select"> |
61 | 61 | <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);"> |
62 | - <?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?> |
|
63 | - <option value=""><?php _e( 'View:', 'geodirectory' ); ?></option> |
|
62 | + <?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?> |
|
63 | + <option value=""><?php _e('View:', 'geodirectory'); ?></option> |
|
64 | 64 | <option |
65 | - value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option> |
|
65 | + value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option> |
|
66 | 66 | <option |
67 | - value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option> |
|
67 | + value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option> |
|
68 | 68 | <option |
69 | - value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option> |
|
69 | + value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option> |
|
70 | 70 | <option |
71 | - value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option> |
|
71 | + value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option> |
|
72 | 72 | <option |
73 | - value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option> |
|
73 | + value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option> |
|
74 | 74 | </select> |
75 | 75 | </div> |
76 | 76 | <?php |
77 | 77 | } |
78 | 78 | |
79 | -add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 ); |
|
79 | +add_action('geodir_before_listing', 'geodir_list_view_select', 100); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Limit the listing excerpt. |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | * @global object $post The current post object. |
92 | 92 | * @return string The modified excerpt. |
93 | 93 | */ |
94 | -function geodir_max_excerpt( $charlength ) { |
|
94 | +function geodir_max_excerpt($charlength) { |
|
95 | 95 | global $post; |
96 | - if ( $charlength == '0' ) { |
|
96 | + if ($charlength == '0') { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | $out = ''; |
@@ -101,46 +101,46 @@ discard block |
||
101 | 101 | $temp_post = $post; |
102 | 102 | $excerpt = get_the_excerpt(); |
103 | 103 | |
104 | - $charlength ++; |
|
105 | - $excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' ); |
|
106 | - if ( geodir_utf8_strlen( $excerpt ) > $charlength ) { |
|
107 | - if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) { |
|
108 | - $excut = - ( geodir_utf8_strlen( $excerpt_more ) ); |
|
109 | - $subex = geodir_utf8_substr( $excerpt, 0, $excut ); |
|
110 | - if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) { |
|
111 | - $subex = geodir_utf8_substr( $subex, 0, $charlength ); |
|
104 | + $charlength++; |
|
105 | + $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more(''); |
|
106 | + if (geodir_utf8_strlen($excerpt) > $charlength) { |
|
107 | + if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) { |
|
108 | + $excut = - (geodir_utf8_strlen($excerpt_more)); |
|
109 | + $subex = geodir_utf8_substr($excerpt, 0, $excut); |
|
110 | + if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) { |
|
111 | + $subex = geodir_utf8_substr($subex, 0, $charlength); |
|
112 | 112 | } |
113 | 113 | $out .= $subex; |
114 | 114 | } else { |
115 | - $subex = geodir_utf8_substr( $excerpt, 0, $charlength - 5 ); |
|
116 | - $exwords = explode( ' ', $subex ); |
|
117 | - $excut = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) ); |
|
118 | - if ( $excut < 0 ) { |
|
119 | - $out .= geodir_utf8_substr( $subex, 0, $excut ); |
|
115 | + $subex = geodir_utf8_substr($excerpt, 0, $charlength - 5); |
|
116 | + $exwords = explode(' ', $subex); |
|
117 | + $excut = - (geodir_utf8_strlen($exwords[count($exwords) - 1])); |
|
118 | + if ($excut < 0) { |
|
119 | + $out .= geodir_utf8_substr($subex, 0, $excut); |
|
120 | 120 | } else { |
121 | 121 | $out .= $subex; |
122 | 122 | } |
123 | 123 | } |
124 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
124 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
125 | 125 | /** |
126 | 126 | * Filter excerpt read more text. |
127 | 127 | * |
128 | 128 | * @since 1.0.0 |
129 | 129 | */ |
130 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
130 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory')); |
|
131 | 131 | $out .= '</a>'; |
132 | 132 | |
133 | 133 | } else { |
134 | - if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) { |
|
135 | - $excut = - ( geodir_utf8_strlen( $excerpt_more ) ); |
|
136 | - $out .= geodir_utf8_substr( $excerpt, 0, $excut ); |
|
137 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
134 | + if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) { |
|
135 | + $excut = - (geodir_utf8_strlen($excerpt_more)); |
|
136 | + $out .= geodir_utf8_substr($excerpt, 0, $excut); |
|
137 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
138 | 138 | /** |
139 | 139 | * Filter excerpt read more text. |
140 | 140 | * |
141 | 141 | * @since 1.0.0 |
142 | 142 | */ |
143 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
143 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory')); |
|
144 | 144 | $out .= '</a>'; |
145 | 145 | } else { |
146 | 146 | $out .= $excerpt; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return object Returns filtered package info as an object. |
165 | 165 | */ |
166 | -function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) { |
|
166 | +function geodir_post_package_info($package_info, $post = '', $post_type = '') { |
|
167 | 167 | $package_info['pid'] = 0; |
168 | 168 | $package_info['days'] = 0; |
169 | 169 | $package_info['amount'] = 0; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param object|string $post The post object. |
193 | 193 | * @param string $post_type The post type. |
194 | 194 | */ |
195 | - return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type ); |
|
195 | + return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | * |
221 | 221 | * } |
222 | 222 | */ |
223 | -function geodir_send_inquiry( $request ) { |
|
223 | +function geodir_send_inquiry($request) { |
|
224 | 224 | global $wpdb; |
225 | 225 | |
226 | 226 | // strip slashes from text |
227 | - $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; |
|
227 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
228 | 228 | |
229 | 229 | $yourname = sanitize_text_field($request['inq_name']); |
230 | 230 | $youremail = sanitize_email($request['inq_email']); |
@@ -232,25 +232,25 @@ discard block |
||
232 | 232 | $frnd_comments = sanitize_text_field($request['inq_msg']); |
233 | 233 | $pid = absint($request['pid']); |
234 | 234 | |
235 | - $author_id = ''; |
|
235 | + $author_id = ''; |
|
236 | 236 | |
237 | - if ( $pid && 'publish' == get_post_status ( $pid ) ) { |
|
237 | + if ($pid && 'publish' == get_post_status($pid)) { |
|
238 | 238 | |
239 | - check_ajax_referer( 'send_inquiry_'.$pid ); |
|
239 | + check_ajax_referer('send_inquiry_'.$pid); |
|
240 | 240 | |
241 | 241 | $p_post = get_post($pid); |
242 | 242 | |
243 | - $author_id = $p_post->post_author; |
|
243 | + $author_id = $p_post->post_author; |
|
244 | 244 | |
245 | - }else{ |
|
245 | + } else { |
|
246 | 246 | gd_die(); |
247 | 247 | } |
248 | 248 | |
249 | - $to_email = geodir_get_post_meta( $pid, 'geodir_email', true ); |
|
250 | - $to_name = geodir_get_client_name( $author_id ); |
|
249 | + $to_email = geodir_get_post_meta($pid, 'geodir_email', true); |
|
250 | + $to_name = geodir_get_client_name($author_id); |
|
251 | 251 | |
252 | - if ( $to_email == '' ) { |
|
253 | - $to_email = get_option( 'admin_email' ); |
|
252 | + if ($to_email == '') { |
|
253 | + $to_email = get_option('admin_email'); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * } |
272 | 272 | * @param string $type The form type, default: `Enquiry`. |
273 | 273 | */ |
274 | - do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' ); |
|
274 | + do_action('geodir_after_send_enquiry', $request, 'Enquiry'); |
|
275 | 275 | |
276 | 276 | $client_message = $frnd_comments; |
277 | - $client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.'; |
|
277 | + $client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.'; |
|
278 | 278 | /** |
279 | 279 | * Filter client message text. |
280 | 280 | * |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @param string $client_message Client message text. |
284 | 284 | */ |
285 | - $client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message ); |
|
285 | + $client_message = apply_filters('geodir_inquiry_email_msg', $client_message); |
|
286 | 286 | |
287 | 287 | /** |
288 | 288 | * Called before the send enquiry email is sent. |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | * |
302 | 302 | * } |
303 | 303 | */ |
304 | - do_action( 'geodir_before_send_enquiry_email', $request ); |
|
305 | - if ( $to_email ) { |
|
304 | + do_action('geodir_before_send_enquiry_email', $request); |
|
305 | + if ($to_email) { |
|
306 | 306 | // strip slashes message |
307 | - $client_message = stripslashes_deep( $client_message ); |
|
307 | + $client_message = stripslashes_deep($client_message); |
|
308 | 308 | |
309 | - geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email |
|
309 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | * |
327 | 327 | * } |
328 | 328 | */ |
329 | - do_action( 'geodir_after_send_enquiry_email', $request ); |
|
330 | - $url = get_permalink( $pid ); |
|
331 | - if ( strstr( $url, '?' ) ) { |
|
332 | - $url = $url . "&send_inquiry=success"; |
|
329 | + do_action('geodir_after_send_enquiry_email', $request); |
|
330 | + $url = get_permalink($pid); |
|
331 | + if (strstr($url, '?')) { |
|
332 | + $url = $url."&send_inquiry=success"; |
|
333 | 333 | } else { |
334 | - $url = $url . "?send_inquiry=success"; |
|
334 | + $url = $url."?send_inquiry=success"; |
|
335 | 335 | } |
336 | 336 | /** |
337 | 337 | * Filter redirect url after the send enquiry email is sent. |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @param string $url Redirect url. |
342 | 342 | */ |
343 | - $url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url ); |
|
344 | - wp_redirect( $url ); |
|
343 | + $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url); |
|
344 | + wp_redirect($url); |
|
345 | 345 | gd_die(); |
346 | 346 | |
347 | 347 | } |
@@ -372,11 +372,11 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @deprecated 1.6.26 |
374 | 374 | */ |
375 | -function geodir_send_friend( $request ) { |
|
375 | +function geodir_send_friend($request) { |
|
376 | 376 | global $wpdb; |
377 | 377 | |
378 | 378 | // strip slashes from text |
379 | - $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; |
|
379 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
380 | 380 | |
381 | 381 | $yourname = sanitize_text_field($request['yourname']); |
382 | 382 | $youremail = sanitize_email($request['youremail']); |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | $pid = absint($request['pid']); |
386 | 386 | $to_email = sanitize_email($request['to_email']); |
387 | 387 | $to_name = sanitize_text_field($request['to_name']); |
388 | - if ( $pid && 'publish' == get_post_status ( $pid ) ) { |
|
388 | + if ($pid && 'publish' == get_post_status($pid)) { |
|
389 | 389 | |
390 | - check_ajax_referer( 'send_to_frnd_'.$pid ); |
|
390 | + check_ajax_referer('send_to_frnd_'.$pid); |
|
391 | 391 | |
392 | - }else{ |
|
392 | + } else { |
|
393 | 393 | gd_die(); |
394 | 394 | } |
395 | 395 | |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | * |
413 | 413 | * } |
414 | 414 | */ |
415 | - do_action( 'geodir_before_send_to_friend_email', $request ); |
|
416 | - geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email |
|
415 | + do_action('geodir_before_send_to_friend_email', $request); |
|
416 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email |
|
417 | 417 | |
418 | 418 | /** |
419 | 419 | * Called after the send to friend email is sent. |
@@ -434,13 +434,13 @@ discard block |
||
434 | 434 | * |
435 | 435 | * } |
436 | 436 | */ |
437 | - do_action( 'geodir_after_send_to_friend_email', $request ); |
|
437 | + do_action('geodir_after_send_to_friend_email', $request); |
|
438 | 438 | |
439 | - $url = get_permalink( $pid ); |
|
440 | - if ( strstr( $url, '?' ) ) { |
|
441 | - $url = $url . "&sendtofrnd=success"; |
|
439 | + $url = get_permalink($pid); |
|
440 | + if (strstr($url, '?')) { |
|
441 | + $url = $url."&sendtofrnd=success"; |
|
442 | 442 | } else { |
443 | - $url = $url . "?sendtofrnd=success"; |
|
443 | + $url = $url."?sendtofrnd=success"; |
|
444 | 444 | } |
445 | 445 | /** |
446 | 446 | * Filter redirect url after the send to friend email is sent. |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @param string $url Redirect url. |
451 | 451 | */ |
452 | - $url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url ); |
|
453 | - wp_redirect( $url ); |
|
452 | + $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url); |
|
453 | + wp_redirect($url); |
|
454 | 454 | gd_die(); |
455 | 455 | } |
456 | 456 | |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @param string $hash_key |
466 | 466 | */ |
467 | -function geodir_before_tab_content( $hash_key ) { |
|
468 | - switch ( $hash_key ) { |
|
467 | +function geodir_before_tab_content($hash_key) { |
|
468 | + switch ($hash_key) { |
|
469 | 469 | case 'post_info' : |
470 | 470 | echo '<div class="geodir-company_info field-group">'; |
471 | 471 | break; |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @since 1.0.0 |
477 | 477 | */ |
478 | - echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >'; |
|
478 | + echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >'; |
|
479 | 479 | break; |
480 | 480 | case 'reviews' : |
481 | 481 | echo '<div id="reviews-wrap" class="clearfix"> '; |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @param string $hash_key |
501 | 501 | */ |
502 | -function geodir_after_tab_content( $hash_key ) { |
|
503 | - switch ( $hash_key ) { |
|
502 | +function geodir_after_tab_content($hash_key) { |
|
503 | + switch ($hash_key) { |
|
504 | 504 | case 'post_info' : |
505 | 505 | echo '</div>'; |
506 | 506 | break; |
@@ -531,25 +531,25 @@ discard block |
||
531 | 531 | * @global object $wpdb WordPress Database object. |
532 | 532 | * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false. |
533 | 533 | */ |
534 | -function geodir_get_posts_default_sort( $post_type ) { |
|
534 | +function geodir_get_posts_default_sort($post_type) { |
|
535 | 535 | |
536 | 536 | global $wpdb; |
537 | 537 | |
538 | - if ( $post_type != '' ) { |
|
538 | + if ($post_type != '') { |
|
539 | 539 | |
540 | 540 | $all_postypes = geodir_get_posttypes(); |
541 | 541 | |
542 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
542 | + if (!in_array($post_type, $all_postypes)) { |
|
543 | 543 | return false; |
544 | 544 | } |
545 | 545 | |
546 | - $sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type= %s and is_active=%d and is_default=%d", array( |
|
546 | + $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type= %s and is_active=%d and is_default=%d", array( |
|
547 | 547 | $post_type, |
548 | 548 | 1, |
549 | 549 | 1 |
550 | - ) ) ); |
|
550 | + ))); |
|
551 | 551 | |
552 | - if ( ! empty( $sort_field_info ) ) { |
|
552 | + if (!empty($sort_field_info)) { |
|
553 | 553 | return $sort_field_info; |
554 | 554 | } |
555 | 555 | |
@@ -569,20 +569,20 @@ discard block |
||
569 | 569 | * @global object $wpdb WordPress Database object. |
570 | 570 | * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false. |
571 | 571 | */ |
572 | -function geodir_get_sort_options( $post_type ) { |
|
572 | +function geodir_get_sort_options($post_type) { |
|
573 | 573 | global $wpdb; |
574 | 574 | |
575 | - if ( $post_type != '' ) { |
|
575 | + if ($post_type != '') { |
|
576 | 576 | $all_postypes = geodir_get_posttypes(); |
577 | 577 | |
578 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
578 | + if (!in_array($post_type, $all_postypes)) { |
|
579 | 579 | return false; |
580 | 580 | } |
581 | 581 | |
582 | - $sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array( |
|
582 | + $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array( |
|
583 | 583 | $post_type, |
584 | 584 | 1 |
585 | - ) ) ); |
|
585 | + ))); |
|
586 | 586 | |
587 | 587 | /** |
588 | 588 | * Filter post sort options. |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | * @param array $sort_field_info Unfiltered sort field array. |
593 | 593 | * @param string $post_type Post type. |
594 | 594 | */ |
595 | - return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type ); |
|
595 | + return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | } |
@@ -613,63 +613,63 @@ discard block |
||
613 | 613 | * |
614 | 614 | * @since 1.4.4 |
615 | 615 | */ |
616 | - if ( is_search() ) { |
|
616 | + if (is_search()) { |
|
617 | 617 | return; |
618 | 618 | } |
619 | 619 | |
620 | 620 | $sort_by = ''; |
621 | 621 | |
622 | - if ( isset( $_REQUEST['sort_by'] ) ) { |
|
622 | + if (isset($_REQUEST['sort_by'])) { |
|
623 | 623 | $sort_by = $_REQUEST['sort_by']; |
624 | 624 | } |
625 | 625 | |
626 | 626 | $gd_post_type = geodir_get_current_posttype(); |
627 | 627 | |
628 | - $sort_options = geodir_get_sort_options( $gd_post_type ); |
|
628 | + $sort_options = geodir_get_sort_options($gd_post_type); |
|
629 | 629 | |
630 | 630 | |
631 | 631 | $sort_field_options = ''; |
632 | 632 | |
633 | - if ( ! empty( $sort_options ) ) { |
|
634 | - foreach ( $sort_options as $sort ) { |
|
635 | - $sort = stripslashes_deep( $sort ); // strip slashes |
|
633 | + if (!empty($sort_options)) { |
|
634 | + foreach ($sort_options as $sort) { |
|
635 | + $sort = stripslashes_deep($sort); // strip slashes |
|
636 | 636 | |
637 | - $label = __( $sort->site_title, 'geodirectory' ); |
|
637 | + $label = __($sort->site_title, 'geodirectory'); |
|
638 | 638 | |
639 | - if ( $sort->field_type == 'random' ) { |
|
639 | + if ($sort->field_type == 'random') { |
|
640 | 640 | $key = $sort->field_type; |
641 | - ( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
642 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
641 | + ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
642 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
643 | 643 | } |
644 | 644 | |
645 | - if ( $sort->htmlvar_name == 'comment_count' ) { |
|
645 | + if ($sort->htmlvar_name == 'comment_count') { |
|
646 | 646 | $sort->htmlvar_name = 'rating_count'; |
647 | 647 | } |
648 | 648 | |
649 | - if ( $sort->sort_asc ) { |
|
650 | - $key = $sort->htmlvar_name . '_asc'; |
|
649 | + if ($sort->sort_asc) { |
|
650 | + $key = $sort->htmlvar_name.'_asc'; |
|
651 | 651 | $label = $sort->site_title; |
652 | - if ( $sort->asc_title ) { |
|
652 | + if ($sort->asc_title) { |
|
653 | 653 | $label = $sort->asc_title; |
654 | 654 | } |
655 | - ( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
656 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
655 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
656 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
657 | 657 | } |
658 | 658 | |
659 | - if ( $sort->sort_desc ) { |
|
660 | - $key = $sort->htmlvar_name . '_desc'; |
|
659 | + if ($sort->sort_desc) { |
|
660 | + $key = $sort->htmlvar_name.'_desc'; |
|
661 | 661 | $label = $sort->site_title; |
662 | - if ( $sort->desc_title ) { |
|
662 | + if ($sort->desc_title) { |
|
663 | 663 | $label = $sort->desc_title; |
664 | 664 | } |
665 | - ( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
666 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
665 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
666 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | } |
670 | 670 | } |
671 | 671 | |
672 | - if ( $sort_field_options != '' ) { |
|
672 | + if ($sort_field_options != '') { |
|
673 | 673 | |
674 | 674 | ?> |
675 | 675 | |
@@ -678,9 +678,9 @@ discard block |
||
678 | 678 | <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;"> |
679 | 679 | |
680 | 680 | <option |
681 | - value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) { |
|
681 | + value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') { |
|
682 | 682 | echo 'selected="selected"'; |
683 | - } ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php |
|
683 | + } ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php |
|
684 | 684 | |
685 | 685 | echo $sort_field_options; ?> |
686 | 686 | |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | * |
709 | 709 | * @return string Returns the section title. |
710 | 710 | */ |
711 | -function geodir_advance_customfields_heading( $title, $field_type ) { |
|
711 | +function geodir_advance_customfields_heading($title, $field_type) { |
|
712 | 712 | |
713 | - if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) { |
|
713 | + if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) { |
|
714 | 714 | $title = ''; |
715 | 715 | } |
716 | 716 | |
@@ -732,34 +732,34 @@ discard block |
||
732 | 732 | * @global object $gd_session GeoDirectory Session object. |
733 | 733 | * @return string Returns related posts html. |
734 | 734 | */ |
735 | -function geodir_related_posts_display( $request ) { |
|
736 | - if ( ! empty( $request ) ) { |
|
737 | - $before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : ''; |
|
738 | - $after_title = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : ''; |
|
739 | - |
|
740 | - $title = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' ); |
|
741 | - $post_number = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5'; |
|
742 | - $relate_to = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category'; |
|
743 | - $layout = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf'; |
|
744 | - $add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0'; |
|
745 | - $listing_width = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : ''; |
|
746 | - $list_sort = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest'; |
|
747 | - $character_count = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : ''; |
|
735 | +function geodir_related_posts_display($request) { |
|
736 | + if (!empty($request)) { |
|
737 | + $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : ''; |
|
738 | + $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : ''; |
|
739 | + |
|
740 | + $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory'); |
|
741 | + $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5'; |
|
742 | + $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category'; |
|
743 | + $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf'; |
|
744 | + $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0'; |
|
745 | + $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : ''; |
|
746 | + $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest'; |
|
747 | + $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : ''; |
|
748 | 748 | |
749 | 749 | global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon; |
750 | - $related_parent_lat = !empty($post->post_latitude) && geodir_is_page( 'detail' ) ? $post->post_latitude : ''; |
|
751 | - $related_parent_lon = !empty($post->post_longitude) && geodir_is_page( 'detail' ) ? $post->post_longitude : ''; |
|
750 | + $related_parent_lat = !empty($post->post_latitude) && geodir_is_page('detail') ? $post->post_latitude : ''; |
|
751 | + $related_parent_lon = !empty($post->post_longitude) && geodir_is_page('detail') ? $post->post_longitude : ''; |
|
752 | 752 | $arr_detail_page_tabs = geodir_detail_page_tabs_list(); |
753 | 753 | |
754 | 754 | $related_listing_array = array(); |
755 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) { |
|
756 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
755 | + if (get_option('geodir_add_related_listing_posttypes')) { |
|
756 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes'); |
|
757 | 757 | } |
758 | - if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) { |
|
758 | + if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) { |
|
759 | 759 | $arr_detail_page_tabs['related_listing']['is_display'] = true; |
760 | 760 | } |
761 | 761 | |
762 | - $is_display = ! empty( $arr_detail_page_tabs['related_listing'] ) && isset( $arr_detail_page_tabs['related_listing']['is_display'] ) ? $arr_detail_page_tabs['related_listing']['is_display'] : false; |
|
762 | + $is_display = !empty($arr_detail_page_tabs['related_listing']) && isset($arr_detail_page_tabs['related_listing']['is_display']) ? $arr_detail_page_tabs['related_listing']['is_display'] : false; |
|
763 | 763 | $origi_post = $post; |
764 | 764 | $post_type = ''; |
765 | 765 | $post_id = ''; |
@@ -767,90 +767,90 @@ discard block |
||
767 | 767 | $tax_field = 'id'; |
768 | 768 | $category = array(); |
769 | 769 | |
770 | - if ( isset( $_REQUEST['backandedit'] ) ) { |
|
771 | - $post = (object) $gd_session->get( 'listing' ); |
|
770 | + if (isset($_REQUEST['backandedit'])) { |
|
771 | + $post = (object) $gd_session->get('listing'); |
|
772 | 772 | $post_type = $post->listing_type; |
773 | - if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) { |
|
773 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
774 | 774 | $post_id = $_REQUEST['pid']; |
775 | 775 | } |
776 | - } elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) { |
|
777 | - $post = geodir_get_post_info( $_REQUEST['pid'] ); |
|
776 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
777 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
778 | 778 | $post_type = $post->post_type; |
779 | 779 | $post_id = $_REQUEST['pid']; |
780 | - } elseif ( isset( $post->post_type ) && $post->post_type != '' ) { |
|
780 | + } elseif (isset($post->post_type) && $post->post_type != '') { |
|
781 | 781 | $post_type = $post->post_type; |
782 | 782 | $post_id = $post->ID; |
783 | 783 | } |
784 | 784 | |
785 | - if ( $relate_to == 'category' ) { |
|
785 | + if ($relate_to == 'category') { |
|
786 | 786 | |
787 | - $category_taxonomy = $post_type . $relate_to; |
|
788 | - if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) { |
|
789 | - $category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) ); |
|
787 | + $category_taxonomy = $post_type.$relate_to; |
|
788 | + if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') { |
|
789 | + $category = explode(',', trim($post->{$category_taxonomy}, ',')); |
|
790 | 790 | } |
791 | 791 | |
792 | - } elseif ( $relate_to == 'tags' ) { |
|
792 | + } elseif ($relate_to == 'tags') { |
|
793 | 793 | |
794 | - $category_taxonomy = $post_type . '_' . $relate_to; |
|
795 | - if ( $post->post_tags != '' ) { |
|
796 | - $category = explode( ',', trim( $post->post_tags, ',' ) ); |
|
794 | + $category_taxonomy = $post_type.'_'.$relate_to; |
|
795 | + if ($post->post_tags != '') { |
|
796 | + $category = explode(',', trim($post->post_tags, ',')); |
|
797 | 797 | } |
798 | 798 | $tax_field = 'name'; |
799 | 799 | } |
800 | 800 | |
801 | 801 | /* --- return false in invalid request --- */ |
802 | - if ( empty( $category ) ) { |
|
802 | + if (empty($category)) { |
|
803 | 803 | return false; |
804 | 804 | } |
805 | 805 | |
806 | 806 | $all_postypes = geodir_get_posttypes(); |
807 | 807 | |
808 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
808 | + if (!in_array($post_type, $all_postypes)) { |
|
809 | 809 | return false; |
810 | 810 | } |
811 | 811 | |
812 | 812 | /* --- return false in invalid request --- */ |
813 | 813 | |
814 | 814 | $location_url = ''; |
815 | - if ( $add_location_filter != '0' ) { |
|
815 | + if ($add_location_filter != '0') { |
|
816 | 816 | $location_url = array(); |
817 | - $geodir_show_location_url = get_option( 'geodir_show_location_url' ); |
|
817 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
818 | 818 | |
819 | - $gd_city = get_query_var( 'gd_city' ); |
|
819 | + $gd_city = get_query_var('gd_city'); |
|
820 | 820 | |
821 | - if ( $gd_city ) { |
|
822 | - $gd_country = get_query_var( 'gd_country' ); |
|
823 | - $gd_region = get_query_var( 'gd_region' ); |
|
821 | + if ($gd_city) { |
|
822 | + $gd_country = get_query_var('gd_country'); |
|
823 | + $gd_region = get_query_var('gd_region'); |
|
824 | 824 | } else { |
825 | 825 | $location = geodir_get_default_location(); |
826 | 826 | |
827 | - $gd_country = isset( $location->country_slug ) ? $location->country_slug : ''; |
|
828 | - $gd_region = isset( $location->region_slug ) ? $location->region_slug : ''; |
|
829 | - $gd_city = isset( $location->city_slug ) ? $location->city_slug : ''; |
|
827 | + $gd_country = isset($location->country_slug) ? $location->country_slug : ''; |
|
828 | + $gd_region = isset($location->region_slug) ? $location->region_slug : ''; |
|
829 | + $gd_city = isset($location->city_slug) ? $location->city_slug : ''; |
|
830 | 830 | } |
831 | 831 | |
832 | - if ( $geodir_show_location_url == 'all' ) { |
|
832 | + if ($geodir_show_location_url == 'all') { |
|
833 | 833 | $location_url[] = $gd_country; |
834 | 834 | $location_url[] = $gd_region; |
835 | - } else if ( $geodir_show_location_url == 'country_city' ) { |
|
835 | + } else if ($geodir_show_location_url == 'country_city') { |
|
836 | 836 | $location_url[] = $gd_country; |
837 | - } else if ( $geodir_show_location_url == 'region_city' ) { |
|
837 | + } else if ($geodir_show_location_url == 'region_city') { |
|
838 | 838 | $location_url[] = $gd_region; |
839 | 839 | } |
840 | 840 | |
841 | 841 | $location_url[] = $gd_city; |
842 | 842 | |
843 | - $location_url = implode( '/', $location_url ); |
|
843 | + $location_url = implode('/', $location_url); |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | |
847 | - if ( ! empty( $category ) ) { |
|
847 | + if (!empty($category)) { |
|
848 | 848 | global $geodir_add_location_url; |
849 | 849 | $geodir_add_location_url = '0'; |
850 | - if ( $add_location_filter != '0' ) { |
|
850 | + if ($add_location_filter != '0') { |
|
851 | 851 | $geodir_add_location_url = '1'; |
852 | 852 | } |
853 | - $viewall_url = get_term_link( (int) $category[0], $post_type . $category_taxonomy ); |
|
853 | + $viewall_url = get_term_link((int) $category[0], $post_type.$category_taxonomy); |
|
854 | 854 | $geodir_add_location_url = null; |
855 | 855 | } |
856 | 856 | ob_start(); |
@@ -860,24 +860,24 @@ discard block |
||
860 | 860 | <div class="geodir_locations geodir_location_listing"> |
861 | 861 | |
862 | 862 | <?php |
863 | - if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) { |
|
863 | + if (isset($request['is_widget']) && $request['is_widget'] == '1') { |
|
864 | 864 | /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
865 | - $before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' ); |
|
865 | + $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
866 | 866 | /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
867 | - $after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' ); |
|
867 | + $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>'); |
|
868 | 868 | ?> |
869 | 869 | <div class="location_list_heading clearfix"> |
870 | - <?php echo $before_title . $title . $after_title; ?> |
|
870 | + <?php echo $before_title.$title.$after_title; ?> |
|
871 | 871 | </div> |
872 | 872 | <?php |
873 | 873 | } |
874 | 874 | $query_args = array( |
875 | 875 | 'posts_per_page' => $post_number, |
876 | 876 | 'is_geodir_loop' => true, |
877 | - 'gd_location' => ( $add_location_filter ) ? true : false, |
|
877 | + 'gd_location' => ($add_location_filter) ? true : false, |
|
878 | 878 | 'post_type' => $post_type, |
879 | 879 | 'order_by' => $list_sort, |
880 | - 'post__not_in' => array( $post_id ), |
|
880 | + 'post__not_in' => array($post_id), |
|
881 | 881 | 'excerpt_length' => $character_count, |
882 | 882 | 'related_listings' => $is_display |
883 | 883 | ); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | 'terms' => $category |
889 | 889 | ); |
890 | 890 | |
891 | - $query_args['tax_query'] = array( $tax_query ); |
|
891 | + $query_args['tax_query'] = array($tax_query); |
|
892 | 892 | |
893 | 893 | global $gridview_columns_widget, $post; |
894 | 894 | |
@@ -900,21 +900,21 @@ discard block |
||
900 | 900 | * @param array $query_args The query array. |
901 | 901 | * @param array $request Related posts request array. |
902 | 902 | */ |
903 | - $query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request ); |
|
903 | + $query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request); |
|
904 | 904 | |
905 | - query_posts( $query_args ); |
|
905 | + query_posts($query_args); |
|
906 | 906 | |
907 | - if ( strstr( $layout, 'gridview' ) ) { |
|
908 | - $listing_view_exp = explode( '_', $layout ); |
|
907 | + if (strstr($layout, 'gridview')) { |
|
908 | + $listing_view_exp = explode('_', $layout); |
|
909 | 909 | $gridview_columns_widget = $layout; |
910 | 910 | $layout = $listing_view_exp[0]; |
911 | - } else if ( $layout == 'list' ) { |
|
911 | + } else if ($layout == 'list') { |
|
912 | 912 | $gridview_columns_widget = ''; |
913 | 913 | } |
914 | 914 | $related_posts = true; |
915 | 915 | |
916 | 916 | $related_nearest = false; |
917 | - if ( $list_sort == 'nearest' ) { |
|
917 | + if ($list_sort == 'nearest') { |
|
918 | 918 | $related_nearest = true; |
919 | 919 | } |
920 | 920 | |
@@ -931,14 +931,14 @@ discard block |
||
931 | 931 | * |
932 | 932 | * @since 1.0.0 |
933 | 933 | */ |
934 | - $template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'widget-listing-listview' ) ); |
|
934 | + $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
935 | 935 | |
936 | 936 | /** |
937 | 937 | * Includes related listing listview template. |
938 | 938 | * |
939 | 939 | * @since 1.0.0 |
940 | 940 | */ |
941 | - include( $template ); |
|
941 | + include($template); |
|
942 | 942 | |
943 | 943 | wp_reset_query(); |
944 | 944 | $post = $origi_post; |
@@ -966,12 +966,12 @@ discard block |
||
966 | 966 | function geodir_category_count_script() { |
967 | 967 | global $geodir_post_category_str; |
968 | 968 | |
969 | - if ( ! empty( $geodir_post_category_str ) ) { |
|
970 | - $geodir_post_category_str = serialize( $geodir_post_category_str ); |
|
969 | + if (!empty($geodir_post_category_str)) { |
|
970 | + $geodir_post_category_str = serialize($geodir_post_category_str); |
|
971 | 971 | } |
972 | 972 | |
973 | - $all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' ); |
|
974 | - $script = "var post_category_array = " . json_encode( $all_var ) . ';'; |
|
973 | + $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
974 | + $script = "var post_category_array = ".json_encode($all_var).';'; |
|
975 | 975 | echo '<script>'; |
976 | 976 | echo $script; |
977 | 977 | echo '</script>'; |
@@ -986,8 +986,8 @@ discard block |
||
986 | 986 | * @return string Returns the default language. |
987 | 987 | */ |
988 | 988 | function geodir_get_map_default_language() { |
989 | - $geodir_default_map_language = get_option( 'geodir_default_map_language' ); |
|
990 | - if ( empty( $geodir_default_map_language ) ) { |
|
989 | + $geodir_default_map_language = get_option('geodir_default_map_language'); |
|
990 | + if (empty($geodir_default_map_language)) { |
|
991 | 991 | $geodir_default_map_language = 'en'; |
992 | 992 | } |
993 | 993 | |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | * |
999 | 999 | * @param string $geodir_default_map_language Default map language. |
1000 | 1000 | */ |
1001 | - return apply_filters( 'geodir_default_map_language', $geodir_default_map_language ); |
|
1001 | + return apply_filters('geodir_default_map_language', $geodir_default_map_language); |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | /** |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | * @return string Returns the api key. |
1010 | 1010 | */ |
1011 | 1011 | function geodir_get_map_api_key() { |
1012 | - $key = get_option( 'geodir_google_api_key' ); |
|
1012 | + $key = get_option('geodir_google_api_key'); |
|
1013 | 1013 | |
1014 | 1014 | /** |
1015 | 1015 | * Filter Google maps api key. |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | * |
1019 | 1019 | * @param string $key Google maps api key. |
1020 | 1020 | */ |
1021 | - return apply_filters( 'geodir_google_api_key', $key ); |
|
1021 | + return apply_filters('geodir_google_api_key', $key); |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | |
@@ -1038,20 +1038,20 @@ discard block |
||
1038 | 1038 | global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
1039 | 1039 | |
1040 | 1040 | $is_geodir_page = geodir_is_geodir_page(); |
1041 | - if ( ! $is_geodir_page ) { |
|
1041 | + if (!$is_geodir_page) { |
|
1042 | 1042 | return; |
1043 | 1043 | }// if non GD page, bail |
1044 | 1044 | |
1045 | 1045 | $use_gd_meta = true; |
1046 | - if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) { |
|
1046 | + if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) { |
|
1047 | 1047 | $use_gd_meta = false; |
1048 | 1048 | |
1049 | - if ( geodir_is_page( 'search' ) ) { |
|
1049 | + if (geodir_is_page('search')) { |
|
1050 | 1050 | $use_gd_meta = true; |
1051 | 1051 | } |
1052 | 1052 | } |
1053 | 1053 | |
1054 | - if ( ! $use_gd_meta ) { |
|
1054 | + if (!$use_gd_meta) { |
|
1055 | 1055 | return; |
1056 | 1056 | }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active. |
1057 | 1057 | |
@@ -1059,68 +1059,68 @@ discard block |
||
1059 | 1059 | |
1060 | 1060 | $all_postypes = geodir_get_posttypes(); |
1061 | 1061 | |
1062 | - $geodir_taxonomies = geodir_get_taxonomies( '', true ); |
|
1062 | + $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1063 | 1063 | |
1064 | 1064 | $meta_desc = ''; |
1065 | 1065 | $meta_key = ''; |
1066 | - if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) { |
|
1066 | + if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) { |
|
1067 | 1067 | /** |
1068 | 1068 | * Filter SEO meta location description. |
1069 | 1069 | * |
1070 | 1070 | * @since 1.0.0 |
1071 | 1071 | */ |
1072 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' ); |
|
1072 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', ''); |
|
1073 | 1073 | $meta_desc .= ''; |
1074 | 1074 | } |
1075 | - if ( have_posts() && is_single() OR is_page() ) { |
|
1076 | - while ( have_posts() ) { |
|
1075 | + if (have_posts() && is_single() OR is_page()) { |
|
1076 | + while (have_posts()) { |
|
1077 | 1077 | the_post(); |
1078 | 1078 | |
1079 | - if ( has_excerpt() ) { |
|
1080 | - $out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) ); |
|
1081 | - if ( empty( $out_excerpt ) ) { |
|
1082 | - $out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) ); |
|
1079 | + if (has_excerpt()) { |
|
1080 | + $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
1081 | + if (empty($out_excerpt)) { |
|
1082 | + $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
1083 | 1083 | } |
1084 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt ); |
|
1084 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt); |
|
1085 | 1085 | } else { |
1086 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content ); |
|
1087 | - $out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) ); |
|
1088 | - if ( empty( $out_excerpt ) ) { |
|
1089 | - $out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content |
|
1086 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content); |
|
1087 | + $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
1088 | + if (empty($out_excerpt)) { |
|
1089 | + $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
1090 | 1090 | } |
1091 | - $out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' ); |
|
1091 | + $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | $meta_desc .= $out_excerpt; |
1095 | 1095 | } |
1096 | - } elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) { |
|
1097 | - if ( is_category() ) { |
|
1098 | - $meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ); |
|
1099 | - } elseif ( is_tag() ) { |
|
1100 | - $meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ); |
|
1096 | + } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) { |
|
1097 | + if (is_category()) { |
|
1098 | + $meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)); |
|
1099 | + } elseif (is_tag()) { |
|
1100 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)); |
|
1101 | 1101 | } |
1102 | - } elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) { |
|
1103 | - $meta_desc .= isset( $current_term->description ) ? $current_term->description : ''; |
|
1102 | + } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) { |
|
1103 | + $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
1107 | 1107 | $geodir_post_type = geodir_get_current_posttype(); |
1108 | - $geodir_post_type_info = get_post_type_object( $geodir_post_type ); |
|
1109 | - $geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false; |
|
1110 | - |
|
1111 | - $category_taxonomy = geodir_get_taxonomies( $geodir_post_type ); |
|
1112 | - $tag_taxonomy = geodir_get_taxonomies( $geodir_post_type, true ); |
|
1113 | - |
|
1114 | - $geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false; |
|
1115 | - $geodir_is_tag = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false; |
|
1116 | - |
|
1117 | - $geodir_is_search = geodir_is_page( 'search' ) ? true : false; |
|
1118 | - $geodir_is_location = geodir_is_page( 'location' ) ? true : false; |
|
1119 | - $geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
1120 | - $godir_location_terms = geodir_get_current_location_terms( 'query_vars' ); |
|
1121 | - $gd_city = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null; |
|
1122 | - $gd_region = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null; |
|
1123 | - $gd_country = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null; |
|
1108 | + $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
1109 | + $geodir_is_page_listing = geodir_is_page('listing') ? true : false; |
|
1110 | + |
|
1111 | + $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
1112 | + $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
1113 | + |
|
1114 | + $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
1115 | + $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
1116 | + |
|
1117 | + $geodir_is_search = geodir_is_page('search') ? true : false; |
|
1118 | + $geodir_is_location = geodir_is_page('location') ? true : false; |
|
1119 | + $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
1120 | + $godir_location_terms = geodir_get_current_location_terms('query_vars'); |
|
1121 | + $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null; |
|
1122 | + $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null; |
|
1123 | + $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null; |
|
1124 | 1124 | /** |
1125 | 1125 | * Filter the Everywhere text in location description. |
1126 | 1126 | * |
@@ -1128,108 +1128,108 @@ discard block |
||
1128 | 1128 | * |
1129 | 1129 | * @param string $replace_location Everywhere text. |
1130 | 1130 | */ |
1131 | - $replace_location = apply_filters( 'geodir_location_description_everywhere_text', __( 'Everywhere', 'geodirectory' ) ); |
|
1131 | + $replace_location = apply_filters('geodir_location_description_everywhere_text', __('Everywhere', 'geodirectory')); |
|
1132 | 1132 | $location_id = null; |
1133 | - if ( $geodir_location_manager ) { |
|
1134 | - $sql = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) ); |
|
1135 | - $location_id = (int) $wpdb->get_var( $sql ); |
|
1133 | + if ($geodir_location_manager) { |
|
1134 | + $sql = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city)); |
|
1135 | + $location_id = (int) $wpdb->get_var($sql); |
|
1136 | 1136 | $location_type = geodir_what_is_current_location(); |
1137 | - if ( $location_type == 'city' ) { |
|
1138 | - $replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) ); |
|
1139 | - } elseif ( $location_type == 'region' ) { |
|
1140 | - $replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) ); |
|
1141 | - } elseif ( $location_type == 'country' ) { |
|
1142 | - $replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) ); |
|
1143 | - $replace_location = __( $replace_location, 'geodirectory' ); |
|
1144 | - } |
|
1145 | - $country = get_query_var( 'gd_country' ); |
|
1146 | - $region = get_query_var( 'gd_region' ); |
|
1147 | - $city = get_query_var( 'gd_city' ); |
|
1137 | + if ($location_type == 'city') { |
|
1138 | + $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false)); |
|
1139 | + } elseif ($location_type == 'region') { |
|
1140 | + $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false)); |
|
1141 | + } elseif ($location_type == 'country') { |
|
1142 | + $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false)); |
|
1143 | + $replace_location = __($replace_location, 'geodirectory'); |
|
1144 | + } |
|
1145 | + $country = get_query_var('gd_country'); |
|
1146 | + $region = get_query_var('gd_region'); |
|
1147 | + $city = get_query_var('gd_city'); |
|
1148 | 1148 | $current_location = ''; |
1149 | - if ( $country != '' ) { |
|
1150 | - $current_location = get_actual_location_name( 'country', $country, true ); |
|
1149 | + if ($country != '') { |
|
1150 | + $current_location = get_actual_location_name('country', $country, true); |
|
1151 | 1151 | } |
1152 | - if ( $region != '' ) { |
|
1153 | - $current_location = get_actual_location_name( 'region', $region ); |
|
1152 | + if ($region != '') { |
|
1153 | + $current_location = get_actual_location_name('region', $region); |
|
1154 | 1154 | } |
1155 | - if ( $city != '' ) { |
|
1156 | - $current_location = get_actual_location_name( 'city', $city ); |
|
1155 | + if ($city != '') { |
|
1156 | + $current_location = get_actual_location_name('city', $city); |
|
1157 | 1157 | } |
1158 | 1158 | $replace_location = $current_location != '' ? $current_location : $replace_location; |
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | $geodir_meta_keys = ''; |
1162 | 1162 | $geodir_meta_desc = ''; |
1163 | - if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) { |
|
1164 | - if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) { |
|
1165 | - $geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
1163 | + if ($is_geodir_page && !empty($geodir_post_type_info)) { |
|
1164 | + if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) { |
|
1165 | + $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
1166 | 1166 | |
1167 | - $geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
1168 | - $geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
1167 | + $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
1168 | + $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
1169 | 1169 | |
1170 | - if ( $geodir_is_category ) { |
|
1171 | - $category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null; |
|
1172 | - if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) { |
|
1170 | + if ($geodir_is_category) { |
|
1171 | + $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null; |
|
1172 | + if (isset($category->term_id) && !empty($category->term_id)) { |
|
1173 | 1173 | $category_id = $category->term_id; |
1174 | - $category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type ); |
|
1175 | - if ( $location_id ) { |
|
1176 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
1177 | - $cat_loc_option = get_option( $option_name ); |
|
1178 | - |
|
1179 | - $gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
1180 | - if ( ! $gd_cat_loc_default ) { |
|
1181 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
1182 | - $option = get_option( $option_name ); |
|
1183 | - $category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc; |
|
1174 | + $category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
1175 | + if ($location_id) { |
|
1176 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id; |
|
1177 | + $cat_loc_option = get_option($option_name); |
|
1178 | + |
|
1179 | + $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
1180 | + if (!$gd_cat_loc_default) { |
|
1181 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id; |
|
1182 | + $option = get_option($option_name); |
|
1183 | + $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
1184 | 1184 | } |
1185 | 1185 | } |
1186 | - $geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc; |
|
1186 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc; |
|
1187 | 1187 | } |
1188 | - } else if ( $geodir_is_tag ) { |
|
1189 | - $geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc; |
|
1188 | + } else if ($geodir_is_tag) { |
|
1189 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc; |
|
1190 | 1190 | } |
1191 | 1191 | } |
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | |
1195 | 1195 | $gd_page = ''; |
1196 | - if ( geodir_is_page( 'home' ) ) { |
|
1196 | + if (geodir_is_page('home')) { |
|
1197 | 1197 | $gd_page = 'home'; |
1198 | - $meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc; |
|
1199 | - } elseif ( geodir_is_page( 'detail' ) ) { |
|
1198 | + $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc; |
|
1199 | + } elseif (geodir_is_page('detail')) { |
|
1200 | 1200 | $gd_page = 'detail'; |
1201 | - $meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc; |
|
1202 | - } elseif ( geodir_is_page( 'pt' ) ) { |
|
1201 | + $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc; |
|
1202 | + } elseif (geodir_is_page('pt')) { |
|
1203 | 1203 | $gd_page = 'pt'; |
1204 | - $meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc; |
|
1205 | - } elseif ( geodir_is_page( 'listing' ) ) { |
|
1204 | + $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc; |
|
1205 | + } elseif (geodir_is_page('listing')) { |
|
1206 | 1206 | $gd_page = 'listing'; |
1207 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc; |
|
1208 | - } elseif ( geodir_is_page( 'location' ) ) { |
|
1207 | + $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc; |
|
1208 | + } elseif (geodir_is_page('location')) { |
|
1209 | 1209 | $gd_page = 'location'; |
1210 | - $meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc; |
|
1211 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc ); |
|
1210 | + $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc; |
|
1211 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc); |
|
1212 | 1212 | |
1213 | - } elseif ( geodir_is_page( 'search' ) ) { |
|
1213 | + } elseif (geodir_is_page('search')) { |
|
1214 | 1214 | $gd_page = 'search'; |
1215 | - $meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc; |
|
1216 | - } elseif ( geodir_is_page( 'add-listing' ) ) { |
|
1215 | + $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc; |
|
1216 | + } elseif (geodir_is_page('add-listing')) { |
|
1217 | 1217 | $gd_page = 'add-listing'; |
1218 | - $meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc; |
|
1219 | - } elseif ( geodir_is_page( 'author' ) ) { |
|
1218 | + $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc; |
|
1219 | + } elseif (geodir_is_page('author')) { |
|
1220 | 1220 | $gd_page = 'author'; |
1221 | - $meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc; |
|
1222 | - } elseif ( geodir_is_page( 'login' ) ) { |
|
1221 | + $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc; |
|
1222 | + } elseif (geodir_is_page('login')) { |
|
1223 | 1223 | $gd_page = 'login'; |
1224 | - $meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc; |
|
1225 | - } elseif ( geodir_is_page( 'listing-success' ) ) { |
|
1224 | + $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc; |
|
1225 | + } elseif (geodir_is_page('listing-success')) { |
|
1226 | 1226 | $gd_page = 'listing-success'; |
1227 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc; |
|
1227 | + $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc; |
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | |
1231 | - if ( $meta_desc ) { |
|
1232 | - $meta_desc = stripslashes_deep( $meta_desc ); |
|
1231 | + if ($meta_desc) { |
|
1232 | + $meta_desc = stripslashes_deep($meta_desc); |
|
1233 | 1233 | /** |
1234 | 1234 | * Filter page description to replace variables. |
1235 | 1235 | * |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * @param string $title The page description including variables. |
1239 | 1239 | * @param string $gd_page The GeoDirectory page type if any. |
1240 | 1240 | */ |
1241 | - $meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' ); |
|
1241 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, ''); |
|
1242 | 1242 | |
1243 | 1243 | /** |
1244 | 1244 | * Filter SEO meta description. |
@@ -1247,20 +1247,20 @@ discard block |
||
1247 | 1247 | * |
1248 | 1248 | * @param string $meta_desc Meta description content. |
1249 | 1249 | */ |
1250 | - echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc ); |
|
1250 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc); |
|
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | // meta keywords |
1254 | - if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) { |
|
1255 | - $place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) ); |
|
1256 | - $place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) ); |
|
1254 | + if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) { |
|
1255 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names")); |
|
1256 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names")); |
|
1257 | 1257 | |
1258 | - $meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) ); |
|
1258 | + $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags)); |
|
1259 | 1259 | } else { |
1260 | 1260 | $posttags = get_the_tags(); |
1261 | - if ( $posttags ) { |
|
1262 | - foreach ( $posttags as $tag ) { |
|
1263 | - $meta_key .= $tag->name . ' '; |
|
1261 | + if ($posttags) { |
|
1262 | + foreach ($posttags as $tag) { |
|
1263 | + $meta_key .= $tag->name.' '; |
|
1264 | 1264 | } |
1265 | 1265 | } else { |
1266 | 1266 | // $tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) ); |
@@ -1276,20 +1276,20 @@ discard block |
||
1276 | 1276 | } |
1277 | 1277 | } |
1278 | 1278 | |
1279 | - $meta_key = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key; |
|
1280 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key; |
|
1281 | - if ( $geodir_meta_keys != '' ) { |
|
1282 | - $geodir_meta_keys = strip_tags( $geodir_meta_keys ); |
|
1283 | - $geodir_meta_keys = esc_html( $geodir_meta_keys ); |
|
1284 | - $geodir_meta_keys = geodir_strtolower( $geodir_meta_keys ); |
|
1285 | - $geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' ); |
|
1286 | - $geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys ); |
|
1279 | + $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
1280 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
1281 | + if ($geodir_meta_keys != '') { |
|
1282 | + $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
1283 | + $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
1284 | + $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
1285 | + $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
1286 | + $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys); |
|
1287 | 1287 | |
1288 | - $meta_key = rtrim( trim( $geodir_meta_keys ), "," ); |
|
1288 | + $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | - if ( $meta_key ) { |
|
1292 | - $meta_key = stripslashes_deep( $meta_key ); |
|
1291 | + if ($meta_key) { |
|
1292 | + $meta_key = stripslashes_deep($meta_key); |
|
1293 | 1293 | /** |
1294 | 1294 | * Filter SEO meta keywords. |
1295 | 1295 | * |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | * |
1298 | 1298 | * @param string $meta_desc Meta keywords. |
1299 | 1299 | */ |
1300 | - echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key ); |
|
1300 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | } |
@@ -1317,8 +1317,8 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
1319 | 1319 | |
1320 | - foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) { |
|
1321 | - $geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text']; |
|
1320 | + foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) { |
|
1321 | + $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | return $geodir_detail_page_tabs_key_value_array; |
@@ -1340,57 +1340,57 @@ discard block |
||
1340 | 1340 | * @since 1.0.0 |
1341 | 1341 | */ |
1342 | 1342 | $arr_tabs['post_profile'] = array( |
1343 | - 'heading_text' => __( 'Profile', 'geodirectory' ), |
|
1343 | + 'heading_text' => __('Profile', 'geodirectory'), |
|
1344 | 1344 | 'is_active_tab' => true, |
1345 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ), |
|
1345 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'), |
|
1346 | 1346 | 'tab_content' => '' |
1347 | 1347 | ); |
1348 | - $arr_tabs['post_info'] = array( |
|
1349 | - 'heading_text' => __( 'More Info', 'geodirectory' ), |
|
1348 | + $arr_tabs['post_info'] = array( |
|
1349 | + 'heading_text' => __('More Info', 'geodirectory'), |
|
1350 | 1350 | 'is_active_tab' => false, |
1351 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ), |
|
1351 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'), |
|
1352 | 1352 | 'tab_content' => '' |
1353 | 1353 | ); |
1354 | 1354 | |
1355 | 1355 | $arr_tabs['post_images'] = array( |
1356 | - 'heading_text' => __( 'Photos', 'geodirectory' ), |
|
1356 | + 'heading_text' => __('Photos', 'geodirectory'), |
|
1357 | 1357 | 'is_active_tab' => false, |
1358 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ), |
|
1358 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'), |
|
1359 | 1359 | 'tab_content' => '' |
1360 | 1360 | ); |
1361 | 1361 | |
1362 | 1362 | $arr_tabs['post_video'] = array( |
1363 | - 'heading_text' => __( 'Video', 'geodirectory' ), |
|
1363 | + 'heading_text' => __('Video', 'geodirectory'), |
|
1364 | 1364 | 'is_active_tab' => false, |
1365 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ), |
|
1365 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'), |
|
1366 | 1366 | 'tab_content' => '' |
1367 | 1367 | ); |
1368 | 1368 | |
1369 | 1369 | $arr_tabs['special_offers'] = array( |
1370 | - 'heading_text' => __( 'Special Offers', 'geodirectory' ), |
|
1370 | + 'heading_text' => __('Special Offers', 'geodirectory'), |
|
1371 | 1371 | 'is_active_tab' => false, |
1372 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ), |
|
1372 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'), |
|
1373 | 1373 | 'tab_content' => '' |
1374 | 1374 | ); |
1375 | 1375 | |
1376 | 1376 | $arr_tabs['post_map'] = array( |
1377 | - 'heading_text' => __( 'Map', 'geodirectory' ), |
|
1377 | + 'heading_text' => __('Map', 'geodirectory'), |
|
1378 | 1378 | 'is_active_tab' => false, |
1379 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ), |
|
1379 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'), |
|
1380 | 1380 | 'tab_content' => '' |
1381 | 1381 | ); |
1382 | 1382 | |
1383 | 1383 | $arr_tabs['reviews'] = array( |
1384 | - 'heading_text' => __( 'Reviews', 'geodirectory' ), |
|
1384 | + 'heading_text' => __('Reviews', 'geodirectory'), |
|
1385 | 1385 | 'is_active_tab' => false, |
1386 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ), |
|
1386 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'), |
|
1387 | 1387 | 'tab_content' => 'review display' |
1388 | 1388 | ); |
1389 | 1389 | |
1390 | 1390 | $arr_tabs['related_listing'] = array( |
1391 | - 'heading_text' => __( 'Related Listing', 'geodirectory' ), |
|
1391 | + 'heading_text' => __('Related Listing', 'geodirectory'), |
|
1392 | 1392 | 'is_active_tab' => false, |
1393 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ), |
|
1393 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'), |
|
1394 | 1394 | 'tab_content' => '' |
1395 | 1395 | ); |
1396 | 1396 | |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | * |
1400 | 1400 | * @since 1.0.0 |
1401 | 1401 | */ |
1402 | - return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs ); |
|
1402 | + return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs); |
|
1403 | 1403 | |
1404 | 1404 | |
1405 | 1405 | } |
@@ -1413,13 +1413,13 @@ discard block |
||
1413 | 1413 | * @return mixed|array Tabs array. |
1414 | 1414 | */ |
1415 | 1415 | function geodir_detail_page_tabs_list() { |
1416 | - $tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
1416 | + $tabs_excluded = get_option('geodir_detail_page_tabs_excluded'); |
|
1417 | 1417 | $tabs_array = geodir_detail_page_tabs_array(); |
1418 | 1418 | |
1419 | - if ( ! empty( $tabs_excluded ) ) { |
|
1420 | - foreach ( $tabs_excluded as $tab ) { |
|
1421 | - if ( array_key_exists( $tab, $tabs_array ) ) { |
|
1422 | - unset( $tabs_array[ $tab ] ); |
|
1419 | + if (!empty($tabs_excluded)) { |
|
1420 | + foreach ($tabs_excluded as $tab) { |
|
1421 | + if (array_key_exists($tab, $tabs_array)) { |
|
1422 | + unset($tabs_array[$tab]); |
|
1423 | 1423 | } |
1424 | 1424 | } |
1425 | 1425 | } |
@@ -1443,66 +1443,66 @@ discard block |
||
1443 | 1443 | function geodir_show_detail_page_tabs() { |
1444 | 1444 | global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview; |
1445 | 1445 | |
1446 | - $post_id = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0; |
|
1447 | - $request_post_id = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0; |
|
1448 | - $is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend |
|
1446 | + $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0; |
|
1447 | + $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0; |
|
1448 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
1449 | 1449 | |
1450 | - if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) { |
|
1451 | - $post = geodir_get_post_info( $request_post_id ); |
|
1452 | - setup_postdata( $post ); |
|
1450 | + if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) { |
|
1451 | + $post = geodir_get_post_info($request_post_id); |
|
1452 | + setup_postdata($post); |
|
1453 | 1453 | } |
1454 | 1454 | |
1455 | - $geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' ); |
|
1455 | + $geodir_post_detail_fields = geodir_show_listing_info('moreinfo'); |
|
1456 | 1456 | |
1457 | 1457 | $package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : '')); |
1458 | 1458 | $image_limit = ''; |
1459 | 1459 | if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') { |
1460 | - $image_limit = (int)$package_info->image_limit; |
|
1460 | + $image_limit = (int) $package_info->image_limit; |
|
1461 | 1461 | } |
1462 | 1462 | |
1463 | - if ( geodir_is_page( 'detail' ) ) { |
|
1464 | - $video = geodir_get_video( $post->ID ); |
|
1465 | - $special_offers = geodir_get_special_offers( $post->ID ); |
|
1463 | + if (geodir_is_page('detail')) { |
|
1464 | + $video = geodir_get_video($post->ID); |
|
1465 | + $special_offers = geodir_get_special_offers($post->ID); |
|
1466 | 1466 | $related_listing_array = array(); |
1467 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) { |
|
1468 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
1467 | + if (get_option('geodir_add_related_listing_posttypes')) { |
|
1468 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes'); |
|
1469 | 1469 | } |
1470 | 1470 | |
1471 | - $excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
1472 | - if ( ! $excluded_tabs ) { |
|
1471 | + $excluded_tabs = get_option('geodir_detail_page_tabs_excluded'); |
|
1472 | + if (!$excluded_tabs) { |
|
1473 | 1473 | $excluded_tabs = array(); |
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | $related_listing = ''; |
1477 | - if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) { |
|
1477 | + if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) { |
|
1478 | 1478 | $request = array( |
1479 | - 'post_number' => get_option( 'geodir_related_post_count' ), |
|
1480 | - 'relate_to' => get_option( 'geodir_related_post_relate_to' ), |
|
1481 | - 'layout' => get_option( 'geodir_related_post_listing_view' ), |
|
1482 | - 'add_location_filter' => get_option( 'geodir_related_post_location_filter' ), |
|
1483 | - 'list_sort' => get_option( 'geodir_related_post_sortby' ), |
|
1484 | - 'character_count' => get_option( 'geodir_related_post_excerpt' ) |
|
1479 | + 'post_number' => get_option('geodir_related_post_count'), |
|
1480 | + 'relate_to' => get_option('geodir_related_post_relate_to'), |
|
1481 | + 'layout' => get_option('geodir_related_post_listing_view'), |
|
1482 | + 'add_location_filter' => get_option('geodir_related_post_location_filter'), |
|
1483 | + 'list_sort' => get_option('geodir_related_post_sortby'), |
|
1484 | + 'character_count' => get_option('geodir_related_post_excerpt') |
|
1485 | 1485 | ); |
1486 | 1486 | |
1487 | - if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) { |
|
1488 | - $related_listing = geodir_get_detail_page_related_events( $request ); |
|
1487 | + if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) { |
|
1488 | + $related_listing = geodir_get_detail_page_related_events($request); |
|
1489 | 1489 | } else { |
1490 | - $related_listing = geodir_related_posts_display( $request ); |
|
1490 | + $related_listing = geodir_related_posts_display($request); |
|
1491 | 1491 | } |
1492 | 1492 | |
1493 | 1493 | } |
1494 | 1494 | |
1495 | - $post_images = geodir_get_images( $post->ID, 'thumbnail' ); |
|
1495 | + $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
1496 | 1496 | $thumb_image = ''; |
1497 | - if ( ! empty( $post_images ) ) { |
|
1497 | + if (!empty($post_images)) { |
|
1498 | 1498 | $count = 1; |
1499 | - foreach ( $post_images as $image ) { |
|
1499 | + foreach ($post_images as $image) { |
|
1500 | 1500 | if ($image_limit !== '' && $count > $image_limit) { |
1501 | 1501 | break; |
1502 | 1502 | } |
1503 | - $caption = ( ! empty( $image->caption ) ) ? $image->caption : ''; |
|
1504 | - $thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">'; |
|
1505 | - $thumb_image .= geodir_show_image( $image, 'thumbnail', true, false ); |
|
1503 | + $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
1504 | + $thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">'; |
|
1505 | + $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
1506 | 1506 | $thumb_image .= '</a>'; |
1507 | 1507 | $count++; |
1508 | 1508 | } |
@@ -1512,11 +1512,11 @@ discard block |
||
1512 | 1512 | $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
1513 | 1513 | $map_args['width'] = '600'; |
1514 | 1514 | $map_args['height'] = '300'; |
1515 | - if ( $post->post_mapzoom ) { |
|
1516 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
1515 | + if ($post->post_mapzoom) { |
|
1516 | + $map_args['zoom'] = ''.$post->post_mapzoom.''; |
|
1517 | 1517 | } |
1518 | 1518 | $map_args['autozoom'] = false; |
1519 | - $map_args['scrollwheel'] = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1; |
|
1519 | + $map_args['scrollwheel'] = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1; |
|
1520 | 1520 | $map_args['child_collapse'] = '0'; |
1521 | 1521 | $map_args['enable_cat_filters'] = false; |
1522 | 1522 | $map_args['enable_text_search'] = false; |
@@ -1525,29 +1525,29 @@ discard block |
||
1525 | 1525 | $map_args['enable_jason_on_load'] = true; |
1526 | 1526 | $map_args['enable_map_direction'] = true; |
1527 | 1527 | $map_args['map_class_name'] = 'geodir-map-detail-page'; |
1528 | - $map_args['maptype'] = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP'; |
|
1529 | - } else if ( geodir_is_page( 'preview' ) ) { |
|
1530 | - $video = isset( $post->geodir_video ) ? $post->geodir_video : ''; |
|
1531 | - $special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : ''; |
|
1528 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
1529 | + } else if (geodir_is_page('preview')) { |
|
1530 | + $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
1531 | + $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
1532 | 1532 | |
1533 | - if ( isset( $post->post_images ) ) { |
|
1534 | - $post->post_images = trim( $post->post_images, "," ); |
|
1533 | + if (isset($post->post_images)) { |
|
1534 | + $post->post_images = trim($post->post_images, ","); |
|
1535 | 1535 | } |
1536 | 1536 | |
1537 | - if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) { |
|
1538 | - $post_images = explode( ",", $post->post_images ); |
|
1537 | + if (isset($post->post_images) && !empty($post->post_images)) { |
|
1538 | + $post_images = explode(",", $post->post_images); |
|
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | $thumb_image = ''; |
1542 | - if ( ! empty( $post_images ) ) { |
|
1542 | + if (!empty($post_images)) { |
|
1543 | 1543 | $count = 1; |
1544 | - foreach ( $post_images as $image ) { |
|
1545 | - if ( $image != '' ) { |
|
1544 | + foreach ($post_images as $image) { |
|
1545 | + if ($image != '') { |
|
1546 | 1546 | if ($image_limit !== '' && $count > $image_limit) { |
1547 | 1547 | break; |
1548 | 1548 | } |
1549 | - $thumb_image .= '<a href="' . $image . '">'; |
|
1550 | - $thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false ); |
|
1549 | + $thumb_image .= '<a href="'.$image.'">'; |
|
1550 | + $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false); |
|
1551 | 1551 | $thumb_image .= '</a>'; |
1552 | 1552 | $count++; |
1553 | 1553 | } |
@@ -1555,18 +1555,18 @@ discard block |
||
1555 | 1555 | } |
1556 | 1556 | |
1557 | 1557 | global $map_jason; |
1558 | - $marker_json = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array(); |
|
1559 | - $marker_icon = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : ''; |
|
1560 | - $icon_size = geodir_get_marker_size( $marker_icon ); |
|
1558 | + $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
1559 | + $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
1560 | + $icon_size = geodir_get_marker_size($marker_icon); |
|
1561 | 1561 | $marker_json['w'] = $icon_size['w']; |
1562 | 1562 | $marker_json['h'] = $icon_size['h']; |
1563 | - $map_jason[] = json_encode( $marker_json ); |
|
1563 | + $map_jason[] = json_encode($marker_json); |
|
1564 | 1564 | |
1565 | - $address_latitude = isset( $post->post_latitude ) ? $post->post_latitude : ''; |
|
1566 | - $address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : ''; |
|
1567 | - $mapview = isset( $post->post_mapview ) ? $post->post_mapview : ''; |
|
1568 | - $mapzoom = isset( $post->post_mapzoom ) ? $post->post_mapzoom : ''; |
|
1569 | - if ( ! $mapzoom ) { |
|
1565 | + $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
1566 | + $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
1567 | + $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
1568 | + $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
1569 | + if (!$mapzoom) { |
|
1570 | 1570 | $mapzoom = 12; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1589,37 +1589,37 @@ discard block |
||
1589 | 1589 | $map_args['map_class_name'] = 'geodir-map-preview-page'; |
1590 | 1590 | } |
1591 | 1591 | |
1592 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
1592 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user |
|
1593 | 1593 | |
1594 | 1594 | $active_tab = ''; |
1595 | 1595 | $active_tab_name = ''; |
1596 | 1596 | $default_tab = ''; |
1597 | 1597 | $default_tab_name = ''; |
1598 | - foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) { |
|
1599 | - if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) { |
|
1598 | + foreach ($arr_detail_page_tabs as $tab_index => $tabs) { |
|
1599 | + if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) { |
|
1600 | 1600 | $active_tab = $tab_index; |
1601 | - $active_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
1601 | + $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | - if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) { |
|
1604 | + if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) { |
|
1605 | 1605 | $default_tab = $tab_index; |
1606 | - $default_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
1606 | + $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
1607 | 1607 | } |
1608 | 1608 | } |
1609 | 1609 | |
1610 | - if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active. |
|
1611 | - if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) { |
|
1612 | - $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false; |
|
1610 | + if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active. |
|
1611 | + if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) { |
|
1612 | + $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
1613 | 1613 | } |
1614 | 1614 | |
1615 | - $arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true; |
|
1615 | + $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
1616 | 1616 | $active_tab = $default_tab; |
1617 | 1617 | $active_tab_name = $default_tab_name; |
1618 | 1618 | } |
1619 | - $tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false; |
|
1619 | + $tab_list = (get_option('geodir_disable_tabs', false)) ? true : false; |
|
1620 | 1620 | ?> |
1621 | 1621 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
1622 | - <?php if ( ! $tab_list ){ ?> |
|
1622 | + <?php if (!$tab_list) { ?> |
|
1623 | 1623 | <div id="geodir-tab-mobile-menu"> |
1624 | 1624 | <i class="fas fa-bars"></i> |
1625 | 1625 | <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span> |
@@ -1634,26 +1634,26 @@ discard block |
||
1634 | 1634 | * @since 1.0.0 |
1635 | 1635 | * @see 'geodir_after_tab_list' |
1636 | 1636 | */ |
1637 | - do_action( 'geodir_before_tab_list' ); ?> |
|
1637 | + do_action('geodir_before_tab_list'); ?> |
|
1638 | 1638 | <?php |
1639 | 1639 | |
1640 | - foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) { |
|
1641 | - if ( $detail_page_tab['is_display'] ) { |
|
1640 | + foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) { |
|
1641 | + if ($detail_page_tab['is_display']) { |
|
1642 | 1642 | |
1643 | - if ( ! $tab_list ) { |
|
1643 | + if (!$tab_list) { |
|
1644 | 1644 | ?> |
1645 | 1645 | <dt></dt> <!-- added to comply with validation --> |
1646 | - <dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a |
|
1646 | + <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a |
|
1647 | 1647 | data-tab="#<?php echo $tab_index; ?>" |
1648 | - data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a> |
|
1648 | + data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
|
1649 | 1649 | </dd> |
1650 | 1650 | <?php |
1651 | 1651 | } |
1652 | 1652 | ob_start() // start tab content buffering |
1653 | 1653 | ?> |
1654 | 1654 | <li id="<?php echo $tab_index; ?>Tab"> |
1655 | - <?php if ( $tab_list ) { |
|
1656 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />'; |
|
1655 | + <?php if ($tab_list) { |
|
1656 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />'; |
|
1657 | 1657 | /** |
1658 | 1658 | * Filter the tab list title html. |
1659 | 1659 | * |
@@ -1663,7 +1663,7 @@ discard block |
||
1663 | 1663 | * @param string $tab_index The tab index type. |
1664 | 1664 | * @param array $detail_page_tab The array of values including title text. |
1665 | 1665 | */ |
1666 | - echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab ); |
|
1666 | + echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab); |
|
1667 | 1667 | } ?> |
1668 | 1668 | <div id="<?php echo $tab_index; ?>" class="hash-offset"></div> |
1669 | 1669 | <?php |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | * |
1675 | 1675 | * @param string $tab_index The tab name ID. |
1676 | 1676 | */ |
1677 | - do_action( 'geodir_before_tab_content', $tab_index ); |
|
1677 | + do_action('geodir_before_tab_content', $tab_index); |
|
1678 | 1678 | |
1679 | 1679 | /** |
1680 | 1680 | * Called before the details tab content is output per tab. |
@@ -1684,21 +1684,21 @@ discard block |
||
1684 | 1684 | * @since 1.0.0 |
1685 | 1685 | * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
1686 | 1686 | */ |
1687 | - do_action( 'geodir_before_' . $tab_index . '_tab_content' ); |
|
1687 | + do_action('geodir_before_'.$tab_index.'_tab_content'); |
|
1688 | 1688 | /// write a code to generate content of each tab |
1689 | - switch ( $tab_index ) { |
|
1689 | + switch ($tab_index) { |
|
1690 | 1690 | case 'post_profile': |
1691 | 1691 | /** |
1692 | 1692 | * Called before the listing description content on the details page tab. |
1693 | 1693 | * |
1694 | 1694 | * @since 1.0.0 |
1695 | 1695 | */ |
1696 | - do_action( 'geodir_before_description_on_listing_detail' ); |
|
1697 | - if ( geodir_is_page( 'detail' ) ) { |
|
1696 | + do_action('geodir_before_description_on_listing_detail'); |
|
1697 | + if (geodir_is_page('detail')) { |
|
1698 | 1698 | the_content(); |
1699 | 1699 | } else { |
1700 | 1700 | /** This action is documented in geodirectory_template_actions.php */ |
1701 | - echo apply_filters( 'the_content', stripslashes( $post->post_desc ) ); |
|
1701 | + echo apply_filters('the_content', stripslashes($post->post_desc)); |
|
1702 | 1702 | } |
1703 | 1703 | |
1704 | 1704 | /** |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | * |
1707 | 1707 | * @since 1.0.0 |
1708 | 1708 | */ |
1709 | - do_action( 'geodir_after_description_on_listing_detail' ); |
|
1709 | + do_action('geodir_after_description_on_listing_detail'); |
|
1710 | 1710 | break; |
1711 | 1711 | case 'post_info': |
1712 | 1712 | echo $geodir_post_detail_fields; |
@@ -1716,32 +1716,32 @@ discard block |
||
1716 | 1716 | break; |
1717 | 1717 | case 'post_video': |
1718 | 1718 | // some browsers hide $_POST data if used for embeds so we replace with a placeholder |
1719 | - if ( $preview ) { |
|
1720 | - if ( $video ) { |
|
1721 | - echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fas fa-video\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>"; |
|
1719 | + if ($preview) { |
|
1720 | + if ($video) { |
|
1721 | + echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fas fa-video\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>"; |
|
1722 | 1722 | } |
1723 | 1723 | } else { |
1724 | 1724 | |
1725 | 1725 | // stop payment manager filtering content length |
1726 | - $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
1727 | - if ( false !== $filter_priority ) { |
|
1728 | - remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
1726 | + $filter_priority = has_filter('the_content', 'geodir_payments_the_content'); |
|
1727 | + if (false !== $filter_priority) { |
|
1728 | + remove_filter('the_content', 'geodir_payments_the_content', $filter_priority); |
|
1729 | 1729 | } |
1730 | 1730 | |
1731 | 1731 | /** This action is documented in geodirectory_template_actions.php */ |
1732 | - echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also; |
|
1732 | + echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also; |
|
1733 | 1733 | |
1734 | - if ( false !== $filter_priority ) { |
|
1735 | - add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
1734 | + if (false !== $filter_priority) { |
|
1735 | + add_filter('the_content', 'geodir_payments_the_content', $filter_priority); |
|
1736 | 1736 | } |
1737 | 1737 | } |
1738 | 1738 | break; |
1739 | 1739 | case 'special_offers': |
1740 | - echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) ); |
|
1740 | + echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers))); |
|
1741 | 1741 | |
1742 | 1742 | break; |
1743 | 1743 | case 'post_map': |
1744 | - geodir_draw_map( $map_args ); |
|
1744 | + geodir_draw_map($map_args); |
|
1745 | 1745 | break; |
1746 | 1746 | case 'reviews': |
1747 | 1747 | comments_template(); |
@@ -1750,7 +1750,7 @@ discard block |
||
1750 | 1750 | echo $related_listing; |
1751 | 1751 | break; |
1752 | 1752 | default: { |
1753 | - if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) { |
|
1753 | + if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) { |
|
1754 | 1754 | echo $detail_page_tab['tab_content']; |
1755 | 1755 | } |
1756 | 1756 | } |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | * |
1763 | 1763 | * @since 1.0.0 |
1764 | 1764 | */ |
1765 | - do_action( 'geodir_after_tab_content', $tab_index ); |
|
1765 | + do_action('geodir_after_tab_content', $tab_index); |
|
1766 | 1766 | |
1767 | 1767 | /** |
1768 | 1768 | * Called after the details tab content is output per tab. |
@@ -1772,7 +1772,7 @@ discard block |
||
1772 | 1772 | * @since 1.0.0 |
1773 | 1773 | * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
1774 | 1774 | */ |
1775 | - do_action( 'geodir_after_' . $tab_index . '_tab_content' ); |
|
1775 | + do_action('geodir_after_'.$tab_index.'_tab_content'); |
|
1776 | 1776 | ?> </li> |
1777 | 1777 | <?php |
1778 | 1778 | /** |
@@ -1780,7 +1780,7 @@ discard block |
||
1780 | 1780 | * |
1781 | 1781 | * @since 1.0.0 |
1782 | 1782 | */ |
1783 | - $arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() ); |
|
1783 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean()); |
|
1784 | 1784 | } // end of if for is_display |
1785 | 1785 | }// end of foreach |
1786 | 1786 | |
@@ -1790,14 +1790,14 @@ discard block |
||
1790 | 1790 | * @since 1.0.0 |
1791 | 1791 | * @see 'geodir_before_tab_list' |
1792 | 1792 | */ |
1793 | - do_action( 'geodir_after_tab_list' ); |
|
1793 | + do_action('geodir_after_tab_list'); |
|
1794 | 1794 | ?> |
1795 | - <?php if ( ! $tab_list ){ ?></dl><?php } ?> |
|
1796 | - <ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>" |
|
1795 | + <?php if (!$tab_list) { ?></dl><?php } ?> |
|
1796 | + <ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>" |
|
1797 | 1797 | style="position:relative;"> |
1798 | 1798 | <?php |
1799 | - foreach ( $arr_detail_page_tabs as $detail_page_tab ) { |
|
1800 | - if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) { |
|
1799 | + foreach ($arr_detail_page_tabs as $detail_page_tab) { |
|
1800 | + if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) { |
|
1801 | 1801 | echo $detail_page_tab['tab_content']; |
1802 | 1802 | }// end of if |
1803 | 1803 | }// end of foreach |
@@ -1807,11 +1807,11 @@ discard block |
||
1807 | 1807 | * |
1808 | 1808 | * @since 1.0.0 |
1809 | 1809 | */ |
1810 | - do_action( 'geodir_add_tab_content' ); ?> |
|
1810 | + do_action('geodir_add_tab_content'); ?> |
|
1811 | 1811 | </ul> |
1812 | 1812 | <!--gd-tabs-content ul end--> |
1813 | 1813 | </div> |
1814 | - <?php if ( ! $tab_list ) { ?> |
|
1814 | + <?php if (!$tab_list) { ?> |
|
1815 | 1815 | <script> |
1816 | 1816 | if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) { |
1817 | 1817 | hashVal = window.location.hash; |
@@ -1843,31 +1843,31 @@ discard block |
||
1843 | 1843 | * |
1844 | 1844 | * @return mixed Image file. |
1845 | 1845 | */ |
1846 | -function geodir_exif( $file ) { |
|
1847 | - if ( empty( $file ) || ! is_array( $file ) ) { |
|
1846 | +function geodir_exif($file) { |
|
1847 | + if (empty($file) || !is_array($file)) { |
|
1848 | 1848 | return $file; |
1849 | 1849 | } |
1850 | 1850 | |
1851 | - $file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : ''; |
|
1852 | - if ( ! ( $file_path && file_exists( $file_path ) ) ) { |
|
1851 | + $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
1852 | + if (!($file_path && file_exists($file_path))) { |
|
1853 | 1853 | return $file; |
1854 | 1854 | } |
1855 | 1855 | $file['file'] = $file_path; |
1856 | 1856 | |
1857 | - if ( ! file_is_valid_image( $file_path ) ) { |
|
1857 | + if (!file_is_valid_image($file_path)) { |
|
1858 | 1858 | return $file; // Bail if file is not an image. |
1859 | 1859 | } |
1860 | 1860 | |
1861 | - if ( ! function_exists( 'wp_get_image_editor' ) ) { |
|
1861 | + if (!function_exists('wp_get_image_editor')) { |
|
1862 | 1862 | return $file; |
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | $mime_type = $file['type']; |
1866 | 1866 | $exif = array(); |
1867 | - if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) { |
|
1867 | + if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) { |
|
1868 | 1868 | try { |
1869 | - $exif = exif_read_data( $file_path ); |
|
1870 | - } catch ( Exception $e ) { |
|
1869 | + $exif = exif_read_data($file_path); |
|
1870 | + } catch (Exception $e) { |
|
1871 | 1871 | $exif = array(); |
1872 | 1872 | } |
1873 | 1873 | } |
@@ -1876,13 +1876,13 @@ discard block |
||
1876 | 1876 | $flip = false; |
1877 | 1877 | $modify = false; |
1878 | 1878 | $orientation = 0; |
1879 | - if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) { |
|
1880 | - switch ( (int) $exif['Orientation'] ) { |
|
1879 | + if (!empty($exif) && isset($exif['Orientation'])) { |
|
1880 | + switch ((int) $exif['Orientation']) { |
|
1881 | 1881 | case 1: |
1882 | 1882 | // do nothing |
1883 | 1883 | break; |
1884 | 1884 | case 2: |
1885 | - $flip = array( false, true ); |
|
1885 | + $flip = array(false, true); |
|
1886 | 1886 | $modify = true; |
1887 | 1887 | break; |
1888 | 1888 | case 3: |
@@ -1891,13 +1891,13 @@ discard block |
||
1891 | 1891 | $modify = true; |
1892 | 1892 | break; |
1893 | 1893 | case 4: |
1894 | - $flip = array( true, false ); |
|
1894 | + $flip = array(true, false); |
|
1895 | 1895 | $modify = true; |
1896 | 1896 | break; |
1897 | 1897 | case 5: |
1898 | 1898 | $orientation = - 90; |
1899 | 1899 | $rotate = true; |
1900 | - $flip = array( false, true ); |
|
1900 | + $flip = array(false, true); |
|
1901 | 1901 | $modify = true; |
1902 | 1902 | break; |
1903 | 1903 | case 6: |
@@ -1908,7 +1908,7 @@ discard block |
||
1908 | 1908 | case 7: |
1909 | 1909 | $orientation = - 270; |
1910 | 1910 | $rotate = true; |
1911 | - $flip = array( false, true ); |
|
1911 | + $flip = array(false, true); |
|
1912 | 1912 | $modify = true; |
1913 | 1913 | break; |
1914 | 1914 | case 8: |
@@ -1934,31 +1934,31 @@ discard block |
||
1934 | 1934 | * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
1935 | 1935 | * @param string $quality Image mime type. |
1936 | 1936 | */ |
1937 | - $quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type ); |
|
1938 | - if ( $quality !== null ) { |
|
1937 | + $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type); |
|
1938 | + if ($quality !== null) { |
|
1939 | 1939 | $modify = true; |
1940 | 1940 | } |
1941 | 1941 | |
1942 | - if ( ! $modify ) { |
|
1942 | + if (!$modify) { |
|
1943 | 1943 | return $file; // no change |
1944 | 1944 | } |
1945 | 1945 | |
1946 | - $image = wp_get_image_editor( $file_path ); |
|
1947 | - if ( ! is_wp_error( $image ) ) { |
|
1948 | - if ( $rotate ) { |
|
1949 | - $image->rotate( $orientation ); |
|
1946 | + $image = wp_get_image_editor($file_path); |
|
1947 | + if (!is_wp_error($image)) { |
|
1948 | + if ($rotate) { |
|
1949 | + $image->rotate($orientation); |
|
1950 | 1950 | } |
1951 | 1951 | |
1952 | - if ( ! empty( $flip ) ) { |
|
1953 | - $image->flip( $flip[0], $flip[1] ); |
|
1952 | + if (!empty($flip)) { |
|
1953 | + $image->flip($flip[0], $flip[1]); |
|
1954 | 1954 | } |
1955 | 1955 | |
1956 | - if ( $quality !== null ) { |
|
1957 | - $image->set_quality( (int) $quality ); |
|
1956 | + if ($quality !== null) { |
|
1957 | + $image->set_quality((int) $quality); |
|
1958 | 1958 | } |
1959 | 1959 | |
1960 | - $result = $image->save( $file_path ); |
|
1961 | - if ( ! is_wp_error( $result ) ) { |
|
1960 | + $result = $image->save($file_path); |
|
1961 | + if (!is_wp_error($result)) { |
|
1962 | 1962 | $file['file'] = $result['path']; |
1963 | 1963 | $file['tmp_name'] = $result['path']; |
1964 | 1964 | } |
@@ -1986,7 +1986,7 @@ discard block |
||
1986 | 1986 | * |
1987 | 1987 | * @return string Returns the recent reviews html. |
1988 | 1988 | */ |
1989 | -function geodir_get_recent_reviews( $g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false ) { |
|
1989 | +function geodir_get_recent_reviews($g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false) { |
|
1990 | 1990 | global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session, $table_prefix; |
1991 | 1991 | $tablecomments = $wpdb->comments; |
1992 | 1992 | $tableposts = $wpdb->posts; |
@@ -1996,17 +1996,17 @@ discard block |
||
1996 | 1996 | $region_filter = ''; |
1997 | 1997 | $country_filter = ''; |
1998 | 1998 | |
1999 | - if ( $gd_session->get( 'gd_multi_location' ) ) { |
|
2000 | - if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) { |
|
2001 | - $country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) ); |
|
1999 | + if ($gd_session->get('gd_multi_location')) { |
|
2000 | + if ($gd_ses_country = $gd_session->get('gd_country')) { |
|
2001 | + $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country)); |
|
2002 | 2002 | } |
2003 | 2003 | |
2004 | - if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) { |
|
2005 | - $region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) ); |
|
2004 | + if ($gd_ses_region = $gd_session->get('gd_region')) { |
|
2005 | + $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region)); |
|
2006 | 2006 | } |
2007 | 2007 | |
2008 | - if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) { |
|
2009 | - $city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) ); |
|
2008 | + if ($gd_ses_city = $gd_session->get('gd_city')) { |
|
2009 | + $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city)); |
|
2010 | 2010 | } |
2011 | 2011 | } |
2012 | 2012 | |
@@ -2017,84 +2017,84 @@ discard block |
||
2017 | 2017 | $lang_code = ICL_LANGUAGE_CODE; |
2018 | 2018 | |
2019 | 2019 | if ($lang_code) { |
2020 | - $join .= " JOIN " . $table_prefix . "icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN " . $table_prefix . "icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'"; |
|
2021 | - $where .= " AND icltr2.language_code = '" . $lang_code . "' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)"; |
|
2020 | + $join .= " JOIN ".$table_prefix."icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN ".$table_prefix."icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'"; |
|
2021 | + $where .= " AND icltr2.language_code = '".$lang_code."' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)"; |
|
2022 | 2022 | } |
2023 | 2023 | } |
2024 | 2024 | |
2025 | - $request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM " . GEODIR_REVIEW_TABLE . " AS r JOIN " . $wpdb->comments . " AS c ON c.comment_ID = r.comment_id JOIN " . $wpdb->posts . " AS p ON p.ID = c.comment_post_ID " . $join . " WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' " . $where . " ORDER BY r.post_date DESC, r.id DESC LIMIT ". $no_comments; |
|
2025 | + $request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM ".GEODIR_REVIEW_TABLE." AS r JOIN ".$wpdb->comments." AS c ON c.comment_ID = r.comment_id JOIN ".$wpdb->posts." AS p ON p.ID = c.comment_post_ID ".$join." WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' ".$where." ORDER BY r.post_date DESC, r.id DESC LIMIT ".$no_comments; |
|
2026 | 2026 | |
2027 | - $comments = $wpdb->get_results( $request ); |
|
2027 | + $comments = $wpdb->get_results($request); |
|
2028 | 2028 | |
2029 | - foreach ( $comments as $comment ) { |
|
2029 | + foreach ($comments as $comment) { |
|
2030 | 2030 | // Set the extra comment info needed. |
2031 | - $comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" ); |
|
2031 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
2032 | 2032 | $comment->comment_content = $comment_extra->comment_content; |
2033 | 2033 | $comment->comment_author = $comment_extra->comment_author; |
2034 | 2034 | $comment->comment_author_email = $comment_extra->comment_author_email; |
2035 | 2035 | |
2036 | 2036 | $comment_id = ''; |
2037 | 2037 | $comment_id = $comment->comment_ID; |
2038 | - $comment_content = strip_tags( $comment->comment_content ); |
|
2038 | + $comment_content = strip_tags($comment->comment_content); |
|
2039 | 2039 | |
2040 | - $comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content ); |
|
2040 | + $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content); |
|
2041 | 2041 | |
2042 | - $permalink = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID; |
|
2042 | + $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; |
|
2043 | 2043 | $comment_author_email = $comment->comment_author_email; |
2044 | 2044 | $comment_post_ID = $comment->post_id; |
2045 | 2045 | |
2046 | - $post_title = get_the_title( $comment_post_ID ); |
|
2047 | - $permalink = get_permalink( $comment_post_ID ); |
|
2048 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
2049 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>'; |
|
2046 | + $post_title = get_the_title($comment_post_ID); |
|
2047 | + $permalink = get_permalink($comment_post_ID); |
|
2048 | + $comment_permalink = $permalink."#comment-".$comment->comment_ID; |
|
2049 | + $read_more = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>'; |
|
2050 | 2050 | |
2051 | - $comment_content_length = strlen( $comment_content ); |
|
2052 | - if ( $comment_content_length > $comment_lenth ) { |
|
2053 | - $comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more; |
|
2051 | + $comment_content_length = strlen($comment_content); |
|
2052 | + if ($comment_content_length > $comment_lenth) { |
|
2053 | + $comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more; |
|
2054 | 2054 | } else { |
2055 | 2055 | $comment_excerpt = $comment_content; |
2056 | 2056 | } |
2057 | 2057 | |
2058 | - if ( $comment->user_id ) { |
|
2059 | - $user_profile_url = get_author_posts_url( $comment->user_id ); |
|
2058 | + if ($comment->user_id) { |
|
2059 | + $user_profile_url = get_author_posts_url($comment->user_id); |
|
2060 | 2060 | } else { |
2061 | 2061 | $user_profile_url = ''; |
2062 | 2062 | } |
2063 | 2063 | |
2064 | - if ( $comment_id ) { |
|
2064 | + if ($comment_id) { |
|
2065 | 2065 | $comments_echo .= '<li class="clearfix">'; |
2066 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
2067 | - if ( function_exists( 'get_avatar' ) ) { |
|
2068 | - if ( ! isset( $comment->comment_type ) ) { |
|
2069 | - if ( $user_profile_url ) { |
|
2070 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2066 | + $comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">"; |
|
2067 | + if (function_exists('get_avatar')) { |
|
2068 | + if (!isset($comment->comment_type)) { |
|
2069 | + if ($user_profile_url) { |
|
2070 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2071 | 2071 | } |
2072 | - $comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2073 | - if ( $user_profile_url ) { |
|
2072 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2073 | + if ($user_profile_url) { |
|
2074 | 2074 | $comments_echo .= '</a>'; |
2075 | 2075 | } |
2076 | - } elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) { |
|
2077 | - if ( $user_profile_url ) { |
|
2078 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2076 | + } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) { |
|
2077 | + if ($user_profile_url) { |
|
2078 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2079 | 2079 | } |
2080 | - $comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2080 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2081 | 2081 | } |
2082 | - } elseif ( function_exists( 'gravatar' ) ) { |
|
2083 | - if ( $user_profile_url ) { |
|
2084 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2082 | + } elseif (function_exists('gravatar')) { |
|
2083 | + if ($user_profile_url) { |
|
2084 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2085 | 2085 | } |
2086 | 2086 | $comments_echo .= "<img src=\""; |
2087 | - if ( '' == $comment->comment_type ) { |
|
2088 | - $comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2089 | - if ( $user_profile_url ) { |
|
2087 | + if ('' == $comment->comment_type) { |
|
2088 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2089 | + if ($user_profile_url) { |
|
2090 | 2090 | $comments_echo .= '</a>'; |
2091 | 2091 | } |
2092 | - } elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) { |
|
2093 | - if ( $user_profile_url ) { |
|
2094 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2092 | + } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) { |
|
2093 | + if ($user_profile_url) { |
|
2094 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2095 | 2095 | } |
2096 | - $comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2097 | - if ( $user_profile_url ) { |
|
2096 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2097 | + if ($user_profile_url) { |
|
2098 | 2098 | $comments_echo .= '</a>'; |
2099 | 2099 | } |
2100 | 2100 | } |
@@ -2105,17 +2105,17 @@ discard block |
||
2105 | 2105 | |
2106 | 2106 | $comments_echo .= '<span class="geodir_reviewer_content">'; |
2107 | 2107 | $author_link = apply_filters('geodir_reviewer_content_author_link', true); |
2108 | - if ( $comment->user_id && $author_link ) { |
|
2109 | - $comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">'; |
|
2108 | + if ($comment->user_id && $author_link) { |
|
2109 | + $comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">'; |
|
2110 | 2110 | } |
2111 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
2112 | - if ( $comment->user_id && $author_link ) { |
|
2111 | + $comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> '; |
|
2112 | + if ($comment->user_id && $author_link) { |
|
2113 | 2113 | $comments_echo .= '</a>'; |
2114 | 2114 | } |
2115 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> '; |
|
2116 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
2117 | - $comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID ); |
|
2118 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
2115 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> '; |
|
2116 | + $comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>'; |
|
2117 | + $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
2118 | + $comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.''; |
|
2119 | 2119 | //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt); |
2120 | 2120 | $comments_echo .= '</p>'; |
2121 | 2121 | |
@@ -2135,25 +2135,25 @@ discard block |
||
2135 | 2135 | * @return array Returns post categories as an array. |
2136 | 2136 | */ |
2137 | 2137 | function geodir_home_map_cats_key_value_array() { |
2138 | - $post_types = geodir_get_posttypes( 'object' ); |
|
2138 | + $post_types = geodir_get_posttypes('object'); |
|
2139 | 2139 | |
2140 | 2140 | $return = array(); |
2141 | - if ( ! empty( $post_types ) ) { |
|
2142 | - foreach ( $post_types as $key => $post_type ) { |
|
2143 | - $cpt_name = __( $post_type->labels->singular_name, 'geodirectory' ); |
|
2144 | - $post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ); |
|
2145 | - $taxonomies = geodir_get_taxonomies( $key ); |
|
2146 | - $cat_taxonomy = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null; |
|
2147 | - $cat_terms = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null; |
|
2148 | - |
|
2149 | - if ( ! empty( $cat_terms ) ) { |
|
2150 | - $return[ 'optgroup_start-' . $key ] = $post_type_name; |
|
2151 | - |
|
2152 | - foreach ( $cat_terms as $cat_term ) { |
|
2153 | - $return[ $key . '_' . $cat_term->term_id ] = $cat_term->name; |
|
2141 | + if (!empty($post_types)) { |
|
2142 | + foreach ($post_types as $key => $post_type) { |
|
2143 | + $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
2144 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name); |
|
2145 | + $taxonomies = geodir_get_taxonomies($key); |
|
2146 | + $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : null; |
|
2147 | + $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : null; |
|
2148 | + |
|
2149 | + if (!empty($cat_terms)) { |
|
2150 | + $return['optgroup_start-'.$key] = $post_type_name; |
|
2151 | + |
|
2152 | + foreach ($cat_terms as $cat_term) { |
|
2153 | + $return[$key.'_'.$cat_term->term_id] = $cat_term->name; |
|
2154 | 2154 | } |
2155 | 2155 | |
2156 | - $return[ 'optgroup_end-' . $key ] = $post_type_name; |
|
2156 | + $return['optgroup_end-'.$key] = $post_type_name; |
|
2157 | 2157 | } |
2158 | 2158 | } |
2159 | 2159 | } |
@@ -2169,14 +2169,14 @@ discard block |
||
2169 | 2169 | * @package GeoDirectory |
2170 | 2170 | */ |
2171 | 2171 | function geodir_twitter_tweet_button() { |
2172 | - if ( isset( $_GET['gde'] ) ) { |
|
2173 | - $link = '?url=' . urlencode( geodir_curPageURL() ); |
|
2172 | + if (isset($_GET['gde'])) { |
|
2173 | + $link = '?url='.urlencode(geodir_curPageURL()); |
|
2174 | 2174 | } else { |
2175 | 2175 | $link = ''; |
2176 | 2176 | } |
2177 | 2177 | ?> |
2178 | 2178 | <a href="http://twitter.com/share<?php echo $link; ?>" |
2179 | - class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a> |
|
2179 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a> |
|
2180 | 2180 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
2181 | 2181 | <?php |
2182 | 2182 | } |
@@ -2193,10 +2193,10 @@ discard block |
||
2193 | 2193 | function geodir_fb_like_button() { |
2194 | 2194 | global $post; |
2195 | 2195 | ?> |
2196 | - <iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) { |
|
2196 | + <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { |
|
2197 | 2197 | echo 'allowtransparency="true"'; |
2198 | 2198 | } ?> class="facebook" |
2199 | - src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
2199 | + src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
2200 | 2200 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
2201 | 2201 | <?php |
2202 | 2202 | } |
@@ -2227,7 +2227,7 @@ discard block |
||
2227 | 2227 | |
2228 | 2228 | |
2229 | 2229 | function geodir_listing_bounce_map_pin_on_hover() { |
2230 | - if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) { |
|
2230 | + if (get_option('geodir_listing_hover_bounce_map_pin', true)) { |
|
2231 | 2231 | ?> |
2232 | 2232 | <script> |
2233 | 2233 | jQuery(function ($) { |
@@ -2250,44 +2250,44 @@ discard block |
||
2250 | 2250 | } |
2251 | 2251 | } |
2252 | 2252 | |
2253 | -add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 ); |
|
2253 | +add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10); |
|
2254 | 2254 | |
2255 | -add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 ); |
|
2256 | -function geodir_output_favourite_html_listings( $post_id ) { |
|
2257 | - geodir_favourite_html( '', $post_id ); |
|
2255 | +add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1); |
|
2256 | +function geodir_output_favourite_html_listings($post_id) { |
|
2257 | + geodir_favourite_html('', $post_id); |
|
2258 | 2258 | } |
2259 | 2259 | |
2260 | -add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 ); |
|
2261 | -function geodir_output_pinpoint_html_listings( $post_id, $post = array() ) { |
|
2260 | +add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2); |
|
2261 | +function geodir_output_pinpoint_html_listings($post_id, $post = array()) { |
|
2262 | 2262 | global $wp_query; |
2263 | 2263 | |
2264 | 2264 | $show_pin_point = $wp_query->is_main_query(); |
2265 | 2265 | |
2266 | - if ( ! empty( $post ) && ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) { |
|
2267 | - $term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type ); |
|
2268 | - $marker_icon = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' ); |
|
2266 | + if (!empty($post) && !empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) { |
|
2267 | + $term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
2268 | + $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon'); |
|
2269 | 2269 | ?> |
2270 | 2270 | <span class="geodir-pinpoint" |
2271 | - style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span> |
|
2271 | + style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span> |
|
2272 | 2272 | <a class="geodir-pinpoint-link" href="javascript:void(0)" |
2273 | 2273 | onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}" |
2274 | 2274 | onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}" |
2275 | - onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a> |
|
2275 | + onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a> |
|
2276 | 2276 | <?php |
2277 | 2277 | } |
2278 | 2278 | } |
2279 | 2279 | |
2280 | 2280 | function geodir_search_form_submit_button() { |
2281 | 2281 | |
2282 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
2282 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
|
2283 | 2283 | |
2284 | - if ( $new_style ) { |
|
2284 | + if ($new_style) { |
|
2285 | 2285 | $default_search_button_label = '<i class="fas fa-search" aria-hidden="true"></i>'; |
2286 | - }else{ |
|
2286 | + } else { |
|
2287 | 2287 | $default_search_button_label = 'Search'; |
2288 | 2288 | } |
2289 | - if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) { |
|
2290 | - $default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' ); |
|
2289 | + if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') { |
|
2290 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory'); |
|
2291 | 2291 | } |
2292 | 2292 | |
2293 | 2293 | /** |
@@ -2299,76 +2299,76 @@ discard block |
||
2299 | 2299 | * |
2300 | 2300 | * @param string $default_search_button_label The current search button text. |
2301 | 2301 | */ |
2302 | - $default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label ); |
|
2302 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label); |
|
2303 | 2303 | |
2304 | 2304 | $fa_class = ''; |
2305 | - if ( strpos( $default_search_button_label, '&#' ) !== false ) { |
|
2305 | + if (strpos($default_search_button_label, '&#') !== false) { |
|
2306 | 2306 | $fa_class = 'fa'; |
2307 | 2307 | } |
2308 | 2308 | |
2309 | - if ( ! empty( $new_style ) ) { |
|
2309 | + if (!empty($new_style)) { |
|
2310 | 2310 | ?> |
2311 | - <button class="geodir_submit_search"><?php _e( $default_search_button_label ,'geodirectory'); ?></button> |
|
2312 | - <?php }else{?> |
|
2313 | - <input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>" class="geodir_submit_search"/> |
|
2311 | + <button class="geodir_submit_search"><?php _e($default_search_button_label, 'geodirectory'); ?></button> |
|
2312 | + <?php } else {?> |
|
2313 | + <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search"/> |
|
2314 | 2314 | <?php } |
2315 | 2315 | } |
2316 | 2316 | |
2317 | -add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 ); |
|
2317 | +add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000); |
|
2318 | 2318 | |
2319 | 2319 | function geodir_search_form_post_type_input() { |
2320 | 2320 | global $geodir_search_post_type; |
2321 | - $post_types = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) ); |
|
2321 | + $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object')); |
|
2322 | 2322 | $curr_post_type = $geodir_search_post_type; |
2323 | 2323 | |
2324 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) { |
|
2324 | + if (!empty($post_types) && count((array) $post_types) > 1) { |
|
2325 | 2325 | |
2326 | - foreach ( $post_types as $post_type => $info ){ |
|
2326 | + foreach ($post_types as $post_type => $info) { |
|
2327 | 2327 | global $wpdb; |
2328 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
2329 | - if ( ! $has_posts ) { |
|
2328 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type)); |
|
2329 | + if (!$has_posts) { |
|
2330 | 2330 | unset($post_types->{$post_type}); |
2331 | 2331 | } |
2332 | 2332 | } |
2333 | 2333 | |
2334 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) { |
|
2334 | + if (!empty($post_types) && count((array) $post_types) > 1) { |
|
2335 | 2335 | |
2336 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
2337 | - if ( $new_style ) { |
|
2336 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
|
2337 | + if ($new_style) { |
|
2338 | 2338 | echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>"; |
2339 | 2339 | } |
2340 | 2340 | ?> |
2341 | 2341 | <select name="stype" class="search_by_post"> |
2342 | - <?php foreach ( $post_types as $post_type => $info ): |
|
2342 | + <?php foreach ($post_types as $post_type => $info): |
|
2343 | 2343 | global $wpdb; |
2344 | 2344 | ?> |
2345 | 2345 | |
2346 | - <option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>" |
|
2347 | - value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) { |
|
2348 | - if ( $post_type == $_REQUEST['stype'] ) { |
|
2346 | + <option data-label="<?php echo get_post_type_archive_link($post_type); ?>" |
|
2347 | + value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) { |
|
2348 | + if ($post_type == $_REQUEST['stype']) { |
|
2349 | 2349 | echo 'selected="selected"'; |
2350 | 2350 | } |
2351 | - } elseif ( $curr_post_type == $post_type ) { |
|
2351 | + } elseif ($curr_post_type == $post_type) { |
|
2352 | 2352 | echo 'selected="selected"'; |
2353 | - } ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option> |
|
2353 | + } ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option> |
|
2354 | 2354 | |
2355 | 2355 | <?php endforeach; ?> |
2356 | 2356 | </select> |
2357 | 2357 | <?php |
2358 | - if ( $new_style ) { |
|
2358 | + if ($new_style) { |
|
2359 | 2359 | echo "</div>"; |
2360 | 2360 | } |
2361 | - }else{ |
|
2362 | - if(! empty( $post_types )){ |
|
2363 | - $pt_arr = (array)$post_types; |
|
2364 | - echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" />'; |
|
2365 | - }else{ |
|
2361 | + } else { |
|
2362 | + if (!empty($post_types)) { |
|
2363 | + $pt_arr = (array) $post_types; |
|
2364 | + echo '<input type="hidden" name="stype" value="'.key($pt_arr).'" />'; |
|
2365 | + } else { |
|
2366 | 2366 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2367 | 2367 | } |
2368 | 2368 | |
2369 | 2369 | } |
2370 | 2370 | |
2371 | - }elseif ( ! empty( $post_types ) ) { |
|
2371 | + }elseif (!empty($post_types)) { |
|
2372 | 2372 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2373 | 2373 | } |
2374 | 2374 | } |
@@ -2376,27 +2376,27 @@ discard block |
||
2376 | 2376 | function geodir_search_form_search_input() { |
2377 | 2377 | |
2378 | 2378 | $default_search_for_text = SEARCH_FOR_TEXT; |
2379 | - if ( get_option( 'geodir_search_field_default_text' ) ) { |
|
2380 | - $default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' ); |
|
2379 | + if (get_option('geodir_search_field_default_text')) { |
|
2380 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
2381 | 2381 | } |
2382 | 2382 | |
2383 | 2383 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
2384 | - if($new_style){ |
|
2384 | + if ($new_style) { |
|
2385 | 2385 | echo "<div class='gd-search-input-wrapper gd-search-field-search'>"; |
2386 | 2386 | } |
2387 | 2387 | ?> |
2388 | 2388 | <input class="search_text" name="s" |
2389 | - value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) { |
|
2390 | - $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
2389 | + value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') { |
|
2390 | + $search_term = esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
2391 | 2391 | echo $search_term; |
2392 | 2392 | } else { |
2393 | 2393 | echo $default_search_for_text; |
2394 | 2394 | } ?>" type="text" |
2395 | - onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}" |
|
2396 | - onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}" |
|
2395 | + onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}" |
|
2396 | + onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}" |
|
2397 | 2397 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
2398 | 2398 | <?php |
2399 | - if($new_style){ |
|
2399 | + if ($new_style) { |
|
2400 | 2400 | echo "</div>"; |
2401 | 2401 | } |
2402 | 2402 | } |
@@ -2404,12 +2404,12 @@ discard block |
||
2404 | 2404 | function geodir_search_form_near_input() { |
2405 | 2405 | |
2406 | 2406 | $default_near_text = NEAR_TEXT; |
2407 | - if ( get_option( 'geodir_near_field_default_text' ) ) { |
|
2408 | - $default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' ); |
|
2407 | + if (get_option('geodir_near_field_default_text')) { |
|
2408 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
2409 | 2409 | } |
2410 | 2410 | |
2411 | - if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) { |
|
2412 | - $near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) ); |
|
2411 | + if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') { |
|
2412 | + $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
2413 | 2413 | } else { |
2414 | 2414 | $near = $default_near_text; |
2415 | 2415 | } |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | * @since 1.6.9 |
2424 | 2424 | * @param string $curr_post_type The current post type. |
2425 | 2425 | */ |
2426 | - $near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type); |
|
2426 | + $near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type); |
|
2427 | 2427 | |
2428 | 2428 | |
2429 | 2429 | /** |
@@ -2436,7 +2436,7 @@ discard block |
||
2436 | 2436 | * @param string $near The current near value. |
2437 | 2437 | * @param string $default_near_text The default near value. |
2438 | 2438 | */ |
2439 | - $near = apply_filters( 'geodir_search_near_text', $near, $default_near_text ); |
|
2439 | + $near = apply_filters('geodir_search_near_text', $near, $default_near_text); |
|
2440 | 2440 | /** |
2441 | 2441 | * Filter the default "Near" text value for the search form. |
2442 | 2442 | * |
@@ -2447,7 +2447,7 @@ discard block |
||
2447 | 2447 | * @param string $near The current near value. |
2448 | 2448 | * @param string $default_near_text The default near value. |
2449 | 2449 | */ |
2450 | - $default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near ); |
|
2450 | + $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near); |
|
2451 | 2451 | /** |
2452 | 2452 | * Filter the class for the near search input. |
2453 | 2453 | * |
@@ -2455,10 +2455,10 @@ discard block |
||
2455 | 2455 | * |
2456 | 2456 | * @param string $class The class for the HTML near input, default is blank. |
2457 | 2457 | */ |
2458 | - $near_class = apply_filters( 'geodir_search_near_class', '' ); |
|
2458 | + $near_class = apply_filters('geodir_search_near_class', ''); |
|
2459 | 2459 | |
2460 | 2460 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
2461 | - if($new_style){ |
|
2461 | + if ($new_style) { |
|
2462 | 2462 | echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>"; |
2463 | 2463 | |
2464 | 2464 | do_action('geodir_before_near_input'); |
@@ -2466,30 +2466,30 @@ discard block |
||
2466 | 2466 | |
2467 | 2467 | ?> |
2468 | 2468 | <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>" |
2469 | - onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}" |
|
2470 | - onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}" |
|
2471 | - onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/> |
|
2469 | + onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}" |
|
2470 | + onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}" |
|
2471 | + onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/> |
|
2472 | 2472 | <?php |
2473 | - if($new_style){ |
|
2473 | + if ($new_style) { |
|
2474 | 2474 | do_action('geodir_after_near_input'); |
2475 | 2475 | |
2476 | 2476 | echo "</div>"; |
2477 | 2477 | } |
2478 | 2478 | } |
2479 | 2479 | |
2480 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 ); |
|
2481 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 ); |
|
2482 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 ); |
|
2480 | +add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10); |
|
2481 | +add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20); |
|
2482 | +add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30); |
|
2483 | 2483 | |
2484 | -function geodir_get_search_post_type($pt=''){ |
|
2484 | +function geodir_get_search_post_type($pt = '') { |
|
2485 | 2485 | global $geodir_search_post_type; |
2486 | 2486 | |
2487 | - if($pt!=''){return $geodir_search_post_type = $pt;} |
|
2488 | - if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;} |
|
2487 | + if ($pt != '') {return $geodir_search_post_type = $pt; } |
|
2488 | + if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; } |
|
2489 | 2489 | |
2490 | 2490 | $geodir_search_post_type = geodir_get_current_posttype(); |
2491 | 2491 | |
2492 | - if(!$geodir_search_post_type) { |
|
2492 | + if (!$geodir_search_post_type) { |
|
2493 | 2493 | $geodir_search_post_type = geodir_get_default_posttype(); |
2494 | 2494 | } |
2495 | 2495 | |
@@ -2497,7 +2497,7 @@ discard block |
||
2497 | 2497 | return $geodir_search_post_type; |
2498 | 2498 | } |
2499 | 2499 | |
2500 | -function geodir_search_form(){ |
|
2500 | +function geodir_search_form() { |
|
2501 | 2501 | |
2502 | 2502 | geodir_get_search_post_type(); |
2503 | 2503 | |
@@ -2507,8 +2507,8 @@ discard block |
||
2507 | 2507 | die(); |
2508 | 2508 | } |
2509 | 2509 | |
2510 | -add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' ); |
|
2511 | -add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' ); |
|
2510 | +add_action('wp_ajax_geodir_search_form', 'geodir_search_form'); |
|
2511 | +add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form'); |
|
2512 | 2512 | |
2513 | 2513 | /** |
2514 | 2514 | * Check wpml active or not. |
@@ -2582,7 +2582,7 @@ discard block |
||
2582 | 2582 | } |
2583 | 2583 | } |
2584 | 2584 | } |
2585 | -add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
|
2585 | +add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4); |
|
2586 | 2586 | |
2587 | 2587 | /** |
2588 | 2588 | * Duplicate post listing manually after listing saved. |
@@ -2606,7 +2606,7 @@ discard block |
||
2606 | 2606 | foreach ($post_duplicates as $lang => $dup_post_id) { |
2607 | 2607 | geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true); |
2608 | 2608 | } |
2609 | - do_action( 'geodir_wpml_listing_duplicated', $post_id, $request_info ); |
|
2609 | + do_action('geodir_wpml_listing_duplicated', $post_id, $request_info); |
|
2610 | 2610 | } |
2611 | 2611 | } |
2612 | 2612 | |
@@ -2625,7 +2625,7 @@ discard block |
||
2625 | 2625 | function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) { |
2626 | 2626 | global $wpdb; |
2627 | 2627 | |
2628 | - $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A); |
|
2628 | + $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A); |
|
2629 | 2629 | |
2630 | 2630 | if (!empty($reviews)) { |
2631 | 2631 | foreach ($reviews as $review) { |
@@ -2654,15 +2654,15 @@ discard block |
||
2654 | 2654 | global $wpdb, $plugin_prefix; |
2655 | 2655 | |
2656 | 2656 | $post_type = get_post_type($master_post_id); |
2657 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
2657 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
2658 | 2658 | |
2659 | - $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id)); |
|
2660 | - $data = (array)$wpdb->get_row($query); |
|
2659 | + $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id)); |
|
2660 | + $data = (array) $wpdb->get_row($query); |
|
2661 | 2661 | |
2662 | - if ( !empty( $data ) ) { |
|
2663 | - $data = apply_filters( 'geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang ); |
|
2662 | + if (!empty($data)) { |
|
2663 | + $data = apply_filters('geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang); |
|
2664 | 2664 | $data['post_id'] = $tr_post_id; |
2665 | - unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']); |
|
2665 | + unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']); |
|
2666 | 2666 | $wpdb->update($post_table, $data, array('post_id' => $tr_post_id)); |
2667 | 2667 | return true; |
2668 | 2668 | } |
@@ -2687,7 +2687,7 @@ discard block |
||
2687 | 2687 | global $sitepress, $wpdb; |
2688 | 2688 | $post_type = get_post_type($master_post_id); |
2689 | 2689 | |
2690 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language |
|
2690 | + remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language |
|
2691 | 2691 | |
2692 | 2692 | $taxonomies = get_object_taxonomies($post_type); |
2693 | 2693 | foreach ($taxonomies as $taxonomy) { |
@@ -2696,9 +2696,9 @@ discard block |
||
2696 | 2696 | |
2697 | 2697 | if ($terms) { |
2698 | 2698 | foreach ($terms as $term) { |
2699 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
2699 | + $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang); |
|
2700 | 2700 | |
2701 | - if (!is_null($tr_id)){ |
|
2701 | + if (!is_null($tr_id)) { |
|
2702 | 2702 | // not using get_term - unfiltered get_term |
2703 | 2703 | $translated_term = $wpdb->get_row($wpdb->prepare(" |
2704 | 2704 | SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy)); |
@@ -2707,14 +2707,14 @@ discard block |
||
2707 | 2707 | } |
2708 | 2708 | } |
2709 | 2709 | |
2710 | - if (!is_taxonomy_hierarchical($taxonomy)){ |
|
2711 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
2710 | + if (!is_taxonomy_hierarchical($taxonomy)) { |
|
2711 | + $terms_array = array_unique(array_map('intval', $terms_array)); |
|
2712 | 2712 | } |
2713 | 2713 | |
2714 | 2714 | wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
2715 | 2715 | |
2716 | - if ($taxonomy == $post_type . 'category') { |
|
2717 | - geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
2716 | + if ($taxonomy == $post_type.'category') { |
|
2717 | + geodir_set_postcat_structure($tr_post_id, $post_type.'category'); |
|
2718 | 2718 | } |
2719 | 2719 | } |
2720 | 2720 | } |
@@ -2735,15 +2735,15 @@ discard block |
||
2735 | 2735 | function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) { |
2736 | 2736 | global $wpdb; |
2737 | 2737 | |
2738 | - $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id)); |
|
2738 | + $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id)); |
|
2739 | 2739 | $wpdb->query($query); |
2740 | 2740 | |
2741 | - $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id)); |
|
2741 | + $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id)); |
|
2742 | 2742 | $post_images = $wpdb->get_results($query); |
2743 | 2743 | |
2744 | - if ( !empty( $post_images ) ) { |
|
2745 | - foreach ( $post_images as $post_image) { |
|
2746 | - $image_data = (array)$post_image; |
|
2744 | + if (!empty($post_images)) { |
|
2745 | + foreach ($post_images as $post_image) { |
|
2746 | + $image_data = (array) $post_image; |
|
2747 | 2747 | unset($image_data['ID']); |
2748 | 2748 | $image_data['post_id'] = $tr_post_id; |
2749 | 2749 | |
@@ -2776,13 +2776,13 @@ discard block |
||
2776 | 2776 | function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) { |
2777 | 2777 | global $wpdb, $plugin_prefix, $sitepress; |
2778 | 2778 | |
2779 | - $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A); |
|
2779 | + $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A); |
|
2780 | 2780 | |
2781 | 2781 | if (empty($review)) { |
2782 | 2782 | return false; |
2783 | 2783 | } |
2784 | 2784 | if ($review['post_id'] != $master_post_id) { |
2785 | - $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id)); |
|
2785 | + $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id)); |
|
2786 | 2786 | geodir_update_postrating($master_post_id, $post_type); |
2787 | 2787 | } |
2788 | 2788 | |
@@ -2793,9 +2793,9 @@ discard block |
||
2793 | 2793 | } |
2794 | 2794 | |
2795 | 2795 | $post_type = get_post_type($master_post_id); |
2796 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
2796 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
2797 | 2797 | |
2798 | - $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A); |
|
2798 | + $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A); |
|
2799 | 2799 | if (empty($translated_post)) { |
2800 | 2800 | return false; |
2801 | 2801 | } |
@@ -2813,7 +2813,7 @@ discard block |
||
2813 | 2813 | unset($review['id']); |
2814 | 2814 | } |
2815 | 2815 | |
2816 | - $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id)); |
|
2816 | + $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id)); |
|
2817 | 2817 | |
2818 | 2818 | if ($tr_review_id) { // update review |
2819 | 2819 | $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id)); |
@@ -2826,8 +2826,8 @@ discard block |
||
2826 | 2826 | geodir_update_postrating($tr_post_id, $post_type); |
2827 | 2827 | |
2828 | 2828 | if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) { |
2829 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id))); |
|
2830 | - $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A); |
|
2829 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id))); |
|
2830 | + $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A); |
|
2831 | 2831 | |
2832 | 2832 | if (!empty($likes)) { |
2833 | 2833 | foreach ($likes as $like) { |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | * @return bool True if review star disabled, otherwise false. |
2930 | 2930 | */ |
2931 | 2931 | function geodir_rating_disabled_post_types() { |
2932 | - $post_types = get_option( 'geodir_disable_rating_cpt' ); |
|
2932 | + $post_types = get_option('geodir_disable_rating_cpt'); |
|
2933 | 2933 | |
2934 | 2934 | /** |
2935 | 2935 | * Filter the post types array which have rating disabled. |
@@ -2938,7 +2938,7 @@ discard block |
||
2938 | 2938 | * |
2939 | 2939 | * @param array $post_types Array of post types which have rating starts disabled. |
2940 | 2940 | */ |
2941 | - return apply_filters( 'geodir_rating_disabled_post_types', $post_types ); |
|
2941 | + return apply_filters('geodir_rating_disabled_post_types', $post_types); |
|
2942 | 2942 | } |
2943 | 2943 | |
2944 | 2944 | /** |
@@ -2950,30 +2950,30 @@ discard block |
||
2950 | 2950 | * @param bool $taxonomy Whether $post_type is taxonomy or not. |
2951 | 2951 | * @return bool True if review star disabled, otherwise false. |
2952 | 2952 | */ |
2953 | -function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) { |
|
2953 | +function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) { |
|
2954 | 2954 | $post_types = geodir_rating_disabled_post_types(); |
2955 | 2955 | |
2956 | - if ( empty( $post_types ) ) { |
|
2956 | + if (empty($post_types)) { |
|
2957 | 2957 | return false; |
2958 | 2958 | } |
2959 | 2959 | |
2960 | - if ( is_int( $post_type ) ) { |
|
2961 | - $post_type = get_post_type( $post_type ); |
|
2960 | + if (is_int($post_type)) { |
|
2961 | + $post_type = get_post_type($post_type); |
|
2962 | 2962 | } |
2963 | 2963 | |
2964 | - if ( $taxonomy && !empty( $post_types ) ) { |
|
2964 | + if ($taxonomy && !empty($post_types)) { |
|
2965 | 2965 | $posttypes = array(); |
2966 | 2966 | |
2967 | - foreach ( $post_types as $posttype ) { |
|
2968 | - $posttypes[] = $posttype . 'category'; |
|
2969 | - $posttypes[] = $posttype . '_tags'; |
|
2967 | + foreach ($post_types as $posttype) { |
|
2968 | + $posttypes[] = $posttype.'category'; |
|
2969 | + $posttypes[] = $posttype.'_tags'; |
|
2970 | 2970 | } |
2971 | 2971 | |
2972 | 2972 | $post_types = $posttypes; |
2973 | 2973 | } |
2974 | 2974 | |
2975 | 2975 | $return = false; |
2976 | - if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) { |
|
2976 | + if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) { |
|
2977 | 2977 | $return = true; |
2978 | 2978 | } |
2979 | 2979 | |
@@ -2988,7 +2988,7 @@ discard block |
||
2988 | 2988 | * @return bool True if Yoast SEO disabled on GD pages. |
2989 | 2989 | */ |
2990 | 2990 | function geodir_disable_yoast_seo_metas() { |
2991 | - return (bool)get_option( 'geodir_disable_yoast_meta' ); |
|
2991 | + return (bool) get_option('geodir_disable_yoast_meta'); |
|
2992 | 2992 | } |
2993 | 2993 | |
2994 | 2994 | /** |
@@ -2999,30 +2999,30 @@ discard block |
||
2999 | 2999 | * @param int $post_id The post ID. |
3000 | 3000 | * @return bool True if allowed. |
3001 | 3001 | */ |
3002 | -function geodir_wpml_allowed_to_duplicate( $post_id ) { |
|
3002 | +function geodir_wpml_allowed_to_duplicate($post_id) { |
|
3003 | 3003 | $allowed = false; |
3004 | 3004 | |
3005 | - if ( !geodir_is_wpml() || empty( $post_id ) ) { |
|
3005 | + if (!geodir_is_wpml() || empty($post_id)) { |
|
3006 | 3006 | return $allowed; |
3007 | 3007 | } |
3008 | 3008 | |
3009 | - $user_id = (int)get_current_user_id(); |
|
3009 | + $user_id = (int) get_current_user_id(); |
|
3010 | 3010 | |
3011 | - if ( empty( $user_id ) ) { |
|
3011 | + if (empty($user_id)) { |
|
3012 | 3012 | return $allowed; |
3013 | 3013 | } |
3014 | 3014 | |
3015 | - $post_type = get_post_type( $post_id ); |
|
3016 | - if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) { |
|
3015 | + $post_type = get_post_type($post_id); |
|
3016 | + if (!geodir_wpml_is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) { |
|
3017 | 3017 | return $allowed; |
3018 | 3018 | } |
3019 | 3019 | |
3020 | - if ( geodir_listing_belong_to_current_user( $post_id ) ) { |
|
3020 | + if (geodir_listing_belong_to_current_user($post_id)) { |
|
3021 | 3021 | $allowed = true; |
3022 | 3022 | } |
3023 | 3023 | |
3024 | - $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' ); |
|
3025 | - if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) { |
|
3024 | + $disable_cpts = get_option('geodir_wpml_disable_duplicate'); |
|
3025 | + if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) { |
|
3026 | 3026 | $allowed = false; |
3027 | 3027 | } |
3028 | 3028 | |
@@ -3032,7 +3032,7 @@ discard block |
||
3032 | 3032 | * @param bool $allowed True if allowed. |
3033 | 3033 | * @param int $post_id The post ID. |
3034 | 3034 | */ |
3035 | - return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id ); |
|
3035 | + return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id); |
|
3036 | 3036 | } |
3037 | 3037 | |
3038 | 3038 | /** |
@@ -3047,61 +3047,61 @@ discard block |
||
3047 | 3047 | * @param string $content_html The output html of the geodir_edit_post_link() function. |
3048 | 3048 | * @return string Filtered html of the geodir_edit_post_link() function. |
3049 | 3049 | */ |
3050 | -function geodir_wpml_frontend_duplicate_listing( $content_html ) { |
|
3050 | +function geodir_wpml_frontend_duplicate_listing($content_html) { |
|
3051 | 3051 | global $post, $preview, $sitepress; |
3052 | 3052 | |
3053 | - if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) { |
|
3053 | + if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) { |
|
3054 | 3054 | $post_id = $post->ID; |
3055 | - $element_type = 'post_' . get_post_type( $post_id ); |
|
3056 | - $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type ); |
|
3055 | + $element_type = 'post_'.get_post_type($post_id); |
|
3056 | + $original_post_id = $sitepress->get_original_element_id($post_id, $element_type); |
|
3057 | 3057 | |
3058 | - if ( $original_post_id == $post_id ) { |
|
3058 | + if ($original_post_id == $post_id) { |
|
3059 | 3059 | $wpml_languages = $sitepress->get_active_languages(); |
3060 | - $post_language = $sitepress->get_language_for_element( $post_id, $element_type ); |
|
3060 | + $post_language = $sitepress->get_language_for_element($post_id, $element_type); |
|
3061 | 3061 | |
3062 | - if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) { |
|
3063 | - unset( $wpml_languages[ $post_language ] ); |
|
3062 | + if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) { |
|
3063 | + unset($wpml_languages[$post_language]); |
|
3064 | 3064 | } |
3065 | 3065 | |
3066 | - if ( !empty( $wpml_languages ) ) { |
|
3067 | - $trid = $sitepress->get_element_trid( $post_id, $element_type ); |
|
3068 | - $element_translations = $sitepress->get_element_translations( $trid, $element_type ); |
|
3069 | - $duplicates = $sitepress->get_duplicates( $post_id ); |
|
3066 | + if (!empty($wpml_languages)) { |
|
3067 | + $trid = $sitepress->get_element_trid($post_id, $element_type); |
|
3068 | + $element_translations = $sitepress->get_element_translations($trid, $element_type); |
|
3069 | + $duplicates = $sitepress->get_duplicates($post_id); |
|
3070 | 3070 | |
3071 | - $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>'; |
|
3071 | + $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>'; |
|
3072 | 3072 | $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>'; |
3073 | - $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>'; |
|
3073 | + $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">'.__('Language', 'geodirectory').'</th><th style="width:25px;"></th><th style="width:5em;text-align:center">'.__('Translate', 'geodirectory').'</th></tr>'; |
|
3074 | 3074 | |
3075 | 3075 | $needs_translation = false; |
3076 | 3076 | |
3077 | - foreach ( $wpml_languages as $lang_code => $lang ) { |
|
3077 | + foreach ($wpml_languages as $lang_code => $lang) { |
|
3078 | 3078 | $duplicates_text = ''; |
3079 | 3079 | $translated = false; |
3080 | 3080 | |
3081 | - if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) { |
|
3081 | + if (!empty($element_translations) && isset($element_translations[$lang_code])) { |
|
3082 | 3082 | $translated = true; |
3083 | 3083 | |
3084 | - if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) { |
|
3085 | - $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' ); |
|
3084 | + if (!empty($duplicates) && isset($duplicates[$lang_code])) { |
|
3085 | + $duplicates_text = ' '.__('(duplicate)', 'geodirectory'); |
|
3086 | 3086 | } |
3087 | 3087 | } else { |
3088 | 3088 | $needs_translation = true; |
3089 | 3089 | } |
3090 | 3090 | |
3091 | - $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td> </td><td style="text-align:center;">'; |
|
3091 | + $wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td> </td><td style="text-align:center;">'; |
|
3092 | 3092 | |
3093 | - if ( $translated ) { |
|
3093 | + if ($translated) { |
|
3094 | 3094 | $wpml_content .= '<i class="fas fa-check" style="color:orange"></i>'; |
3095 | 3095 | } else { |
3096 | - $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">'; |
|
3096 | + $wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">'; |
|
3097 | 3097 | } |
3098 | 3098 | |
3099 | 3099 | $wpml_content .= '</td></tr>'; |
3100 | 3100 | } |
3101 | 3101 | |
3102 | - if ( $needs_translation ) { |
|
3103 | - $nonce = wp_create_nonce( 'geodir_duplicate_nonce' ); |
|
3104 | - $wpml_content .= '<tr><td> </td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fas fa-spin fa-sync"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>'; |
|
3102 | + if ($needs_translation) { |
|
3103 | + $nonce = wp_create_nonce('geodir_duplicate_nonce'); |
|
3104 | + $wpml_content .= '<tr><td> </td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fas fa-spin fa-sync"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="'.esc_attr($nonce).'" data-post-id="'.$post_id.'" id="gd_make_duplicates" class="button-secondary">'.__('Duplicate', 'geodirectory').'</button></td></tr>'; |
|
3105 | 3105 | } |
3106 | 3106 | |
3107 | 3107 | $wpml_content .= '</tbody></table>'; |
@@ -3123,12 +3123,12 @@ discard block |
||
3123 | 3123 | * @param array $settings GD design settings array. |
3124 | 3124 | * @return array Filtered GD design settings array.. |
3125 | 3125 | */ |
3126 | -function geodir_wpml_duplicate_settings( $settings = array() ) { |
|
3126 | +function geodir_wpml_duplicate_settings($settings = array()) { |
|
3127 | 3127 | $new_settings = array(); |
3128 | 3128 | |
3129 | - foreach ( $settings as $key => $setting ) { |
|
3129 | + foreach ($settings as $key => $setting) { |
|
3130 | 3130 | |
3131 | - if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) { |
|
3131 | + if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') { |
|
3132 | 3132 | $new_settings[] = array( |
3133 | 3133 | 'name' => __('Disable WPML duplicate translation', 'geodirectory'), |
3134 | 3134 | 'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'), |
@@ -3156,12 +3156,12 @@ discard block |
||
3156 | 3156 | * @param string $taxonomy name/slug of a taxonomy. |
3157 | 3157 | * @return bool true if the taxonomy is currently set to being translatable in WPML. |
3158 | 3158 | */ |
3159 | -function geodir_wpml_is_taxonomy_translated( $taxonomy ) { |
|
3160 | - if ( empty( $taxonomy ) || !geodir_is_wpml() || !function_exists( 'is_taxonomy_translated' ) ) { |
|
3159 | +function geodir_wpml_is_taxonomy_translated($taxonomy) { |
|
3160 | + if (empty($taxonomy) || !geodir_is_wpml() || !function_exists('is_taxonomy_translated')) { |
|
3161 | 3161 | return false; |
3162 | 3162 | } |
3163 | 3163 | |
3164 | - if ( is_taxonomy_translated( $taxonomy ) ) { |
|
3164 | + if (is_taxonomy_translated($taxonomy)) { |
|
3165 | 3165 | return true; |
3166 | 3166 | } |
3167 | 3167 | |
@@ -3176,12 +3176,12 @@ discard block |
||
3176 | 3176 | * @param string $post_type name/slug of a post_type. |
3177 | 3177 | * @return bool true if the post_type is currently set to being translatable in WPML. |
3178 | 3178 | */ |
3179 | -function geodir_wpml_is_post_type_translated( $post_type ) { |
|
3180 | - if ( empty( $post_type ) || !geodir_is_wpml() || !function_exists( 'is_post_type_translated' ) ) { |
|
3179 | +function geodir_wpml_is_post_type_translated($post_type) { |
|
3180 | + if (empty($post_type) || !geodir_is_wpml() || !function_exists('is_post_type_translated')) { |
|
3181 | 3181 | return false; |
3182 | 3182 | } |
3183 | 3183 | |
3184 | - if ( is_post_type_translated( $post_type ) ) { |
|
3184 | + if (is_post_type_translated($post_type)) { |
|
3185 | 3185 | return true; |
3186 | 3186 | } |
3187 | 3187 | |
@@ -3203,12 +3203,12 @@ discard block |
||
3203 | 3203 | * |
3204 | 3204 | * @return int|NULL |
3205 | 3205 | */ |
3206 | -function geodir_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) { |
|
3207 | - if ( geodir_is_wpml() ) { |
|
3208 | - if ( function_exists( 'wpml_object_id_filter' ) ) { |
|
3209 | - return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code ); |
|
3206 | +function geodir_wpml_object_id($element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null) { |
|
3207 | + if (geodir_is_wpml()) { |
|
3208 | + if (function_exists('wpml_object_id_filter')) { |
|
3209 | + return apply_filters('wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code); |
|
3210 | 3210 | } else { |
3211 | - return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code ); |
|
3211 | + return icl_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code); |
|
3212 | 3212 | } |
3213 | 3213 | } |
3214 | 3214 |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $author_id = $p_post->post_author; |
244 | 244 | |
245 | - }else{ |
|
245 | + } else{ |
|
246 | 246 | gd_die(); |
247 | 247 | } |
248 | 248 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | check_ajax_referer( 'send_to_frnd_'.$pid ); |
391 | 391 | |
392 | - }else{ |
|
392 | + } else{ |
|
393 | 393 | gd_die(); |
394 | 394 | } |
395 | 395 | |
@@ -2283,7 +2283,7 @@ discard block |
||
2283 | 2283 | |
2284 | 2284 | if ( $new_style ) { |
2285 | 2285 | $default_search_button_label = '<i class="fas fa-search" aria-hidden="true"></i>'; |
2286 | - }else{ |
|
2286 | + } else{ |
|
2287 | 2287 | $default_search_button_label = 'Search'; |
2288 | 2288 | } |
2289 | 2289 | if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) { |
@@ -2309,7 +2309,7 @@ discard block |
||
2309 | 2309 | if ( ! empty( $new_style ) ) { |
2310 | 2310 | ?> |
2311 | 2311 | <button class="geodir_submit_search"><?php _e( $default_search_button_label ,'geodirectory'); ?></button> |
2312 | - <?php }else{?> |
|
2312 | + <?php } else{?> |
|
2313 | 2313 | <input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>" class="geodir_submit_search"/> |
2314 | 2314 | <?php } |
2315 | 2315 | } |
@@ -2358,17 +2358,17 @@ discard block |
||
2358 | 2358 | if ( $new_style ) { |
2359 | 2359 | echo "</div>"; |
2360 | 2360 | } |
2361 | - }else{ |
|
2361 | + } else{ |
|
2362 | 2362 | if(! empty( $post_types )){ |
2363 | 2363 | $pt_arr = (array)$post_types; |
2364 | 2364 | echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" />'; |
2365 | - }else{ |
|
2365 | + } else{ |
|
2366 | 2366 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2367 | 2367 | } |
2368 | 2368 | |
2369 | 2369 | } |
2370 | 2370 | |
2371 | - }elseif ( ! empty( $post_types ) ) { |
|
2371 | + } elseif ( ! empty( $post_types ) ) { |
|
2372 | 2372 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2373 | 2373 | } |
2374 | 2374 | } |
@@ -33,265 +33,265 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function geodir_add_nav_menu_items() |
35 | 35 | { |
36 | - $items = ''; |
|
37 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
38 | - |
|
39 | - if (get_option('geodir_show_listing_nav')) { |
|
40 | - |
|
41 | - $menu_class = ''; |
|
42 | - if (geodir_is_page('listing')) |
|
43 | - $menu_class = 'current-menu-item'; |
|
44 | - |
|
45 | - |
|
46 | - //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
47 | - $post_types = geodir_get_posttypes('object'); |
|
48 | - $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav'); |
|
49 | - if (!empty($post_types)) { |
|
50 | - foreach ($post_types as $post_type => $args) { |
|
51 | - if (!empty($show_post_type_main_nav)) { |
|
52 | - if (in_array($post_type, $show_post_type_main_nav)) { |
|
53 | - if (get_post_type_archive_link($post_type)) { |
|
54 | - $menu_class = ''; |
|
55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | - $menu_class = 'current-menu-item'; |
|
57 | - /** |
|
58 | - * Filter the menu li class. |
|
59 | - * |
|
60 | - * @since 1.0.0 |
|
61 | - * @param string $menu_class The menu HTML class. |
|
62 | - */ |
|
63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
64 | - /** |
|
65 | - * Filter the menu a class. |
|
66 | - * |
|
67 | - * @since 1.0.0 |
|
68 | - */ |
|
69 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
70 | - $items .= '<li class="' . $li_class . '"> |
|
36 | + $items = ''; |
|
37 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
38 | + |
|
39 | + if (get_option('geodir_show_listing_nav')) { |
|
40 | + |
|
41 | + $menu_class = ''; |
|
42 | + if (geodir_is_page('listing')) |
|
43 | + $menu_class = 'current-menu-item'; |
|
44 | + |
|
45 | + |
|
46 | + //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
47 | + $post_types = geodir_get_posttypes('object'); |
|
48 | + $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav'); |
|
49 | + if (!empty($post_types)) { |
|
50 | + foreach ($post_types as $post_type => $args) { |
|
51 | + if (!empty($show_post_type_main_nav)) { |
|
52 | + if (in_array($post_type, $show_post_type_main_nav)) { |
|
53 | + if (get_post_type_archive_link($post_type)) { |
|
54 | + $menu_class = ''; |
|
55 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | + $menu_class = 'current-menu-item'; |
|
57 | + /** |
|
58 | + * Filter the menu li class. |
|
59 | + * |
|
60 | + * @since 1.0.0 |
|
61 | + * @param string $menu_class The menu HTML class. |
|
62 | + */ |
|
63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
64 | + /** |
|
65 | + * Filter the menu a class. |
|
66 | + * |
|
67 | + * @since 1.0.0 |
|
68 | + */ |
|
69 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
70 | + $items .= '<li class="' . $li_class . '"> |
|
71 | 71 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
72 | 72 | ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
73 | 73 | </a> |
74 | 74 | </li>'; |
75 | - } |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
79 | - } |
|
80 | - //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
81 | - |
|
82 | - $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav'); |
|
83 | - $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
84 | - if ($is_listing_sub_meny_exists) { |
|
85 | - /** |
|
86 | - * Filter the menu li class. |
|
87 | - * |
|
88 | - * @since 1.0.0 |
|
89 | - * @param string $menu_class The menu HTML class. |
|
90 | - */ |
|
91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
92 | - /** |
|
93 | - * Filter the sub menu li class. |
|
94 | - * |
|
95 | - * @since 1.0.0 |
|
96 | - * @param string $menu_class The menu HTML class. |
|
97 | - */ |
|
98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
99 | - /** |
|
100 | - * Filter the sub menu ul class. |
|
101 | - * |
|
102 | - * @since 1.0.0 |
|
103 | - */ |
|
104 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
105 | - /** |
|
106 | - * Filter the menu a class. |
|
107 | - * |
|
108 | - * @since 1.0.0 |
|
109 | - */ |
|
110 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
111 | - /** |
|
112 | - * Filter the sub menu a class. |
|
113 | - * |
|
114 | - * @since 1.0.0 |
|
115 | - */ |
|
116 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
117 | - $items .= '<li class="' . $li_class . '"> |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | + } |
|
80 | + //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
81 | + |
|
82 | + $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav'); |
|
83 | + $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
84 | + if ($is_listing_sub_meny_exists) { |
|
85 | + /** |
|
86 | + * Filter the menu li class. |
|
87 | + * |
|
88 | + * @since 1.0.0 |
|
89 | + * @param string $menu_class The menu HTML class. |
|
90 | + */ |
|
91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
92 | + /** |
|
93 | + * Filter the sub menu li class. |
|
94 | + * |
|
95 | + * @since 1.0.0 |
|
96 | + * @param string $menu_class The menu HTML class. |
|
97 | + */ |
|
98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
99 | + /** |
|
100 | + * Filter the sub menu ul class. |
|
101 | + * |
|
102 | + * @since 1.0.0 |
|
103 | + */ |
|
104 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
105 | + /** |
|
106 | + * Filter the menu a class. |
|
107 | + * |
|
108 | + * @since 1.0.0 |
|
109 | + */ |
|
110 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
111 | + /** |
|
112 | + * Filter the sub menu a class. |
|
113 | + * |
|
114 | + * @since 1.0.0 |
|
115 | + */ |
|
116 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
117 | + $items .= '<li class="' . $li_class . '"> |
|
118 | 118 | <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a> |
119 | 119 | <ul class="' . $sub_ul_class . '">'; |
120 | - $post_types = geodir_get_posttypes('object'); |
|
120 | + $post_types = geodir_get_posttypes('object'); |
|
121 | 121 | |
122 | - $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
|
122 | + $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
|
123 | 123 | |
124 | - if (!empty($post_types)) { |
|
125 | - global $geodir_add_location_url; |
|
126 | - $geodir_add_location_url = true; |
|
127 | - foreach ($post_types as $post_type => $args) { |
|
128 | - if (!empty($show_listing_post_types)) { |
|
129 | - if (in_array($post_type, $show_listing_post_types)) { |
|
130 | - if (get_post_type_archive_link($post_type)) { |
|
124 | + if (!empty($post_types)) { |
|
125 | + global $geodir_add_location_url; |
|
126 | + $geodir_add_location_url = true; |
|
127 | + foreach ($post_types as $post_type => $args) { |
|
128 | + if (!empty($show_listing_post_types)) { |
|
129 | + if (in_array($post_type, $show_listing_post_types)) { |
|
130 | + if (get_post_type_archive_link($post_type)) { |
|
131 | 131 | |
132 | - $menu_class = ''; |
|
133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | - $menu_class = 'current-menu-item'; |
|
132 | + $menu_class = ''; |
|
133 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | + $menu_class = 'current-menu-item'; |
|
135 | 135 | |
136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
136 | + $items .= '<li class="' . $sub_li_class . '"> |
|
137 | 137 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
138 | 138 | ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
139 | 139 | </a> |
140 | 140 | </li>'; |
141 | - } |
|
142 | - } |
|
143 | - } |
|
144 | - } |
|
145 | - $geodir_add_location_url = NULL; |
|
146 | - } |
|
141 | + } |
|
142 | + } |
|
143 | + } |
|
144 | + } |
|
145 | + $geodir_add_location_url = NULL; |
|
146 | + } |
|
147 | 147 | |
148 | - $items .= ' </ul> '; |
|
149 | - /** |
|
150 | - * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
151 | - * |
|
152 | - * @since 1.5.9 |
|
153 | - */ |
|
154 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
155 | - $items .= '</li>'; |
|
156 | - } |
|
157 | - } |
|
158 | - |
|
159 | - if (get_option('geodir_show_addlisting_nav')) { |
|
160 | - |
|
161 | - $menu_class = ''; |
|
162 | - if (geodir_is_page('add-listing')) |
|
163 | - $menu_class = 'current-menu-item'; |
|
164 | - |
|
165 | - //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
166 | - $post_types = geodir_get_posttypes('object'); |
|
167 | - $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav'); |
|
168 | - $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
169 | - |
|
170 | - if (!empty($post_types)) { |
|
171 | - foreach ($post_types as $post_type => $args) { |
|
172 | - if (!empty($geodir_allow_posttype_frontend)) { |
|
173 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
174 | - if (!empty($show_add_listing_post_types_main_nav)) { |
|
175 | - if (in_array($post_type, $show_add_listing_post_types_main_nav)) { |
|
176 | - if (geodir_get_addlisting_link($post_type)) { |
|
177 | - |
|
178 | - $menu_class = ''; |
|
179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
180 | - $menu_class = 'current-menu-item'; |
|
181 | - /** |
|
182 | - * Filter the menu li class. |
|
183 | - * |
|
184 | - * @since 1.0.0 |
|
185 | - * @param string $menu_class The menu HTML class. |
|
186 | - */ |
|
187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
188 | - /** |
|
189 | - * Filter the menu a class. |
|
190 | - * |
|
191 | - * @since 1.0.0 |
|
192 | - */ |
|
193 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
194 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
195 | - $items .= '<li class="' . $li_class . '"> |
|
148 | + $items .= ' </ul> '; |
|
149 | + /** |
|
150 | + * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
151 | + * |
|
152 | + * @since 1.5.9 |
|
153 | + */ |
|
154 | + $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
155 | + $items .= '</li>'; |
|
156 | + } |
|
157 | + } |
|
158 | + |
|
159 | + if (get_option('geodir_show_addlisting_nav')) { |
|
160 | + |
|
161 | + $menu_class = ''; |
|
162 | + if (geodir_is_page('add-listing')) |
|
163 | + $menu_class = 'current-menu-item'; |
|
164 | + |
|
165 | + //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
166 | + $post_types = geodir_get_posttypes('object'); |
|
167 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav'); |
|
168 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
169 | + |
|
170 | + if (!empty($post_types)) { |
|
171 | + foreach ($post_types as $post_type => $args) { |
|
172 | + if (!empty($geodir_allow_posttype_frontend)) { |
|
173 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
174 | + if (!empty($show_add_listing_post_types_main_nav)) { |
|
175 | + if (in_array($post_type, $show_add_listing_post_types_main_nav)) { |
|
176 | + if (geodir_get_addlisting_link($post_type)) { |
|
177 | + |
|
178 | + $menu_class = ''; |
|
179 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
180 | + $menu_class = 'current-menu-item'; |
|
181 | + /** |
|
182 | + * Filter the menu li class. |
|
183 | + * |
|
184 | + * @since 1.0.0 |
|
185 | + * @param string $menu_class The menu HTML class. |
|
186 | + */ |
|
187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
188 | + /** |
|
189 | + * Filter the menu a class. |
|
190 | + * |
|
191 | + * @since 1.0.0 |
|
192 | + */ |
|
193 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
194 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
195 | + $items .= '<li class="' . $li_class . '"> |
|
196 | 196 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
197 | 197 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
198 | 198 | </a> |
199 | 199 | </li>'; |
200 | - } |
|
201 | - } |
|
202 | - } |
|
203 | - } |
|
204 | - } |
|
205 | - } |
|
206 | - } |
|
207 | - //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
208 | - } |
|
209 | - |
|
210 | - $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav'); |
|
211 | - $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
212 | - if ($is_add_listing_sub_meny_exists) { |
|
213 | - |
|
214 | - if (get_option('geodir_show_addlisting_nav')) { |
|
215 | - /** |
|
216 | - * Filter the menu li class. |
|
217 | - * |
|
218 | - * @since 1.0.0 |
|
219 | - * @param string $menu_class The menu HTML class. |
|
220 | - */ |
|
221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
222 | - /** |
|
223 | - * Filter the sub menu li class. |
|
224 | - * |
|
225 | - * @since 1.0.0 |
|
226 | - * @param string $menu_class The menu HTML class. |
|
227 | - */ |
|
228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
229 | - /** |
|
230 | - * Filter the sub menu ul class. |
|
231 | - * |
|
232 | - * @since 1.0.0 |
|
233 | - */ |
|
234 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
235 | - /** |
|
236 | - * Filter the menu a class. |
|
237 | - * |
|
238 | - * @since 1.0.0 |
|
239 | - */ |
|
240 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
241 | - /** |
|
242 | - * Filter the sub menu a class. |
|
243 | - * |
|
244 | - * @since 1.0.0 |
|
245 | - */ |
|
246 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
247 | - $items .= '<li class="' . $li_class . '"> |
|
200 | + } |
|
201 | + } |
|
202 | + } |
|
203 | + } |
|
204 | + } |
|
205 | + } |
|
206 | + } |
|
207 | + //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
208 | + } |
|
209 | + |
|
210 | + $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav'); |
|
211 | + $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
212 | + if ($is_add_listing_sub_meny_exists) { |
|
213 | + |
|
214 | + if (get_option('geodir_show_addlisting_nav')) { |
|
215 | + /** |
|
216 | + * Filter the menu li class. |
|
217 | + * |
|
218 | + * @since 1.0.0 |
|
219 | + * @param string $menu_class The menu HTML class. |
|
220 | + */ |
|
221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
222 | + /** |
|
223 | + * Filter the sub menu li class. |
|
224 | + * |
|
225 | + * @since 1.0.0 |
|
226 | + * @param string $menu_class The menu HTML class. |
|
227 | + */ |
|
228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
229 | + /** |
|
230 | + * Filter the sub menu ul class. |
|
231 | + * |
|
232 | + * @since 1.0.0 |
|
233 | + */ |
|
234 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
235 | + /** |
|
236 | + * Filter the menu a class. |
|
237 | + * |
|
238 | + * @since 1.0.0 |
|
239 | + */ |
|
240 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
241 | + /** |
|
242 | + * Filter the sub menu a class. |
|
243 | + * |
|
244 | + * @since 1.0.0 |
|
245 | + */ |
|
246 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
247 | + $items .= '<li class="' . $li_class . '"> |
|
248 | 248 | <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a> |
249 | 249 | <ul class="' . $sub_ul_class . '">'; |
250 | 250 | |
251 | - $post_types = geodir_get_posttypes('object'); |
|
252 | - |
|
253 | - $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav'); |
|
254 | - |
|
255 | - if (!empty($post_types)) { |
|
256 | - foreach ($post_types as $post_type => $args) { |
|
257 | - if (!empty($geodir_allow_posttype_frontend)) { |
|
258 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
259 | - if (!empty($show_add_listing_post_types)) { |
|
260 | - if (in_array($post_type, $show_add_listing_post_types)) { |
|
261 | - if (geodir_get_addlisting_link($post_type)) { |
|
262 | - |
|
263 | - $menu_class = ''; |
|
264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
265 | - $menu_class = 'current-menu-item'; |
|
266 | - /** |
|
267 | - * Filter the menu li class. |
|
268 | - * |
|
269 | - * @since 1.0.0 |
|
270 | - * @param string $menu_class The menu HTML class. |
|
271 | - */ |
|
272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
273 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
274 | - $items .= '<li class="' . $sub_li_class . '"> |
|
251 | + $post_types = geodir_get_posttypes('object'); |
|
252 | + |
|
253 | + $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav'); |
|
254 | + |
|
255 | + if (!empty($post_types)) { |
|
256 | + foreach ($post_types as $post_type => $args) { |
|
257 | + if (!empty($geodir_allow_posttype_frontend)) { |
|
258 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
259 | + if (!empty($show_add_listing_post_types)) { |
|
260 | + if (in_array($post_type, $show_add_listing_post_types)) { |
|
261 | + if (geodir_get_addlisting_link($post_type)) { |
|
262 | + |
|
263 | + $menu_class = ''; |
|
264 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
265 | + $menu_class = 'current-menu-item'; |
|
266 | + /** |
|
267 | + * Filter the menu li class. |
|
268 | + * |
|
269 | + * @since 1.0.0 |
|
270 | + * @param string $menu_class The menu HTML class. |
|
271 | + */ |
|
272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
273 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
274 | + $items .= '<li class="' . $sub_li_class . '"> |
|
275 | 275 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
276 | 276 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
277 | 277 | </a> |
278 | 278 | </li>'; |
279 | - } |
|
280 | - } |
|
281 | - } |
|
282 | - } |
|
283 | - } |
|
284 | - } |
|
285 | - } |
|
279 | + } |
|
280 | + } |
|
281 | + } |
|
282 | + } |
|
283 | + } |
|
284 | + } |
|
285 | + } |
|
286 | 286 | |
287 | - $items .= ' </ul> '; |
|
288 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
289 | - $items .= '</li>'; |
|
287 | + $items .= ' </ul> '; |
|
288 | + $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
289 | + $items .= '</li>'; |
|
290 | 290 | |
291 | - } |
|
292 | - } |
|
293 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
294 | - return $items; |
|
291 | + } |
|
292 | + } |
|
293 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
294 | + return $items; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -309,20 +309,20 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function geodir_pagemenu_items($menu, $args) |
311 | 311 | { |
312 | - $locations = get_nav_menu_locations(); |
|
313 | - $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
314 | - $geodir_theme_location_nav = array(); |
|
315 | - if (empty($locations) && empty($geodir_theme_location)) { |
|
316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
317 | - $geodir_theme_location_nav[] = $args['theme_location']; |
|
318 | - update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
|
319 | - } |
|
320 | - //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
312 | + $locations = get_nav_menu_locations(); |
|
313 | + $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
314 | + $geodir_theme_location_nav = array(); |
|
315 | + if (empty($locations) && empty($geodir_theme_location)) { |
|
316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
317 | + $geodir_theme_location_nav[] = $args['theme_location']; |
|
318 | + update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
|
319 | + } |
|
320 | + //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
322 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
322 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
324 | 324 | |
325 | - return $menu; |
|
325 | + return $menu; |
|
326 | 326 | |
327 | 327 | } |
328 | 328 | |
@@ -342,18 +342,18 @@ discard block |
||
342 | 342 | function geodir_menu_items($items, $args) |
343 | 343 | { |
344 | 344 | |
345 | - $location = $args->theme_location; |
|
345 | + $location = $args->theme_location; |
|
346 | 346 | |
347 | - $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
347 | + $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
348 | 348 | |
349 | - if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
|
349 | + if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
|
350 | 350 | |
351 | - $items = $items . geodir_add_nav_menu_items(); |
|
352 | - return $items; |
|
351 | + $items = $items . geodir_add_nav_menu_items(); |
|
352 | + return $items; |
|
353 | 353 | |
354 | - } else { |
|
355 | - return $items; |
|
356 | - } |
|
354 | + } else { |
|
355 | + return $items; |
|
356 | + } |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -368,25 +368,25 @@ discard block |
||
368 | 368 | */ |
369 | 369 | function geodir_get_category_all_array() |
370 | 370 | { |
371 | - global $wpdb; |
|
372 | - $return_array = array(); |
|
373 | - |
|
374 | - $taxonomies = geodir_get_taxonomies(); |
|
375 | - $taxonomies = implode("','", $taxonomies); |
|
376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
377 | - |
|
378 | - $pn_categories = $wpdb->get_results( |
|
379 | - $wpdb->prepare( |
|
380 | - "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
381 | - array($wpdb->terms . term_id) |
|
382 | - ) |
|
383 | - ); |
|
384 | - |
|
385 | - foreach ($pn_categories as $pn_categories_obj) { |
|
386 | - $return_array[] = array("id" => $pn_categories_obj->cat_ID, |
|
387 | - "title" => $pn_categories_obj->name,); |
|
388 | - } |
|
389 | - return $return_array; |
|
371 | + global $wpdb; |
|
372 | + $return_array = array(); |
|
373 | + |
|
374 | + $taxonomies = geodir_get_taxonomies(); |
|
375 | + $taxonomies = implode("','", $taxonomies); |
|
376 | + $taxonomies = "'" . $taxonomies . "'"; |
|
377 | + |
|
378 | + $pn_categories = $wpdb->get_results( |
|
379 | + $wpdb->prepare( |
|
380 | + "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
381 | + array($wpdb->terms . term_id) |
|
382 | + ) |
|
383 | + ); |
|
384 | + |
|
385 | + foreach ($pn_categories as $pn_categories_obj) { |
|
386 | + $return_array[] = array("id" => $pn_categories_obj->cat_ID, |
|
387 | + "title" => $pn_categories_obj->name,); |
|
388 | + } |
|
389 | + return $return_array; |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -402,52 +402,52 @@ discard block |
||
402 | 402 | * @return string The post type. |
403 | 403 | */ |
404 | 404 | function geodir_get_current_posttype() { |
405 | - global $wp_query, $post, $geodir_post_type; |
|
405 | + global $wp_query, $post, $geodir_post_type; |
|
406 | 406 | |
407 | - $geodir_post_type = get_query_var('post_type'); |
|
407 | + $geodir_post_type = get_query_var('post_type'); |
|
408 | 408 | if (is_array($geodir_post_type) && ! empty($geodir_post_type[0])) { |
409 | 409 | $geodir_post_type = $geodir_post_type[0]; |
410 | 410 | } |
411 | 411 | |
412 | - if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
|
413 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
414 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
415 | - elseif (isset($_REQUEST['listing_type'])) |
|
416 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
417 | - } |
|
418 | - |
|
419 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
420 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
421 | - |
|
422 | - if (is_tax()) |
|
423 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
424 | - |
|
425 | - // Retrive post type for map marker html ajax request on preview page. |
|
426 | - if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) { |
|
427 | - if (!empty($post->post_type)) { |
|
428 | - $geodir_post_type = $post->post_type; |
|
429 | - } else if (!empty($post->listing_type)) { |
|
430 | - $geodir_post_type = $post->listing_type; |
|
431 | - } |
|
432 | - } |
|
433 | - |
|
434 | - $all_postypes = geodir_get_posttypes(); |
|
435 | - $all_postypes = stripslashes_deep($all_postypes); |
|
436 | - |
|
437 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
438 | - $geodir_post_type = ''; |
|
439 | - |
|
440 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
|
441 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
442 | - } |
|
443 | - |
|
444 | - |
|
445 | - /** |
|
446 | - * Filter the default CPT return. |
|
447 | - * |
|
448 | - * @since 1.6.9 |
|
449 | - */ |
|
450 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type); |
|
412 | + if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
|
413 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
414 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
415 | + elseif (isset($_REQUEST['listing_type'])) |
|
416 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
417 | + } |
|
418 | + |
|
419 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
420 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
421 | + |
|
422 | + if (is_tax()) |
|
423 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
424 | + |
|
425 | + // Retrive post type for map marker html ajax request on preview page. |
|
426 | + if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) { |
|
427 | + if (!empty($post->post_type)) { |
|
428 | + $geodir_post_type = $post->post_type; |
|
429 | + } else if (!empty($post->listing_type)) { |
|
430 | + $geodir_post_type = $post->listing_type; |
|
431 | + } |
|
432 | + } |
|
433 | + |
|
434 | + $all_postypes = geodir_get_posttypes(); |
|
435 | + $all_postypes = stripslashes_deep($all_postypes); |
|
436 | + |
|
437 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
438 | + $geodir_post_type = ''; |
|
439 | + |
|
440 | + if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
|
441 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
442 | + } |
|
443 | + |
|
444 | + |
|
445 | + /** |
|
446 | + * Filter the default CPT return. |
|
447 | + * |
|
448 | + * @since 1.6.9 |
|
449 | + */ |
|
450 | + return apply_filters('geodir_get_current_posttype',$geodir_post_type); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -461,22 +461,22 @@ discard block |
||
461 | 461 | */ |
462 | 462 | function geodir_get_default_posttype() |
463 | 463 | { |
464 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
465 | - |
|
466 | - $stype = false; |
|
467 | - foreach ( $post_types as $post_type => $info ) { |
|
468 | - global $wpdb; |
|
469 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
470 | - if ( $has_posts ) { |
|
471 | - $stype = $post_type; break; |
|
472 | - } |
|
473 | - } |
|
474 | - |
|
475 | - if(!$stype){ |
|
476 | - $stype = 'gd_place'; |
|
477 | - } |
|
478 | - |
|
479 | - return $stype; |
|
464 | + $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
465 | + |
|
466 | + $stype = false; |
|
467 | + foreach ( $post_types as $post_type => $info ) { |
|
468 | + global $wpdb; |
|
469 | + $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
470 | + if ( $has_posts ) { |
|
471 | + $stype = $post_type; break; |
|
472 | + } |
|
473 | + } |
|
474 | + |
|
475 | + if(!$stype){ |
|
476 | + $stype = 'gd_place'; |
|
477 | + } |
|
478 | + |
|
479 | + return $stype; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -490,21 +490,21 @@ discard block |
||
490 | 490 | */ |
491 | 491 | function geodir_get_posttypes($output = 'names') |
492 | 492 | { |
493 | - $post_types = array(); |
|
494 | - $post_types = get_option('geodir_post_types'); |
|
495 | - $post_types = stripslashes_deep($post_types); |
|
496 | - if (!empty($post_types)) { |
|
497 | - switch ($output): |
|
498 | - case 'object': |
|
499 | - case 'Object': |
|
500 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
501 | - break; |
|
502 | - case 'array': |
|
503 | - case 'Array': |
|
504 | - $post_types = (array)$post_types; |
|
505 | - break; |
|
493 | + $post_types = array(); |
|
494 | + $post_types = get_option('geodir_post_types'); |
|
495 | + $post_types = stripslashes_deep($post_types); |
|
496 | + if (!empty($post_types)) { |
|
497 | + switch ($output): |
|
498 | + case 'object': |
|
499 | + case 'Object': |
|
500 | + $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
501 | + break; |
|
502 | + case 'array': |
|
503 | + case 'Array': |
|
504 | + $post_types = (array)$post_types; |
|
505 | + break; |
|
506 | 506 | case 'options': |
507 | - $post_types = (array)$post_types; |
|
507 | + $post_types = (array)$post_types; |
|
508 | 508 | |
509 | 509 | $options = array(); |
510 | 510 | if (!empty($post_types)) { |
@@ -513,17 +513,17 @@ discard block |
||
513 | 513 | } |
514 | 514 | } |
515 | 515 | $post_types = $options; |
516 | - break; |
|
517 | - default: |
|
518 | - $post_types = array_keys($post_types); |
|
519 | - break; |
|
520 | - endswitch; |
|
521 | - } |
|
522 | - |
|
523 | - if (!empty($post_types)) |
|
524 | - return $post_types; |
|
525 | - else |
|
526 | - return array(); |
|
516 | + break; |
|
517 | + default: |
|
518 | + $post_types = array_keys($post_types); |
|
519 | + break; |
|
520 | + endswitch; |
|
521 | + } |
|
522 | + |
|
523 | + if (!empty($post_types)) |
|
524 | + return $post_types; |
|
525 | + else |
|
526 | + return array(); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -536,104 +536,104 @@ discard block |
||
536 | 536 | */ |
537 | 537 | function geodir_get_posttype_info($post_type = '') |
538 | 538 | { |
539 | - $post_types = array(); |
|
540 | - $post_types = get_option('geodir_post_types'); |
|
541 | - $post_types = stripslashes_deep($post_types); |
|
542 | - if (!empty($post_types) && $post_type != '') { |
|
543 | - return $post_types[$post_type]; |
|
544 | - } else |
|
545 | - return false; |
|
539 | + $post_types = array(); |
|
540 | + $post_types = get_option('geodir_post_types'); |
|
541 | + $post_types = stripslashes_deep($post_types); |
|
542 | + if (!empty($post_types) && $post_type != '') { |
|
543 | + return $post_types[$post_type]; |
|
544 | + } else |
|
545 | + return false; |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | if (!function_exists('geodir_get_taxonomies')) { |
549 | - /** |
|
550 | - * Get all custom taxonomies. |
|
551 | - * |
|
552 | - * @since 1.0.0 |
|
553 | - * @package GeoDirectory |
|
554 | - * @param string $post_type The post type. |
|
555 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
556 | - * @return array|bool Taxonomies on success. false on failure. |
|
557 | - */ |
|
558 | - function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) { |
|
559 | - $taxonomies = array(); |
|
560 | - $gd_taxonomies = array(); |
|
561 | - |
|
562 | - if ($taxonomies = get_option('geodir_taxonomies')) { |
|
563 | - $gd_taxonomies = array_keys($taxonomies); |
|
564 | - |
|
565 | - if ($post_type != '') { |
|
566 | - $gd_taxonomies = array(); |
|
567 | - } |
|
549 | + /** |
|
550 | + * Get all custom taxonomies. |
|
551 | + * |
|
552 | + * @since 1.0.0 |
|
553 | + * @package GeoDirectory |
|
554 | + * @param string $post_type The post type. |
|
555 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
556 | + * @return array|bool Taxonomies on success. false on failure. |
|
557 | + */ |
|
558 | + function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) { |
|
559 | + $taxonomies = array(); |
|
560 | + $gd_taxonomies = array(); |
|
561 | + |
|
562 | + if ($taxonomies = get_option('geodir_taxonomies')) { |
|
563 | + $gd_taxonomies = array_keys($taxonomies); |
|
564 | + |
|
565 | + if ($post_type != '') { |
|
566 | + $gd_taxonomies = array(); |
|
567 | + } |
|
568 | 568 | |
569 | - $i = 0; |
|
570 | - foreach ($taxonomies as $taxonomy => $args) { |
|
571 | - if ($post_type != '' && $args['object_type'] == $post_type) { |
|
572 | - $gd_taxonomies[] = $taxonomy; |
|
573 | - } |
|
569 | + $i = 0; |
|
570 | + foreach ($taxonomies as $taxonomy => $args) { |
|
571 | + if ($post_type != '' && $args['object_type'] == $post_type) { |
|
572 | + $gd_taxonomies[] = $taxonomy; |
|
573 | + } |
|
574 | 574 | |
575 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') { |
|
576 | - if (array_search($taxonomy, $gd_taxonomies) !== false) { |
|
577 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
578 | - } |
|
579 | - } |
|
580 | - } |
|
575 | + if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') { |
|
576 | + if (array_search($taxonomy, $gd_taxonomies) !== false) { |
|
577 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
578 | + } |
|
579 | + } |
|
580 | + } |
|
581 | + |
|
582 | + $gd_taxonomies = array_values($gd_taxonomies); |
|
583 | + } |
|
581 | 584 | |
582 | - $gd_taxonomies = array_values($gd_taxonomies); |
|
583 | - } |
|
584 | - |
|
585 | - /** |
|
586 | - * Filter the taxonomies. |
|
587 | - * |
|
588 | - * @since 1.0.0 |
|
589 | - * @param array $gd_taxonomies The taxonomy array. |
|
590 | - */ |
|
591 | - $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies); |
|
592 | - |
|
593 | - if (!empty($taxonomies)) { |
|
594 | - return $taxonomies; |
|
595 | - } else { |
|
596 | - return false; |
|
597 | - } |
|
598 | - } |
|
585 | + /** |
|
586 | + * Filter the taxonomies. |
|
587 | + * |
|
588 | + * @since 1.0.0 |
|
589 | + * @param array $gd_taxonomies The taxonomy array. |
|
590 | + */ |
|
591 | + $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies); |
|
592 | + |
|
593 | + if (!empty($taxonomies)) { |
|
594 | + return $taxonomies; |
|
595 | + } else { |
|
596 | + return false; |
|
597 | + } |
|
598 | + } |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | if (!function_exists(' geodir_get_categories_dl')) { |
602 | - /** |
|
603 | - * Get categories dropdown HTML. |
|
604 | - * |
|
605 | - * @since 1.0.0 |
|
606 | - * @package GeoDirectory |
|
607 | - * @param string $post_type The post type. |
|
608 | - * @param string $selected The selected value. |
|
609 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
610 | - * @param bool $echo Prints the HTML when set to true. Default: true. |
|
611 | - * @return void|string Dropdown HTML. |
|
612 | - */ |
|
613 | - function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
614 | - { |
|
615 | - |
|
616 | - $html = ''; |
|
617 | - $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
618 | - |
|
619 | - $categories = get_terms($taxonomies); |
|
620 | - |
|
621 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
622 | - |
|
623 | - foreach ($categories as $category_obj) { |
|
624 | - $select_opt = ''; |
|
625 | - if ($selected == $category_obj->term_id) { |
|
626 | - $select_opt = 'selected="selected"'; |
|
627 | - } |
|
628 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
629 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
630 | - } |
|
631 | - |
|
632 | - if ($echo) |
|
633 | - echo $html; |
|
634 | - else |
|
635 | - return $html; |
|
636 | - } |
|
602 | + /** |
|
603 | + * Get categories dropdown HTML. |
|
604 | + * |
|
605 | + * @since 1.0.0 |
|
606 | + * @package GeoDirectory |
|
607 | + * @param string $post_type The post type. |
|
608 | + * @param string $selected The selected value. |
|
609 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
610 | + * @param bool $echo Prints the HTML when set to true. Default: true. |
|
611 | + * @return void|string Dropdown HTML. |
|
612 | + */ |
|
613 | + function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
614 | + { |
|
615 | + |
|
616 | + $html = ''; |
|
617 | + $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
618 | + |
|
619 | + $categories = get_terms($taxonomies); |
|
620 | + |
|
621 | + $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
622 | + |
|
623 | + foreach ($categories as $category_obj) { |
|
624 | + $select_opt = ''; |
|
625 | + if ($selected == $category_obj->term_id) { |
|
626 | + $select_opt = 'selected="selected"'; |
|
627 | + } |
|
628 | + $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
629 | + . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
630 | + } |
|
631 | + |
|
632 | + if ($echo) |
|
633 | + echo $html; |
|
634 | + else |
|
635 | + return $html; |
|
636 | + } |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | |
@@ -648,28 +648,28 @@ discard block |
||
648 | 648 | function geodir_get_listing_slug($object_type = '') |
649 | 649 | { |
650 | 650 | |
651 | - $listing_slug = ''; |
|
651 | + $listing_slug = ''; |
|
652 | 652 | |
653 | - $post_types = get_option('geodir_post_types'); |
|
654 | - $taxonomies = get_option('geodir_taxonomies'); |
|
653 | + $post_types = get_option('geodir_post_types'); |
|
654 | + $taxonomies = get_option('geodir_taxonomies'); |
|
655 | 655 | |
656 | 656 | |
657 | - if ($object_type != '') { |
|
658 | - if (!empty($post_types) && array_key_exists($object_type, $post_types)) { |
|
657 | + if ($object_type != '') { |
|
658 | + if (!empty($post_types) && array_key_exists($object_type, $post_types)) { |
|
659 | 659 | |
660 | - $object_info = $post_types[$object_type]; |
|
661 | - $listing_slug = $object_info['listing_slug']; |
|
662 | - } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) { |
|
663 | - $object_info = $taxonomies[$object_type]; |
|
664 | - $listing_slug = $object_info['listing_slug']; |
|
665 | - } |
|
660 | + $object_info = $post_types[$object_type]; |
|
661 | + $listing_slug = $object_info['listing_slug']; |
|
662 | + } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) { |
|
663 | + $object_info = $taxonomies[$object_type]; |
|
664 | + $listing_slug = $object_info['listing_slug']; |
|
665 | + } |
|
666 | 666 | |
667 | - } |
|
667 | + } |
|
668 | 668 | |
669 | - if (!empty($listing_slug)) |
|
670 | - return $listing_slug; |
|
671 | - else |
|
672 | - return false; |
|
669 | + if (!empty($listing_slug)) |
|
670 | + return $listing_slug; |
|
671 | + else |
|
672 | + return false; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | |
@@ -684,212 +684,212 @@ discard block |
||
684 | 684 | */ |
685 | 685 | function geodir_get_taxonomy_posttype($taxonomy = '') |
686 | 686 | { |
687 | - global $wp_query; |
|
688 | - |
|
689 | - $post_type = array(); |
|
690 | - $taxonomies = array(); |
|
691 | - |
|
692 | - if (!empty($taxonomy)) { |
|
693 | - $taxonomies[] = $taxonomy; |
|
694 | - } elseif (isset($wp_query->tax_query->queries)) { |
|
695 | - $tax_arr = $wp_query->tax_query->queries; |
|
696 | - //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
697 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
698 | - $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
699 | - } |
|
700 | - |
|
701 | - if (!empty($taxonomies)) { |
|
702 | - foreach (geodir_get_posttypes() as $pt) { |
|
703 | - $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
704 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
705 | - $post_type[] = $pt; |
|
706 | - } |
|
707 | - } |
|
708 | - |
|
709 | - if (!empty($post_type)) |
|
710 | - return $post_type[0]; |
|
711 | - else |
|
712 | - return false; |
|
687 | + global $wp_query; |
|
688 | + |
|
689 | + $post_type = array(); |
|
690 | + $taxonomies = array(); |
|
691 | + |
|
692 | + if (!empty($taxonomy)) { |
|
693 | + $taxonomies[] = $taxonomy; |
|
694 | + } elseif (isset($wp_query->tax_query->queries)) { |
|
695 | + $tax_arr = $wp_query->tax_query->queries; |
|
696 | + //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
697 | + if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
698 | + $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
699 | + } |
|
700 | + |
|
701 | + if (!empty($taxonomies)) { |
|
702 | + foreach (geodir_get_posttypes() as $pt) { |
|
703 | + $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
704 | + if (array_intersect($taxonomies, $object_taxonomies)) |
|
705 | + $post_type[] = $pt; |
|
706 | + } |
|
707 | + } |
|
708 | + |
|
709 | + if (!empty($post_type)) |
|
710 | + return $post_type[0]; |
|
711 | + else |
|
712 | + return false; |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | if (!function_exists('geodir_custom_taxonomy_walker')) { |
716 | - /** |
|
717 | - * Custom taxonomy walker function. |
|
718 | - * |
|
719 | - * @since 1.0.0 |
|
720 | - * @package GeoDirectory |
|
721 | - * @param string $cat_taxonomy The taxonomy name. |
|
722 | - * @param int $cat_parent The parent term ID. |
|
723 | - * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
724 | - * @param int $pading CSS padding in pixels. |
|
725 | - * @return string|void taxonomy HTML. |
|
726 | - */ |
|
727 | - function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
728 | - { |
|
729 | - global $cat_display, $post_cat, $exclude_cats; |
|
730 | - |
|
731 | - $search_terms = trim($post_cat, ","); |
|
732 | - |
|
733 | - $search_terms = explode(",", $search_terms); |
|
734 | - |
|
735 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats)); |
|
736 | - |
|
737 | - $display = ''; |
|
738 | - $onchange = ''; |
|
739 | - $term_check = ''; |
|
740 | - $main_list_class = ''; |
|
741 | - $out = ''; |
|
742 | - //If there are terms, start displaying |
|
743 | - if (count($cat_terms) > 0) { |
|
744 | - //Displaying as a list |
|
745 | - $p = $pading * 20; |
|
746 | - $pading++; |
|
747 | - |
|
748 | - |
|
749 | - if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
|
750 | - if ($cat_parent == 0) { |
|
751 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
752 | - $main_list_class = 'class="main_list_selecter"'; |
|
753 | - } else { |
|
754 | - //$display = 'display:none'; |
|
755 | - $list_class = 'sub_list gd-sub-cats-list'; |
|
756 | - } |
|
757 | - } |
|
716 | + /** |
|
717 | + * Custom taxonomy walker function. |
|
718 | + * |
|
719 | + * @since 1.0.0 |
|
720 | + * @package GeoDirectory |
|
721 | + * @param string $cat_taxonomy The taxonomy name. |
|
722 | + * @param int $cat_parent The parent term ID. |
|
723 | + * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
724 | + * @param int $pading CSS padding in pixels. |
|
725 | + * @return string|void taxonomy HTML. |
|
726 | + */ |
|
727 | + function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
728 | + { |
|
729 | + global $cat_display, $post_cat, $exclude_cats; |
|
730 | + |
|
731 | + $search_terms = trim($post_cat, ","); |
|
732 | + |
|
733 | + $search_terms = explode(",", $search_terms); |
|
734 | + |
|
735 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats)); |
|
736 | + |
|
737 | + $display = ''; |
|
738 | + $onchange = ''; |
|
739 | + $term_check = ''; |
|
740 | + $main_list_class = ''; |
|
741 | + $out = ''; |
|
742 | + //If there are terms, start displaying |
|
743 | + if (count($cat_terms) > 0) { |
|
744 | + //Displaying as a list |
|
745 | + $p = $pading * 20; |
|
746 | + $pading++; |
|
747 | + |
|
748 | + |
|
749 | + if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
|
750 | + if ($cat_parent == 0) { |
|
751 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
752 | + $main_list_class = 'class="main_list_selecter"'; |
|
753 | + } else { |
|
754 | + //$display = 'display:none'; |
|
755 | + $list_class = 'sub_list gd-sub-cats-list'; |
|
756 | + } |
|
757 | + } |
|
758 | 758 | |
759 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
760 | - $p = 0; |
|
761 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
762 | - } |
|
759 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
760 | + $p = 0; |
|
761 | + $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
762 | + } |
|
763 | 763 | |
764 | - foreach ($cat_terms as $cat_term) { |
|
764 | + foreach ($cat_terms as $cat_term) { |
|
765 | 765 | |
766 | - $checked = ''; |
|
766 | + $checked = ''; |
|
767 | 767 | |
768 | - if (in_array($cat_term->term_id, $search_terms)) { |
|
769 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
770 | - $checked = 'selected="selected"'; |
|
771 | - else |
|
772 | - $checked = 'checked="checked"'; |
|
773 | - } |
|
768 | + if (in_array($cat_term->term_id, $search_terms)) { |
|
769 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
770 | + $checked = 'selected="selected"'; |
|
771 | + else |
|
772 | + $checked = 'checked="checked"'; |
|
773 | + } |
|
774 | 774 | |
775 | - if ($cat_display == 'radio') |
|
776 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
777 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
778 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
775 | + if ($cat_display == 'radio') |
|
776 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
777 | + elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
778 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
779 | 779 | |
780 | - else { |
|
781 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
782 | - } |
|
780 | + else { |
|
781 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
782 | + } |
|
783 | 783 | |
784 | - // Call recurson to print sub cats |
|
785 | - $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
784 | + // Call recurson to print sub cats |
|
785 | + $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
786 | 786 | |
787 | - } |
|
787 | + } |
|
788 | 788 | |
789 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
790 | - $out .= '</div>'; |
|
789 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
790 | + $out .= '</div>'; |
|
791 | 791 | |
792 | - return $out; |
|
793 | - } |
|
794 | - return; |
|
795 | - } |
|
792 | + return $out; |
|
793 | + } |
|
794 | + return; |
|
795 | + } |
|
796 | 796 | } |
797 | 797 | |
798 | 798 | if (!function_exists('geodir_custom_taxonomy_walker2')) { |
799 | - /** |
|
800 | - * Custom taxonomy walker function. |
|
801 | - * |
|
802 | - * @since 1.0.0 |
|
803 | - * @package GeoDirectory |
|
804 | - * @global object $post WordPress Post object. |
|
805 | - * @global object $gd_session GeoDirectory Session object. |
|
806 | - * @param string $cat_taxonomy The taxonomy name. |
|
807 | - * @param string $cat_limit Number of categories to display. |
|
808 | - */ |
|
809 | - function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
810 | - { |
|
811 | - $post_category = ''; |
|
812 | - $post_category_str = ''; |
|
813 | - global $exclude_cats, $gd_session; |
|
814 | - |
|
815 | - $cat_exclude = ''; |
|
816 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
817 | - $cat_exclude = serialize($exclude_cats); |
|
818 | - |
|
819 | - if (isset($_REQUEST['backandedit'])) { |
|
820 | - $post = (object)$gd_session->get('listing'); |
|
821 | - |
|
822 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
823 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
824 | - |
|
825 | - $post_categories = $post->post_category_str; |
|
826 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
827 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
828 | - |
|
829 | - } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
|
830 | - global $post; |
|
831 | - |
|
832 | - $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
833 | - if (empty($post_category) && isset($post->{$cat_taxonomy})) { |
|
834 | - $post_category = $post->{$cat_taxonomy}; |
|
835 | - } |
|
799 | + /** |
|
800 | + * Custom taxonomy walker function. |
|
801 | + * |
|
802 | + * @since 1.0.0 |
|
803 | + * @package GeoDirectory |
|
804 | + * @global object $post WordPress Post object. |
|
805 | + * @global object $gd_session GeoDirectory Session object. |
|
806 | + * @param string $cat_taxonomy The taxonomy name. |
|
807 | + * @param string $cat_limit Number of categories to display. |
|
808 | + */ |
|
809 | + function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
810 | + { |
|
811 | + $post_category = ''; |
|
812 | + $post_category_str = ''; |
|
813 | + global $exclude_cats, $gd_session; |
|
814 | + |
|
815 | + $cat_exclude = ''; |
|
816 | + if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
817 | + $cat_exclude = serialize($exclude_cats); |
|
818 | + |
|
819 | + if (isset($_REQUEST['backandedit'])) { |
|
820 | + $post = (object)$gd_session->get('listing'); |
|
821 | + |
|
822 | + if (!is_array($post->post_category[$cat_taxonomy])) |
|
823 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
824 | + |
|
825 | + $post_categories = $post->post_category_str; |
|
826 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
827 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
828 | + |
|
829 | + } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
|
830 | + global $post; |
|
831 | + |
|
832 | + $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
833 | + if (empty($post_category) && isset($post->{$cat_taxonomy})) { |
|
834 | + $post_category = $post->{$cat_taxonomy}; |
|
835 | + } |
|
836 | 836 | |
837 | - $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
837 | + $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
838 | 838 | |
839 | - if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) { |
|
840 | - foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) { |
|
841 | - if (is_numeric($cat_part)) { |
|
842 | - $cat_part_arr[] = $cat_part; |
|
843 | - } |
|
844 | - } |
|
845 | - if (is_array($cat_part_arr)) { |
|
846 | - $post_category = implode(',', $cat_part_arr); |
|
847 | - } |
|
848 | - } |
|
839 | + if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) { |
|
840 | + foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) { |
|
841 | + if (is_numeric($cat_part)) { |
|
842 | + $cat_part_arr[] = $cat_part; |
|
843 | + } |
|
844 | + } |
|
845 | + if (is_array($cat_part_arr)) { |
|
846 | + $post_category = implode(',', $cat_part_arr); |
|
847 | + } |
|
848 | + } |
|
849 | 849 | |
850 | - if (!empty($post_category)) { |
|
851 | - $cat1 = array_filter(explode(',', $post_category)); |
|
852 | - $post_category = ',' . implode(',', $cat1) . ','; |
|
850 | + if (!empty($post_category)) { |
|
851 | + $cat1 = array_filter(explode(',', $post_category)); |
|
852 | + $post_category = ',' . implode(',', $cat1) . ','; |
|
853 | 853 | |
854 | - } |
|
854 | + } |
|
855 | 855 | |
856 | - if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) { |
|
856 | + if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) { |
|
857 | 857 | |
858 | - $post_category_upd = explode(',', $post_category); |
|
859 | - $post_category_change = ''; |
|
860 | - foreach ($post_category_upd as $cat) { |
|
858 | + $post_category_upd = explode(',', $post_category); |
|
859 | + $post_category_change = ''; |
|
860 | + foreach ($post_category_upd as $cat) { |
|
861 | 861 | |
862 | - if (!in_array($cat, $exclude_cats) && $cat != '') { |
|
863 | - $post_category_change .= ',' . $cat; |
|
864 | - } |
|
865 | - } |
|
866 | - $post_category = $post_category_change; |
|
867 | - } |
|
862 | + if (!in_array($cat, $exclude_cats) && $cat != '') { |
|
863 | + $post_category_change .= ',' . $cat; |
|
864 | + } |
|
865 | + } |
|
866 | + $post_category = $post_category_change; |
|
867 | + } |
|
868 | 868 | |
869 | 869 | |
870 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
871 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
872 | - } |
|
873 | - } |
|
870 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
871 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
872 | + } |
|
873 | + } |
|
874 | 874 | |
875 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
875 | + echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
876 | 876 | |
877 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
877 | + echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
878 | 878 | |
879 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
879 | + echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
880 | 880 | |
881 | 881 | |
882 | - ?> |
|
882 | + ?> |
|
883 | 883 | <div class="cat_sublist"> |
884 | 884 | <?php |
885 | 885 | |
886 | - $post_id = isset($post->ID) ? $post->ID : ''; |
|
886 | + $post_id = isset($post->ID) ? $post->ID : ''; |
|
887 | 887 | |
888 | - if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) { |
|
888 | + if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) { |
|
889 | 889 | |
890 | - geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
891 | - } |
|
892 | - ?> |
|
890 | + geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
891 | + } |
|
892 | + ?> |
|
893 | 893 | </div> |
894 | 894 | <script type="text/javascript"> |
895 | 895 | |
@@ -1012,22 +1012,22 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | </script> |
1014 | 1014 | <?php |
1015 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
1016 | - $post_cat_str = $post_categories[$cat_taxonomy]; |
|
1017 | - $post_cat_array = explode("#", $post_cat_str); |
|
1018 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
1019 | - $style = "display:none;"; |
|
1020 | - } |
|
1021 | - ?> |
|
1015 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
1016 | + $post_cat_str = $post_categories[$cat_taxonomy]; |
|
1017 | + $post_cat_array = explode("#", $post_cat_str); |
|
1018 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
1019 | + $style = "display:none;"; |
|
1020 | + } |
|
1021 | + ?> |
|
1022 | 1022 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
1023 | - echo $style; |
|
1024 | - }?> "> |
|
1023 | + echo $style; |
|
1024 | + }?> "> |
|
1025 | 1025 | <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
1026 | - ?> |
|
1026 | + ?> |
|
1027 | 1027 | </div> |
1028 | 1028 | <?php |
1029 | 1029 | |
1030 | - } |
|
1030 | + } |
|
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | /** |
@@ -1044,23 +1044,23 @@ discard block |
||
1044 | 1044 | */ |
1045 | 1045 | function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '') |
1046 | 1046 | { |
1047 | - global $exclude_cats; |
|
1047 | + global $exclude_cats; |
|
1048 | 1048 | |
1049 | - if ($exclude != '') { |
|
1050 | - $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
1049 | + if ($exclude != '') { |
|
1050 | + $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
1051 | 1051 | |
1052 | - if(is_array( $exclude_cats)){ |
|
1053 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1054 | - }else{ |
|
1055 | - $exclude_cats = intval($exclude_cats); |
|
1056 | - } |
|
1052 | + if(is_array( $exclude_cats)){ |
|
1053 | + $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1054 | + }else{ |
|
1055 | + $exclude_cats = intval($exclude_cats); |
|
1056 | + } |
|
1057 | 1057 | |
1058 | - } |
|
1058 | + } |
|
1059 | 1059 | |
1060 | - if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
1061 | - (!is_array($exclude_cats) || empty($exclude_cats)) |
|
1062 | - ) { |
|
1063 | - ?> |
|
1060 | + if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
1061 | + (!is_array($exclude_cats) || empty($exclude_cats)) |
|
1062 | + ) { |
|
1063 | + ?> |
|
1064 | 1064 | |
1065 | 1065 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1066 | 1066 | |
@@ -1089,8 +1089,8 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | <br/> |
1091 | 1091 | <?php |
1092 | - $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1093 | - if (!empty($cat_terms)) { ?> |
|
1092 | + $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1093 | + if (!empty($cat_terms)) { ?> |
|
1094 | 1094 | <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span> |
1095 | 1095 | <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?> |
1096 | 1096 | <?php } ?> |
@@ -1112,53 +1112,53 @@ discard block |
||
1112 | 1112 | function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories) |
1113 | 1113 | { |
1114 | 1114 | |
1115 | - if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) { |
|
1116 | - $post_cat_str = $post_categories[$request_taxonomy]; |
|
1117 | - $post_cat_array = explode("#", $post_cat_str); |
|
1118 | - if (is_array($post_cat_array)) { |
|
1119 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1115 | + if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) { |
|
1116 | + $post_cat_str = $post_categories[$request_taxonomy]; |
|
1117 | + $post_cat_array = explode("#", $post_cat_str); |
|
1118 | + if (is_array($post_cat_array)) { |
|
1119 | + $post_cat_array = array_unique( $post_cat_array ); |
|
1120 | 1120 | |
1121 | 1121 | foreach ($post_cat_array as $post_cat_html) { |
1122 | 1122 | |
1123 | - $post_cat_info = explode(":", $post_cat_html); |
|
1124 | - $post_maincat_str = $post_cat_info[0]; |
|
1123 | + $post_cat_info = explode(":", $post_cat_html); |
|
1124 | + $post_maincat_str = $post_cat_info[0]; |
|
1125 | 1125 | |
1126 | - if (!empty($post_maincat_str)) { |
|
1127 | - $post_maincat_info = explode(",", $post_maincat_str); |
|
1128 | - $post_maincat_id = $post_maincat_info[0]; |
|
1129 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1130 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1131 | - } |
|
1132 | - $post_sub_catid = ''; |
|
1133 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1134 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1135 | - } |
|
1126 | + if (!empty($post_maincat_str)) { |
|
1127 | + $post_maincat_info = explode(",", $post_maincat_str); |
|
1128 | + $post_maincat_id = $post_maincat_info[0]; |
|
1129 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1130 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1131 | + } |
|
1132 | + $post_sub_catid = ''; |
|
1133 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1134 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
1135 | + } |
|
1136 | 1136 | |
1137 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1137 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1138 | 1138 | |
1139 | - } |
|
1140 | - } else { |
|
1139 | + } |
|
1140 | + } else { |
|
1141 | 1141 | |
1142 | - $post_cat_info = explode(":", $post_cat_str); |
|
1143 | - $post_maincat_str = $post_cat_info[0]; |
|
1142 | + $post_cat_info = explode(":", $post_cat_str); |
|
1143 | + $post_maincat_str = $post_cat_info[0]; |
|
1144 | 1144 | |
1145 | - $post_sub_catid = ''; |
|
1145 | + $post_sub_catid = ''; |
|
1146 | 1146 | |
1147 | - if (!empty($post_maincat_str)) { |
|
1148 | - $post_maincat_info = explode(",", $post_maincat_str); |
|
1149 | - $post_maincat_id = $post_maincat_info[0]; |
|
1150 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1151 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1152 | - } |
|
1147 | + if (!empty($post_maincat_str)) { |
|
1148 | + $post_maincat_info = explode(",", $post_maincat_str); |
|
1149 | + $post_maincat_id = $post_maincat_info[0]; |
|
1150 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1151 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1152 | + } |
|
1153 | 1153 | |
1154 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1155 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1156 | - } |
|
1154 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1155 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
1156 | + } |
|
1157 | 1157 | |
1158 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1158 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1159 | 1159 | |
1160 | - } |
|
1161 | - } |
|
1160 | + } |
|
1161 | + } |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | 1164 | /** |
@@ -1172,35 +1172,35 @@ discard block |
||
1172 | 1172 | */ |
1173 | 1173 | function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false) |
1174 | 1174 | { |
1175 | - global $exclude_cats; |
|
1175 | + global $exclude_cats; |
|
1176 | 1176 | |
1177 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1177 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1178 | 1178 | |
1179 | - if (!empty($cat_terms)) { |
|
1180 | - $onchange = ''; |
|
1181 | - $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
1179 | + if (!empty($cat_terms)) { |
|
1180 | + $onchange = ''; |
|
1181 | + $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
1182 | 1182 | |
1183 | - $option_selected = ''; |
|
1184 | - if (!$selected) |
|
1185 | - $option_slected = ' selected="selected" '; |
|
1183 | + $option_selected = ''; |
|
1184 | + if (!$selected) |
|
1185 | + $option_slected = ' selected="selected" '; |
|
1186 | 1186 | |
1187 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1187 | + echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1188 | 1188 | |
1189 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1189 | + echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1190 | 1190 | |
1191 | - foreach ($cat_terms as $cat_term) { |
|
1192 | - $option_selected = ''; |
|
1193 | - if ($selected == $cat_term->term_id) |
|
1194 | - $option_selected = ' selected="selected" '; |
|
1191 | + foreach ($cat_terms as $cat_term) { |
|
1192 | + $option_selected = ''; |
|
1193 | + if ($selected == $cat_term->term_id) |
|
1194 | + $option_selected = ' selected="selected" '; |
|
1195 | 1195 | |
1196 | - // Count child terms |
|
1197 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1198 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1196 | + // Count child terms |
|
1197 | + $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1198 | + $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1199 | 1199 | |
1200 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
1201 | - } |
|
1202 | - echo '</select>'; |
|
1203 | - } |
|
1200 | + echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
1201 | + } |
|
1202 | + echo '</select>'; |
|
1203 | + } |
|
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | /** |
@@ -1216,28 +1216,28 @@ discard block |
||
1216 | 1216 | */ |
1217 | 1217 | function geodir_custom_update_messages($messages) |
1218 | 1218 | { |
1219 | - global $post, $post_ID; |
|
1220 | - |
|
1221 | - $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects'); |
|
1222 | - |
|
1223 | - foreach ($post_types as $post_type => $post_object) { |
|
1224 | - |
|
1225 | - $messages[$post_type] = array( |
|
1226 | - 0 => '', // Unused. Messages start at index 1. |
|
1227 | - 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1228 | - 2 => __('Custom field updated.', 'geodirectory'), |
|
1229 | - 3 => __('Custom field deleted.', 'geodirectory'), |
|
1230 | - 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
|
1231 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1232 | - 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1233 | - 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
|
1234 | - 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1235 | - 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1236 | - 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1237 | - ); |
|
1238 | - } |
|
1239 | - |
|
1240 | - return $messages; |
|
1219 | + global $post, $post_ID; |
|
1220 | + |
|
1221 | + $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects'); |
|
1222 | + |
|
1223 | + foreach ($post_types as $post_type => $post_object) { |
|
1224 | + |
|
1225 | + $messages[$post_type] = array( |
|
1226 | + 0 => '', // Unused. Messages start at index 1. |
|
1227 | + 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1228 | + 2 => __('Custom field updated.', 'geodirectory'), |
|
1229 | + 3 => __('Custom field deleted.', 'geodirectory'), |
|
1230 | + 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
|
1231 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1232 | + 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1233 | + 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
|
1234 | + 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1235 | + 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1236 | + 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1237 | + ); |
|
1238 | + } |
|
1239 | + |
|
1240 | + return $messages; |
|
1241 | 1241 | } |
1242 | 1242 | |
1243 | 1243 | |
@@ -1252,182 +1252,182 @@ discard block |
||
1252 | 1252 | function geodir_register_defaults() |
1253 | 1253 | { |
1254 | 1254 | |
1255 | - global $wpdb; |
|
1256 | - |
|
1257 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1258 | - |
|
1259 | - if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1260 | - $listing_slug = 'places'; |
|
1261 | - |
|
1262 | - /** |
|
1263 | - * Taxonomies |
|
1264 | - **/ |
|
1265 | - //if ( ! taxonomy_exists('gd_place_tags') ) |
|
1266 | - { |
|
1267 | - |
|
1268 | - $gd_placetags = array(); |
|
1269 | - $gd_placetags['object_type'] = 'gd_place'; |
|
1270 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1271 | - $gd_placetags['args'] = array( |
|
1272 | - 'public' => true, |
|
1273 | - 'hierarchical' => false, |
|
1274 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1275 | - 'query_var' => true, |
|
1276 | - |
|
1277 | - 'labels' => array( |
|
1278 | - 'name' => __('Place Tags', 'geodirectory'), |
|
1279 | - 'singular_name' => __('Place Tag', 'geodirectory'), |
|
1280 | - 'search_items' => __('Search Place Tags', 'geodirectory'), |
|
1281 | - 'popular_items' => __('Popular Place Tags', 'geodirectory'), |
|
1282 | - 'all_items' => __('All Place Tags', 'geodirectory'), |
|
1283 | - 'edit_item' => __('Edit Place Tag', 'geodirectory'), |
|
1284 | - 'update_item' => __('Update Place Tag', 'geodirectory'), |
|
1285 | - 'add_new_item' => __('Add New Place Tag', 'geodirectory'), |
|
1286 | - 'new_item_name' => __('New Place Tag Name', 'geodirectory'), |
|
1287 | - 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'), |
|
1288 | - 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'), |
|
1289 | - 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'), |
|
1290 | - ), |
|
1291 | - ); |
|
1292 | - |
|
1293 | - |
|
1294 | - $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1295 | - $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
1296 | - update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1297 | - |
|
1298 | - |
|
1299 | - // Update post types and delete tmp options |
|
1300 | - flush_rewrite_rules(); |
|
1301 | - |
|
1302 | - } |
|
1303 | - |
|
1304 | - //if ( ! taxonomy_exists('gd_placecategory') ) |
|
1305 | - { |
|
1306 | - |
|
1307 | - $gd_placecategory = array(); |
|
1308 | - $gd_placecategory['object_type'] = 'gd_place'; |
|
1309 | - $gd_placecategory['listing_slug'] = $listing_slug; |
|
1310 | - $gd_placecategory['args'] = array( |
|
1311 | - 'public' => true, |
|
1312 | - 'hierarchical' => true, |
|
1313 | - 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), |
|
1314 | - 'query_var' => true, |
|
1315 | - 'labels' => array( |
|
1316 | - 'name' => __('Place Categories', 'geodirectory'), |
|
1317 | - 'singular_name' => __('Place Category', 'geodirectory'), |
|
1318 | - 'search_items' => __('Search Place Categories', 'geodirectory'), |
|
1319 | - 'popular_items' => __('Popular Place Categories', 'geodirectory'), |
|
1320 | - 'all_items' => __('All Place Categories', 'geodirectory'), |
|
1321 | - 'edit_item' => __('Edit Place Category', 'geodirectory'), |
|
1322 | - 'update_item' => __('Update Place Category', 'geodirectory'), |
|
1323 | - 'add_new_item' => __('Add New Place Category', 'geodirectory'), |
|
1324 | - 'new_item_name' => __('New Place Category', 'geodirectory'), |
|
1325 | - 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'), |
|
1326 | - ), |
|
1327 | - ); |
|
1328 | - |
|
1329 | - |
|
1330 | - $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1331 | - $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
1332 | - update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1333 | - |
|
1334 | - |
|
1335 | - flush_rewrite_rules(); |
|
1336 | - } |
|
1337 | - |
|
1338 | - /** |
|
1339 | - * Post Types |
|
1340 | - **/ |
|
1341 | - |
|
1342 | - //if ( ! post_type_exists('gd_place') ) |
|
1343 | - { |
|
1344 | - |
|
1345 | - $labels = array( |
|
1346 | - 'name' => __('Places', 'geodirectory'), |
|
1347 | - 'singular_name' => __('Place', 'geodirectory'), |
|
1348 | - 'add_new' => __('Add New', 'geodirectory'), |
|
1349 | - 'add_new_item' => __('Add New Place', 'geodirectory'), |
|
1350 | - 'edit_item' => __('Edit Place', 'geodirectory'), |
|
1351 | - 'new_item' => __('New Place', 'geodirectory'), |
|
1352 | - 'view_item' => __('View Place', 'geodirectory'), |
|
1353 | - 'search_items' => __('Search Places', 'geodirectory'), |
|
1354 | - 'not_found' => __('No Place Found', 'geodirectory'), |
|
1355 | - 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory')); |
|
1356 | - |
|
1357 | - $place_default = array( |
|
1358 | - 'labels' => $labels, |
|
1359 | - 'can_export' => true, |
|
1360 | - 'capability_type' => 'post', |
|
1361 | - 'description' => 'Place post type.', |
|
1362 | - 'has_archive' => $listing_slug, |
|
1363 | - 'hierarchical' => false, |
|
1364 | - 'map_meta_cap' => true, |
|
1365 | - 'menu_icon' => $menu_icon, |
|
1366 | - 'public' => true, |
|
1367 | - 'query_var' => true, |
|
1368 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1369 | - 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
|
1370 | - 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
|
1371 | - |
|
1372 | - //Update custom post types |
|
1373 | - $geodir_post_types = get_option('geodir_post_types'); |
|
1374 | - $geodir_post_types['gd_place'] = $place_default; |
|
1375 | - update_option('geodir_post_types', $geodir_post_types); |
|
1376 | - |
|
1377 | - // Update post types and delete tmp options |
|
1378 | - flush_rewrite_rules(); |
|
1379 | - } |
|
1380 | - |
|
1381 | - |
|
1382 | - geodir_register_taxonomies(); |
|
1383 | - geodir_register_post_types(); |
|
1384 | - |
|
1385 | - //die; |
|
1255 | + global $wpdb; |
|
1256 | + |
|
1257 | + $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1258 | + |
|
1259 | + if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1260 | + $listing_slug = 'places'; |
|
1261 | + |
|
1262 | + /** |
|
1263 | + * Taxonomies |
|
1264 | + **/ |
|
1265 | + //if ( ! taxonomy_exists('gd_place_tags') ) |
|
1266 | + { |
|
1267 | + |
|
1268 | + $gd_placetags = array(); |
|
1269 | + $gd_placetags['object_type'] = 'gd_place'; |
|
1270 | + $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1271 | + $gd_placetags['args'] = array( |
|
1272 | + 'public' => true, |
|
1273 | + 'hierarchical' => false, |
|
1274 | + 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1275 | + 'query_var' => true, |
|
1276 | + |
|
1277 | + 'labels' => array( |
|
1278 | + 'name' => __('Place Tags', 'geodirectory'), |
|
1279 | + 'singular_name' => __('Place Tag', 'geodirectory'), |
|
1280 | + 'search_items' => __('Search Place Tags', 'geodirectory'), |
|
1281 | + 'popular_items' => __('Popular Place Tags', 'geodirectory'), |
|
1282 | + 'all_items' => __('All Place Tags', 'geodirectory'), |
|
1283 | + 'edit_item' => __('Edit Place Tag', 'geodirectory'), |
|
1284 | + 'update_item' => __('Update Place Tag', 'geodirectory'), |
|
1285 | + 'add_new_item' => __('Add New Place Tag', 'geodirectory'), |
|
1286 | + 'new_item_name' => __('New Place Tag Name', 'geodirectory'), |
|
1287 | + 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'), |
|
1288 | + 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'), |
|
1289 | + 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'), |
|
1290 | + ), |
|
1291 | + ); |
|
1292 | + |
|
1293 | + |
|
1294 | + $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1295 | + $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
1296 | + update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1297 | + |
|
1298 | + |
|
1299 | + // Update post types and delete tmp options |
|
1300 | + flush_rewrite_rules(); |
|
1301 | + |
|
1302 | + } |
|
1303 | + |
|
1304 | + //if ( ! taxonomy_exists('gd_placecategory') ) |
|
1305 | + { |
|
1306 | + |
|
1307 | + $gd_placecategory = array(); |
|
1308 | + $gd_placecategory['object_type'] = 'gd_place'; |
|
1309 | + $gd_placecategory['listing_slug'] = $listing_slug; |
|
1310 | + $gd_placecategory['args'] = array( |
|
1311 | + 'public' => true, |
|
1312 | + 'hierarchical' => true, |
|
1313 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), |
|
1314 | + 'query_var' => true, |
|
1315 | + 'labels' => array( |
|
1316 | + 'name' => __('Place Categories', 'geodirectory'), |
|
1317 | + 'singular_name' => __('Place Category', 'geodirectory'), |
|
1318 | + 'search_items' => __('Search Place Categories', 'geodirectory'), |
|
1319 | + 'popular_items' => __('Popular Place Categories', 'geodirectory'), |
|
1320 | + 'all_items' => __('All Place Categories', 'geodirectory'), |
|
1321 | + 'edit_item' => __('Edit Place Category', 'geodirectory'), |
|
1322 | + 'update_item' => __('Update Place Category', 'geodirectory'), |
|
1323 | + 'add_new_item' => __('Add New Place Category', 'geodirectory'), |
|
1324 | + 'new_item_name' => __('New Place Category', 'geodirectory'), |
|
1325 | + 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'), |
|
1326 | + ), |
|
1327 | + ); |
|
1328 | + |
|
1329 | + |
|
1330 | + $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1331 | + $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
1332 | + update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1333 | + |
|
1334 | + |
|
1335 | + flush_rewrite_rules(); |
|
1336 | + } |
|
1337 | + |
|
1338 | + /** |
|
1339 | + * Post Types |
|
1340 | + **/ |
|
1341 | + |
|
1342 | + //if ( ! post_type_exists('gd_place') ) |
|
1343 | + { |
|
1344 | + |
|
1345 | + $labels = array( |
|
1346 | + 'name' => __('Places', 'geodirectory'), |
|
1347 | + 'singular_name' => __('Place', 'geodirectory'), |
|
1348 | + 'add_new' => __('Add New', 'geodirectory'), |
|
1349 | + 'add_new_item' => __('Add New Place', 'geodirectory'), |
|
1350 | + 'edit_item' => __('Edit Place', 'geodirectory'), |
|
1351 | + 'new_item' => __('New Place', 'geodirectory'), |
|
1352 | + 'view_item' => __('View Place', 'geodirectory'), |
|
1353 | + 'search_items' => __('Search Places', 'geodirectory'), |
|
1354 | + 'not_found' => __('No Place Found', 'geodirectory'), |
|
1355 | + 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory')); |
|
1356 | + |
|
1357 | + $place_default = array( |
|
1358 | + 'labels' => $labels, |
|
1359 | + 'can_export' => true, |
|
1360 | + 'capability_type' => 'post', |
|
1361 | + 'description' => 'Place post type.', |
|
1362 | + 'has_archive' => $listing_slug, |
|
1363 | + 'hierarchical' => false, |
|
1364 | + 'map_meta_cap' => true, |
|
1365 | + 'menu_icon' => $menu_icon, |
|
1366 | + 'public' => true, |
|
1367 | + 'query_var' => true, |
|
1368 | + 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1369 | + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
|
1370 | + 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
|
1371 | + |
|
1372 | + //Update custom post types |
|
1373 | + $geodir_post_types = get_option('geodir_post_types'); |
|
1374 | + $geodir_post_types['gd_place'] = $place_default; |
|
1375 | + update_option('geodir_post_types', $geodir_post_types); |
|
1376 | + |
|
1377 | + // Update post types and delete tmp options |
|
1378 | + flush_rewrite_rules(); |
|
1379 | + } |
|
1380 | + |
|
1381 | + |
|
1382 | + geodir_register_taxonomies(); |
|
1383 | + geodir_register_post_types(); |
|
1384 | + |
|
1385 | + //die; |
|
1386 | 1386 | |
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | $gd_wpml_get_languages = ""; |
1390 | 1390 | function gd_wpml_get_lang_from_url($url) { |
1391 | - global $sitepress, $gd_wpml_get_languages; |
|
1391 | + global $sitepress, $gd_wpml_get_languages; |
|
1392 | 1392 | |
1393 | - if (geodir_is_wpml()) { |
|
1394 | - return $sitepress->get_language_from_url($url); |
|
1395 | - } |
|
1393 | + if (geodir_is_wpml()) { |
|
1394 | + return $sitepress->get_language_from_url($url); |
|
1395 | + } |
|
1396 | 1396 | |
1397 | - if (isset($_REQUEST['lang']) && $_REQUEST['lang']) { |
|
1398 | - return $_REQUEST['lang']; |
|
1399 | - } |
|
1397 | + if (isset($_REQUEST['lang']) && $_REQUEST['lang']) { |
|
1398 | + return $_REQUEST['lang']; |
|
1399 | + } |
|
1400 | 1400 | |
1401 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1401 | + $url = str_replace(array("http://","https://"),"",$url); |
|
1402 | 1402 | |
1403 | - // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang. |
|
1404 | - $site_url = str_replace(array("http://","https://"),"",site_url()); |
|
1403 | + // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang. |
|
1404 | + $site_url = str_replace(array("http://","https://"),"",site_url()); |
|
1405 | 1405 | |
1406 | - $url = str_replace($site_url,"",$url); |
|
1406 | + $url = str_replace($site_url,"",$url); |
|
1407 | 1407 | |
1408 | - $segments = explode('/', trim($url, '/')); |
|
1408 | + $segments = explode('/', trim($url, '/')); |
|
1409 | 1409 | |
1410 | - if ($gd_wpml_get_languages) { |
|
1411 | - $langs = $gd_wpml_get_languages; |
|
1412 | - } else { |
|
1413 | - $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
1414 | - } |
|
1410 | + if ($gd_wpml_get_languages) { |
|
1411 | + $langs = $gd_wpml_get_languages; |
|
1412 | + } else { |
|
1413 | + $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
1414 | + } |
|
1415 | 1415 | |
1416 | - if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) { |
|
1417 | - return $segments[0]; |
|
1418 | - } |
|
1416 | + if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) { |
|
1417 | + return $segments[0]; |
|
1418 | + } |
|
1419 | 1419 | |
1420 | - return false; |
|
1420 | + return false; |
|
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | function gd_wpml_slug_translation_turned_on($post_type) { |
1424 | 1424 | |
1425 | - global $sitepress; |
|
1426 | - $settings = $sitepress->get_settings(); |
|
1427 | - return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
1428 | - && $settings['posts_slug_translation']['types'][$post_type] |
|
1429 | - && isset($settings['posts_slug_translation']['on']) |
|
1430 | - && $settings['posts_slug_translation']['on']; |
|
1425 | + global $sitepress; |
|
1426 | + $settings = $sitepress->get_settings(); |
|
1427 | + return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
1428 | + && $settings['posts_slug_translation']['types'][$post_type] |
|
1429 | + && isset($settings['posts_slug_translation']['on']) |
|
1430 | + && $settings['posts_slug_translation']['on']; |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | |
@@ -1454,162 +1454,162 @@ discard block |
||
1454 | 1454 | */ |
1455 | 1455 | function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample) |
1456 | 1456 | { |
1457 | - //echo $post_link."<br />".$sample ; |
|
1457 | + //echo $post_link."<br />".$sample ; |
|
1458 | 1458 | |
1459 | 1459 | |
1460 | - global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache, $gd_cache_post; |
|
1461 | - if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) { |
|
1462 | - if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;} |
|
1463 | - } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) { |
|
1464 | - return $post_link; |
|
1465 | - } else { |
|
1466 | - $orig_post = $post; |
|
1467 | - $post = $post_obj; |
|
1468 | - } |
|
1460 | + global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache, $gd_cache_post; |
|
1461 | + if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) { |
|
1462 | + if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;} |
|
1463 | + } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) { |
|
1464 | + return $post_link; |
|
1465 | + } else { |
|
1466 | + $orig_post = $post; |
|
1467 | + $post = $post_obj; |
|
1468 | + } |
|
1469 | 1469 | |
1470 | 1470 | |
1471 | 1471 | |
1472 | - if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit; |
|
1472 | + if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit; |
|
1473 | 1473 | |
1474 | 1474 | |
1475 | - // if we dont have a GD post then try to grab it |
|
1476 | - if(!isset($post->default_category)){ |
|
1477 | - $gd_post = geodir_get_post_info($post->ID); |
|
1478 | - if(!empty($gd_post)){ |
|
1479 | - $post = $gd_post; |
|
1480 | - } |
|
1481 | - } |
|
1475 | + // if we dont have a GD post then try to grab it |
|
1476 | + if(!isset($post->default_category)){ |
|
1477 | + $gd_post = geodir_get_post_info($post->ID); |
|
1478 | + if(!empty($gd_post)){ |
|
1479 | + $post = $gd_post; |
|
1480 | + } |
|
1481 | + } |
|
1482 | 1482 | |
1483 | 1483 | |
1484 | - $post_types = get_option('geodir_post_types'); |
|
1485 | - $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
1484 | + $post_types = get_option('geodir_post_types'); |
|
1485 | + $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
1486 | 1486 | |
1487 | - // Alter the CPT slug if WPML is set to do so |
|
1488 | - if(geodir_wpml_is_post_type_translated($post->post_type)){ |
|
1489 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1487 | + // Alter the CPT slug if WPML is set to do so |
|
1488 | + if(geodir_wpml_is_post_type_translated($post->post_type)){ |
|
1489 | + if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1490 | 1490 | |
1491 | - $org_slug = $slug; |
|
1492 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1493 | - $slug, |
|
1494 | - 'WordPress', |
|
1495 | - 'URL slug: ' . $slug, |
|
1496 | - $language_code); |
|
1491 | + $org_slug = $slug; |
|
1492 | + $slug = apply_filters( 'wpml_translate_single_string', |
|
1493 | + $slug, |
|
1494 | + 'WordPress', |
|
1495 | + 'URL slug: ' . $slug, |
|
1496 | + $language_code); |
|
1497 | 1497 | |
1498 | - if(!$slug){$slug = $org_slug;} |
|
1498 | + if(!$slug){$slug = $org_slug;} |
|
1499 | 1499 | |
1500 | - } |
|
1501 | - } |
|
1500 | + } |
|
1501 | + } |
|
1502 | 1502 | |
1503 | - if (function_exists('geodir_location_geo_home_link')) { |
|
1504 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
1505 | - } |
|
1503 | + if (function_exists('geodir_location_geo_home_link')) { |
|
1504 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
1505 | + } |
|
1506 | 1506 | |
1507 | - // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
1508 | - $site_url = trailingslashit(get_bloginfo('url')); |
|
1507 | + // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
1508 | + $site_url = trailingslashit(get_bloginfo('url')); |
|
1509 | 1509 | |
1510 | - if (function_exists('geodir_location_geo_home_link')) { |
|
1511 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
1512 | - } |
|
1513 | - |
|
1514 | - $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
1515 | - if ($fix_url) { |
|
1516 | - $post_link = str_replace($site_url, '', $post_link); |
|
1517 | - } |
|
1518 | - |
|
1519 | - $post_link = trailingslashit( |
|
1520 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1521 | - ); |
|
1522 | - |
|
1523 | - if ($fix_url) { |
|
1524 | - $post_link = $site_url . $post_link; |
|
1525 | - } |
|
1526 | - |
|
1527 | - if (isset($comment_post_cache[$post->ID])) { |
|
1528 | - $post = $comment_post_cache[$post->ID]; |
|
1529 | - } |
|
1530 | - if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) { |
|
1531 | - $post_id = $post->ID; |
|
1532 | - if (isset($orig_post)) { |
|
1533 | - $post = $orig_post; |
|
1534 | - } |
|
1535 | - return $gd_permalink_cache[$post_id]; |
|
1536 | - } |
|
1510 | + if (function_exists('geodir_location_geo_home_link')) { |
|
1511 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
1512 | + } |
|
1537 | 1513 | |
1538 | - if (!isset($post->post_locations)) { |
|
1539 | - $post_type = $post->post_type; |
|
1540 | - $ID = $post->ID; |
|
1541 | - $post2 = $wpdb->get_row( |
|
1542 | - $wpdb->prepare( |
|
1543 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1544 | - array($post->ID) |
|
1545 | - ) |
|
1546 | - ); |
|
1514 | + $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
1515 | + if ($fix_url) { |
|
1516 | + $post_link = str_replace($site_url, '', $post_link); |
|
1517 | + } |
|
1547 | 1518 | |
1548 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1519 | + $post_link = trailingslashit( |
|
1520 | + preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1521 | + ); |
|
1549 | 1522 | |
1550 | - $comment_post_cache[$post->ID] = $post; |
|
1551 | - } |
|
1523 | + if ($fix_url) { |
|
1524 | + $post_link = $site_url . $post_link; |
|
1525 | + } |
|
1552 | 1526 | |
1527 | + if (isset($comment_post_cache[$post->ID])) { |
|
1528 | + $post = $comment_post_cache[$post->ID]; |
|
1529 | + } |
|
1530 | + if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) { |
|
1531 | + $post_id = $post->ID; |
|
1532 | + if (isset($orig_post)) { |
|
1533 | + $post = $orig_post; |
|
1534 | + } |
|
1535 | + return $gd_permalink_cache[$post_id]; |
|
1536 | + } |
|
1553 | 1537 | |
1538 | + if (!isset($post->post_locations)) { |
|
1539 | + $post_type = $post->post_type; |
|
1540 | + $ID = $post->ID; |
|
1541 | + $post2 = $wpdb->get_row( |
|
1542 | + $wpdb->prepare( |
|
1543 | + "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1544 | + array($post->ID) |
|
1545 | + ) |
|
1546 | + ); |
|
1554 | 1547 | |
1555 | - if (false !== strpos($post_link, '%gd_taxonomy%')) { |
|
1548 | + $post = (object)array_merge((array)$post, (array)$post2); |
|
1556 | 1549 | |
1557 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1558 | - $location_request = ''; |
|
1550 | + $comment_post_cache[$post->ID] = $post; |
|
1551 | + } |
|
1559 | 1552 | |
1560 | 1553 | |
1561 | - if (!empty($post->post_locations)) { |
|
1562 | - $geodir_arr_locations = explode(',', $post->post_locations); |
|
1563 | - if (count($geodir_arr_locations) == 3) { |
|
1564 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1565 | - $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1566 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1567 | - $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1568 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1569 | - $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1570 | 1554 | |
1571 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1572 | - 'region_slug' => $post->region_slug, |
|
1573 | - 'city_slug' => $post->city_slug |
|
1574 | - ); |
|
1555 | + if (false !== strpos($post_link, '%gd_taxonomy%')) { |
|
1575 | 1556 | |
1576 | - } else |
|
1577 | - $post_location = geodir_get_location(); |
|
1557 | + if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1558 | + $location_request = ''; |
|
1578 | 1559 | |
1579 | 1560 | |
1580 | - } else { |
|
1561 | + if (!empty($post->post_locations)) { |
|
1562 | + $geodir_arr_locations = explode(',', $post->post_locations); |
|
1563 | + if (count($geodir_arr_locations) == 3) { |
|
1564 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1565 | + $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1566 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1567 | + $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1568 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1569 | + $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1581 | 1570 | |
1582 | - $post_location_sql = $wpdb->get_results( |
|
1583 | - $wpdb->prepare( |
|
1584 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1585 | - array($post->ID) |
|
1586 | - ) |
|
1587 | - ); |
|
1588 | - |
|
1589 | - if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) { |
|
1590 | - |
|
1591 | - $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations); |
|
1592 | - if (count($geodir_arr_locations) == 3) { |
|
1593 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1594 | - $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1595 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1596 | - $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1597 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1598 | - $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1599 | - |
|
1600 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1601 | - 'region_slug' => $post->region_slug, |
|
1602 | - 'city_slug' => $post->city_slug |
|
1603 | - ); |
|
1571 | + $post_location = (object)array('country_slug' => $post->country_slug, |
|
1572 | + 'region_slug' => $post->region_slug, |
|
1573 | + 'city_slug' => $post->city_slug |
|
1574 | + ); |
|
1604 | 1575 | |
1605 | - } |
|
1606 | - } else |
|
1607 | - $post_location = geodir_get_location(); |
|
1608 | - } |
|
1576 | + } else |
|
1577 | + $post_location = geodir_get_location(); |
|
1578 | + |
|
1579 | + |
|
1580 | + } else { |
|
1581 | + |
|
1582 | + $post_location_sql = $wpdb->get_results( |
|
1583 | + $wpdb->prepare( |
|
1584 | + "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1585 | + array($post->ID) |
|
1586 | + ) |
|
1587 | + ); |
|
1588 | + |
|
1589 | + if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) { |
|
1590 | + |
|
1591 | + $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations); |
|
1592 | + if (count($geodir_arr_locations) == 3) { |
|
1593 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1594 | + $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1595 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1596 | + $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1597 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1598 | + $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1599 | + |
|
1600 | + $post_location = (object)array('country_slug' => $post->country_slug, |
|
1601 | + 'region_slug' => $post->region_slug, |
|
1602 | + 'city_slug' => $post->city_slug |
|
1603 | + ); |
|
1604 | + |
|
1605 | + } |
|
1606 | + } else |
|
1607 | + $post_location = geodir_get_location(); |
|
1608 | + } |
|
1609 | 1609 | |
1610 | 1610 | |
1611 | - if (!empty($post_location)) { |
|
1612 | - $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
1611 | + if (!empty($post_location)) { |
|
1612 | + $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
1613 | 1613 | $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
1614 | 1614 | $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
1615 | 1615 | |
@@ -1627,89 +1627,89 @@ discard block |
||
1627 | 1627 | $location_slug[] = $city_slug; |
1628 | 1628 | |
1629 | 1629 | $location_request .= implode('/', $location_slug) . '/'; |
1630 | - } |
|
1631 | - } |
|
1630 | + } |
|
1631 | + } |
|
1632 | 1632 | |
1633 | - if (get_option('geodir_add_categories_url')) { |
|
1633 | + if (get_option('geodir_add_categories_url')) { |
|
1634 | 1634 | |
1635 | - $term_request = ''; |
|
1636 | - $taxonomies = geodir_get_taxonomies($post->post_type); |
|
1637 | - $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : ''; |
|
1635 | + $term_request = ''; |
|
1636 | + $taxonomies = geodir_get_taxonomies($post->post_type); |
|
1637 | + $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : ''; |
|
1638 | 1638 | |
1639 | - if (!empty($post->default_category)) { |
|
1640 | - $post_terms = $post->default_category; |
|
1641 | - } else { |
|
1642 | - $post_terms = ''; |
|
1643 | - |
|
1644 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
|
1645 | - $post_terms = absint($_POST['post_default_category']); |
|
1646 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1647 | - $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
|
1648 | - $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
|
1649 | - }elseif (isset($post->{$taxonomies})) { |
|
1650 | - $post_terms = explode(",", trim($post->{$taxonomies}, ",")); |
|
1651 | - $post_terms = $post_terms[0]; |
|
1652 | - } |
|
1639 | + if (!empty($post->default_category)) { |
|
1640 | + $post_terms = $post->default_category; |
|
1641 | + } else { |
|
1642 | + $post_terms = ''; |
|
1643 | + |
|
1644 | + if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
|
1645 | + $post_terms = absint($_POST['post_default_category']); |
|
1646 | + }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1647 | + $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
|
1648 | + $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
|
1649 | + }elseif (isset($post->{$taxonomies})) { |
|
1650 | + $post_terms = explode(",", trim($post->{$taxonomies}, ",")); |
|
1651 | + $post_terms = $post_terms[0]; |
|
1652 | + } |
|
1653 | 1653 | |
1654 | - if (!$post_terms) |
|
1655 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1654 | + if (!$post_terms) |
|
1655 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1656 | 1656 | |
1657 | - if (!$post_terms) { |
|
1658 | - $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
1657 | + if (!$post_terms) { |
|
1658 | + $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
1659 | 1659 | |
1660 | - if ($post_terms) { |
|
1661 | - $post_terms = explode(",", trim($post_terms, ",")); |
|
1662 | - $post_terms = $post_terms[0]; |
|
1663 | - } |
|
1664 | - } |
|
1665 | - } |
|
1660 | + if ($post_terms) { |
|
1661 | + $post_terms = explode(",", trim($post_terms, ",")); |
|
1662 | + $post_terms = $post_terms[0]; |
|
1663 | + } |
|
1664 | + } |
|
1665 | + } |
|
1666 | 1666 | |
1667 | - $term = get_term_by('id', $post_terms, $taxonomies); |
|
1667 | + $term = get_term_by('id', $post_terms, $taxonomies); |
|
1668 | 1668 | |
1669 | - if (!empty($term)) |
|
1670 | - $term_request = $term->slug; |
|
1671 | - //$term_request = $term->slug.'/'; |
|
1672 | - } |
|
1669 | + if (!empty($term)) |
|
1670 | + $term_request = $term->slug; |
|
1671 | + //$term_request = $term->slug.'/'; |
|
1672 | + } |
|
1673 | 1673 | |
1674 | - $request_term = ''; |
|
1675 | - $listingurl_separator = ''; |
|
1676 | - //$detailurl_separator = get_option('geodir_detailurl_separator'); |
|
1677 | - $detailurl_separator = ''; |
|
1678 | - if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') { |
|
1679 | - $request_term = $location_request; |
|
1680 | - //$listingurl_separator = get_option('geodir_listingurl_separator'); |
|
1681 | - //$request_term .= $listingurl_separator.'/'.$term_request; |
|
1682 | - $request_term .= $term_request; |
|
1674 | + $request_term = ''; |
|
1675 | + $listingurl_separator = ''; |
|
1676 | + //$detailurl_separator = get_option('geodir_detailurl_separator'); |
|
1677 | + $detailurl_separator = ''; |
|
1678 | + if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') { |
|
1679 | + $request_term = $location_request; |
|
1680 | + //$listingurl_separator = get_option('geodir_listingurl_separator'); |
|
1681 | + //$request_term .= $listingurl_separator.'/'.$term_request; |
|
1682 | + $request_term .= $term_request; |
|
1683 | 1683 | |
1684 | - } else { |
|
1685 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1684 | + } else { |
|
1685 | + if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1686 | 1686 | |
1687 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1688 | - } |
|
1689 | - $request_term = trim($request_term, '/'); |
|
1687 | + if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1688 | + } |
|
1689 | + $request_term = trim($request_term, '/'); |
|
1690 | 1690 | |
1691 | - // Fix with WPML the location terms added twice when CPT slug is translated. |
|
1692 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) { |
|
1693 | - $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
|
1694 | - } |
|
1691 | + // Fix with WPML the location terms added twice when CPT slug is translated. |
|
1692 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) { |
|
1693 | + $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
|
1694 | + } |
|
1695 | 1695 | |
1696 | - if (!empty($request_term)) |
|
1697 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1698 | - else |
|
1699 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1700 | - //echo $post_link ; |
|
1701 | - } |
|
1702 | - // temp cache the permalink |
|
1703 | - if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) { |
|
1704 | - $gd_permalink_cache[$post->ID] = $post_link; |
|
1705 | - } |
|
1706 | - } |
|
1707 | - if (isset($orig_post)) { |
|
1708 | - $post = $orig_post; |
|
1709 | - } |
|
1696 | + if (!empty($request_term)) |
|
1697 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1698 | + else |
|
1699 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1700 | + //echo $post_link ; |
|
1701 | + } |
|
1702 | + // temp cache the permalink |
|
1703 | + if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) { |
|
1704 | + $gd_permalink_cache[$post->ID] = $post_link; |
|
1705 | + } |
|
1706 | + } |
|
1707 | + if (isset($orig_post)) { |
|
1708 | + $post = $orig_post; |
|
1709 | + } |
|
1710 | 1710 | $gd_cache_post = $post; |
1711 | 1711 | |
1712 | - return $post_link; |
|
1712 | + return $post_link; |
|
1713 | 1713 | } |
1714 | 1714 | |
1715 | 1715 | /** |
@@ -1725,73 +1725,73 @@ discard block |
||
1725 | 1725 | * @return string The term link. |
1726 | 1726 | */ |
1727 | 1727 | function geodir_term_link($termlink, $term, $taxonomy) { |
1728 | - $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1728 | + $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1729 | 1729 | |
1730 | - if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) { |
|
1731 | - global $geodir_add_location_url, $gd_session; |
|
1732 | - $orig_termlink = $termlink; |
|
1730 | + if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) { |
|
1731 | + global $geodir_add_location_url, $gd_session; |
|
1732 | + $orig_termlink = $termlink; |
|
1733 | 1733 | $include_location = false; |
1734 | - $request_term = array(); |
|
1735 | - $add_location_url = get_option('geodir_add_location_url'); |
|
1736 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1734 | + $request_term = array(); |
|
1735 | + $add_location_url = get_option('geodir_add_location_url'); |
|
1736 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1737 | 1737 | |
1738 | - $listing_slug = geodir_get_listing_slug($taxonomy); |
|
1738 | + $listing_slug = geodir_get_listing_slug($taxonomy); |
|
1739 | 1739 | |
1740 | - if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') { |
|
1741 | - if ($geodir_add_location_url && $add_location_url) { |
|
1742 | - $include_location = true; |
|
1743 | - } |
|
1744 | - } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) { |
|
1745 | - $include_location = true; |
|
1746 | - } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) { |
|
1747 | - $include_location = true; |
|
1748 | - } |
|
1749 | - |
|
1750 | - if ($include_location) { |
|
1751 | - global $post; |
|
1752 | - $location_terms = array(); |
|
1740 | + if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') { |
|
1741 | + if ($geodir_add_location_url && $add_location_url) { |
|
1742 | + $include_location = true; |
|
1743 | + } |
|
1744 | + } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) { |
|
1745 | + $include_location = true; |
|
1746 | + } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) { |
|
1747 | + $include_location = true; |
|
1748 | + } |
|
1749 | + |
|
1750 | + if ($include_location) { |
|
1751 | + global $post; |
|
1752 | + $location_terms = array(); |
|
1753 | 1753 | |
1754 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1754 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1755 | 1755 | |
1756 | - if (geodir_is_page('detail')) { |
|
1757 | - if (!isset($post->country_slug) && !empty($post->post_locations)) { |
|
1758 | - $post_locations = explode(',', $post->post_locations); |
|
1759 | - |
|
1760 | - if (count($post_locations) == 3) { |
|
1761 | - $post->city_slug = str_replace('[', '', $post_locations[0]); |
|
1762 | - $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1763 | - $post->region_slug = str_replace('[', '', $post_locations[1]); |
|
1764 | - $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1765 | - $post->country_slug = str_replace('[', '', $post_locations[2]); |
|
1766 | - $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1767 | - } |
|
1768 | - } |
|
1756 | + if (geodir_is_page('detail')) { |
|
1757 | + if (!isset($post->country_slug) && !empty($post->post_locations)) { |
|
1758 | + $post_locations = explode(',', $post->post_locations); |
|
1759 | + |
|
1760 | + if (count($post_locations) == 3) { |
|
1761 | + $post->city_slug = str_replace('[', '', $post_locations[0]); |
|
1762 | + $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1763 | + $post->region_slug = str_replace('[', '', $post_locations[1]); |
|
1764 | + $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1765 | + $post->country_slug = str_replace('[', '', $post_locations[2]); |
|
1766 | + $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1767 | + } |
|
1768 | + } |
|
1769 | 1769 | |
1770 | - if (isset($post->country_slug)) { |
|
1771 | - $location_terms = array( |
|
1772 | - 'gd_country' => $post->country_slug, |
|
1773 | - 'gd_region' => $post->region_slug, |
|
1774 | - 'gd_city' => $post->city_slug |
|
1775 | - ); |
|
1770 | + if (isset($post->country_slug)) { |
|
1771 | + $location_terms = array( |
|
1772 | + 'gd_country' => $post->country_slug, |
|
1773 | + 'gd_region' => $post->region_slug, |
|
1774 | + 'gd_city' => $post->city_slug |
|
1775 | + ); |
|
1776 | 1776 | |
1777 | - if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1778 | - $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
1779 | - } |
|
1780 | - } |
|
1781 | - } |
|
1777 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1778 | + $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
1779 | + } |
|
1780 | + } |
|
1781 | + } |
|
1782 | 1782 | |
1783 | - if (empty($location_terms)) { |
|
1784 | - $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1785 | - } |
|
1783 | + if (empty($location_terms)) { |
|
1784 | + $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1785 | + } |
|
1786 | 1786 | |
1787 | - $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1788 | - $location_terms = geodir_remove_location_terms($location_terms); |
|
1787 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1788 | + $location_terms = geodir_remove_location_terms($location_terms); |
|
1789 | 1789 | |
1790 | - if (!empty($location_terms)) { |
|
1791 | - $url_separator = ''; |
|
1790 | + if (!empty($location_terms)) { |
|
1791 | + $url_separator = ''; |
|
1792 | 1792 | |
1793 | - if (get_option('permalink_structure') != '') { |
|
1794 | - $found = false; |
|
1793 | + if (get_option('permalink_structure') != '') { |
|
1794 | + $found = false; |
|
1795 | 1795 | $request_term = implode("/", $location_terms); |
1796 | 1796 | if (geodir_is_wpml()) { |
1797 | 1797 | $post_types = get_option('geodir_post_types'); |
@@ -1827,47 +1827,47 @@ discard block |
||
1827 | 1827 | |
1828 | 1828 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
1829 | 1829 | } |
1830 | - } else { |
|
1831 | - $termlink = geodir_getlink($termlink, $request_term); |
|
1832 | - } |
|
1833 | - } |
|
1834 | - } |
|
1830 | + } else { |
|
1831 | + $termlink = geodir_getlink($termlink, $request_term); |
|
1832 | + } |
|
1833 | + } |
|
1834 | + } |
|
1835 | 1835 | |
1836 | - // Alter the CPT slug is WPML is set to do so |
|
1837 | - /* we can replace this with the below function |
|
1836 | + // Alter the CPT slug is WPML is set to do so |
|
1837 | + /* we can replace this with the below function |
|
1838 | 1838 | if(geodir_is_wpml()){ |
1839 | 1839 | global $sitepress; |
1840 | 1840 | $post_type = str_replace("category","",$taxonomy); |
1841 | 1841 | $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type); |
1842 | 1842 | }*/ |
1843 | 1843 | |
1844 | - // Alter the CPT slug if WPML is set to do so |
|
1845 | - if (geodir_is_wpml()) { |
|
1846 | - $post_types = get_option('geodir_post_types'); |
|
1847 | - $post_type = str_replace("category","",$taxonomy); |
|
1848 | - $post_type = str_replace("_tags","",$post_type); |
|
1849 | - $slug = $post_types[$post_type]['rewrite']['slug']; |
|
1850 | - if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
|
1851 | - global $sitepress; |
|
1852 | - $default_lang = $sitepress->get_default_language(); |
|
1853 | - $language_code = gd_wpml_get_lang_from_url($orig_termlink); |
|
1854 | - if (!$language_code ) { |
|
1855 | - $language_code = $default_lang; |
|
1856 | - } |
|
1844 | + // Alter the CPT slug if WPML is set to do so |
|
1845 | + if (geodir_is_wpml()) { |
|
1846 | + $post_types = get_option('geodir_post_types'); |
|
1847 | + $post_type = str_replace("category","",$taxonomy); |
|
1848 | + $post_type = str_replace("_tags","",$post_type); |
|
1849 | + $slug = $post_types[$post_type]['rewrite']['slug']; |
|
1850 | + if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
|
1851 | + global $sitepress; |
|
1852 | + $default_lang = $sitepress->get_default_language(); |
|
1853 | + $language_code = gd_wpml_get_lang_from_url($orig_termlink); |
|
1854 | + if (!$language_code ) { |
|
1855 | + $language_code = $default_lang; |
|
1856 | + } |
|
1857 | 1857 | |
1858 | - $org_slug = $slug; |
|
1859 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code); |
|
1858 | + $org_slug = $slug; |
|
1859 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code); |
|
1860 | 1860 | |
1861 | - if (!$slug) { |
|
1862 | - $slug = $org_slug; |
|
1863 | - } |
|
1861 | + if (!$slug) { |
|
1862 | + $slug = $org_slug; |
|
1863 | + } |
|
1864 | 1864 | |
1865 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1)); |
|
1866 | - } |
|
1867 | - } |
|
1868 | - } |
|
1865 | + $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1)); |
|
1866 | + } |
|
1867 | + } |
|
1868 | + } |
|
1869 | 1869 | |
1870 | - return $termlink; |
|
1870 | + return $termlink; |
|
1871 | 1871 | } |
1872 | 1872 | |
1873 | 1873 | /** |
@@ -1893,14 +1893,14 @@ discard block |
||
1893 | 1893 | if (in_array($post_type, geodir_get_posttypes())) { |
1894 | 1894 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1895 | 1895 | if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
1896 | - $location_terms = array( |
|
1897 | - 'gd_country' => $post->country_slug, |
|
1898 | - 'gd_region' => $post->region_slug, |
|
1899 | - 'gd_city' => $post->city_slug |
|
1900 | - ); |
|
1901 | - } else { |
|
1902 | - $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1903 | - } |
|
1896 | + $location_terms = array( |
|
1897 | + 'gd_country' => $post->country_slug, |
|
1898 | + 'gd_region' => $post->region_slug, |
|
1899 | + 'gd_city' => $post->city_slug |
|
1900 | + ); |
|
1901 | + } else { |
|
1902 | + $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1903 | + } |
|
1904 | 1904 | |
1905 | 1905 | $location_terms = geodir_remove_location_terms($location_terms); |
1906 | 1906 | |
@@ -1932,17 +1932,17 @@ discard block |
||
1932 | 1932 | * @return void|string Label. |
1933 | 1933 | */ |
1934 | 1934 | function get_post_type_singular_label($post_type, $echo = false, $translate = false) { |
1935 | - $obj_post_type = get_post_type_object($post_type); |
|
1936 | - if (!is_object($obj_post_type)) { |
|
1937 | - return; |
|
1938 | - } |
|
1935 | + $obj_post_type = get_post_type_object($post_type); |
|
1936 | + if (!is_object($obj_post_type)) { |
|
1937 | + return; |
|
1938 | + } |
|
1939 | 1939 | |
1940 | - $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
1940 | + $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
1941 | 1941 | |
1942 | - if ($echo) |
|
1943 | - echo $label; |
|
1944 | - else |
|
1945 | - return $label; |
|
1942 | + if ($echo) |
|
1943 | + echo $label; |
|
1944 | + else |
|
1945 | + return $label; |
|
1946 | 1946 | } |
1947 | 1947 | |
1948 | 1948 | /** |
@@ -1957,19 +1957,19 @@ discard block |
||
1957 | 1957 | * @return void|string Label. |
1958 | 1958 | */ |
1959 | 1959 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) { |
1960 | - $all_postypes = geodir_get_posttypes(); |
|
1960 | + $all_postypes = geodir_get_posttypes(); |
|
1961 | 1961 | |
1962 | - if (!in_array($post_type, $all_postypes)) |
|
1963 | - return false; |
|
1962 | + if (!in_array($post_type, $all_postypes)) |
|
1963 | + return false; |
|
1964 | 1964 | |
1965 | - $obj_post_type = get_post_type_object($post_type); |
|
1965 | + $obj_post_type = get_post_type_object($post_type); |
|
1966 | 1966 | |
1967 | - $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
1967 | + $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
1968 | 1968 | |
1969 | - if ($echo) |
|
1970 | - echo $label; |
|
1971 | - else |
|
1972 | - return $label; |
|
1969 | + if ($echo) |
|
1970 | + echo $label; |
|
1971 | + else |
|
1972 | + return $label; |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | 1975 | /** |
@@ -1987,51 +1987,51 @@ discard block |
||
1987 | 1987 | */ |
1988 | 1988 | function geodir_term_exists($term, $taxonomy = '', $parent = 0) |
1989 | 1989 | { |
1990 | - global $wpdb; |
|
1991 | - |
|
1992 | - $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
1993 | - $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
1994 | - |
|
1995 | - if (is_int($term)) { |
|
1996 | - if (0 == $term) |
|
1997 | - return 0; |
|
1998 | - $where = 't.term_id = %d'; |
|
1999 | - if (!empty($taxonomy)) |
|
2000 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2001 | - else |
|
2002 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2003 | - } |
|
1990 | + global $wpdb; |
|
1991 | + |
|
1992 | + $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
1993 | + $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
1994 | + |
|
1995 | + if (is_int($term)) { |
|
1996 | + if (0 == $term) |
|
1997 | + return 0; |
|
1998 | + $where = 't.term_id = %d'; |
|
1999 | + if (!empty($taxonomy)) |
|
2000 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2001 | + else |
|
2002 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2003 | + } |
|
2004 | 2004 | |
2005 | - $term = trim(wp_unslash($term)); |
|
2005 | + $term = trim(wp_unslash($term)); |
|
2006 | 2006 | |
2007 | - if ('' === $slug = sanitize_title($term)) |
|
2008 | - return 0; |
|
2007 | + if ('' === $slug = sanitize_title($term)) |
|
2008 | + return 0; |
|
2009 | 2009 | |
2010 | - $where = 't.slug = %s'; |
|
2010 | + $where = 't.slug = %s'; |
|
2011 | 2011 | |
2012 | - $where_fields = array($slug); |
|
2013 | - if (!empty($taxonomy)) { |
|
2014 | - $parent = (int)$parent; |
|
2015 | - if ($parent > 0) { |
|
2016 | - $where_fields[] = $parent; |
|
2017 | - $else_where_fields[] = $parent; |
|
2018 | - $where .= ' AND tt.parent = %d'; |
|
2012 | + $where_fields = array($slug); |
|
2013 | + if (!empty($taxonomy)) { |
|
2014 | + $parent = (int)$parent; |
|
2015 | + if ($parent > 0) { |
|
2016 | + $where_fields[] = $parent; |
|
2017 | + $else_where_fields[] = $parent; |
|
2018 | + $where .= ' AND tt.parent = %d'; |
|
2019 | 2019 | |
2020 | - } |
|
2020 | + } |
|
2021 | 2021 | |
2022 | - $where_fields[] = $taxonomy; |
|
2022 | + $where_fields[] = $taxonomy; |
|
2023 | 2023 | |
2024 | 2024 | |
2025 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
2026 | - return $result; |
|
2025 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
2026 | + return $result; |
|
2027 | 2027 | |
2028 | - return false; |
|
2029 | - } |
|
2028 | + return false; |
|
2029 | + } |
|
2030 | 2030 | |
2031 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
2032 | - return $result; |
|
2031 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
2032 | + return $result; |
|
2033 | 2033 | |
2034 | - return false; |
|
2034 | + return false; |
|
2035 | 2035 | } |
2036 | 2036 | |
2037 | 2037 | /** |
@@ -2043,7 +2043,7 @@ discard block |
||
2043 | 2043 | function geodir_get_term_icon_rebuild() |
2044 | 2044 | { |
2045 | 2045 | |
2046 | - update_option('gd_term_icons', ''); |
|
2046 | + update_option('gd_term_icons', ''); |
|
2047 | 2047 | |
2048 | 2048 | } |
2049 | 2049 | |
@@ -2061,61 +2061,61 @@ discard block |
||
2061 | 2061 | */ |
2062 | 2062 | function geodir_get_term_icon($term_id = false, $rebuild = false) |
2063 | 2063 | { |
2064 | - global $wpdb; |
|
2065 | - if (!$rebuild) { |
|
2066 | - $terms_icons = get_option('gd_term_icons'); |
|
2067 | - } else { |
|
2068 | - $terms_icons = array(); |
|
2069 | - } |
|
2070 | - |
|
2071 | - if (empty($terms_icons)) { |
|
2072 | - $terms_icons = array(); |
|
2073 | - $default_icon_url = get_option('geodir_default_marker_icon'); |
|
2074 | - $taxonomy = geodir_get_taxonomies(); |
|
2075 | - $post_types = geodir_get_posttypes(); |
|
2076 | - $tax_arr = array(); |
|
2077 | - foreach ($post_types as $post_type) { |
|
2078 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
2079 | - } |
|
2080 | - $tax_c = implode(',', $tax_arr); |
|
2081 | - $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
|
2082 | - //$terms = get_terms( $taxonomy ); |
|
2083 | - |
|
2084 | - if($terms) { |
|
2085 | - foreach ($terms as $term) { |
|
2086 | - $post_type = str_replace("category", "", $term->taxonomy); |
|
2087 | - $a_terms[$post_type][] = $term; |
|
2064 | + global $wpdb; |
|
2065 | + if (!$rebuild) { |
|
2066 | + $terms_icons = get_option('gd_term_icons'); |
|
2067 | + } else { |
|
2068 | + $terms_icons = array(); |
|
2069 | + } |
|
2088 | 2070 | |
2089 | - } |
|
2090 | - } |
|
2071 | + if (empty($terms_icons)) { |
|
2072 | + $terms_icons = array(); |
|
2073 | + $default_icon_url = get_option('geodir_default_marker_icon'); |
|
2074 | + $taxonomy = geodir_get_taxonomies(); |
|
2075 | + $post_types = geodir_get_posttypes(); |
|
2076 | + $tax_arr = array(); |
|
2077 | + foreach ($post_types as $post_type) { |
|
2078 | + $tax_arr[] = "'" . $post_type . "category'"; |
|
2079 | + } |
|
2080 | + $tax_c = implode(',', $tax_arr); |
|
2081 | + $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
|
2082 | + //$terms = get_terms( $taxonomy ); |
|
2091 | 2083 | |
2092 | - if($a_terms) { |
|
2093 | - foreach ($a_terms as $pt => $t2) { |
|
2084 | + if($terms) { |
|
2085 | + foreach ($terms as $term) { |
|
2086 | + $post_type = str_replace("category", "", $term->taxonomy); |
|
2087 | + $a_terms[$post_type][] = $term; |
|
2094 | 2088 | |
2095 | - foreach ($t2 as $term) { |
|
2096 | - $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
2097 | - if ($term_icon) { |
|
2098 | - $term_icon_url = $term_icon["src"]; |
|
2099 | - } else { |
|
2100 | - $term_icon_url = $default_icon_url; |
|
2101 | - } |
|
2102 | - $terms_icons[$term->term_id] = $term_icon_url; |
|
2103 | - } |
|
2104 | - } |
|
2105 | - } |
|
2089 | + } |
|
2090 | + } |
|
2106 | 2091 | |
2107 | - update_option('gd_term_icons', $terms_icons); |
|
2108 | - } |
|
2092 | + if($a_terms) { |
|
2093 | + foreach ($a_terms as $pt => $t2) { |
|
2109 | 2094 | |
2110 | - if ($term_id && isset($terms_icons[$term_id])) { |
|
2111 | - return $terms_icons[$term_id]; |
|
2112 | - } elseif ($term_id && !isset($terms_icons[$term_id])) { |
|
2113 | - return get_option('geodir_default_marker_icon'); |
|
2114 | - } |
|
2095 | + foreach ($t2 as $term) { |
|
2096 | + $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
2097 | + if ($term_icon) { |
|
2098 | + $term_icon_url = $term_icon["src"]; |
|
2099 | + } else { |
|
2100 | + $term_icon_url = $default_icon_url; |
|
2101 | + } |
|
2102 | + $terms_icons[$term->term_id] = $term_icon_url; |
|
2103 | + } |
|
2104 | + } |
|
2105 | + } |
|
2106 | + |
|
2107 | + update_option('gd_term_icons', $terms_icons); |
|
2108 | + } |
|
2109 | + |
|
2110 | + if ($term_id && isset($terms_icons[$term_id])) { |
|
2111 | + return $terms_icons[$term_id]; |
|
2112 | + } elseif ($term_id && !isset($terms_icons[$term_id])) { |
|
2113 | + return get_option('geodir_default_marker_icon'); |
|
2114 | + } |
|
2115 | 2115 | |
2116 | - if (is_ssl()) { |
|
2117 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
2118 | - } |
|
2116 | + if (is_ssl()) { |
|
2117 | + $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
2118 | + } |
|
2119 | 2119 | |
2120 | - return apply_filters('geodir_get_term_icons', $terms_icons, $term_id); |
|
2120 | + return apply_filters('geodir_get_term_icons', $terms_icons, $term_id); |
|
2121 | 2121 | } |
2122 | 2122 | \ No newline at end of file |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | * @since 1.0.0 |
61 | 61 | * @param string $menu_class The menu HTML class. |
62 | 62 | */ |
63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
64 | 64 | /** |
65 | 65 | * Filter the menu a class. |
66 | 66 | * |
67 | 67 | * @since 1.0.0 |
68 | 68 | */ |
69 | 69 | $a_class = apply_filters('geodir_menu_a_class', ''); |
70 | - $items .= '<li class="' . $li_class . '"> |
|
71 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
|
72 | - ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
|
70 | + $items .= '<li class="'.$li_class.'"> |
|
71 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'"> |
|
72 | + ' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').' |
|
73 | 73 | </a> |
74 | 74 | </li>'; |
75 | 75 | } |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * @since 1.0.0 |
89 | 89 | * @param string $menu_class The menu HTML class. |
90 | 90 | */ |
91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class); |
|
92 | 92 | /** |
93 | 93 | * Filter the sub menu li class. |
94 | 94 | * |
95 | 95 | * @since 1.0.0 |
96 | 96 | * @param string $menu_class The menu HTML class. |
97 | 97 | */ |
98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class); |
|
99 | 99 | /** |
100 | 100 | * Filter the sub menu ul class. |
101 | 101 | * |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * @since 1.0.0 |
115 | 115 | */ |
116 | 116 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
117 | - $items .= '<li class="' . $li_class . '"> |
|
118 | - <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a> |
|
119 | - <ul class="' . $sub_ul_class . '">'; |
|
117 | + $items .= '<li class="'.$li_class.'"> |
|
118 | + <a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a> |
|
119 | + <ul class="' . $sub_ul_class.'">'; |
|
120 | 120 | $post_types = geodir_get_posttypes('object'); |
121 | 121 | |
122 | 122 | $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
134 | 134 | $menu_class = 'current-menu-item'; |
135 | 135 | |
136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
137 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
|
138 | - ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
|
136 | + $items .= '<li class="'.$sub_li_class.'"> |
|
137 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'"> |
|
138 | + ' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').' |
|
139 | 139 | </a> |
140 | 140 | </li>'; |
141 | 141 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.5.9 |
153 | 153 | */ |
154 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
154 | + $items .= apply_filters('geodir_menu_after_sub_ul', ''); |
|
155 | 155 | $items .= '</li>'; |
156 | 156 | } |
157 | 157 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @since 1.0.0 |
185 | 185 | * @param string $menu_class The menu HTML class. |
186 | 186 | */ |
187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
188 | 188 | /** |
189 | 189 | * Filter the menu a class. |
190 | 190 | * |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | */ |
193 | 193 | $a_class = apply_filters('geodir_menu_a_class', ''); |
194 | 194 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
195 | - $items .= '<li class="' . $li_class . '"> |
|
196 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
|
197 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
195 | + $items .= '<li class="'.$li_class.'"> |
|
196 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'"> |
|
197 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).' |
|
198 | 198 | </a> |
199 | 199 | </li>'; |
200 | 200 | } |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * @since 1.0.0 |
219 | 219 | * @param string $menu_class The menu HTML class. |
220 | 220 | */ |
221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class); |
|
222 | 222 | /** |
223 | 223 | * Filter the sub menu li class. |
224 | 224 | * |
225 | 225 | * @since 1.0.0 |
226 | 226 | * @param string $menu_class The menu HTML class. |
227 | 227 | */ |
228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class); |
|
229 | 229 | /** |
230 | 230 | * Filter the sub menu ul class. |
231 | 231 | * |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @since 1.0.0 |
245 | 245 | */ |
246 | 246 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
247 | - $items .= '<li class="' . $li_class . '"> |
|
248 | - <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a> |
|
249 | - <ul class="' . $sub_ul_class . '">'; |
|
247 | + $items .= '<li class="'.$li_class.'"> |
|
248 | + <a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a> |
|
249 | + <ul class="' . $sub_ul_class.'">'; |
|
250 | 250 | |
251 | 251 | $post_types = geodir_get_posttypes('object'); |
252 | 252 | |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @since 1.0.0 |
270 | 270 | * @param string $menu_class The menu HTML class. |
271 | 271 | */ |
272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
273 | 273 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
274 | - $items .= '<li class="' . $sub_li_class . '"> |
|
275 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
|
276 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
274 | + $items .= '<li class="'.$sub_li_class.'"> |
|
275 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'"> |
|
276 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).' |
|
277 | 277 | </a> |
278 | 278 | </li>'; |
279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | $items .= ' </ul> '; |
288 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
288 | + $items .= apply_filters('geodir_menu_after_sub_ul', ''); |
|
289 | 289 | $items .= '</li>'; |
290 | 290 | |
291 | 291 | } |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | $geodir_theme_location = get_option('geodir_theme_location_nav'); |
314 | 314 | $geodir_theme_location_nav = array(); |
315 | 315 | if (empty($locations) && empty($geodir_theme_location)) { |
316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu); |
|
317 | 317 | $geodir_theme_location_nav[] = $args['theme_location']; |
318 | 318 | update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
319 | 319 | } |
320 | 320 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
322 | 322 | else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu); |
|
324 | 324 | |
325 | 325 | return $menu; |
326 | 326 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
350 | 350 | |
351 | - $items = $items . geodir_add_nav_menu_items(); |
|
351 | + $items = $items.geodir_add_nav_menu_items(); |
|
352 | 352 | return $items; |
353 | 353 | |
354 | 354 | } else { |
@@ -373,12 +373,12 @@ discard block |
||
373 | 373 | |
374 | 374 | $taxonomies = geodir_get_taxonomies(); |
375 | 375 | $taxonomies = implode("','", $taxonomies); |
376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
376 | + $taxonomies = "'".$taxonomies."'"; |
|
377 | 377 | |
378 | 378 | $pn_categories = $wpdb->get_results( |
379 | 379 | $wpdb->prepare( |
380 | 380 | "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
381 | - array($wpdb->terms . term_id) |
|
381 | + array($wpdb->terms.term_id) |
|
382 | 382 | ) |
383 | 383 | ); |
384 | 384 | |
@@ -405,13 +405,13 @@ discard block |
||
405 | 405 | global $wp_query, $post, $geodir_post_type; |
406 | 406 | |
407 | 407 | $geodir_post_type = get_query_var('post_type'); |
408 | - if (is_array($geodir_post_type) && ! empty($geodir_post_type[0])) { |
|
408 | + if (is_array($geodir_post_type) && !empty($geodir_post_type[0])) { |
|
409 | 409 | $geodir_post_type = $geodir_post_type[0]; |
410 | 410 | } |
411 | 411 | |
412 | 412 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
413 | 413 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
414 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
414 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
415 | 415 | elseif (isset($_REQUEST['listing_type'])) |
416 | 416 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
417 | 417 | } |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
438 | 438 | $geodir_post_type = ''; |
439 | 439 | |
440 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
|
440 | + if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) { |
|
441 | 441 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
442 | 442 | } |
443 | 443 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * |
448 | 448 | * @since 1.6.9 |
449 | 449 | */ |
450 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type); |
|
450 | + return apply_filters('geodir_get_current_posttype', $geodir_post_type); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -461,18 +461,18 @@ discard block |
||
461 | 461 | */ |
462 | 462 | function geodir_get_default_posttype() |
463 | 463 | { |
464 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
464 | + $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object')); |
|
465 | 465 | |
466 | 466 | $stype = false; |
467 | - foreach ( $post_types as $post_type => $info ) { |
|
467 | + foreach ($post_types as $post_type => $info) { |
|
468 | 468 | global $wpdb; |
469 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
470 | - if ( $has_posts ) { |
|
469 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type)); |
|
470 | + if ($has_posts) { |
|
471 | 471 | $stype = $post_type; break; |
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | - if(!$stype){ |
|
475 | + if (!$stype) { |
|
476 | 476 | $stype = 'gd_place'; |
477 | 477 | } |
478 | 478 | |
@@ -497,14 +497,14 @@ discard block |
||
497 | 497 | switch ($output): |
498 | 498 | case 'object': |
499 | 499 | case 'Object': |
500 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
500 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
501 | 501 | break; |
502 | 502 | case 'array': |
503 | 503 | case 'Array': |
504 | - $post_types = (array)$post_types; |
|
504 | + $post_types = (array) $post_types; |
|
505 | 505 | break; |
506 | 506 | case 'options': |
507 | - $post_types = (array)$post_types; |
|
507 | + $post_types = (array) $post_types; |
|
508 | 508 | |
509 | 509 | $options = array(); |
510 | 510 | if (!empty($post_types)) { |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $gd_taxonomies[] = $taxonomy; |
573 | 573 | } |
574 | 574 | |
575 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') { |
|
575 | + if ($tages_taxonomies === false && substr($taxonomy, -5) == '_tags') { |
|
576 | 576 | if (array_search($taxonomy, $gd_taxonomies) !== false) { |
577 | 577 | unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
578 | 578 | } |
@@ -618,15 +618,15 @@ discard block |
||
618 | 618 | |
619 | 619 | $categories = get_terms($taxonomies); |
620 | 620 | |
621 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
621 | + $html .= '<option value="0">'.__('All', 'geodirectory').'</option>'; |
|
622 | 622 | |
623 | 623 | foreach ($categories as $category_obj) { |
624 | 624 | $select_opt = ''; |
625 | 625 | if ($selected == $category_obj->term_id) { |
626 | 626 | $select_opt = 'selected="selected"'; |
627 | 627 | } |
628 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
629 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
628 | + $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">' |
|
629 | + . geodir_utf8_ucfirst($category_obj->name).'</option>'; |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | if ($echo) |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | } elseif (isset($wp_query->tax_query->queries)) { |
695 | 695 | $tax_arr = $wp_query->tax_query->queries; |
696 | 696 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
697 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
697 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); } |
|
698 | 698 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
699 | 699 | } |
700 | 700 | |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | |
749 | 749 | if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
750 | 750 | if ($cat_parent == 0) { |
751 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
751 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display; |
|
752 | 752 | $main_list_class = 'class="main_list_selecter"'; |
753 | 753 | } else { |
754 | 754 | //$display = 'display:none'; |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | |
759 | 759 | if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
760 | 760 | $p = 0; |
761 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
761 | + $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | foreach ($cat_terms as $cat_term) { |
@@ -773,12 +773,12 @@ discard block |
||
773 | 773 | } |
774 | 774 | |
775 | 775 | if ($cat_display == 'radio') |
776 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
776 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
777 | 777 | elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
778 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
778 | + $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
779 | 779 | |
780 | 780 | else { |
781 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
781 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | // Call recurson to print sub cats |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | $cat_exclude = serialize($exclude_cats); |
818 | 818 | |
819 | 819 | if (isset($_REQUEST['backandedit'])) { |
820 | - $post = (object)$gd_session->get('listing'); |
|
820 | + $post = (object) $gd_session->get('listing'); |
|
821 | 821 | |
822 | 822 | if (!is_array($post->post_category[$cat_taxonomy])) |
823 | 823 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | |
850 | 850 | if (!empty($post_category)) { |
851 | 851 | $cat1 = array_filter(explode(',', $post_category)); |
852 | - $post_category = ',' . implode(',', $cat1) . ','; |
|
852 | + $post_category = ','.implode(',', $cat1).','; |
|
853 | 853 | |
854 | 854 | } |
855 | 855 | |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | foreach ($post_category_upd as $cat) { |
861 | 861 | |
862 | 862 | if (!in_array($cat, $exclude_cats) && $cat != '') { |
863 | - $post_category_change .= ',' . $cat; |
|
863 | + $post_category_change .= ','.$cat; |
|
864 | 864 | } |
865 | 865 | } |
866 | 866 | $post_category = $post_category_change; |
@@ -872,11 +872,11 @@ discard block |
||
872 | 872 | } |
873 | 873 | } |
874 | 874 | |
875 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
875 | + echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']" />'; |
|
876 | 876 | |
877 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
877 | + echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']" />'; |
|
878 | 878 | |
879 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
879 | + echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']" />'; |
|
880 | 880 | |
881 | 881 | |
882 | 882 | ?> |
@@ -895,14 +895,14 @@ discard block |
||
895 | 895 | |
896 | 896 | function show_subcatlist(main_cat, catObj) { |
897 | 897 | if (main_cat != '') { |
898 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
899 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
900 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
898 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
899 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
900 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
901 | 901 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val(); |
902 | - <?php if ((int)$cat_limit > 0) { ?> |
|
902 | + <?php if ((int) $cat_limit > 0) { ?> |
|
903 | 903 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length); |
904 | 904 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) { |
905 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>"); |
|
905 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>"); |
|
906 | 906 | return false; |
907 | 907 | } |
908 | 908 | <?php } ?> |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | } |
942 | 942 | |
943 | 943 | function update_listing_cat(el) { |
944 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
944 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
945 | 945 | var cat_ids = ''; |
946 | 946 | var main_cat = ''; |
947 | 947 | var sub_cat = ''; |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
1023 | 1023 | echo $style; |
1024 | 1024 | }?> "> |
1025 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
1025 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
1026 | 1026 | ?> |
1027 | 1027 | </div> |
1028 | 1028 | <?php |
@@ -1049,9 +1049,9 @@ discard block |
||
1049 | 1049 | if ($exclude != '') { |
1050 | 1050 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
1051 | 1051 | |
1052 | - if(is_array( $exclude_cats)){ |
|
1053 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1054 | - }else{ |
|
1052 | + if (is_array($exclude_cats)) { |
|
1053 | + $exclude_cats = array_map('intval', $exclude_cats); |
|
1054 | + } else { |
|
1055 | 1055 | $exclude_cats = intval($exclude_cats); |
1056 | 1056 | } |
1057 | 1057 | |
@@ -1065,25 +1065,25 @@ discard block |
||
1065 | 1065 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1066 | 1066 | |
1067 | 1067 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
1068 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
1068 | + <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>" |
|
1069 | 1069 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/> |
1070 | 1070 | <?php /* ?> |
1071 | 1071 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> |
1072 | 1072 | <?php */ ?> |
1073 | 1073 | |
1074 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
1074 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
1075 | 1075 | onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()" |
1076 | 1076 | checked="checked" disabled="disabled"/> |
1077 | 1077 | <span> |
1078 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1078 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1079 | 1079 | </span> |
1080 | 1080 | <br/> |
1081 | 1081 | |
1082 | 1082 | <div class="post_default_category"> |
1083 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
1084 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1083 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
1084 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
1085 | 1085 | <span> |
1086 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1086 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1087 | 1087 | </span> |
1088 | 1088 | </div> |
1089 | 1089 | |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | $post_cat_str = $post_categories[$request_taxonomy]; |
1117 | 1117 | $post_cat_array = explode("#", $post_cat_str); |
1118 | 1118 | if (is_array($post_cat_array)) { |
1119 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1119 | + $post_cat_array = array_unique($post_cat_array); |
|
1120 | 1120 | |
1121 | 1121 | foreach ($post_cat_array as $post_cat_html) { |
1122 | 1122 | |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | } |
1132 | 1132 | $post_sub_catid = ''; |
1133 | 1133 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1134 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1134 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1155 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1155 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1184,9 +1184,9 @@ discard block |
||
1184 | 1184 | if (!$selected) |
1185 | 1185 | $option_slected = ' selected="selected" '; |
1186 | 1186 | |
1187 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1187 | + echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >'; |
|
1188 | 1188 | |
1189 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1189 | + echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>'; |
|
1190 | 1190 | |
1191 | 1191 | foreach ($cat_terms as $cat_term) { |
1192 | 1192 | $option_selected = ''; |
@@ -1194,10 +1194,10 @@ discard block |
||
1194 | 1194 | $option_selected = ' selected="selected" '; |
1195 | 1195 | |
1196 | 1196 | // Count child terms |
1197 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1198 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1197 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1)); |
|
1198 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
1199 | 1199 | |
1200 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
1200 | + echo '<option '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
1201 | 1201 | } |
1202 | 1202 | echo '</select>'; |
1203 | 1203 | } |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | 2 => __('Custom field updated.', 'geodirectory'), |
1229 | 1229 | 3 => __('Custom field deleted.', 'geodirectory'), |
1230 | 1230 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
1231 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1231 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
1232 | 1232 | 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
1233 | 1233 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
1234 | 1234 | 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
@@ -1254,7 +1254,7 @@ discard block |
||
1254 | 1254 | |
1255 | 1255 | global $wpdb; |
1256 | 1256 | |
1257 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1257 | + $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico'; |
|
1258 | 1258 | |
1259 | 1259 | if (!$listing_slug = get_option('geodir_listing_prefix')) |
1260 | 1260 | $listing_slug = 'places'; |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | |
1268 | 1268 | $gd_placetags = array(); |
1269 | 1269 | $gd_placetags['object_type'] = 'gd_place'; |
1270 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1270 | + $gd_placetags['listing_slug'] = $listing_slug.'/tags'; |
|
1271 | 1271 | $gd_placetags['args'] = array( |
1272 | 1272 | 'public' => true, |
1273 | 1273 | 'hierarchical' => false, |
1274 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1274 | + 'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true), |
|
1275 | 1275 | 'query_var' => true, |
1276 | 1276 | |
1277 | 1277 | 'labels' => array( |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | 'menu_icon' => $menu_icon, |
1366 | 1366 | 'public' => true, |
1367 | 1367 | 'query_var' => true, |
1368 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1368 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1369 | 1369 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
1370 | 1370 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
1371 | 1371 | |
@@ -1398,12 +1398,12 @@ discard block |
||
1398 | 1398 | return $_REQUEST['lang']; |
1399 | 1399 | } |
1400 | 1400 | |
1401 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1401 | + $url = str_replace(array("http://", "https://"), "", $url); |
|
1402 | 1402 | |
1403 | 1403 | // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang. |
1404 | - $site_url = str_replace(array("http://","https://"),"",site_url()); |
|
1404 | + $site_url = str_replace(array("http://", "https://"), "", site_url()); |
|
1405 | 1405 | |
1406 | - $url = str_replace($site_url,"",$url); |
|
1406 | + $url = str_replace($site_url, "", $url); |
|
1407 | 1407 | |
1408 | 1408 | $segments = explode('/', trim($url, '/')); |
1409 | 1409 | |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | |
1460 | 1460 | global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache, $gd_cache_post; |
1461 | 1461 | if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) { |
1462 | - if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;} |
|
1462 | + if ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending') {return $post_link; } |
|
1463 | 1463 | } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) { |
1464 | 1464 | return $post_link; |
1465 | 1465 | } else { |
@@ -1473,9 +1473,9 @@ discard block |
||
1473 | 1473 | |
1474 | 1474 | |
1475 | 1475 | // if we dont have a GD post then try to grab it |
1476 | - if(!isset($post->default_category)){ |
|
1476 | + if (!isset($post->default_category)) { |
|
1477 | 1477 | $gd_post = geodir_get_post_info($post->ID); |
1478 | - if(!empty($gd_post)){ |
|
1478 | + if (!empty($gd_post)) { |
|
1479 | 1479 | $post = $gd_post; |
1480 | 1480 | } |
1481 | 1481 | } |
@@ -1485,17 +1485,17 @@ discard block |
||
1485 | 1485 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
1486 | 1486 | |
1487 | 1487 | // Alter the CPT slug if WPML is set to do so |
1488 | - if(geodir_wpml_is_post_type_translated($post->post_type)){ |
|
1489 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1488 | + if (geodir_wpml_is_post_type_translated($post->post_type)) { |
|
1489 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1490 | 1490 | |
1491 | 1491 | $org_slug = $slug; |
1492 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1492 | + $slug = apply_filters('wpml_translate_single_string', |
|
1493 | 1493 | $slug, |
1494 | 1494 | 'WordPress', |
1495 | - 'URL slug: ' . $slug, |
|
1495 | + 'URL slug: '.$slug, |
|
1496 | 1496 | $language_code); |
1497 | 1497 | |
1498 | - if(!$slug){$slug = $org_slug;} |
|
1498 | + if (!$slug) {$slug = $org_slug; } |
|
1499 | 1499 | |
1500 | 1500 | } |
1501 | 1501 | } |
@@ -1517,11 +1517,11 @@ discard block |
||
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | $post_link = trailingslashit( |
1520 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1520 | + preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1) |
|
1521 | 1521 | ); |
1522 | 1522 | |
1523 | 1523 | if ($fix_url) { |
1524 | - $post_link = $site_url . $post_link; |
|
1524 | + $post_link = $site_url.$post_link; |
|
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | if (isset($comment_post_cache[$post->ID])) { |
@@ -1540,12 +1540,12 @@ discard block |
||
1540 | 1540 | $ID = $post->ID; |
1541 | 1541 | $post2 = $wpdb->get_row( |
1542 | 1542 | $wpdb->prepare( |
1543 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1543 | + "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
1544 | 1544 | array($post->ID) |
1545 | 1545 | ) |
1546 | 1546 | ); |
1547 | 1547 | |
1548 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1548 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
1549 | 1549 | |
1550 | 1550 | $comment_post_cache[$post->ID] = $post; |
1551 | 1551 | } |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | |
1555 | 1555 | if (false !== strpos($post_link, '%gd_taxonomy%')) { |
1556 | 1556 | |
1557 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1557 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) { |
|
1558 | 1558 | $location_request = ''; |
1559 | 1559 | |
1560 | 1560 | |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1569 | 1569 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1570 | 1570 | |
1571 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1571 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1572 | 1572 | 'region_slug' => $post->region_slug, |
1573 | 1573 | 'city_slug' => $post->city_slug |
1574 | 1574 | ); |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | |
1582 | 1582 | $post_location_sql = $wpdb->get_results( |
1583 | 1583 | $wpdb->prepare( |
1584 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1584 | + "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
1585 | 1585 | array($post->ID) |
1586 | 1586 | ) |
1587 | 1587 | ); |
@@ -1597,7 +1597,7 @@ discard block |
||
1597 | 1597 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1598 | 1598 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1599 | 1599 | |
1600 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1600 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1601 | 1601 | 'region_slug' => $post->region_slug, |
1602 | 1602 | 'city_slug' => $post->city_slug |
1603 | 1603 | ); |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | } |
1627 | 1627 | $location_slug[] = $city_slug; |
1628 | 1628 | |
1629 | - $location_request .= implode('/', $location_slug) . '/'; |
|
1629 | + $location_request .= implode('/', $location_slug).'/'; |
|
1630 | 1630 | } |
1631 | 1631 | } |
1632 | 1632 | |
@@ -1641,9 +1641,9 @@ discard block |
||
1641 | 1641 | } else { |
1642 | 1642 | $post_terms = ''; |
1643 | 1643 | |
1644 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
|
1644 | + if (isset($_POST['post_default_category']) && $_POST['post_default_category']) { |
|
1645 | 1645 | $post_terms = absint($_POST['post_default_category']); |
1646 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1646 | + }elseif (isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1647 | 1647 | $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
1648 | 1648 | $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
1649 | 1649 | }elseif (isset($post->{$taxonomies})) { |
@@ -1689,14 +1689,14 @@ discard block |
||
1689 | 1689 | $request_term = trim($request_term, '/'); |
1690 | 1690 | |
1691 | 1691 | // Fix with WPML the location terms added twice when CPT slug is translated. |
1692 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) { |
|
1692 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/'.$request_term.$detailurl_separator) !== false) { |
|
1693 | 1693 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | if (!empty($request_term)) |
1697 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1697 | + $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link); |
|
1698 | 1698 | else |
1699 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1699 | + $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link); |
|
1700 | 1700 | //echo $post_link ; |
1701 | 1701 | } |
1702 | 1702 | // temp cache the permalink |
@@ -1795,35 +1795,35 @@ discard block |
||
1795 | 1795 | $request_term = implode("/", $location_terms); |
1796 | 1796 | if (geodir_is_wpml()) { |
1797 | 1797 | $post_types = get_option('geodir_post_types'); |
1798 | - $post_type = str_replace("category","",$taxonomy); |
|
1799 | - $post_type = str_replace("_tags","",$post_type); |
|
1798 | + $post_type = str_replace("category", "", $taxonomy); |
|
1799 | + $post_type = str_replace("_tags", "", $post_type); |
|
1800 | 1800 | $org_slug = $post_types[$post_type]['rewrite']['slug']; |
1801 | 1801 | if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
1802 | 1802 | global $sitepress; |
1803 | 1803 | $default_lang = $sitepress->get_default_language(); |
1804 | 1804 | $language_code = gd_wpml_get_lang_from_url($orig_termlink); |
1805 | - if (!$language_code ) { |
|
1806 | - $language_code = $default_lang; |
|
1805 | + if (!$language_code) { |
|
1806 | + $language_code = $default_lang; |
|
1807 | 1807 | } |
1808 | 1808 | |
1809 | - $slug = apply_filters('wpml_translate_single_string', $org_slug, 'WordPress', 'URL slug: ' . $org_slug, $language_code); |
|
1809 | + $slug = apply_filters('wpml_translate_single_string', $org_slug, 'WordPress', 'URL slug: '.$org_slug, $language_code); |
|
1810 | 1810 | |
1811 | 1811 | if ($slug && $slug != $org_slug && $slug != $listing_slug) { |
1812 | - $old_listing_slug = '/' . $slug . '/'; |
|
1813 | - $new_listing_slug = '/' . $slug . '/' . $request_term . '/'; |
|
1812 | + $old_listing_slug = '/'.$slug.'/'; |
|
1813 | + $new_listing_slug = '/'.$slug.'/'.$request_term.'/'; |
|
1814 | 1814 | |
1815 | - if ( strpos( $termlink, $old_listing_slug ) !== false ) { |
|
1815 | + if (strpos($termlink, $old_listing_slug) !== false) { |
|
1816 | 1816 | $found = true; |
1817 | - $termlink = preg_replace( "/" . preg_quote( $old_listing_slug, "/" ) . "/", $new_listing_slug, $termlink, 1 ); |
|
1817 | + $termlink = preg_replace("/".preg_quote($old_listing_slug, "/")."/", $new_listing_slug, $termlink, 1); |
|
1818 | 1818 | } |
1819 | 1819 | } |
1820 | 1820 | } |
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | if (!$found) { |
1824 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
1824 | + $old_listing_slug = '/'.$listing_slug.'/'; |
|
1825 | 1825 | $request_term = implode("/", $location_terms); |
1826 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
1826 | + $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/'; |
|
1827 | 1827 | |
1828 | 1828 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
1829 | 1829 | } |
@@ -1844,25 +1844,25 @@ discard block |
||
1844 | 1844 | // Alter the CPT slug if WPML is set to do so |
1845 | 1845 | if (geodir_is_wpml()) { |
1846 | 1846 | $post_types = get_option('geodir_post_types'); |
1847 | - $post_type = str_replace("category","",$taxonomy); |
|
1848 | - $post_type = str_replace("_tags","",$post_type); |
|
1847 | + $post_type = str_replace("category", "", $taxonomy); |
|
1848 | + $post_type = str_replace("_tags", "", $post_type); |
|
1849 | 1849 | $slug = $post_types[$post_type]['rewrite']['slug']; |
1850 | 1850 | if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
1851 | 1851 | global $sitepress; |
1852 | 1852 | $default_lang = $sitepress->get_default_language(); |
1853 | 1853 | $language_code = gd_wpml_get_lang_from_url($orig_termlink); |
1854 | - if (!$language_code ) { |
|
1855 | - $language_code = $default_lang; |
|
1854 | + if (!$language_code) { |
|
1855 | + $language_code = $default_lang; |
|
1856 | 1856 | } |
1857 | 1857 | |
1858 | 1858 | $org_slug = $slug; |
1859 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code); |
|
1859 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code); |
|
1860 | 1860 | |
1861 | 1861 | if (!$slug) { |
1862 | 1862 | $slug = $org_slug; |
1863 | 1863 | } |
1864 | 1864 | |
1865 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1)); |
|
1865 | + $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1)); |
|
1866 | 1866 | } |
1867 | 1867 | } |
1868 | 1868 | } |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | |
1893 | 1893 | if (in_array($post_type, geodir_get_posttypes())) { |
1894 | 1894 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1895 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1895 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1896 | 1896 | $location_terms = array( |
1897 | 1897 | 'gd_country' => $post->country_slug, |
1898 | 1898 | 'gd_region' => $post->region_slug, |
@@ -1909,7 +1909,7 @@ discard block |
||
1909 | 1909 | $location_terms = implode("/", $location_terms); |
1910 | 1910 | $location_terms = rtrim($location_terms, '/'); |
1911 | 1911 | |
1912 | - $link .= urldecode($location_terms) . '/'; |
|
1912 | + $link .= urldecode($location_terms).'/'; |
|
1913 | 1913 | } else { |
1914 | 1914 | $link = geodir_getlink($link, $location_terms); |
1915 | 1915 | } |
@@ -1997,9 +1997,9 @@ discard block |
||
1997 | 1997 | return 0; |
1998 | 1998 | $where = 't.term_id = %d'; |
1999 | 1999 | if (!empty($taxonomy)) |
2000 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2000 | + return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2001 | 2001 | else |
2002 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2002 | + return $wpdb->get_var($wpdb->prepare($select.$where, $term)); |
|
2003 | 2003 | } |
2004 | 2004 | |
2005 | 2005 | $term = trim(wp_unslash($term)); |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | |
2012 | 2012 | $where_fields = array($slug); |
2013 | 2013 | if (!empty($taxonomy)) { |
2014 | - $parent = (int)$parent; |
|
2014 | + $parent = (int) $parent; |
|
2015 | 2015 | if ($parent > 0) { |
2016 | 2016 | $where_fields[] = $parent; |
2017 | 2017 | $else_where_fields[] = $parent; |
@@ -2075,13 +2075,13 @@ discard block |
||
2075 | 2075 | $post_types = geodir_get_posttypes(); |
2076 | 2076 | $tax_arr = array(); |
2077 | 2077 | foreach ($post_types as $post_type) { |
2078 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
2078 | + $tax_arr[] = "'".$post_type."category'"; |
|
2079 | 2079 | } |
2080 | 2080 | $tax_c = implode(',', $tax_arr); |
2081 | 2081 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
2082 | 2082 | //$terms = get_terms( $taxonomy ); |
2083 | 2083 | |
2084 | - if($terms) { |
|
2084 | + if ($terms) { |
|
2085 | 2085 | foreach ($terms as $term) { |
2086 | 2086 | $post_type = str_replace("category", "", $term->taxonomy); |
2087 | 2087 | $a_terms[$post_type][] = $term; |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | } |
2090 | 2090 | } |
2091 | 2091 | |
2092 | - if($a_terms) { |
|
2092 | + if ($a_terms) { |
|
2093 | 2093 | foreach ($a_terms as $pt => $t2) { |
2094 | 2094 | |
2095 | 2095 | foreach ($t2 as $term) { |
@@ -2114,7 +2114,7 @@ discard block |
||
2114 | 2114 | } |
2115 | 2115 | |
2116 | 2116 | if (is_ssl()) { |
2117 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
2117 | + $terms_icons = str_replace("http:", "https:", $terms_icons); |
|
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | return apply_filters('geodir_get_term_icons', $terms_icons, $term_id); |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | if (get_option('geodir_show_listing_nav')) { |
40 | 40 | |
41 | 41 | $menu_class = ''; |
42 | - if (geodir_is_page('listing')) |
|
43 | - $menu_class = 'current-menu-item'; |
|
42 | + if (geodir_is_page('listing')) { |
|
43 | + $menu_class = 'current-menu-item'; |
|
44 | + } |
|
44 | 45 | |
45 | 46 | |
46 | 47 | //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | if (in_array($post_type, $show_post_type_main_nav)) { |
53 | 54 | if (get_post_type_archive_link($post_type)) { |
54 | 55 | $menu_class = ''; |
55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | - $menu_class = 'current-menu-item'; |
|
56 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
57 | + $menu_class = 'current-menu-item'; |
|
58 | + } |
|
57 | 59 | /** |
58 | 60 | * Filter the menu li class. |
59 | 61 | * |
@@ -130,8 +132,9 @@ discard block |
||
130 | 132 | if (get_post_type_archive_link($post_type)) { |
131 | 133 | |
132 | 134 | $menu_class = ''; |
133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | - $menu_class = 'current-menu-item'; |
|
135 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
136 | + $menu_class = 'current-menu-item'; |
|
137 | + } |
|
135 | 138 | |
136 | 139 | $items .= '<li class="' . $sub_li_class . '"> |
137 | 140 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
@@ -159,8 +162,9 @@ discard block |
||
159 | 162 | if (get_option('geodir_show_addlisting_nav')) { |
160 | 163 | |
161 | 164 | $menu_class = ''; |
162 | - if (geodir_is_page('add-listing')) |
|
163 | - $menu_class = 'current-menu-item'; |
|
165 | + if (geodir_is_page('add-listing')) { |
|
166 | + $menu_class = 'current-menu-item'; |
|
167 | + } |
|
164 | 168 | |
165 | 169 | //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
166 | 170 | $post_types = geodir_get_posttypes('object'); |
@@ -176,8 +180,9 @@ discard block |
||
176 | 180 | if (geodir_get_addlisting_link($post_type)) { |
177 | 181 | |
178 | 182 | $menu_class = ''; |
179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
180 | - $menu_class = 'current-menu-item'; |
|
183 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
184 | + $menu_class = 'current-menu-item'; |
|
185 | + } |
|
181 | 186 | /** |
182 | 187 | * Filter the menu li class. |
183 | 188 | * |
@@ -261,8 +266,9 @@ discard block |
||
261 | 266 | if (geodir_get_addlisting_link($post_type)) { |
262 | 267 | |
263 | 268 | $menu_class = ''; |
264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
265 | - $menu_class = 'current-menu-item'; |
|
269 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
270 | + $menu_class = 'current-menu-item'; |
|
271 | + } |
|
266 | 272 | /** |
267 | 273 | * Filter the menu li class. |
268 | 274 | * |
@@ -319,8 +325,9 @@ discard block |
||
319 | 325 | } |
320 | 326 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
321 | 327 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
322 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
328 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) { |
|
329 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
330 | + } |
|
324 | 331 | |
325 | 332 | return $menu; |
326 | 333 | |
@@ -410,17 +417,20 @@ discard block |
||
410 | 417 | } |
411 | 418 | |
412 | 419 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
413 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
414 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
415 | - elseif (isset($_REQUEST['listing_type'])) |
|
416 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
420 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
421 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
422 | + } elseif (isset($_REQUEST['listing_type'])) { |
|
423 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
424 | + } |
|
417 | 425 | } |
418 | 426 | |
419 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
420 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
427 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) { |
|
428 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
429 | + } |
|
421 | 430 | |
422 | - if (is_tax()) |
|
423 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
431 | + if (is_tax()) { |
|
432 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
433 | + } |
|
424 | 434 | |
425 | 435 | // Retrive post type for map marker html ajax request on preview page. |
426 | 436 | if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) { |
@@ -434,8 +444,9 @@ discard block |
||
434 | 444 | $all_postypes = geodir_get_posttypes(); |
435 | 445 | $all_postypes = stripslashes_deep($all_postypes); |
436 | 446 | |
437 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
438 | - $geodir_post_type = ''; |
|
447 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) { |
|
448 | + $geodir_post_type = ''; |
|
449 | + } |
|
439 | 450 | |
440 | 451 | if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
441 | 452 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
@@ -520,11 +531,12 @@ discard block |
||
520 | 531 | endswitch; |
521 | 532 | } |
522 | 533 | |
523 | - if (!empty($post_types)) |
|
524 | - return $post_types; |
|
525 | - else |
|
526 | - return array(); |
|
527 | -} |
|
534 | + if (!empty($post_types)) { |
|
535 | + return $post_types; |
|
536 | + } else { |
|
537 | + return array(); |
|
538 | + } |
|
539 | + } |
|
528 | 540 | |
529 | 541 | /** |
530 | 542 | * Get Custom Post Type info. |
@@ -541,9 +553,10 @@ discard block |
||
541 | 553 | $post_types = stripslashes_deep($post_types); |
542 | 554 | if (!empty($post_types) && $post_type != '') { |
543 | 555 | return $post_types[$post_type]; |
544 | - } else |
|
545 | - return false; |
|
546 | -} |
|
556 | + } else { |
|
557 | + return false; |
|
558 | + } |
|
559 | + } |
|
547 | 560 | |
548 | 561 | if (!function_exists('geodir_get_taxonomies')) { |
549 | 562 | /** |
@@ -629,10 +642,11 @@ discard block |
||
629 | 642 | . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
630 | 643 | } |
631 | 644 | |
632 | - if ($echo) |
|
633 | - echo $html; |
|
634 | - else |
|
635 | - return $html; |
|
645 | + if ($echo) { |
|
646 | + echo $html; |
|
647 | + } else { |
|
648 | + return $html; |
|
649 | + } |
|
636 | 650 | } |
637 | 651 | } |
638 | 652 | |
@@ -666,11 +680,12 @@ discard block |
||
666 | 680 | |
667 | 681 | } |
668 | 682 | |
669 | - if (!empty($listing_slug)) |
|
670 | - return $listing_slug; |
|
671 | - else |
|
672 | - return false; |
|
673 | -} |
|
683 | + if (!empty($listing_slug)) { |
|
684 | + return $listing_slug; |
|
685 | + } else { |
|
686 | + return false; |
|
687 | + } |
|
688 | + } |
|
674 | 689 | |
675 | 690 | |
676 | 691 | /** |
@@ -701,16 +716,18 @@ discard block |
||
701 | 716 | if (!empty($taxonomies)) { |
702 | 717 | foreach (geodir_get_posttypes() as $pt) { |
703 | 718 | $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
704 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
705 | - $post_type[] = $pt; |
|
719 | + if (array_intersect($taxonomies, $object_taxonomies)) { |
|
720 | + $post_type[] = $pt; |
|
721 | + } |
|
706 | 722 | } |
707 | 723 | } |
708 | 724 | |
709 | - if (!empty($post_type)) |
|
710 | - return $post_type[0]; |
|
711 | - else |
|
712 | - return false; |
|
713 | -} |
|
725 | + if (!empty($post_type)) { |
|
726 | + return $post_type[0]; |
|
727 | + } else { |
|
728 | + return false; |
|
729 | + } |
|
730 | + } |
|
714 | 731 | |
715 | 732 | if (!function_exists('geodir_custom_taxonomy_walker')) { |
716 | 733 | /** |
@@ -766,18 +783,18 @@ discard block |
||
766 | 783 | $checked = ''; |
767 | 784 | |
768 | 785 | if (in_array($cat_term->term_id, $search_terms)) { |
769 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
770 | - $checked = 'selected="selected"'; |
|
771 | - else |
|
772 | - $checked = 'checked="checked"'; |
|
786 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
787 | + $checked = 'selected="selected"'; |
|
788 | + } else { |
|
789 | + $checked = 'checked="checked"'; |
|
790 | + } |
|
773 | 791 | } |
774 | 792 | |
775 | - if ($cat_display == 'radio') |
|
776 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
777 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
778 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
779 | - |
|
780 | - else { |
|
793 | + if ($cat_display == 'radio') { |
|
794 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
795 | + } elseif ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
796 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
797 | + } else { |
|
781 | 798 | $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
782 | 799 | } |
783 | 800 | |
@@ -786,8 +803,9 @@ discard block |
||
786 | 803 | |
787 | 804 | } |
788 | 805 | |
789 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
790 | - $out .= '</div>'; |
|
806 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
807 | + $out .= '</div>'; |
|
808 | + } |
|
791 | 809 | |
792 | 810 | return $out; |
793 | 811 | } |
@@ -813,18 +831,21 @@ discard block |
||
813 | 831 | global $exclude_cats, $gd_session; |
814 | 832 | |
815 | 833 | $cat_exclude = ''; |
816 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
817 | - $cat_exclude = serialize($exclude_cats); |
|
834 | + if (is_array($exclude_cats) && !empty($exclude_cats)) { |
|
835 | + $cat_exclude = serialize($exclude_cats); |
|
836 | + } |
|
818 | 837 | |
819 | 838 | if (isset($_REQUEST['backandedit'])) { |
820 | 839 | $post = (object)$gd_session->get('listing'); |
821 | 840 | |
822 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
823 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
841 | + if (!is_array($post->post_category[$cat_taxonomy])) { |
|
842 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
843 | + } |
|
824 | 844 | |
825 | 845 | $post_categories = $post->post_category_str; |
826 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
827 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
846 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
847 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
848 | + } |
|
828 | 849 | |
829 | 850 | } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
830 | 851 | global $post; |
@@ -1015,8 +1036,9 @@ discard block |
||
1015 | 1036 | if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
1016 | 1037 | $post_cat_str = $post_categories[$cat_taxonomy]; |
1017 | 1038 | $post_cat_array = explode("#", $post_cat_str); |
1018 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
1019 | - $style = "display:none;"; |
|
1039 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) { |
|
1040 | + $style = "display:none;"; |
|
1041 | + } |
|
1020 | 1042 | } |
1021 | 1043 | ?> |
1022 | 1044 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
@@ -1051,7 +1073,7 @@ discard block |
||
1051 | 1073 | |
1052 | 1074 | if(is_array( $exclude_cats)){ |
1053 | 1075 | $exclude_cats = array_map( 'intval', $exclude_cats ); |
1054 | - }else{ |
|
1076 | + } else{ |
|
1055 | 1077 | $exclude_cats = intval($exclude_cats); |
1056 | 1078 | } |
1057 | 1079 | |
@@ -1081,7 +1103,10 @@ discard block |
||
1081 | 1103 | |
1082 | 1104 | <div class="post_default_category"> |
1083 | 1105 | <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
1084 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1106 | + onchange="update_listing_cat()" <?php if ($default) { |
|
1107 | + echo ' checked="checked" '; |
|
1108 | +} |
|
1109 | +?> /> |
|
1085 | 1110 | <span> |
1086 | 1111 | <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
1087 | 1112 | </span> |
@@ -1181,8 +1206,9 @@ discard block |
||
1181 | 1206 | $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
1182 | 1207 | |
1183 | 1208 | $option_selected = ''; |
1184 | - if (!$selected) |
|
1185 | - $option_slected = ' selected="selected" '; |
|
1209 | + if (!$selected) { |
|
1210 | + $option_slected = ' selected="selected" '; |
|
1211 | + } |
|
1186 | 1212 | |
1187 | 1213 | echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
1188 | 1214 | |
@@ -1190,8 +1216,9 @@ discard block |
||
1190 | 1216 | |
1191 | 1217 | foreach ($cat_terms as $cat_term) { |
1192 | 1218 | $option_selected = ''; |
1193 | - if ($selected == $cat_term->term_id) |
|
1194 | - $option_selected = ' selected="selected" '; |
|
1219 | + if ($selected == $cat_term->term_id) { |
|
1220 | + $option_selected = ' selected="selected" '; |
|
1221 | + } |
|
1195 | 1222 | |
1196 | 1223 | // Count child terms |
1197 | 1224 | $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
@@ -1256,8 +1283,9 @@ discard block |
||
1256 | 1283 | |
1257 | 1284 | $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
1258 | 1285 | |
1259 | - if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1260 | - $listing_slug = 'places'; |
|
1286 | + if (!$listing_slug = get_option('geodir_listing_prefix')) { |
|
1287 | + $listing_slug = 'places'; |
|
1288 | + } |
|
1261 | 1289 | |
1262 | 1290 | /** |
1263 | 1291 | * Taxonomies |
@@ -1573,8 +1601,9 @@ discard block |
||
1573 | 1601 | 'city_slug' => $post->city_slug |
1574 | 1602 | ); |
1575 | 1603 | |
1576 | - } else |
|
1577 | - $post_location = geodir_get_location(); |
|
1604 | + } else { |
|
1605 | + $post_location = geodir_get_location(); |
|
1606 | + } |
|
1578 | 1607 | |
1579 | 1608 | |
1580 | 1609 | } else { |
@@ -1603,8 +1632,9 @@ discard block |
||
1603 | 1632 | ); |
1604 | 1633 | |
1605 | 1634 | } |
1606 | - } else |
|
1607 | - $post_location = geodir_get_location(); |
|
1635 | + } else { |
|
1636 | + $post_location = geodir_get_location(); |
|
1637 | + } |
|
1608 | 1638 | } |
1609 | 1639 | |
1610 | 1640 | |
@@ -1643,16 +1673,17 @@ discard block |
||
1643 | 1673 | |
1644 | 1674 | if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
1645 | 1675 | $post_terms = absint($_POST['post_default_category']); |
1646 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1676 | + } elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1647 | 1677 | $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
1648 | 1678 | $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
1649 | - }elseif (isset($post->{$taxonomies})) { |
|
1679 | + } elseif (isset($post->{$taxonomies})) { |
|
1650 | 1680 | $post_terms = explode(",", trim($post->{$taxonomies}, ",")); |
1651 | 1681 | $post_terms = $post_terms[0]; |
1652 | 1682 | } |
1653 | 1683 | |
1654 | - if (!$post_terms) |
|
1655 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1684 | + if (!$post_terms) { |
|
1685 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1686 | + } |
|
1656 | 1687 | |
1657 | 1688 | if (!$post_terms) { |
1658 | 1689 | $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
@@ -1666,8 +1697,9 @@ discard block |
||
1666 | 1697 | |
1667 | 1698 | $term = get_term_by('id', $post_terms, $taxonomies); |
1668 | 1699 | |
1669 | - if (!empty($term)) |
|
1670 | - $term_request = $term->slug; |
|
1700 | + if (!empty($term)) { |
|
1701 | + $term_request = $term->slug; |
|
1702 | + } |
|
1671 | 1703 | //$term_request = $term->slug.'/'; |
1672 | 1704 | } |
1673 | 1705 | |
@@ -1682,9 +1714,13 @@ discard block |
||
1682 | 1714 | $request_term .= $term_request; |
1683 | 1715 | |
1684 | 1716 | } else { |
1685 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1717 | + if (isset($location_request) && $location_request != '') { |
|
1718 | + $request_term = $location_request; |
|
1719 | + } |
|
1686 | 1720 | |
1687 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1721 | + if (isset($term_request) && $term_request != '') { |
|
1722 | + $request_term .= $term_request; |
|
1723 | + } |
|
1688 | 1724 | } |
1689 | 1725 | $request_term = trim($request_term, '/'); |
1690 | 1726 | |
@@ -1693,10 +1729,11 @@ discard block |
||
1693 | 1729 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
1694 | 1730 | } |
1695 | 1731 | |
1696 | - if (!empty($request_term)) |
|
1697 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1698 | - else |
|
1699 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1732 | + if (!empty($request_term)) { |
|
1733 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1734 | + } else { |
|
1735 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1736 | + } |
|
1700 | 1737 | //echo $post_link ; |
1701 | 1738 | } |
1702 | 1739 | // temp cache the permalink |
@@ -1939,11 +1976,12 @@ discard block |
||
1939 | 1976 | |
1940 | 1977 | $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
1941 | 1978 | |
1942 | - if ($echo) |
|
1943 | - echo $label; |
|
1944 | - else |
|
1945 | - return $label; |
|
1946 | -} |
|
1979 | + if ($echo) { |
|
1980 | + echo $label; |
|
1981 | + } else { |
|
1982 | + return $label; |
|
1983 | + } |
|
1984 | + } |
|
1947 | 1985 | |
1948 | 1986 | /** |
1949 | 1987 | * Print or Get post type plural label. |
@@ -1959,18 +1997,20 @@ discard block |
||
1959 | 1997 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) { |
1960 | 1998 | $all_postypes = geodir_get_posttypes(); |
1961 | 1999 | |
1962 | - if (!in_array($post_type, $all_postypes)) |
|
1963 | - return false; |
|
2000 | + if (!in_array($post_type, $all_postypes)) { |
|
2001 | + return false; |
|
2002 | + } |
|
1964 | 2003 | |
1965 | 2004 | $obj_post_type = get_post_type_object($post_type); |
1966 | 2005 | |
1967 | 2006 | $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
1968 | 2007 | |
1969 | - if ($echo) |
|
1970 | - echo $label; |
|
1971 | - else |
|
1972 | - return $label; |
|
1973 | -} |
|
2008 | + if ($echo) { |
|
2009 | + echo $label; |
|
2010 | + } else { |
|
2011 | + return $label; |
|
2012 | + } |
|
2013 | + } |
|
1974 | 2014 | |
1975 | 2015 | /** |
1976 | 2016 | * Checks whether a term exists or not. |
@@ -1993,19 +2033,22 @@ discard block |
||
1993 | 2033 | $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
1994 | 2034 | |
1995 | 2035 | if (is_int($term)) { |
1996 | - if (0 == $term) |
|
1997 | - return 0; |
|
2036 | + if (0 == $term) { |
|
2037 | + return 0; |
|
2038 | + } |
|
1998 | 2039 | $where = 't.term_id = %d'; |
1999 | - if (!empty($taxonomy)) |
|
2000 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2001 | - else |
|
2002 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2040 | + if (!empty($taxonomy)) { |
|
2041 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
2042 | + } else { |
|
2043 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
2044 | + } |
|
2003 | 2045 | } |
2004 | 2046 | |
2005 | 2047 | $term = trim(wp_unslash($term)); |
2006 | 2048 | |
2007 | - if ('' === $slug = sanitize_title($term)) |
|
2008 | - return 0; |
|
2049 | + if ('' === $slug = sanitize_title($term)) { |
|
2050 | + return 0; |
|
2051 | + } |
|
2009 | 2052 | |
2010 | 2053 | $where = 't.slug = %s'; |
2011 | 2054 | |
@@ -2022,14 +2065,16 @@ discard block |
||
2022 | 2065 | $where_fields[] = $taxonomy; |
2023 | 2066 | |
2024 | 2067 | |
2025 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
2026 | - return $result; |
|
2068 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) { |
|
2069 | + return $result; |
|
2070 | + } |
|
2027 | 2071 | |
2028 | 2072 | return false; |
2029 | 2073 | } |
2030 | 2074 | |
2031 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
2032 | - return $result; |
|
2075 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) { |
|
2076 | + return $result; |
|
2077 | + } |
|
2033 | 2078 | |
2034 | 2079 | return false; |
2035 | 2080 | } |
@@ -20,72 +20,72 @@ discard block |
||
20 | 20 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
21 | 21 | $grid_view_class = apply_filters('geodir_grid_view_widget_columns', $gridview_columns_widget); |
22 | 22 | if ($gd_session->get('gd_listing_view') && !isset($before_widget)) { |
23 | - $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view')); |
|
23 | + $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view')); |
|
24 | 24 | } |
25 | 25 | ?> |
26 | 26 | <ul class="geodir_category_list_view clearfix <?php echo apply_filters('geodir_listing_listview_ul_extra_class', '', 'widget'); ?>"> |
27 | 27 | <?php |
28 | - if (!empty($widget_listings)) { |
|
29 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
30 | - do_action('geodir_before_listing_post_listview'); |
|
31 | - $all_postypes = geodir_get_posttypes(); |
|
32 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
33 | - foreach ($widget_listings as $widget_listing) { |
|
34 | - global $gd_widget_listing_type; |
|
35 | - $post = $widget_listing; |
|
28 | + if (!empty($widget_listings)) { |
|
29 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
30 | + do_action('geodir_before_listing_post_listview'); |
|
31 | + $all_postypes = geodir_get_posttypes(); |
|
32 | + $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
33 | + foreach ($widget_listings as $widget_listing) { |
|
34 | + global $gd_widget_listing_type; |
|
35 | + $post = $widget_listing; |
|
36 | 36 | |
37 | - $GLOBALS['post'] = $post; |
|
38 | - setup_postdata($post); |
|
37 | + $GLOBALS['post'] = $post; |
|
38 | + setup_postdata($post); |
|
39 | 39 | |
40 | - $gd_widget_listing_type = $post->post_type; |
|
40 | + $gd_widget_listing_type = $post->post_type; |
|
41 | 41 | |
42 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
43 | - $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes); |
|
42 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
43 | + $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes); |
|
44 | 44 | |
45 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
46 | - $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
47 | - ?> |
|
45 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
46 | + $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
47 | + ?> |
|
48 | 48 | <li class="clearfix <?php if ($grid_view_class) { |
49 | - echo 'geodir-gridview ' . $grid_view_class; |
|
50 | - } else { |
|
51 | - echo ' geodir-listview '; |
|
52 | - } ?> <?php if ($post_view_class) { |
|
53 | - echo $post_view_class; |
|
54 | - } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
55 | - echo "style='width:{$listing_width}%;'"; |
|
56 | - } |
|
49 | + echo 'geodir-gridview ' . $grid_view_class; |
|
50 | + } else { |
|
51 | + echo ' geodir-listview '; |
|
52 | + } ?> <?php if ($post_view_class) { |
|
53 | + echo $post_view_class; |
|
54 | + } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
55 | + echo "style='width:{$listing_width}%;'"; |
|
56 | + } |
|
57 | 57 | |
58 | - echo " data-post-id='$post->ID' "; |
|
59 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
60 | - do_action('geodir_listview_inside_li', $post, 'widget'); |
|
61 | - ?>> |
|
58 | + echo " data-post-id='$post->ID' "; |
|
59 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
60 | + do_action('geodir_listview_inside_li', $post, 'widget'); |
|
61 | + ?>> |
|
62 | 62 | <article class="geodir-category-listing <?php if ($post_view_article_class) { |
63 | - echo $post_view_article_class; |
|
64 | - } ?>"> |
|
63 | + echo $post_view_article_class; |
|
64 | + } ?>"> |
|
65 | 65 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'widget'); ?>"> |
66 | 66 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?> |
67 | 67 | <a href="<?php the_permalink(); ?>"><?php echo $fimage; ?></a> |
68 | 68 | <?php |
69 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
70 | - do_action('geodir_before_badge_on_image', $post); |
|
71 | - if ($post->is_featured) { |
|
72 | - echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
73 | - } |
|
69 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
70 | + do_action('geodir_before_badge_on_image', $post); |
|
71 | + if ($post->is_featured) { |
|
72 | + echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
77 | - echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
78 | - } |
|
76 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
77 | + echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
78 | + } |
|
79 | 79 | |
80 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
81 | - do_action('geodir_after_badge_on_image', $post); |
|
82 | - } |
|
83 | - ?> |
|
80 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
81 | + do_action('geodir_after_badge_on_image', $post); |
|
82 | + } |
|
83 | + ?> |
|
84 | 84 | </div> |
85 | 85 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'widget'); ?>"> |
86 | 86 | <?php |
87 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
88 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
87 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
88 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
89 | 89 | <header class="geodir-entry-header"> |
90 | 90 | <?php $title_tag = !empty($title_tag) ? $title_tag : 'h3'; ?> |
91 | 91 | <<?php echo esc_attr($title_tag); ?> class="geodir-entry-title"> |
@@ -95,162 +95,162 @@ discard block |
||
95 | 95 | </header> |
96 | 96 | <!-- .entry-header --> |
97 | 97 | <?php |
98 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
99 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
98 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
99 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
100 | 100 | <?php /// Print Distance |
101 | - if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
102 | - if ( $related_nearest && $related_parent_lat ) { |
|
103 | - $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
104 | - } else { |
|
105 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
106 | - } |
|
101 | + if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
102 | + if ( $related_nearest && $related_parent_lat ) { |
|
103 | + $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
104 | + } else { |
|
105 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
106 | + } |
|
107 | 107 | |
108 | - $endLat = $post->post_latitude; |
|
109 | - $endLon = $post->post_longitude; |
|
110 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
111 | - $uom = get_option('geodir_search_dist_1'); |
|
112 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
113 | - ?> |
|
108 | + $endLat = $post->post_latitude; |
|
109 | + $endLon = $post->post_longitude; |
|
110 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
111 | + $uom = get_option('geodir_search_dist_1'); |
|
112 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
113 | + ?> |
|
114 | 114 | <h3> |
115 | 115 | <?php |
116 | - if (round($distance, 2) == 0) { |
|
117 | - $uom = get_option('geodir_search_dist_2'); |
|
118 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
119 | - if ($uom == 'feet') { |
|
120 | - $uom = __('feet', 'geodirectory'); |
|
121 | - } else { |
|
122 | - $uom = __('meters', 'geodirectory'); |
|
123 | - } |
|
124 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
116 | + if (round($distance, 2) == 0) { |
|
117 | + $uom = get_option('geodir_search_dist_2'); |
|
118 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
119 | + if ($uom == 'feet') { |
|
120 | + $uom = __('feet', 'geodirectory'); |
|
121 | + } else { |
|
122 | + $uom = __('meters', 'geodirectory'); |
|
123 | + } |
|
124 | + echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
125 | 125 | <br /> |
126 | 126 | '; |
127 | - } else { |
|
128 | - if ($uom == 'miles') { |
|
129 | - $uom = __('miles', 'geodirectory'); |
|
130 | - } else { |
|
131 | - $uom = __('km', 'geodirectory'); |
|
132 | - } |
|
133 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
127 | + } else { |
|
128 | + if ($uom == 'miles') { |
|
129 | + $uom = __('miles', 'geodirectory'); |
|
130 | + } else { |
|
131 | + $uom = __('km', 'geodirectory'); |
|
132 | + } |
|
133 | + echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
134 | 134 | <br /> |
135 | 135 | '; |
136 | - } |
|
137 | - ?> |
|
136 | + } |
|
137 | + ?> |
|
138 | 138 | </h3> |
139 | 139 | <?php } ?> |
140 | 140 | <?php |
141 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
142 | - do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
141 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
142 | + do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
143 | 143 | <?php echo geodir_show_listing_info('listing'); ?> |
144 | 144 | <?php if (isset($character_count) && $character_count == '0') { |
145 | - } else { ?> |
|
145 | + } else { ?> |
|
146 | 146 | <div class="geodir-entry-content"> |
147 | 147 | <?php |
148 | - /** |
|
149 | - * Filter to hide the listing excerpt |
|
150 | - * |
|
151 | - * @since 1.5.3 |
|
152 | - * @param bool $display Display the excerpt or not. Default true. |
|
153 | - * @param object $post The post object. |
|
154 | - */ |
|
155 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
|
156 | - if ($show_listing_excerpt) { |
|
157 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
158 | - $content_out = geodir_max_excerpt( $character_count ); |
|
159 | - } else { |
|
160 | - $content_out = get_the_excerpt(); |
|
161 | - } |
|
162 | - if ( ! empty( $content_out ) ) { |
|
163 | - echo "<p>" . $content_out . "</p>"; |
|
164 | - } |
|
165 | - } |
|
166 | - ?> |
|
148 | + /** |
|
149 | + * Filter to hide the listing excerpt |
|
150 | + * |
|
151 | + * @since 1.5.3 |
|
152 | + * @param bool $display Display the excerpt or not. Default true. |
|
153 | + * @param object $post The post object. |
|
154 | + */ |
|
155 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
|
156 | + if ($show_listing_excerpt) { |
|
157 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
158 | + $content_out = geodir_max_excerpt( $character_count ); |
|
159 | + } else { |
|
160 | + $content_out = get_the_excerpt(); |
|
161 | + } |
|
162 | + if ( ! empty( $content_out ) ) { |
|
163 | + echo "<p>" . $content_out . "</p>"; |
|
164 | + } |
|
165 | + } |
|
166 | + ?> |
|
167 | 167 | </div> |
168 | 168 | <?php } ?> |
169 | 169 | <?php |
170 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
171 | - do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
170 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
171 | + do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
172 | 172 | </div> |
173 | 173 | <!-- gd-content ends here--> |
174 | 174 | <?php |
175 | - /** |
|
176 | - * Called after printing listing content. |
|
177 | - * |
|
178 | - * @since 1.5.3 |
|
179 | - * @param object $post The post object. |
|
180 | - * @param string $view The view type, default 'widget'. |
|
181 | - */ |
|
182 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
175 | + /** |
|
176 | + * Called after printing listing content. |
|
177 | + * |
|
178 | + * @since 1.5.3 |
|
179 | + * @param object $post The post object. |
|
180 | + * @param string $view The view type, default 'widget'. |
|
181 | + */ |
|
182 | + do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
183 | 183 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>"> |
184 | 184 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>"> |
185 | 185 | <?php |
186 | - /** |
|
187 | - * Called before printing review stars html. |
|
188 | - * |
|
189 | - * @since 1.5.3 |
|
190 | - * @param object $post The post object. |
|
191 | - * @param string $view The view type, default 'widget'. |
|
192 | - */ |
|
193 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
194 | - $review_show = geodir_is_reviews_show('listview'); |
|
195 | - if ($review_show) { |
|
186 | + /** |
|
187 | + * Called before printing review stars html. |
|
188 | + * |
|
189 | + * @since 1.5.3 |
|
190 | + * @param object $post The post object. |
|
191 | + * @param string $view The view type, default 'widget'. |
|
192 | + */ |
|
193 | + do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
194 | + $review_show = geodir_is_reviews_show('listview'); |
|
195 | + if ($review_show) { |
|
196 | 196 | |
197 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
197 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
198 | 198 | |
199 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
200 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
199 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
200 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
201 | 201 | |
202 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
202 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
203 | 203 | |
204 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
205 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
206 | - ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
204 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
205 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
206 | + ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
207 | 207 | class="fas fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?> |
208 | 208 | </a> |
209 | 209 | <?php |
210 | - } |
|
210 | + } |
|
211 | 211 | |
212 | 212 | |
213 | - /** |
|
214 | - * Called after printing favorite html. |
|
215 | - * |
|
216 | - * @since 1.0.0 |
|
217 | - */ |
|
218 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
213 | + /** |
|
214 | + * Called after printing favorite html. |
|
215 | + * |
|
216 | + * @since 1.0.0 |
|
217 | + */ |
|
218 | + do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
219 | 219 | |
220 | - if ($post->post_author == get_current_user_id()) { |
|
221 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
222 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
223 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
220 | + if ($post->post_author == get_current_user_id()) { |
|
221 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
222 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
223 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
224 | 224 | |
225 | - $ajaxlink = geodir_get_ajax_url(); |
|
226 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
227 | - ?> |
|
225 | + $ajaxlink = geodir_get_ajax_url(); |
|
226 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
227 | + ?> |
|
228 | 228 | <span class="geodir-authorlink clearfix"> |
229 | 229 | <?php |
230 | - if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
|
231 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
232 | - do_action('geodir_before_edit_post_link_on_listing'); |
|
233 | - ?> |
|
230 | + if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
|
231 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
232 | + do_action('geodir_before_edit_post_link_on_listing'); |
|
233 | + ?> |
|
234 | 234 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
235 | 235 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
236 | 236 | <?php |
237 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
|
238 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
239 | - ?> |
|
237 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
|
238 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
239 | + ?> |
|
240 | 240 | <?php _e('Edit', 'geodirectory'); ?> |
241 | 241 | </a> |
242 | 242 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
243 | 243 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
244 | 244 | <?php |
245 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
|
246 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
247 | - ?> |
|
245 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
|
246 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
247 | + ?> |
|
248 | 248 | <?php _e('Delete', 'geodirectory'); ?> |
249 | 249 | </a> |
250 | 250 | <?php |
251 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
252 | - do_action('geodir_after_edit_post_link_on_listing'); |
|
253 | - } ?> |
|
251 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
252 | + do_action('geodir_after_edit_post_link_on_listing'); |
|
253 | + } ?> |
|
254 | 254 | </span> |
255 | 255 | <?php } ?> |
256 | 256 | </div> |
@@ -260,17 +260,17 @@ discard block |
||
260 | 260 | </article> |
261 | 261 | </li> |
262 | 262 | <?php |
263 | - unset($gd_widget_listing_type); |
|
264 | - } |
|
265 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
266 | - do_action('geodir_after_listing_post_listview'); |
|
267 | - } else { |
|
263 | + unset($gd_widget_listing_type); |
|
264 | + } |
|
265 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
266 | + do_action('geodir_after_listing_post_listview'); |
|
267 | + } else { |
|
268 | 268 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
269 | 269 | |
270 | 270 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
271 | - do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite); |
|
272 | - } |
|
273 | - ?> |
|
271 | + do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite); |
|
272 | + } |
|
273 | + ?> |
|
274 | 274 | </ul> <!-- geodir_category_list_view ends here--> |
275 | 275 | <div class="clear"></div> |
276 | 276 | <?php |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
30 | 30 | do_action('geodir_before_listing_post_listview'); |
31 | 31 | $all_postypes = geodir_get_posttypes(); |
32 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
32 | + $geodir_days_new = (int) get_option('geodir_listing_new_days'); |
|
33 | 33 | foreach ($widget_listings as $widget_listing) { |
34 | 34 | global $gd_widget_listing_type; |
35 | 35 | $post = $widget_listing; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
47 | 47 | ?> |
48 | 48 | <li class="clearfix <?php if ($grid_view_class) { |
49 | - echo 'geodir-gridview ' . $grid_view_class; |
|
49 | + echo 'geodir-gridview '.$grid_view_class; |
|
50 | 50 | } else { |
51 | 51 | echo ' geodir-listview '; |
52 | 52 | } ?> <?php if ($post_view_class) { |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
99 | 99 | do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
100 | 100 | <?php /// Print Distance |
101 | - if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
102 | - if ( $related_nearest && $related_parent_lat ) { |
|
101 | + if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || ($related_nearest && $related_parent_lat)) { |
|
102 | + if ($related_nearest && $related_parent_lat) { |
|
103 | 103 | $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
104 | 104 | } else { |
105 | 105 | $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } else { |
122 | 122 | $uom = __('meters', 'geodirectory'); |
123 | 123 | } |
124 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
124 | + echo round($distance).' '.__($uom, 'geodirectory').' |
|
125 | 125 | <br /> |
126 | 126 | '; |
127 | 127 | } else { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } else { |
131 | 131 | $uom = __('km', 'geodirectory'); |
132 | 132 | } |
133 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
133 | + echo round($distance, 2).' '.__($uom, 'geodirectory').' |
|
134 | 134 | <br /> |
135 | 135 | '; |
136 | 136 | } |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | */ |
155 | 155 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
156 | 156 | if ($show_listing_excerpt) { |
157 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
158 | - $content_out = geodir_max_excerpt( $character_count ); |
|
157 | + if (isset($character_count) && ($character_count || $character_count == '0')) { |
|
158 | + $content_out = geodir_max_excerpt($character_count); |
|
159 | 159 | } else { |
160 | 160 | $content_out = get_the_excerpt(); |
161 | 161 | } |
162 | - if ( ! empty( $content_out ) ) { |
|
163 | - echo "<p>" . $content_out . "</p>"; |
|
162 | + if (!empty($content_out)) { |
|
163 | + echo "<p>".$content_out."</p>"; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | ?> |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param object $post The post object. |
180 | 180 | * @param string $view The view type, default 'widget'. |
181 | 181 | */ |
182 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
182 | + do_action('geodir_after_listing_content', $post, 'widget'); ?> |
|
183 | 183 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>"> |
184 | 184 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>"> |
185 | 185 | <?php |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param object $post The post object. |
191 | 191 | * @param string $view The view type, default 'widget'. |
192 | 192 | */ |
193 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
193 | + do_action('geodir_before_review_html', $post, 'widget'); |
|
194 | 194 | $review_show = geodir_is_reviews_show('listview'); |
195 | 195 | if ($review_show) { |
196 | 196 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @since 1.0.0 |
217 | 217 | */ |
218 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
218 | + do_action('geodir_after_favorite_html', $post->ID, 'widget'); |
|
219 | 219 | |
220 | 220 | if ($post->post_author == get_current_user_id()) { |
221 | 221 | $addplacelink = get_permalink(geodir_add_listing_page_id()); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
236 | 236 | <?php |
237 | 237 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
238 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
238 | + echo '<i class="'.$geodir_listing_edit_icon.'"></i>'; |
|
239 | 239 | ?> |
240 | 240 | <?php _e('Edit', 'geodirectory'); ?> |
241 | 241 | </a> |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
244 | 244 | <?php |
245 | 245 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
246 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
246 | + echo '<i class="'.$geodir_listing_delete_icon.'"></i>'; |
|
247 | 247 | ?> |
248 | 248 | <?php _e('Delete', 'geodirectory'); ?> |
249 | 249 | </a> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | // If this file is called directly, abort. |
11 | 11 | if (!defined('WPINC')) { |
12 | - die; |
|
12 | + die; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -22,22 +22,22 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function gdsc_validate_measurements($value) |
24 | 24 | { |
25 | - if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
26 | - // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
27 | - $value = preg_replace('/\D/', '', $value); |
|
28 | - if (100 < $value) { |
|
29 | - $value = 100; |
|
30 | - } |
|
31 | - // Re-add the percent symbol |
|
32 | - $value = $value . '%'; |
|
33 | - } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
34 | - // Get the absint & re-add the 'px' |
|
35 | - $value = preg_replace('/\D/', '', $value) . 'px'; |
|
36 | - } else { |
|
37 | - $value = preg_replace('/\D/', '', $value); |
|
38 | - } |
|
25 | + if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
26 | + // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
27 | + $value = preg_replace('/\D/', '', $value); |
|
28 | + if (100 < $value) { |
|
29 | + $value = 100; |
|
30 | + } |
|
31 | + // Re-add the percent symbol |
|
32 | + $value = $value . '%'; |
|
33 | + } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
34 | + // Get the absint & re-add the 'px' |
|
35 | + $value = preg_replace('/\D/', '', $value) . 'px'; |
|
36 | + } else { |
|
37 | + $value = preg_replace('/\D/', '', $value); |
|
38 | + } |
|
39 | 39 | |
40 | - return $value; |
|
40 | + return $value; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -52,35 +52,35 @@ discard block |
||
52 | 52 | function gdsc_validate_map_args($params) |
53 | 53 | { |
54 | 54 | |
55 | - $params['width'] = gdsc_validate_measurements($params['width']); |
|
56 | - $params['height'] = gdsc_validate_measurements($params['height']); |
|
55 | + $params['width'] = gdsc_validate_measurements($params['width']); |
|
56 | + $params['height'] = gdsc_validate_measurements($params['height']); |
|
57 | 57 | |
58 | - // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
59 | - if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
60 | - $params['maptype'] = 'ROADMAP'; |
|
61 | - } else { |
|
62 | - $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
63 | - } |
|
58 | + // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
59 | + if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
60 | + $params['maptype'] = 'ROADMAP'; |
|
61 | + } else { |
|
62 | + $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
63 | + } |
|
64 | 64 | |
65 | - // Zoom accepts a value between 1 and 19 |
|
66 | - $params['zoom'] = absint($params['zoom']); |
|
67 | - if (19 < $params['zoom']) { |
|
68 | - $params['zoom'] = '19'; |
|
69 | - } |
|
70 | - if (0 == $params['zoom']) { |
|
71 | - $params['zoom'] = '1'; |
|
72 | - } |
|
65 | + // Zoom accepts a value between 1 and 19 |
|
66 | + $params['zoom'] = absint($params['zoom']); |
|
67 | + if (19 < $params['zoom']) { |
|
68 | + $params['zoom'] = '19'; |
|
69 | + } |
|
70 | + if (0 == $params['zoom']) { |
|
71 | + $params['zoom'] = '1'; |
|
72 | + } |
|
73 | 73 | |
74 | - // Child_collapse must be boolean |
|
75 | - $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
74 | + // Child_collapse must be boolean |
|
75 | + $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
76 | 76 | |
77 | - // Scrollwheel must be boolean |
|
78 | - $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
77 | + // Scrollwheel must be boolean |
|
78 | + $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
79 | 79 | |
80 | - // Scrollwheel must be boolean |
|
81 | - $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
80 | + // Scrollwheel must be boolean |
|
81 | + $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
82 | 82 | |
83 | - return $params; |
|
83 | + return $params; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -99,52 +99,52 @@ discard block |
||
99 | 99 | */ |
100 | 100 | function gdsc_to_bool_val($in, $strict = false) |
101 | 101 | { |
102 | - $out = null; |
|
103 | - |
|
104 | - // if not strict, we only have to check if something is false |
|
105 | - if (in_array($in, array( |
|
106 | - 'false', |
|
107 | - 'False', |
|
108 | - 'FALSE', |
|
109 | - 'no', |
|
110 | - 'No', |
|
111 | - 'n', |
|
112 | - 'N', |
|
113 | - '0', |
|
114 | - 'off', |
|
115 | - 'Off', |
|
116 | - 'OFF', |
|
117 | - false, |
|
118 | - 0, |
|
119 | - null |
|
120 | - ), true)) { |
|
121 | - $out = false; |
|
122 | - } else if ($strict) { |
|
123 | - // if strict, check the equivalent true values |
|
124 | - if (in_array($in, array( |
|
125 | - 'true', |
|
126 | - 'True', |
|
127 | - 'TRUE', |
|
128 | - 'yes', |
|
129 | - 'Yes', |
|
130 | - 'y', |
|
131 | - 'Y', |
|
132 | - '1', |
|
133 | - 'on', |
|
134 | - 'On', |
|
135 | - 'ON', |
|
136 | - true, |
|
137 | - 1 |
|
138 | - ), true)) { |
|
139 | - $out = true; |
|
140 | - } |
|
141 | - } else { |
|
142 | - // not strict? let the regular php bool check figure it out (will |
|
143 | - // largely default to true) |
|
144 | - $out = ($in ? true : false); |
|
145 | - } |
|
102 | + $out = null; |
|
103 | + |
|
104 | + // if not strict, we only have to check if something is false |
|
105 | + if (in_array($in, array( |
|
106 | + 'false', |
|
107 | + 'False', |
|
108 | + 'FALSE', |
|
109 | + 'no', |
|
110 | + 'No', |
|
111 | + 'n', |
|
112 | + 'N', |
|
113 | + '0', |
|
114 | + 'off', |
|
115 | + 'Off', |
|
116 | + 'OFF', |
|
117 | + false, |
|
118 | + 0, |
|
119 | + null |
|
120 | + ), true)) { |
|
121 | + $out = false; |
|
122 | + } else if ($strict) { |
|
123 | + // if strict, check the equivalent true values |
|
124 | + if (in_array($in, array( |
|
125 | + 'true', |
|
126 | + 'True', |
|
127 | + 'TRUE', |
|
128 | + 'yes', |
|
129 | + 'Yes', |
|
130 | + 'y', |
|
131 | + 'Y', |
|
132 | + '1', |
|
133 | + 'on', |
|
134 | + 'On', |
|
135 | + 'ON', |
|
136 | + true, |
|
137 | + 1 |
|
138 | + ), true)) { |
|
139 | + $out = true; |
|
140 | + } |
|
141 | + } else { |
|
142 | + // not strict? let the regular php bool check figure it out (will |
|
143 | + // largely default to true) |
|
144 | + $out = ($in ? true : false); |
|
145 | + } |
|
146 | 146 | |
147 | - return $out; |
|
147 | + return $out; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | */ |
158 | 158 | function gdsc_is_post_type_valid($incoming_post_type) |
159 | 159 | { |
160 | - $post_types = geodir_get_posttypes(); |
|
161 | - $post_types = array_map('geodir_strtolower', $post_types); |
|
162 | - $post_type_found = false; |
|
163 | - foreach ($post_types as $type) { |
|
164 | - if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
165 | - $post_type_found = true; |
|
166 | - } |
|
167 | - } |
|
160 | + $post_types = geodir_get_posttypes(); |
|
161 | + $post_types = array_map('geodir_strtolower', $post_types); |
|
162 | + $post_type_found = false; |
|
163 | + foreach ($post_types as $type) { |
|
164 | + if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
165 | + $post_type_found = true; |
|
166 | + } |
|
167 | + } |
|
168 | 168 | |
169 | - return $post_type_found; |
|
169 | + return $post_type_found; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -186,52 +186,52 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function gdsc_listing_loop_filter($query) |
188 | 188 | { |
189 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
190 | - |
|
191 | - $geodir_post_type = geodir_get_current_posttype(); |
|
192 | - |
|
193 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
194 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
195 | - |
|
196 | - if (isset($wp_query->query[$taxonomies[0]])) { |
|
197 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
198 | - $request_term = end($request_term); |
|
199 | - if (!term_exists($request_term)) { |
|
200 | - $args = array('number' => '1',); |
|
201 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
202 | - foreach ($terms_arr as $location_term) { |
|
203 | - $term_arr = $location_term; |
|
204 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
205 | - } |
|
206 | - $wp_query->queried_object_id = 1; |
|
207 | - $wp_query->queried_object = $term_arr; |
|
208 | - } |
|
209 | - } |
|
189 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
190 | + |
|
191 | + $geodir_post_type = geodir_get_current_posttype(); |
|
192 | + |
|
193 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
194 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
195 | + |
|
196 | + if (isset($wp_query->query[$taxonomies[0]])) { |
|
197 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
198 | + $request_term = end($request_term); |
|
199 | + if (!term_exists($request_term)) { |
|
200 | + $args = array('number' => '1',); |
|
201 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
202 | + foreach ($terms_arr as $location_term) { |
|
203 | + $term_arr = $location_term; |
|
204 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
205 | + } |
|
206 | + $wp_query->queried_object_id = 1; |
|
207 | + $wp_query->queried_object = $term_arr; |
|
208 | + } |
|
209 | + } |
|
210 | 210 | |
211 | - } |
|
212 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
211 | + } |
|
212 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
213 | 213 | |
214 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
214 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
215 | 215 | |
216 | - add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
217 | - add_filter('posts_join', 'geodir_posts_join', 1); |
|
218 | - geodir_post_where(); |
|
219 | - if (!is_admin()) { |
|
220 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
221 | - } |
|
216 | + add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
217 | + add_filter('posts_join', 'geodir_posts_join', 1); |
|
218 | + geodir_post_where(); |
|
219 | + if (!is_admin()) { |
|
220 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
221 | + } |
|
222 | 222 | |
223 | - // advanced filter for popular post view widget |
|
224 | - global $wp_query; |
|
225 | - if (!is_admin()) { |
|
226 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
227 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
228 | - } |
|
229 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
230 | - } |
|
223 | + // advanced filter for popular post view widget |
|
224 | + global $wp_query; |
|
225 | + if (!is_admin()) { |
|
226 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
227 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
228 | + } |
|
229 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
230 | + } |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - return $query; |
|
234 | + return $query; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -245,40 +245,40 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function gdsc_manage_category_choice($post_type, $category) |
247 | 247 | { |
248 | - if (0 == $category || '' == $category) { |
|
249 | - return ''; |
|
250 | - } |
|
248 | + if (0 == $category || '' == $category) { |
|
249 | + return ''; |
|
250 | + } |
|
251 | 251 | |
252 | - if (!(gdsc_is_post_type_valid($post_type))) { |
|
253 | - return ''; |
|
254 | - } |
|
252 | + if (!(gdsc_is_post_type_valid($post_type))) { |
|
253 | + return ''; |
|
254 | + } |
|
255 | 255 | |
256 | - $taxonomies = geodir_get_taxonomies($post_type); |
|
256 | + $taxonomies = geodir_get_taxonomies($post_type); |
|
257 | 257 | |
258 | - $categories = get_terms(array('taxonomy' => $taxonomies[0],'hide_empty' => false)); |
|
258 | + $categories = get_terms(array('taxonomy' => $taxonomies[0],'hide_empty' => false)); |
|
259 | 259 | |
260 | - $cat_id = 0; |
|
260 | + $cat_id = 0; |
|
261 | 261 | |
262 | - foreach ($categories as $cat) { |
|
263 | - if (is_numeric($category)) { |
|
264 | - if (absint($category) == $cat->term_id) { |
|
265 | - $cat_id = $cat->term_id; |
|
266 | - break; |
|
267 | - } |
|
268 | - } else { |
|
269 | - if ($category == $cat->slug) { |
|
270 | - $cat_id = $cat->term_id; |
|
271 | - break; |
|
272 | - } |
|
262 | + foreach ($categories as $cat) { |
|
263 | + if (is_numeric($category)) { |
|
264 | + if (absint($category) == $cat->term_id) { |
|
265 | + $cat_id = $cat->term_id; |
|
266 | + break; |
|
267 | + } |
|
268 | + } else { |
|
269 | + if ($category == $cat->slug) { |
|
270 | + $cat_id = $cat->term_id; |
|
271 | + break; |
|
272 | + } |
|
273 | 273 | |
274 | - if ($category == $cat->name) { |
|
275 | - $cat_id = $cat->term_id; |
|
276 | - break; |
|
277 | - } |
|
278 | - } |
|
279 | - } |
|
274 | + if ($category == $cat->name) { |
|
275 | + $cat_id = $cat->term_id; |
|
276 | + break; |
|
277 | + } |
|
278 | + } |
|
279 | + } |
|
280 | 280 | |
281 | - return $cat_id; |
|
281 | + return $cat_id; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // @todo: Extract this |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | * Adds the script in the page footer for the home page google map. |
289 | 289 | * |
290 | 290 | * @since 1.0.0 |
291 | - * @return string Print the script in page footer. |
|
291 | + * @return string Print the script in page footer. |
|
292 | 292 | */ |
293 | 293 | function geodir_home_map_add_script() |
294 | - { |
|
295 | - ?> |
|
294 | + { |
|
295 | + ?> |
|
296 | 296 | <script type="text/javascript"> |
297 | 297 | jQuery(document).ready(function () { |
298 | 298 | geoDirMapSlide(); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | </script> |
367 | 367 | <?php |
368 | - } |
|
368 | + } |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | function geodir_popular_category_add_scripts() |
378 | 378 | { |
379 | - ?> |
|
379 | + ?> |
|
380 | 380 | <script type="text/javascript"> |
381 | 381 | jQuery(function ($) { |
382 | 382 | $('.geodir-showcat').click(function () { |
@@ -406,56 +406,56 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function gdsc_validate_layout_choice($layout_choice) |
408 | 408 | { |
409 | - switch (geodir_strtolower($layout_choice)) { |
|
410 | - case 'list'; |
|
411 | - case 'one'; |
|
412 | - case 'one_column'; |
|
413 | - case 'onecolumn'; |
|
414 | - case '1'; |
|
415 | - $layout_choice = 'list'; |
|
416 | - break; |
|
417 | - case 'gridview_onehalf'; |
|
418 | - case 'two'; |
|
419 | - case 'two_column'; |
|
420 | - case 'two_columns'; |
|
421 | - case 'twocolumn'; |
|
422 | - case 'twocolumns'; |
|
423 | - case '2'; |
|
424 | - $layout_choice = 'gridview_onehalf'; |
|
425 | - break; |
|
426 | - case 'gridview_onethird'; |
|
427 | - case 'three'; |
|
428 | - case 'three_column'; |
|
429 | - case 'three_columns'; |
|
430 | - case 'threecolumn'; |
|
431 | - case 'threecolumns'; |
|
432 | - case '3'; |
|
433 | - $layout_choice = 'gridview_onethird'; |
|
434 | - break; |
|
435 | - case 'gridview_onefourth'; |
|
436 | - case 'four'; |
|
437 | - case 'four_column'; |
|
438 | - case 'four_columns'; |
|
439 | - case 'fourcolumn'; |
|
440 | - case 'fourcolumns'; |
|
441 | - case '4'; |
|
442 | - $layout_choice = 'gridview_onefourth'; |
|
443 | - break; |
|
444 | - case 'gridview_onefifth'; |
|
445 | - case 'five'; |
|
446 | - case 'five_column'; |
|
447 | - case 'five_columns'; |
|
448 | - case 'fivecolumn'; |
|
449 | - case 'fivecolumns'; |
|
450 | - case '5'; |
|
451 | - $layout_choice = 'gridview_onefifth'; |
|
452 | - break; |
|
453 | - default: |
|
454 | - $layout_choice = 'gridview_onehalf'; |
|
455 | - break; |
|
456 | - } |
|
409 | + switch (geodir_strtolower($layout_choice)) { |
|
410 | + case 'list'; |
|
411 | + case 'one'; |
|
412 | + case 'one_column'; |
|
413 | + case 'onecolumn'; |
|
414 | + case '1'; |
|
415 | + $layout_choice = 'list'; |
|
416 | + break; |
|
417 | + case 'gridview_onehalf'; |
|
418 | + case 'two'; |
|
419 | + case 'two_column'; |
|
420 | + case 'two_columns'; |
|
421 | + case 'twocolumn'; |
|
422 | + case 'twocolumns'; |
|
423 | + case '2'; |
|
424 | + $layout_choice = 'gridview_onehalf'; |
|
425 | + break; |
|
426 | + case 'gridview_onethird'; |
|
427 | + case 'three'; |
|
428 | + case 'three_column'; |
|
429 | + case 'three_columns'; |
|
430 | + case 'threecolumn'; |
|
431 | + case 'threecolumns'; |
|
432 | + case '3'; |
|
433 | + $layout_choice = 'gridview_onethird'; |
|
434 | + break; |
|
435 | + case 'gridview_onefourth'; |
|
436 | + case 'four'; |
|
437 | + case 'four_column'; |
|
438 | + case 'four_columns'; |
|
439 | + case 'fourcolumn'; |
|
440 | + case 'fourcolumns'; |
|
441 | + case '4'; |
|
442 | + $layout_choice = 'gridview_onefourth'; |
|
443 | + break; |
|
444 | + case 'gridview_onefifth'; |
|
445 | + case 'five'; |
|
446 | + case 'five_column'; |
|
447 | + case 'five_columns'; |
|
448 | + case 'fivecolumn'; |
|
449 | + case 'fivecolumns'; |
|
450 | + case '5'; |
|
451 | + $layout_choice = 'gridview_onefifth'; |
|
452 | + break; |
|
453 | + default: |
|
454 | + $layout_choice = 'gridview_onehalf'; |
|
455 | + break; |
|
456 | + } |
|
457 | 457 | |
458 | - return $layout_choice; |
|
458 | + return $layout_choice; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -472,34 +472,34 @@ discard block |
||
472 | 472 | */ |
473 | 473 | function gdsc_validate_sort_choice($sort_choice, $post_type = '') |
474 | 474 | { |
475 | - global $plugin_prefix; |
|
476 | - |
|
477 | - $sorts = array( |
|
478 | - 'az', |
|
479 | - 'latest', |
|
480 | - 'featured', |
|
481 | - 'high_review', |
|
482 | - 'high_rating', |
|
483 | - 'random', |
|
484 | - ); |
|
485 | - |
|
486 | - if (in_array($sort_choice, $sorts)) { |
|
487 | - return $sort_choice; |
|
488 | - } |
|
475 | + global $plugin_prefix; |
|
476 | + |
|
477 | + $sorts = array( |
|
478 | + 'az', |
|
479 | + 'latest', |
|
480 | + 'featured', |
|
481 | + 'high_review', |
|
482 | + 'high_rating', |
|
483 | + 'random', |
|
484 | + ); |
|
485 | + |
|
486 | + if (in_array($sort_choice, $sorts)) { |
|
487 | + return $sort_choice; |
|
488 | + } |
|
489 | 489 | |
490 | - if (!empty($post_type)) { |
|
491 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
490 | + if (!empty($post_type)) { |
|
491 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
492 | 492 | |
493 | - if (!geodir_prepare_custom_sorting($sort_choice, $table)) { |
|
494 | - $sort_choice = ''; |
|
495 | - } |
|
496 | - } |
|
493 | + if (!geodir_prepare_custom_sorting($sort_choice, $table)) { |
|
494 | + $sort_choice = ''; |
|
495 | + } |
|
496 | + } |
|
497 | 497 | |
498 | - if (empty($post_type) || empty($sort_choice)) { |
|
499 | - $sort_choice = 'latest'; |
|
500 | - } |
|
498 | + if (empty($post_type) || empty($sort_choice)) { |
|
499 | + $sort_choice = 'latest'; |
|
500 | + } |
|
501 | 501 | |
502 | - return $sort_choice; |
|
502 | + return $sort_choice; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -512,22 +512,22 @@ discard block |
||
512 | 512 | */ |
513 | 513 | function gdsc_validate_listing_width($width_choice) |
514 | 514 | { |
515 | - if (!(empty($width_choice))) { |
|
516 | - $width_choice = absint($width_choice); |
|
517 | - } else { |
|
518 | - return ''; |
|
519 | - } |
|
515 | + if (!(empty($width_choice))) { |
|
516 | + $width_choice = absint($width_choice); |
|
517 | + } else { |
|
518 | + return ''; |
|
519 | + } |
|
520 | 520 | |
521 | - if (100 < $width_choice) { |
|
522 | - $width_choice = 100; |
|
523 | - } |
|
521 | + if (100 < $width_choice) { |
|
522 | + $width_choice = 100; |
|
523 | + } |
|
524 | 524 | |
525 | - // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
526 | - if (10 > $width_choice) { |
|
527 | - $width_choice = 10; |
|
528 | - } |
|
525 | + // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
526 | + if (10 > $width_choice) { |
|
527 | + $width_choice = 10; |
|
528 | + } |
|
529 | 529 | |
530 | - return $width_choice; |
|
530 | + return $width_choice; |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -540,18 +540,18 @@ discard block |
||
540 | 540 | */ |
541 | 541 | function gdsc_validate_list_filter_choice($filter_choice) |
542 | 542 | { |
543 | - $filters = array( |
|
544 | - 'all', |
|
545 | - 'today', |
|
546 | - 'upcoming', |
|
547 | - 'past', |
|
548 | - ); |
|
549 | - |
|
550 | - if (!(in_array($filter_choice, $filters))) { |
|
551 | - $filter_choice = 'all'; |
|
552 | - } |
|
543 | + $filters = array( |
|
544 | + 'all', |
|
545 | + 'today', |
|
546 | + 'upcoming', |
|
547 | + 'past', |
|
548 | + ); |
|
549 | + |
|
550 | + if (!(in_array($filter_choice, $filters))) { |
|
551 | + $filter_choice = 'all'; |
|
552 | + } |
|
553 | 553 | |
554 | - return $filter_choice; |
|
554 | + return $filter_choice; |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | /** |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * @return string Listings HTML content. |
575 | 575 | */ |
576 | 576 | function geodir_sc_gd_listings_output($args = array()) { |
577 | - $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
577 | + $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
578 | 578 | $post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place'; |
579 | 579 | $category = !empty($args['category']) ? $args['category'] : '0'; |
580 | 580 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
@@ -585,17 +585,17 @@ discard block |
||
585 | 585 | $listing_width = !empty($args['listing_width']) ? $args['listing_width'] : ''; |
586 | 586 | $with_pagination = !empty($args['with_pagination']) ? true : false; |
587 | 587 | $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
588 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
589 | - $tags = !empty($args['tags']) ? $args['tags'] : array(); |
|
590 | - /** |
|
591 | - * Filter the content text displayed when no listings found. |
|
592 | - * |
|
593 | - * @since 1.6.0 |
|
594 | - * |
|
595 | - * @param string $shortcode_content The shortcode content text. |
|
596 | - * @param array $args Array of arguements to filter listings. |
|
597 | - */ |
|
598 | - $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
588 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
589 | + $tags = !empty($args['tags']) ? $args['tags'] : array(); |
|
590 | + /** |
|
591 | + * Filter the content text displayed when no listings found. |
|
592 | + * |
|
593 | + * @since 1.6.0 |
|
594 | + * |
|
595 | + * @param string $shortcode_content The shortcode content text. |
|
596 | + * @param array $args Array of arguements to filter listings. |
|
597 | + */ |
|
598 | + $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
599 | 599 | |
600 | 600 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
601 | 601 | $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
@@ -607,92 +607,92 @@ discard block |
||
607 | 607 | $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
608 | 608 | |
609 | 609 | $query_args = array( |
610 | - 'posts_per_page' => $post_number, |
|
611 | - 'is_geodir_loop' => true, |
|
612 | - 'gd_location' => $add_location_filter, |
|
613 | - 'post_type' => $post_type, |
|
614 | - 'order_by' => $list_sort, |
|
610 | + 'posts_per_page' => $post_number, |
|
611 | + 'is_geodir_loop' => true, |
|
612 | + 'gd_location' => $add_location_filter, |
|
613 | + 'post_type' => $post_type, |
|
614 | + 'order_by' => $list_sort, |
|
615 | 615 | 'pageno' => $pageno |
616 | - ); |
|
616 | + ); |
|
617 | 617 | |
618 | - if ($character_count >= 0) { |
|
619 | - $query_args['excerpt_length'] = $character_count; |
|
620 | - } |
|
618 | + if ($character_count >= 0) { |
|
619 | + $query_args['excerpt_length'] = $character_count; |
|
620 | + } |
|
621 | 621 | |
622 | - if (!empty($args['post_author'])) { |
|
623 | - $query_args['post_author'] = $args['post_author']; |
|
624 | - } |
|
622 | + if (!empty($args['post_author'])) { |
|
623 | + $query_args['post_author'] = $args['post_author']; |
|
624 | + } |
|
625 | 625 | |
626 | - if (!empty($args['show_featured_only'])) { |
|
627 | - $query_args['show_featured_only'] = 1; |
|
628 | - } |
|
626 | + if (!empty($args['show_featured_only'])) { |
|
627 | + $query_args['show_featured_only'] = 1; |
|
628 | + } |
|
629 | 629 | |
630 | - if (!empty($args['show_special_only'])) { |
|
631 | - $query_args['show_special_only'] = 1; |
|
632 | - } |
|
630 | + if (!empty($args['show_special_only'])) { |
|
631 | + $query_args['show_special_only'] = 1; |
|
632 | + } |
|
633 | 633 | |
634 | - if (!empty($args['with_pics_only'])) { |
|
635 | - $query_args['with_pics_only'] = 0; |
|
636 | - $query_args['featured_image_only'] = 1; |
|
637 | - } |
|
634 | + if (!empty($args['with_pics_only'])) { |
|
635 | + $query_args['with_pics_only'] = 0; |
|
636 | + $query_args['featured_image_only'] = 1; |
|
637 | + } |
|
638 | 638 | |
639 | - if (!empty($args['with_videos_only'])) { |
|
640 | - $query_args['with_videos_only'] = 1; |
|
641 | - } |
|
639 | + if (!empty($args['with_videos_only'])) { |
|
640 | + $query_args['with_videos_only'] = 1; |
|
641 | + } |
|
642 | 642 | |
643 | - if (!empty($args['show_favorites_only'])) { |
|
644 | - $query_args['show_favorites_only'] = 1; |
|
645 | - $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0; |
|
646 | - } |
|
647 | - $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
643 | + if (!empty($args['show_favorites_only'])) { |
|
644 | + $query_args['show_favorites_only'] = 1; |
|
645 | + $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0; |
|
646 | + } |
|
647 | + $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
648 | 648 | |
649 | - if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
650 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
649 | + if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
650 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
651 | 651 | |
652 | - ######### WPML ######### |
|
653 | - if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { |
|
654 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
655 | - } |
|
656 | - ######### WPML ######### |
|
652 | + ######### WPML ######### |
|
653 | + if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { |
|
654 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
655 | + } |
|
656 | + ######### WPML ######### |
|
657 | 657 | |
658 | - $tax_query = array( |
|
659 | - 'taxonomy' => $category_taxonomy[0], |
|
660 | - 'field' => 'id', |
|
661 | - 'terms' => $category |
|
662 | - ); |
|
658 | + $tax_query = array( |
|
659 | + 'taxonomy' => $category_taxonomy[0], |
|
660 | + 'field' => 'id', |
|
661 | + 'terms' => $category |
|
662 | + ); |
|
663 | 663 | |
664 | - $query_args['tax_query'] = array($tax_query); |
|
665 | - } |
|
664 | + $query_args['tax_query'] = array($tax_query); |
|
665 | + } |
|
666 | 666 | |
667 | - if (!empty($tags)) { |
|
668 | - // Clean tags |
|
669 | - if (!is_array($tags)) { |
|
670 | - $comma = _x(',', 'tag delimiter'); |
|
671 | - if ( ',' !== $comma ) { |
|
672 | - $tags = str_replace($comma, ',', $tags); |
|
673 | - } |
|
674 | - $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
|
675 | - $tags = array_map('trim', $tags); |
|
676 | - } |
|
667 | + if (!empty($tags)) { |
|
668 | + // Clean tags |
|
669 | + if (!is_array($tags)) { |
|
670 | + $comma = _x(',', 'tag delimiter'); |
|
671 | + if ( ',' !== $comma ) { |
|
672 | + $tags = str_replace($comma, ',', $tags); |
|
673 | + } |
|
674 | + $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
|
675 | + $tags = array_map('trim', $tags); |
|
676 | + } |
|
677 | 677 | |
678 | - if (!empty($tags)) { |
|
679 | - $tag_query = array( |
|
680 | - 'taxonomy' => $post_type . '_tags', |
|
681 | - 'field' => 'name', |
|
682 | - 'terms' => $tags |
|
683 | - ); |
|
684 | - |
|
685 | - if (!empty($query_args['tax_query'])) { |
|
686 | - $query_args['tax_query'][] = $tag_query; |
|
687 | - } else { |
|
688 | - $query_args['tax_query'] = array($tag_query); |
|
689 | - } |
|
690 | - } |
|
691 | - } |
|
678 | + if (!empty($tags)) { |
|
679 | + $tag_query = array( |
|
680 | + 'taxonomy' => $post_type . '_tags', |
|
681 | + 'field' => 'name', |
|
682 | + 'terms' => $tags |
|
683 | + ); |
|
684 | + |
|
685 | + if (!empty($query_args['tax_query'])) { |
|
686 | + $query_args['tax_query'][] = $tag_query; |
|
687 | + } else { |
|
688 | + $query_args['tax_query'] = array($tag_query); |
|
689 | + } |
|
690 | + } |
|
691 | + } |
|
692 | 692 | |
693 | - global $gridview_columns_widget, $geodir_is_widget_listing; |
|
693 | + global $gridview_columns_widget, $geodir_is_widget_listing; |
|
694 | 694 | |
695 | - if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
695 | + if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
696 | 696 | global $geodir_event_widget_listview; |
697 | 697 | $geodir_event_widget_listview = true; |
698 | 698 | |
@@ -707,16 +707,16 @@ discard block |
||
707 | 707 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); |
708 | 708 | } |
709 | 709 | $current_gridview_columns_widget = $gridview_columns_widget; |
710 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
711 | - ob_start(); |
|
710 | + $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
711 | + ob_start(); |
|
712 | 712 | if (!empty($widget_listings) || $with_no_results) { |
713 | 713 | if (!$geodir_ajax) { |
714 | - /** |
|
715 | - * Called before the shortcode [gd_listings] content is output. |
|
716 | - * |
|
717 | - * @since 1.0.0 |
|
718 | - */ |
|
719 | - do_action('geodir_before_sc_gd_listings'); |
|
714 | + /** |
|
715 | + * Called before the shortcode [gd_listings] content is output. |
|
716 | + * |
|
717 | + * @since 1.0.0 |
|
718 | + */ |
|
719 | + do_action('geodir_before_sc_gd_listings'); |
|
720 | 720 | ?> |
721 | 721 | <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> |
722 | 722 | <?php if ($title != '') { ?> |
@@ -727,63 +727,63 @@ discard block |
||
727 | 727 | <div class="gd-sc-loader"> |
728 | 728 | <div class="gd-sc-content"> |
729 | 729 | <?php } |
730 | - if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
731 | - if (strstr($layout, 'gridview')) { |
|
732 | - $listing_view_exp = explode('_', $layout); |
|
733 | - $gridview_columns_widget = $layout; |
|
734 | - $layout = $listing_view_exp[0]; |
|
735 | - } else { |
|
736 | - $gridview_columns_widget = ''; |
|
737 | - } |
|
738 | - |
|
739 | - /** |
|
740 | - * Filter the widget listing listview template. |
|
741 | - * |
|
742 | - * @since 1.0.0 |
|
743 | - * |
|
744 | - * @param string The template file to display listing. |
|
745 | - */ |
|
746 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
730 | + if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
731 | + if (strstr($layout, 'gridview')) { |
|
732 | + $listing_view_exp = explode('_', $layout); |
|
733 | + $gridview_columns_widget = $layout; |
|
734 | + $layout = $listing_view_exp[0]; |
|
735 | + } else { |
|
736 | + $gridview_columns_widget = ''; |
|
737 | + } |
|
738 | + |
|
739 | + /** |
|
740 | + * Filter the widget listing listview template. |
|
741 | + * |
|
742 | + * @since 1.0.0 |
|
743 | + * |
|
744 | + * @param string The template file to display listing. |
|
745 | + */ |
|
746 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
747 | 747 | |
748 | - global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
749 | - |
|
750 | - $current_post = $post; |
|
751 | - $current_map_jason = $map_jason; |
|
752 | - $current_map_canvas_arr = $map_canvas_arr; |
|
753 | - $geodir_is_widget_listing = true; |
|
754 | - $gd_session->un_set('gd_listing_view'); |
|
755 | - |
|
756 | - if ($with_pagination && $top_pagination) { |
|
757 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
758 | - } |
|
759 | - |
|
760 | - /** |
|
761 | - * Includes listing listview template. |
|
762 | - * |
|
763 | - * @since 1.0.0 |
|
764 | - */ |
|
765 | - include($template); |
|
748 | + global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
749 | + |
|
750 | + $current_post = $post; |
|
751 | + $current_map_jason = $map_jason; |
|
752 | + $current_map_canvas_arr = $map_canvas_arr; |
|
753 | + $geodir_is_widget_listing = true; |
|
754 | + $gd_session->un_set('gd_listing_view'); |
|
755 | + |
|
756 | + if ($with_pagination && $top_pagination) { |
|
757 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
758 | + } |
|
759 | + |
|
760 | + /** |
|
761 | + * Includes listing listview template. |
|
762 | + * |
|
763 | + * @since 1.0.0 |
|
764 | + */ |
|
765 | + include($template); |
|
766 | 766 | |
767 | - if ($with_pagination && $bottom_pagination) { |
|
768 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
769 | - } |
|
770 | - |
|
771 | - $geodir_is_widget_listing = false; |
|
772 | - |
|
773 | - $GLOBALS['post'] = $current_post; |
|
774 | - if (!empty($current_post)) { |
|
775 | - setup_postdata($current_post); |
|
776 | - } |
|
777 | - $map_jason = $current_map_jason; |
|
778 | - $map_canvas_arr = $current_map_canvas_arr; |
|
779 | - global $gridview_columns_widget; |
|
780 | - $gridview_columns_widget = $current_gridview_columns_widget; |
|
781 | - } else { |
|
782 | - echo $shortcode_content; |
|
783 | - } |
|
767 | + if ($with_pagination && $bottom_pagination) { |
|
768 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
769 | + } |
|
770 | + |
|
771 | + $geodir_is_widget_listing = false; |
|
772 | + |
|
773 | + $GLOBALS['post'] = $current_post; |
|
774 | + if (!empty($current_post)) { |
|
775 | + setup_postdata($current_post); |
|
776 | + } |
|
777 | + $map_jason = $current_map_jason; |
|
778 | + $map_canvas_arr = $current_map_canvas_arr; |
|
779 | + global $gridview_columns_widget; |
|
780 | + $gridview_columns_widget = $current_gridview_columns_widget; |
|
781 | + } else { |
|
782 | + echo $shortcode_content; |
|
783 | + } |
|
784 | 784 | ?> |
785 | 785 | <?php |
786 | - if (!$geodir_ajax) { |
|
786 | + if (!$geodir_ajax) { |
|
787 | 787 | ?> |
788 | 788 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fas fa-cog fa-spin"></i></p></div> |
789 | 789 | <script type="text/javascript"> |
@@ -822,10 +822,10 @@ discard block |
||
822 | 822 | loading.hide(); |
823 | 823 | jQuery(items).html(response); |
824 | 824 | <?php |
825 | - /** |
|
826 | - * if lazyload images enabled then refresh them once ajax page changed. |
|
827 | - */ |
|
828 | - if (get_option('geodir_lazy_load', 1)) { ?> |
|
825 | + /** |
|
826 | + * if lazyload images enabled then refresh them once ajax page changed. |
|
827 | + */ |
|
828 | + if (get_option('geodir_lazy_load', 1)) { ?> |
|
829 | 829 | geodir_init_lazy_load(); |
830 | 830 | <?php } ?> |
831 | 831 | } |
@@ -836,11 +836,11 @@ discard block |
||
836 | 836 | </div> |
837 | 837 | <?php } ?> |
838 | 838 | <?php |
839 | - } |
|
839 | + } |
|
840 | 840 | $output = ob_get_contents(); |
841 | - ob_end_clean(); |
|
841 | + ob_end_clean(); |
|
842 | 842 | |
843 | - return trim($output); |
|
843 | + return trim($output); |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | /** |
@@ -867,15 +867,15 @@ discard block |
||
867 | 867 | * @return string Listings pagination HTML content. |
868 | 868 | */ |
869 | 869 | function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
870 | - if (empty($prelabel)) { |
|
871 | - $prelabel = '<strong>«</strong>'; |
|
872 | - } |
|
870 | + if (empty($prelabel)) { |
|
871 | + $prelabel = '<strong>«</strong>'; |
|
872 | + } |
|
873 | 873 | |
874 | - if (empty($nxtlabel)) { |
|
875 | - $nxtlabel = '<strong>»</strong>'; |
|
876 | - } |
|
874 | + if (empty($nxtlabel)) { |
|
875 | + $nxtlabel = '<strong>»</strong>'; |
|
876 | + } |
|
877 | 877 | |
878 | - $half_pages_to_show = round($pages_to_show / 2); |
|
878 | + $half_pages_to_show = round($pages_to_show / 2); |
|
879 | 879 | |
880 | 880 | $numposts = $total_posts; |
881 | 881 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | } |
909 | 909 | |
910 | 910 | if (($pageno - 1) > 0) { |
911 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
911 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -931,9 +931,9 @@ discard block |
||
931 | 931 | echo "</div> $after </div>"; |
932 | 932 | } |
933 | 933 | $output = ob_get_contents(); |
934 | - ob_end_clean(); |
|
934 | + ob_end_clean(); |
|
935 | 935 | |
936 | - return trim($output); |
|
936 | + return trim($output); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | /** |
@@ -944,10 +944,10 @@ discard block |
||
944 | 944 | * @return string Listings HTML content. |
945 | 945 | */ |
946 | 946 | function geodir_sclistings_callback() { |
947 | - check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
948 | - //set variables |
|
949 | - $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
950 | - $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
947 | + check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
948 | + //set variables |
|
949 | + $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
950 | + $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
951 | 951 | |
952 | 952 | $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
953 | 953 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | } else { |
960 | 960 | echo 0; |
961 | 961 | } |
962 | - wp_die(); |
|
962 | + wp_die(); |
|
963 | 963 | } |
964 | 964 | add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback'); |
965 | 965 | add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback'); |
966 | 966 | \ No newline at end of file |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | $value = 100; |
30 | 30 | } |
31 | 31 | // Re-add the percent symbol |
32 | - $value = $value . '%'; |
|
32 | + $value = $value.'%'; |
|
33 | 33 | } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
34 | 34 | // Get the absint & re-add the 'px' |
35 | - $value = preg_replace('/\D/', '', $value) . 'px'; |
|
35 | + $value = preg_replace('/\D/', '', $value).'px'; |
|
36 | 36 | } else { |
37 | 37 | $value = preg_replace('/\D/', '', $value); |
38 | 38 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
213 | 213 | |
214 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
214 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
215 | 215 | |
216 | 216 | add_filter('posts_fields', 'geodir_posts_fields', 1); |
217 | 217 | add_filter('posts_join', 'geodir_posts_join', 1); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | $taxonomies = geodir_get_taxonomies($post_type); |
257 | 257 | |
258 | - $categories = get_terms(array('taxonomy' => $taxonomies[0],'hide_empty' => false)); |
|
258 | + $categories = get_terms(array('taxonomy' => $taxonomies[0], 'hide_empty' => false)); |
|
259 | 259 | |
260 | 260 | $cat_id = 0; |
261 | 261 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | } |
489 | 489 | |
490 | 490 | if (!empty($post_type)) { |
491 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
491 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
492 | 492 | |
493 | 493 | if (!geodir_prepare_custom_sorting($sort_choice, $table)) { |
494 | 494 | $sort_choice = ''; |
@@ -581,10 +581,10 @@ discard block |
||
581 | 581 | $add_location_filter = !empty($args['add_location_filter']) ? true : false; |
582 | 582 | $list_sort = !empty($args['list_sort']) ? $args['list_sort'] : 'latest'; |
583 | 583 | $character_count = isset($args['character_count']) ? $args['character_count'] : ''; |
584 | - $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
584 | + $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
585 | 585 | $listing_width = !empty($args['listing_width']) ? $args['listing_width'] : ''; |
586 | - $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
587 | - $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
586 | + $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
587 | + $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
588 | 588 | $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
589 | 589 | $tags = !empty($args['tags']) ? $args['tags'] : array(); |
590 | 590 | /** |
@@ -598,13 +598,13 @@ discard block |
||
598 | 598 | $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
599 | 599 | |
600 | 600 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
601 | - $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
601 | + $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
602 | 602 | |
603 | 603 | $shortcode_atts = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array(); |
604 | 604 | |
605 | 605 | // ajax mode |
606 | - $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
607 | - $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
606 | + $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
607 | + $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
608 | 608 | |
609 | 609 | $query_args = array( |
610 | 610 | 'posts_per_page' => $post_number, |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | // Clean tags |
669 | 669 | if (!is_array($tags)) { |
670 | 670 | $comma = _x(',', 'tag delimiter'); |
671 | - if ( ',' !== $comma ) { |
|
671 | + if (',' !== $comma) { |
|
672 | 672 | $tags = str_replace($comma, ',', $tags); |
673 | 673 | } |
674 | 674 | $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | |
678 | 678 | if (!empty($tags)) { |
679 | 679 | $tag_query = array( |
680 | - 'taxonomy' => $post_type . '_tags', |
|
680 | + 'taxonomy' => $post_type.'_tags', |
|
681 | 681 | 'field' => 'name', |
682 | 682 | 'terms' => $tags |
683 | 683 | ); |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); |
708 | 708 | } |
709 | 709 | $current_gridview_columns_widget = $gridview_columns_widget; |
710 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
710 | + $identifier = ' gd-wgt-pagi-'.mt_rand(); |
|
711 | 711 | ob_start(); |
712 | 712 | if (!empty($widget_listings) || $with_no_results) { |
713 | 713 | if (!$geodir_ajax) { |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | */ |
719 | 719 | do_action('geodir_before_sc_gd_listings'); |
720 | 720 | ?> |
721 | - <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> |
|
721 | + <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier; ?>"> |
|
722 | 722 | <?php if ($title != '') { ?> |
723 | 723 | <div class="geodir_list_heading clearfix"> |
724 | 724 | <?php echo $title; ?> |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fas fa-cog fa-spin"></i></p></div> |
789 | 789 | <script type="text/javascript"> |
790 | 790 | /* <![CDATA[ */ |
791 | -jQuery(document).on('click', '.<?php echo trim($identifier);?> .gd-wgt-page', function(e) { |
|
792 | - var container = jQuery( '.<?php echo trim($identifier);?>'); |
|
791 | +jQuery(document).on('click', '.<?php echo trim($identifier); ?> .gd-wgt-page', function(e) { |
|
792 | + var container = jQuery( '.<?php echo trim($identifier); ?>'); |
|
793 | 793 | var obj = this; |
794 | 794 | var pid = parseInt(jQuery(this).data('page')); |
795 | 795 | var items = jQuery(obj).closest('.gd-sc-content'); |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | return false; |
800 | 800 | } |
801 | 801 | |
802 | - var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>"; |
|
802 | + var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>"; |
|
803 | 803 | |
804 | 804 | var data = { |
805 | 805 | 'action': 'geodir_sclistings', |
@@ -889,16 +889,16 @@ discard block |
||
889 | 889 | if ($max_page > 1 || $always_show) { |
890 | 890 | // Extra pagination info |
891 | 891 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
892 | - $start_no = ( $pageno - 1 ) * $posts_per_page + 1; |
|
892 | + $start_no = ($pageno - 1) * $posts_per_page + 1; |
|
893 | 893 | $end_no = min($pageno * $posts_per_page, $numposts); |
894 | 894 | |
895 | 895 | if ($geodir_pagination_more_info != '') { |
896 | - $pagination_info = '<div class="gd-pagination-details gd-pagination-details-' . $geodir_pagination_more_info . '">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>'; |
|
896 | + $pagination_info = '<div class="gd-pagination-details gd-pagination-details-'.$geodir_pagination_more_info.'">'.wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts).'</div>'; |
|
897 | 897 | |
898 | 898 | if ($geodir_pagination_more_info == 'before') { |
899 | - $before = $before . $pagination_info; |
|
899 | + $before = $before.$pagination_info; |
|
900 | 900 | } else if ($geodir_pagination_more_info == 'after') { |
901 | - $after = $pagination_info . $after; |
|
901 | + $after = $pagination_info.$after; |
|
902 | 902 | } |
903 | 903 | } |
904 | 904 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | } |
909 | 909 | |
910 | 910 | if (($pageno - 1) > 0) { |
911 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
911 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="'.(int) ($pageno - 1).'" href="javascript:void(0);">'.$prelabel.'</a> '; |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -916,17 +916,17 @@ discard block |
||
916 | 916 | if ($i == $pageno) { |
917 | 917 | echo "<strong class='on' class='gd-page-sc-act'>$i</strong>"; |
918 | 918 | } else { |
919 | - echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="' . (int)$i . '" href="javascript:void(0);">' . $i . '</a> '; |
|
919 | + echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="'.(int) $i.'" href="javascript:void(0);">'.$i.'</a> '; |
|
920 | 920 | } |
921 | 921 | } |
922 | 922 | } |
923 | 923 | |
924 | 924 | if (($pageno + 1) <= $max_page) { |
925 | - echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="' . (int)($pageno + 1) . '" href="javascript:void(0);">' . $nxtlabel . '</a>'; |
|
925 | + echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="'.(int) ($pageno + 1).'" href="javascript:void(0);">'.$nxtlabel.'</a>'; |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | if ($pageno < $max_page) { |
929 | - echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="' . (int)$max_page . '" href="javascript:void(0);">»</a>'; |
|
929 | + echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="'.(int) $max_page.'" href="javascript:void(0);">»</a>'; |
|
930 | 930 | } |
931 | 931 | echo "</div> $after </div>"; |
932 | 932 | } |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
950 | 950 | $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
951 | 951 | |
952 | - $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
|
952 | + $shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL; |
|
953 | 953 | |
954 | 954 | if (!empty($shortcode_atts) && is_array($shortcode_atts)) { |
955 | 955 | $shortcode_atts['pageno'] = $pageno; |