@@ -142,7 +142,7 @@ |
||
142 | 142 | |
143 | 143 | if ($remove_class) { |
144 | 144 | $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
145 | - if ( $new_class == 'content' ) { |
|
145 | + if ($new_class == 'content') { |
|
146 | 146 | $new_class = 'content-no-sidebar'; |
147 | 147 | $classes[] = 'full-width-content'; |
148 | 148 | } |
@@ -17,26 +17,26 @@ discard block |
||
17 | 17 | function gd_compat_php_genesis() |
18 | 18 | { |
19 | 19 | // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS |
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | 26 | |
27 | 27 | |
28 | - // make top section wide |
|
29 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
28 | + // make top section wide |
|
29 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
35 | 35 | |
36 | - // REMOVE PAGE TITLES |
|
37 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
36 | + // REMOVE PAGE TITLES |
|
37 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | } |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | function gd_genesis_compat_left_sidebars() |
54 | 54 | { |
55 | 55 | |
56 | - if (is_page_geodir_home() || geodir_is_page('home')) { |
|
57 | - remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | - } elseif (geodir_is_page('location')) { |
|
60 | - remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | - } elseif (geodir_is_page('listing')) { |
|
63 | - remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | - add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | - } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | - //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | - //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | - } elseif (geodir_is_page('search')) { |
|
69 | - remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | - add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | - } elseif (geodir_is_page('author')) { |
|
72 | - remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | - add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | - } |
|
56 | + if (is_page_geodir_home() || geodir_is_page('home')) { |
|
57 | + remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | + } elseif (geodir_is_page('location')) { |
|
60 | + remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | + } elseif (geodir_is_page('listing')) { |
|
63 | + remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | + add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | + } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | + //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | + //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | + } elseif (geodir_is_page('search')) { |
|
69 | + remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | + add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | + } elseif (geodir_is_page('author')) { |
|
72 | + remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | + add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | } |
@@ -88,68 +88,68 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function geodir_set_body_scs($classes) |
90 | 90 | { |
91 | - $remove_class = false; |
|
92 | - $new_class = ''; |
|
93 | - if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
94 | - $remove_class = true; |
|
95 | - if (get_option('geodir_show_home_left_section')) { |
|
96 | - $new_class .= 'sidebar-'; |
|
97 | - } |
|
98 | - if (get_option('geodir_show_home_contant_section')) { |
|
99 | - $new_class .= 'content'; |
|
100 | - } |
|
101 | - if (get_option('geodir_show_home_right_section')) { |
|
102 | - $new_class .= '-sidebar'; |
|
103 | - } |
|
104 | - } elseif (geodir_is_page('listing')) { |
|
105 | - $remove_class = true; |
|
106 | - if (get_option('geodir_show_listing_left_section')) { |
|
107 | - $new_class .= 'sidebar-'; |
|
108 | - } |
|
109 | - $new_class .= 'content'; |
|
110 | - if (get_option('geodir_show_listing_right_section')) { |
|
111 | - $new_class .= '-sidebar'; |
|
112 | - } |
|
113 | - } elseif (geodir_is_page('detail')) { |
|
114 | - $remove_class = true; |
|
115 | - if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | - $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | - } else { |
|
118 | - $new_class .= 'content-sidebar'; |
|
119 | - } |
|
120 | - } elseif (geodir_is_page('search')) { |
|
121 | - $remove_class = true; |
|
122 | - if (get_option('geodir_show_search_left_section')) { |
|
123 | - $new_class .= 'sidebar-'; |
|
124 | - } |
|
125 | - $new_class .= 'content'; |
|
126 | - if (get_option('geodir_show_search_right_section')) { |
|
127 | - $new_class .= '-sidebar'; |
|
128 | - } |
|
129 | - } elseif (geodir_is_page('author')) { |
|
130 | - $remove_class = true; |
|
131 | - if (get_option('geodir_show_author_left_section')) { |
|
132 | - $new_class .= 'sidebar-'; |
|
133 | - } |
|
134 | - $new_class .= 'content'; |
|
135 | - if (get_option('geodir_show_author_right_section')) { |
|
136 | - $new_class .= '-sidebar'; |
|
137 | - } |
|
138 | - } elseif (geodir_is_page('add-listing')) { |
|
139 | - $remove_class = true; |
|
140 | - $new_class .= 'content-sidebar'; |
|
141 | - } |
|
142 | - |
|
143 | - if ($remove_class) { |
|
144 | - $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | - if ( $new_class == 'content' ) { |
|
146 | - $new_class = 'content-no-sidebar'; |
|
147 | - $classes[] = 'full-width-content'; |
|
148 | - } |
|
149 | - $classes[] = $new_class; |
|
150 | - } |
|
151 | - |
|
152 | - return $classes; |
|
91 | + $remove_class = false; |
|
92 | + $new_class = ''; |
|
93 | + if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
94 | + $remove_class = true; |
|
95 | + if (get_option('geodir_show_home_left_section')) { |
|
96 | + $new_class .= 'sidebar-'; |
|
97 | + } |
|
98 | + if (get_option('geodir_show_home_contant_section')) { |
|
99 | + $new_class .= 'content'; |
|
100 | + } |
|
101 | + if (get_option('geodir_show_home_right_section')) { |
|
102 | + $new_class .= '-sidebar'; |
|
103 | + } |
|
104 | + } elseif (geodir_is_page('listing')) { |
|
105 | + $remove_class = true; |
|
106 | + if (get_option('geodir_show_listing_left_section')) { |
|
107 | + $new_class .= 'sidebar-'; |
|
108 | + } |
|
109 | + $new_class .= 'content'; |
|
110 | + if (get_option('geodir_show_listing_right_section')) { |
|
111 | + $new_class .= '-sidebar'; |
|
112 | + } |
|
113 | + } elseif (geodir_is_page('detail')) { |
|
114 | + $remove_class = true; |
|
115 | + if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | + $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | + } else { |
|
118 | + $new_class .= 'content-sidebar'; |
|
119 | + } |
|
120 | + } elseif (geodir_is_page('search')) { |
|
121 | + $remove_class = true; |
|
122 | + if (get_option('geodir_show_search_left_section')) { |
|
123 | + $new_class .= 'sidebar-'; |
|
124 | + } |
|
125 | + $new_class .= 'content'; |
|
126 | + if (get_option('geodir_show_search_right_section')) { |
|
127 | + $new_class .= '-sidebar'; |
|
128 | + } |
|
129 | + } elseif (geodir_is_page('author')) { |
|
130 | + $remove_class = true; |
|
131 | + if (get_option('geodir_show_author_left_section')) { |
|
132 | + $new_class .= 'sidebar-'; |
|
133 | + } |
|
134 | + $new_class .= 'content'; |
|
135 | + if (get_option('geodir_show_author_right_section')) { |
|
136 | + $new_class .= '-sidebar'; |
|
137 | + } |
|
138 | + } elseif (geodir_is_page('add-listing')) { |
|
139 | + $remove_class = true; |
|
140 | + $new_class .= 'content-sidebar'; |
|
141 | + } |
|
142 | + |
|
143 | + if ($remove_class) { |
|
144 | + $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | + if ( $new_class == 'content' ) { |
|
146 | + $new_class = 'content-no-sidebar'; |
|
147 | + $classes[] = 'full-width-content'; |
|
148 | + } |
|
149 | + $classes[] = $new_class; |
|
150 | + } |
|
151 | + |
|
152 | + return $classes; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | add_action('genesis_after_header', 'gd_genesis_compat_add_top_section_back', 11); |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | function gd_genesis_compat_add_top_section_back() |
163 | 163 | { |
164 | 164 | |
165 | - if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
166 | - geodir_action_geodir_sidebar_home_top(); |
|
167 | - } elseif (geodir_is_page('listing')) { |
|
168 | - geodir_action_geodir_sidebar_listings_top(); |
|
169 | - } elseif (geodir_is_page('detail')) { |
|
170 | - geodir_action_geodir_sidebar_detail_top(); |
|
171 | - } elseif (geodir_is_page('search')) { |
|
172 | - geodir_action_geodir_sidebar_search_top(); |
|
173 | - } elseif (geodir_is_page('author')) { |
|
174 | - geodir_action_geodir_sidebar_author_top(); |
|
175 | - } |
|
165 | + if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
166 | + geodir_action_geodir_sidebar_home_top(); |
|
167 | + } elseif (geodir_is_page('listing')) { |
|
168 | + geodir_action_geodir_sidebar_listings_top(); |
|
169 | + } elseif (geodir_is_page('detail')) { |
|
170 | + geodir_action_geodir_sidebar_detail_top(); |
|
171 | + } elseif (geodir_is_page('search')) { |
|
172 | + geodir_action_geodir_sidebar_search_top(); |
|
173 | + } elseif (geodir_is_page('author')) { |
|
174 | + geodir_action_geodir_sidebar_author_top(); |
|
175 | + } |
|
176 | 176 | |
177 | 177 | |
178 | 178 | } |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | */ |
186 | 186 | function geodir_replace_breadcrumb() |
187 | 187 | { |
188 | - if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
189 | - } else { |
|
190 | - echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
191 | - geodir_breadcrumb(); |
|
192 | - echo '</div></div>'; |
|
193 | - } |
|
188 | + if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
189 | + } else { |
|
190 | + echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
191 | + geodir_breadcrumb(); |
|
192 | + echo '</div></div>'; |
|
193 | + } |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | // Force Full Width on signup page |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | */ |
204 | 204 | function geodir_genesis_meta() |
205 | 205 | { |
206 | - if (geodir_is_page('login')) { |
|
207 | - add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
208 | - } |
|
206 | + if (geodir_is_page('login')) { |
|
207 | + add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
208 | + } |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | function geodir_add_listing_page_title_genesis_before() |
219 | 219 | { |
220 | 220 | |
221 | - echo "<div class='entry' >"; |
|
221 | + echo "<div class='entry' >"; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | function geodir_add_listing_form_genesis_after() |
233 | 233 | { |
234 | 234 | |
235 | - echo "</div>"; |
|
235 | + echo "</div>"; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -251,38 +251,38 @@ discard block |
||
251 | 251 | { |
252 | 252 | |
253 | 253 | |
254 | - $title = ''; |
|
255 | - $subtitle = ''; |
|
256 | - |
|
257 | - if (geodir_is_page('listing')) { |
|
258 | - echo '<div class="wrap gd-title-wrap">'; |
|
259 | - geodir_action_listings_title(); |
|
260 | - echo '</div>'; |
|
261 | - } |
|
262 | - |
|
263 | - if (geodir_is_page('add-listing')) { |
|
264 | - echo '<div class="wrap gd-title-wrap">'; |
|
265 | - geodir_action_add_listing_page_title(); |
|
266 | - echo '</div>'; |
|
267 | - } |
|
268 | - |
|
269 | - if (geodir_is_page('author')) { |
|
270 | - echo '<div class="wrap gd-title-wrap">'; |
|
271 | - geodir_action_author_page_title(); |
|
272 | - echo '</div>'; |
|
273 | - } |
|
274 | - |
|
275 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
276 | - echo '<div class="wrap gd-title-wrap">'; |
|
277 | - echo get_the_title(); |
|
278 | - echo '</div>'; |
|
279 | - } |
|
280 | - |
|
281 | - if (geodir_is_page('search')) { |
|
282 | - echo '<div class="wrap gd-title-wrap">'; |
|
283 | - geodir_action_search_page_title(); |
|
284 | - echo '</div>'; |
|
285 | - } |
|
254 | + $title = ''; |
|
255 | + $subtitle = ''; |
|
256 | + |
|
257 | + if (geodir_is_page('listing')) { |
|
258 | + echo '<div class="wrap gd-title-wrap">'; |
|
259 | + geodir_action_listings_title(); |
|
260 | + echo '</div>'; |
|
261 | + } |
|
262 | + |
|
263 | + if (geodir_is_page('add-listing')) { |
|
264 | + echo '<div class="wrap gd-title-wrap">'; |
|
265 | + geodir_action_add_listing_page_title(); |
|
266 | + echo '</div>'; |
|
267 | + } |
|
268 | + |
|
269 | + if (geodir_is_page('author')) { |
|
270 | + echo '<div class="wrap gd-title-wrap">'; |
|
271 | + geodir_action_author_page_title(); |
|
272 | + echo '</div>'; |
|
273 | + } |
|
274 | + |
|
275 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
276 | + echo '<div class="wrap gd-title-wrap">'; |
|
277 | + echo get_the_title(); |
|
278 | + echo '</div>'; |
|
279 | + } |
|
280 | + |
|
281 | + if (geodir_is_page('search')) { |
|
282 | + echo '<div class="wrap gd-title-wrap">'; |
|
283 | + geodir_action_search_page_title(); |
|
284 | + echo '</div>'; |
|
285 | + } |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | */ |
296 | 296 | function gd_genesis_listing_page_title_bar() |
297 | 297 | { |
298 | - geodir_action_listings_title(); |
|
299 | - //geodir_action_listings_description(); |
|
298 | + geodir_action_listings_title(); |
|
299 | + //geodir_action_listings_description(); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
@@ -309,19 +309,19 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function gd_compat_php_genesis_geo_1280_fix() |
311 | 311 | { |
312 | - if (function_exists('geo1280_search_bar')) { |
|
313 | - remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
314 | - add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
312 | + if (function_exists('geo1280_search_bar')) { |
|
313 | + remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
314 | + add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
315 | 315 | |
316 | - // |
|
316 | + // |
|
317 | 317 | |
318 | - remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
319 | - remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
320 | - add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
318 | + remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
319 | + remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
320 | + add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
321 | 321 | |
322 | - remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
323 | - add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
324 | - } |
|
322 | + remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
323 | + add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
324 | + } |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | function geo1280_search_bar_fix() |
334 | 334 | { |
335 | 335 | |
336 | - echo '<div class="geo1280-placeholder"></div>'; |
|
337 | - if (is_active_sidebar('search-bar')) { |
|
338 | - genesis_widget_area('search-bar', array( |
|
339 | - 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
340 | - 'after' => '</div></div>', |
|
341 | - )); |
|
342 | - } |
|
336 | + echo '<div class="geo1280-placeholder"></div>'; |
|
337 | + if (is_active_sidebar('search-bar')) { |
|
338 | + genesis_widget_area('search-bar', array( |
|
339 | + 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
340 | + 'after' => '</div></div>', |
|
341 | + )); |
|
342 | + } |
|
343 | 343 | } |
@@ -13,34 +13,34 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function geodir_user_favourite_listing_count($user_id=false) |
15 | 15 | { |
16 | - global $wpdb, $plugin_prefix, $current_user; |
|
16 | + global $wpdb, $plugin_prefix, $current_user; |
|
17 | 17 | |
18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
19 | - if(!$user_id){return array();} |
|
18 | + if(!$user_id){$user_id = $current_user->ID;} |
|
19 | + if(!$user_id){return array();} |
|
20 | 20 | |
21 | - $site_id = ''; |
|
22 | - if ( is_multisite() ) { |
|
23 | - $blog_id = get_current_blog_id(); |
|
24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
25 | - } |
|
21 | + $site_id = ''; |
|
22 | + if ( is_multisite() ) { |
|
23 | + $blog_id = get_current_blog_id(); |
|
24 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
25 | + } |
|
26 | 26 | |
27 | - $user_favorites = geodir_get_user_favourites($user_id); |
|
28 | - $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
27 | + $user_favorites = geodir_get_user_favourites($user_id); |
|
28 | + $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
29 | 29 | |
30 | - $user_listing = array(); |
|
31 | - if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
30 | + $user_listing = array(); |
|
31 | + if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
32 | + $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
33 | 33 | |
34 | - foreach ($all_posts as $ptype) { |
|
35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
34 | + foreach ($all_posts as $ptype) { |
|
35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
36 | 36 | |
37 | - if ($total_posts > 0) { |
|
38 | - $user_listing[$ptype] = $total_posts; |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
37 | + if ($total_posts > 0) { |
|
38 | + $user_listing[$ptype] = $total_posts; |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | 42 | |
43 | - return $user_listing; |
|
43 | + return $user_listing; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,48 +50,48 @@ discard block |
||
50 | 50 | * @package GeoDirectory |
51 | 51 | */ |
52 | 52 | function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
53 | - // My Favourites in Dashboard |
|
54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
56 | - |
|
57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
58 | - $favourite_links = $output_type == 'link' ? array() : ''; |
|
59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
60 | - |
|
61 | - $author_link = get_author_posts_url( $user_id ); |
|
62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
63 | - |
|
64 | - foreach ( $post_types as $key => $postobj ) { |
|
65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
68 | - |
|
69 | - /** |
|
70 | - * Filter favorite listing link. |
|
71 | - * |
|
72 | - * @since 1.0.0 |
|
73 | - * @param string $post_type_link Favorite listing link. |
|
74 | - * @param string $key Favorite listing array key. |
|
75 | - * @param int $current_user->ID Current user ID. |
|
76 | - */ |
|
77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
78 | - |
|
79 | - if ( $output_type == 'select' ) { |
|
80 | - $selected = ''; |
|
81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
82 | - $selected = 'selected="selected"'; |
|
83 | - } |
|
84 | - |
|
85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | - } elseif ( $output_type == 'link' ) { |
|
87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
88 | - } |
|
89 | - } |
|
90 | - } |
|
91 | - |
|
92 | - if ( ! empty( $favourite_links ) ) { |
|
93 | - if ( $output_type == 'select' ) { |
|
94 | - ?> |
|
53 | + // My Favourites in Dashboard |
|
54 | + $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | + $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
56 | + |
|
57 | + if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
58 | + $favourite_links = $output_type == 'link' ? array() : ''; |
|
59 | + $post_types = geodir_get_posttypes( 'object' ); |
|
60 | + |
|
61 | + $author_link = get_author_posts_url( $user_id ); |
|
62 | + $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
63 | + |
|
64 | + foreach ( $post_types as $key => $postobj ) { |
|
65 | + if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | + $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | + $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
68 | + |
|
69 | + /** |
|
70 | + * Filter favorite listing link. |
|
71 | + * |
|
72 | + * @since 1.0.0 |
|
73 | + * @param string $post_type_link Favorite listing link. |
|
74 | + * @param string $key Favorite listing array key. |
|
75 | + * @param int $current_user->ID Current user ID. |
|
76 | + */ |
|
77 | + $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
78 | + |
|
79 | + if ( $output_type == 'select' ) { |
|
80 | + $selected = ''; |
|
81 | + if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
82 | + $selected = 'selected="selected"'; |
|
83 | + } |
|
84 | + |
|
85 | + $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | + } elseif ( $output_type == 'link' ) { |
|
87 | + $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
88 | + } |
|
89 | + } |
|
90 | + } |
|
91 | + |
|
92 | + if ( ! empty( $favourite_links ) ) { |
|
93 | + if ( $output_type == 'select' ) { |
|
94 | + ?> |
|
95 | 95 | <li> |
96 | 96 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
97 | 97 | <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
@@ -99,55 +99,55 @@ discard block |
||
99 | 99 | </select> |
100 | 100 | </li> |
101 | 101 | <?php |
102 | - } elseif ( $output_type == 'link' ) { |
|
103 | - echo implode( " | ", $favourite_links ); |
|
104 | - } |
|
105 | - } |
|
106 | - } |
|
102 | + } elseif ( $output_type == 'link' ) { |
|
103 | + echo implode( " | ", $favourite_links ); |
|
104 | + } |
|
105 | + } |
|
106 | + } |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
112 | - |
|
113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
114 | - $listing_links = $output_type == 'link' ? array() : ''; |
|
115 | - |
|
116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
117 | - |
|
118 | - $author_link = get_author_posts_url( $user_id ); |
|
119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
120 | - |
|
121 | - foreach ( $post_types as $key => $postobj ) { |
|
122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
125 | - |
|
126 | - /** |
|
127 | - * Filter my listing link. |
|
128 | - * |
|
129 | - * @since 1.0.0 |
|
130 | - * @param string $listing_link My listing link. |
|
131 | - * @param string $key My listing array key. |
|
132 | - * @param int $current_user->ID Current user ID. |
|
133 | - */ |
|
134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | - if ( $output_type == 'select' ) { |
|
136 | - $selected = ''; |
|
137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
138 | - $selected = 'selected="selected"'; |
|
139 | - } |
|
140 | - |
|
141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | - } elseif ( $output_type == 'link' ) { |
|
143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if ( ! empty( $listing_links ) ) { |
|
149 | - if ( $output_type == 'select' ) { |
|
150 | - ?> |
|
110 | + $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | + $user_listing = geodir_user_post_listing_count( $user_id ); |
|
112 | + |
|
113 | + if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
114 | + $listing_links = $output_type == 'link' ? array() : ''; |
|
115 | + |
|
116 | + $post_types = geodir_get_posttypes( 'object' ); |
|
117 | + |
|
118 | + $author_link = get_author_posts_url( $user_id ); |
|
119 | + $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
120 | + |
|
121 | + foreach ( $post_types as $key => $postobj ) { |
|
122 | + if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | + $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | + $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
125 | + |
|
126 | + /** |
|
127 | + * Filter my listing link. |
|
128 | + * |
|
129 | + * @since 1.0.0 |
|
130 | + * @param string $listing_link My listing link. |
|
131 | + * @param string $key My listing array key. |
|
132 | + * @param int $current_user->ID Current user ID. |
|
133 | + */ |
|
134 | + $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | + if ( $output_type == 'select' ) { |
|
136 | + $selected = ''; |
|
137 | + if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
138 | + $selected = 'selected="selected"'; |
|
139 | + } |
|
140 | + |
|
141 | + $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | + } elseif ( $output_type == 'link' ) { |
|
143 | + $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if ( ! empty( $listing_links ) ) { |
|
149 | + if ( $output_type == 'select' ) { |
|
150 | + ?> |
|
151 | 151 | <li> |
152 | 152 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
153 | 153 | <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | </select> |
156 | 156 | </li> |
157 | 157 | <?php |
158 | - } elseif ( $output_type == 'link' ) { |
|
159 | - echo implode( " | ", $listing_links ); |
|
160 | - } |
|
161 | - } |
|
162 | - } |
|
158 | + } elseif ( $output_type == 'link' ) { |
|
159 | + echo implode( " | ", $listing_links ); |
|
160 | + } |
|
161 | + } |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * @return mixed |
171 | 171 | */ |
172 | 172 | function geodir_get_user_favourites($user_id=''){ |
173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
174 | - $site_id = ''; |
|
175 | - if ( is_multisite() ) { |
|
176 | - $blog_id = get_current_blog_id(); |
|
177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
178 | - } |
|
179 | - |
|
180 | - return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
173 | + if(!$user_id){$user_id = get_current_user_id();} |
|
174 | + $site_id = ''; |
|
175 | + if ( is_multisite() ) { |
|
176 | + $blog_id = get_current_blog_id(); |
|
177 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
178 | + } |
|
179 | + |
|
180 | + return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
181 | 181 | } |
182 | 182 | \ No newline at end of file |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
12 | 12 | * @return array User listing count for each post type. |
13 | 13 | */ |
14 | -function geodir_user_favourite_listing_count($user_id=false) |
|
14 | +function geodir_user_favourite_listing_count($user_id = false) |
|
15 | 15 | { |
16 | 16 | global $wpdb, $plugin_prefix, $current_user; |
17 | 17 | |
18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
19 | - if(!$user_id){return array();} |
|
18 | + if (!$user_id) {$user_id = $current_user->ID; } |
|
19 | + if (!$user_id) {return array(); } |
|
20 | 20 | |
21 | 21 | $site_id = ''; |
22 | - if ( is_multisite() ) { |
|
22 | + if (is_multisite()) { |
|
23 | 23 | $blog_id = get_current_blog_id(); |
24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
24 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $user_favorites = geodir_get_user_favourites($user_id); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | |
30 | 30 | $user_listing = array(); |
31 | 31 | if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
32 | + $user_favorites = "'".implode("','", $user_favorites)."'"; |
|
33 | 33 | |
34 | 34 | foreach ($all_posts as $ptype) { |
35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_type='".$ptype."' AND post_status = 'publish' AND ID IN (".$user_favorites.")"); |
|
36 | 36 | |
37 | 37 | if ($total_posts > 0) { |
38 | 38 | $user_listing[$ptype] = $total_posts; |
@@ -49,22 +49,22 @@ discard block |
||
49 | 49 | * @since 1.5.9 |
50 | 50 | * @package GeoDirectory |
51 | 51 | */ |
52 | -function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
|
52 | +function geodir_user_show_favourites($user_id = '', $output_type = 'select') { |
|
53 | 53 | // My Favourites in Dashboard |
54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
54 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
55 | + $user_favourite = geodir_user_favourite_listing_count($user_id); |
|
56 | 56 | |
57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
57 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
58 | 58 | $favourite_links = $output_type == 'link' ? array() : ''; |
59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
59 | + $post_types = geodir_get_posttypes('object'); |
|
60 | 60 | |
61 | - $author_link = get_author_posts_url( $user_id ); |
|
62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
61 | + $author_link = get_author_posts_url($user_id); |
|
62 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
63 | 63 | |
64 | - foreach ( $post_types as $key => $postobj ) { |
|
65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
64 | + foreach ($post_types as $key => $postobj) { |
|
65 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
66 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
67 | + $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filter favorite listing link. |
@@ -74,54 +74,54 @@ discard block |
||
74 | 74 | * @param string $key Favorite listing array key. |
75 | 75 | * @param int $current_user->ID Current user ID. |
76 | 76 | */ |
77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
77 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id); |
|
78 | 78 | |
79 | - if ( $output_type == 'select' ) { |
|
79 | + if ($output_type == 'select') { |
|
80 | 80 | $selected = ''; |
81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
81 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
82 | 82 | $selected = 'selected="selected"'; |
83 | 83 | } |
84 | 84 | |
85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
86 | - } elseif ( $output_type == 'link' ) { |
|
87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
85 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.$name.'</option>'; |
|
86 | + } elseif ($output_type == 'link') { |
|
87 | + $favourite_links[] = '<a href="'.$post_type_link.'">'.$name.'</a>'; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - if ( ! empty( $favourite_links ) ) { |
|
93 | - if ( $output_type == 'select' ) { |
|
92 | + if (!empty($favourite_links)) { |
|
93 | + if ($output_type == 'select') { |
|
94 | 94 | ?> |
95 | 95 | <li> |
96 | - <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
|
97 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
96 | + <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Favorites', 'geodirectory'); ?>"> |
|
97 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Favorites", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
98 | 98 | <?php echo $favourite_links; ?> |
99 | 99 | </select> |
100 | 100 | </li> |
101 | 101 | <?php |
102 | - } elseif ( $output_type == 'link' ) { |
|
103 | - echo implode( " | ", $favourite_links ); |
|
102 | + } elseif ($output_type == 'link') { |
|
103 | + echo implode(" | ", $favourite_links); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | -function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
|
110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
109 | +function geodir_user_show_listings($user_id = '', $output_type = 'select') { |
|
110 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
111 | + $user_listing = geodir_user_post_listing_count($user_id); |
|
112 | 112 | |
113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
113 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
114 | 114 | $listing_links = $output_type == 'link' ? array() : ''; |
115 | 115 | |
116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
116 | + $post_types = geodir_get_posttypes('object'); |
|
117 | 117 | |
118 | - $author_link = get_author_posts_url( $user_id ); |
|
119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
118 | + $author_link = get_author_posts_url($user_id); |
|
119 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
120 | 120 | |
121 | - foreach ( $post_types as $key => $postobj ) { |
|
122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
121 | + foreach ($post_types as $key => $postobj) { |
|
122 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
123 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
124 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Filter my listing link. |
@@ -131,32 +131,32 @@ discard block |
||
131 | 131 | * @param string $key My listing array key. |
132 | 132 | * @param int $current_user->ID Current user ID. |
133 | 133 | */ |
134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
135 | - if ( $output_type == 'select' ) { |
|
134 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id); |
|
135 | + if ($output_type == 'select') { |
|
136 | 136 | $selected = ''; |
137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
137 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
138 | 138 | $selected = 'selected="selected"'; |
139 | 139 | } |
140 | 140 | |
141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
142 | - } elseif ( $output_type == 'link' ) { |
|
143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
141 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.$name.'</option>'; |
|
142 | + } elseif ($output_type == 'link') { |
|
143 | + $listing_links[] = '<a href="'.$listing_link.'">'.$name.'</a>'; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - if ( ! empty( $listing_links ) ) { |
|
149 | - if ( $output_type == 'select' ) { |
|
148 | + if (!empty($listing_links)) { |
|
149 | + if ($output_type == 'select') { |
|
150 | 150 | ?> |
151 | 151 | <li> |
152 | - <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
|
153 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
152 | + <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Listings', 'geodirectory'); ?>"> |
|
153 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Listings", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
154 | 154 | <?php echo $listing_links; ?> |
155 | 155 | </select> |
156 | 156 | </li> |
157 | 157 | <?php |
158 | - } elseif ( $output_type == 'link' ) { |
|
159 | - echo implode( " | ", $listing_links ); |
|
158 | + } elseif ($output_type == 'link') { |
|
159 | + echo implode(" | ", $listing_links); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | * @since 1.6.24 |
170 | 170 | * @return mixed |
171 | 171 | */ |
172 | -function geodir_get_user_favourites($user_id=''){ |
|
173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
172 | +function geodir_get_user_favourites($user_id = '') { |
|
173 | + if (!$user_id) {$user_id = get_current_user_id(); } |
|
174 | 174 | $site_id = ''; |
175 | - if ( is_multisite() ) { |
|
175 | + if (is_multisite()) { |
|
176 | 176 | $blog_id = get_current_blog_id(); |
177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
177 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function init_listing_map_script() |
20 | 20 | { |
21 | - global $list_map_json; |
|
21 | + global $list_map_json; |
|
22 | 22 | |
23 | - $list_map_json = array(); |
|
23 | + $list_map_json = array(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function create_list_jsondata($post) |
37 | 37 | { |
38 | - global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | - |
|
40 | - if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | - /** |
|
42 | - * Filter the json data for search listing map. |
|
43 | - * |
|
44 | - * @since 1.5.7 |
|
45 | - * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | - * @param object $post The post object. |
|
47 | - */ |
|
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | - } |
|
38 | + global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | + |
|
40 | + if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | + /** |
|
42 | + * Filter the json data for search listing map. |
|
43 | + * |
|
44 | + * @since 1.5.7 |
|
45 | + * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | + * @param object $post The post object. |
|
47 | + */ |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,29 +59,29 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function show_listing_widget_map() |
61 | 61 | { |
62 | - global $list_map_json; |
|
62 | + global $list_map_json; |
|
63 | 63 | |
64 | - if (!empty($list_map_json)) { |
|
65 | - $list_map_json = array_unique($list_map_json); |
|
66 | - $cat_content_info[] = implode(',', $list_map_json); |
|
67 | - } |
|
64 | + if (!empty($list_map_json)) { |
|
65 | + $list_map_json = array_unique($list_map_json); |
|
66 | + $cat_content_info[] = implode(',', $list_map_json); |
|
67 | + } |
|
68 | 68 | |
69 | - $totalcount = count(array_unique($list_map_json)); |
|
69 | + $totalcount = count(array_unique($list_map_json)); |
|
70 | 70 | |
71 | 71 | |
72 | - if (!empty($cat_content_info)) { |
|
73 | - $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | - } else { |
|
78 | - $list_json = '[{"totalcount":"0"}]'; |
|
79 | - } |
|
72 | + if (!empty($cat_content_info)) { |
|
73 | + $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | + $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | + } else { |
|
78 | + $list_json = '[{"totalcount":"0"}]'; |
|
79 | + } |
|
80 | 80 | |
81 | - $listing_map_args = array('list_json' => $list_json); |
|
81 | + $listing_map_args = array('list_json' => $list_json); |
|
82 | 82 | |
83 | - // Pass the json data in listing map script |
|
84 | - wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
83 | + // Pass the json data in listing map script |
|
84 | + wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -93,110 +93,110 @@ discard block |
||
93 | 93 | class geodir_map_listingpage extends WP_Widget |
94 | 94 | { |
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * Register the listing page map widget. |
98 | 98 | * |
99 | 99 | * @since 1.0.0 |
100 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
100 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
101 | 101 | */ |
102 | - public function __construct() { |
|
103 | - $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | - parent::__construct( |
|
105 | - 'geodir_map_v3_listing_map', // Base ID |
|
106 | - __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | - $widget_ops// Args |
|
108 | - ); |
|
102 | + public function __construct() { |
|
103 | + $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | + parent::__construct( |
|
105 | + 'geodir_map_v3_listing_map', // Base ID |
|
106 | + __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | + $widget_ops// Args |
|
108 | + ); |
|
109 | 109 | |
110 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
110 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
111 | 111 | |
112 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
112 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
113 | 113 | |
114 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | - } |
|
114 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | + } |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Front-end display content for listing page map widget. |
119 | 119 | * |
120 | 120 | * @since 1.0.0 |
121 | - * @since 1.5.1 Declare function public. |
|
121 | + * @since 1.5.1 Declare function public. |
|
122 | + * |
|
123 | + * @global object $post The current post object. |
|
122 | 124 | * |
123 | - * @global object $post The current post object. |
|
124 | - * |
|
125 | 125 | * @param array $args Widget arguments. |
126 | 126 | * @param array $instance Saved values from database. |
127 | 127 | */ |
128 | - public function widget($args, $instance) |
|
129 | - { |
|
130 | - |
|
131 | - if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | - || geodir_is_page('detail') |
|
133 | - ) : |
|
134 | - |
|
135 | - extract($args, EXTR_SKIP); |
|
136 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | - $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | - $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | - /** |
|
147 | - * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | - * |
|
149 | - * @since 1.0.0 |
|
150 | - * @param bool $sticky True if should be sticky, false if not |
|
151 | - */ |
|
152 | - $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | - $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
128 | + public function widget($args, $instance) |
|
129 | + { |
|
130 | + |
|
131 | + if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | + || geodir_is_page('detail') |
|
133 | + ) : |
|
134 | + |
|
135 | + extract($args, EXTR_SKIP); |
|
136 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | + $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | + $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | + /** |
|
147 | + * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | + * |
|
149 | + * @since 1.0.0 |
|
150 | + * @param bool $sticky True if should be sticky, false if not |
|
151 | + */ |
|
152 | + $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | + $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
156 | 156 | |
157 | 157 | /** |
158 | - * Filter the listing map should to be displayed or not. |
|
159 | - * |
|
160 | - * @since 1.4.6 |
|
158 | + * Filter the listing map should to be displayed or not. |
|
161 | 159 | * |
162 | - * @param bool $display true if map should be displayed, false if not. |
|
163 | - */ |
|
160 | + * @since 1.4.6 |
|
161 | + * |
|
162 | + * @param bool $display true if map should be displayed, false if not. |
|
163 | + */ |
|
164 | 164 | $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
165 | 165 | if ( !$show_map ) { |
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - $map_args = array(); |
|
170 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | - $map_args['width'] = $width; |
|
172 | - $map_args['height'] = $height; |
|
173 | - |
|
174 | - $map_args['scrollwheel'] = $scrollwheel; |
|
175 | - $map_args['showall'] = $showall; |
|
176 | - $map_args['child_collapse'] = '0'; |
|
177 | - $map_args['sticky'] = $sticky; |
|
178 | - $map_args['enable_cat_filters'] = false; |
|
179 | - $map_args['enable_text_search'] = false; |
|
180 | - $map_args['enable_post_type_filters'] = false; |
|
181 | - $map_args['enable_location_filters'] = false; |
|
182 | - $map_args['enable_jason_on_load'] = true; |
|
169 | + $map_args = array(); |
|
170 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | + $map_args['width'] = $width; |
|
172 | + $map_args['height'] = $height; |
|
173 | + |
|
174 | + $map_args['scrollwheel'] = $scrollwheel; |
|
175 | + $map_args['showall'] = $showall; |
|
176 | + $map_args['child_collapse'] = '0'; |
|
177 | + $map_args['sticky'] = $sticky; |
|
178 | + $map_args['enable_cat_filters'] = false; |
|
179 | + $map_args['enable_text_search'] = false; |
|
180 | + $map_args['enable_post_type_filters'] = false; |
|
181 | + $map_args['enable_location_filters'] = false; |
|
182 | + $map_args['enable_jason_on_load'] = true; |
|
183 | 183 | |
184 | - if (is_single()) { |
|
184 | + if (is_single()) { |
|
185 | 185 | |
186 | - global $post; |
|
187 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | - $mapview = $post->post_mapview; |
|
190 | - $mapzoom = $post->post_mapzoom; |
|
191 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
186 | + global $post; |
|
187 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | + $mapview = $post->post_mapview; |
|
190 | + $mapzoom = $post->post_mapzoom; |
|
191 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
192 | 192 | |
193 | - } else { |
|
194 | - $default_location = geodir_get_default_location(); |
|
193 | + } else { |
|
194 | + $default_location = geodir_get_default_location(); |
|
195 | 195 | |
196 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | - $mapview = $maptype; |
|
196 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | + $mapview = $maptype; |
|
200 | 200 | |
201 | 201 | if ( geodir_is_page( 'search' ) ) { |
202 | 202 | $map_default_lat = ''; |
@@ -213,83 +213,83 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - } |
|
217 | - |
|
218 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
219 | - |
|
220 | - // Set default map options |
|
221 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
222 | - $map_args['latitude'] = $map_default_lat; |
|
223 | - $map_args['longitude'] = $map_default_lng; |
|
224 | - $map_args['zoom'] = $zoom; |
|
225 | - //$map_args['scrollwheel'] = true; |
|
226 | - $map_args['scrollwheel'] = $scrollwheel; |
|
227 | - $map_args['showall'] = $showall; |
|
228 | - $map_args['streetViewControl'] = true; |
|
229 | - $map_args['maptype'] = $maptype; |
|
230 | - $map_args['showPreview'] = '0'; |
|
231 | - $map_args['maxZoom'] = 21; |
|
232 | - $map_args['autozoom'] = $autozoom; |
|
233 | - $map_args['bubble_size'] = 'small'; |
|
216 | + } |
|
217 | + |
|
218 | + if (empty($mapzoom)) $mapzoom = $zoom; |
|
219 | + |
|
220 | + // Set default map options |
|
221 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
222 | + $map_args['latitude'] = $map_default_lat; |
|
223 | + $map_args['longitude'] = $map_default_lng; |
|
224 | + $map_args['zoom'] = $zoom; |
|
225 | + //$map_args['scrollwheel'] = true; |
|
226 | + $map_args['scrollwheel'] = $scrollwheel; |
|
227 | + $map_args['showall'] = $showall; |
|
228 | + $map_args['streetViewControl'] = true; |
|
229 | + $map_args['maptype'] = $maptype; |
|
230 | + $map_args['showPreview'] = '0'; |
|
231 | + $map_args['maxZoom'] = 21; |
|
232 | + $map_args['autozoom'] = $autozoom; |
|
233 | + $map_args['bubble_size'] = 'small'; |
|
234 | 234 | |
235 | - $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
235 | + $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
236 | 236 | |
237 | - echo $before_widget; |
|
238 | - geodir_draw_map($map_args); |
|
239 | - echo $after_widget; |
|
237 | + echo $before_widget; |
|
238 | + geodir_draw_map($map_args); |
|
239 | + echo $after_widget; |
|
240 | 240 | |
241 | - endif; |
|
242 | - } |
|
241 | + endif; |
|
242 | + } |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Sanitize listing page map widget form values as they are saved. |
246 | 246 | * |
247 | 247 | * @since 1.0.0 |
248 | - * @since 1.5.1 Declare function public. |
|
248 | + * @since 1.5.1 Declare function public. |
|
249 | 249 | * |
250 | 250 | * @param array $new_instance Values just sent to be saved. |
251 | 251 | * @param array $old_instance Previously saved values from database. |
252 | 252 | * |
253 | 253 | * @return array Updated safe values to be saved. |
254 | 254 | */ |
255 | - public function update($new_instance, $old_instance) { |
|
256 | - //save the widget |
|
257 | - $instance = $old_instance; |
|
258 | - $instance['width'] = strip_tags($new_instance['width']); |
|
259 | - $instance['heigh'] = ($new_instance['heigh']); |
|
260 | - $instance['maptype'] = ($new_instance['maptype']); |
|
261 | - $instance['zoom'] = ($new_instance['zoom']); |
|
262 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
263 | - $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
264 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
265 | - $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
266 | - $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
267 | - |
|
268 | - return $instance; |
|
269 | - } |
|
255 | + public function update($new_instance, $old_instance) { |
|
256 | + //save the widget |
|
257 | + $instance = $old_instance; |
|
258 | + $instance['width'] = strip_tags($new_instance['width']); |
|
259 | + $instance['heigh'] = ($new_instance['heigh']); |
|
260 | + $instance['maptype'] = ($new_instance['maptype']); |
|
261 | + $instance['zoom'] = ($new_instance['zoom']); |
|
262 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
263 | + $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
264 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
265 | + $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
266 | + $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
267 | + |
|
268 | + return $instance; |
|
269 | + } |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Back-end listing page map widget settings form. |
273 | 273 | * |
274 | 274 | * @since 1.0.0 |
275 | - * @since 1.5.1 Declare function public. |
|
275 | + * @since 1.5.1 Declare function public. |
|
276 | 276 | * |
277 | 277 | * @param array $instance Previously saved values from database. |
278 | 278 | */ |
279 | - public function form($instance) { |
|
280 | - // widget form in backend |
|
281 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
279 | + public function form($instance) { |
|
280 | + // widget form in backend |
|
281 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
282 | 282 | |
283 | - $width = strip_tags($instance['width']); |
|
284 | - $heigh = strip_tags($instance['heigh']); |
|
285 | - $maptype = strip_tags($instance['maptype']); |
|
286 | - $zoom = strip_tags($instance['zoom']); |
|
287 | - $autozoom = strip_tags($instance['autozoom']); |
|
288 | - $sticky = strip_tags($instance['sticky']); |
|
289 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
290 | - $showall = strip_tags($instance['showall']); |
|
291 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
292 | - ?> |
|
283 | + $width = strip_tags($instance['width']); |
|
284 | + $heigh = strip_tags($instance['heigh']); |
|
285 | + $maptype = strip_tags($instance['maptype']); |
|
286 | + $zoom = strip_tags($instance['zoom']); |
|
287 | + $autozoom = strip_tags($instance['autozoom']); |
|
288 | + $sticky = strip_tags($instance['sticky']); |
|
289 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
290 | + $showall = strip_tags($instance['showall']); |
|
291 | + $marker_cluster = (int)$instance['marker_cluster']; |
|
292 | + ?> |
|
293 | 293 | <p> |
294 | 294 | <label |
295 | 295 | for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?> |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | name="<?php echo $this->get_field_name('maptype'); ?>"> |
319 | 319 | |
320 | 320 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') { |
321 | - echo 'selected="selected"'; |
|
322 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
321 | + echo 'selected="selected"'; |
|
322 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
323 | 323 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') { |
324 | - echo 'selected="selected"'; |
|
325 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
324 | + echo 'selected="selected"'; |
|
325 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
326 | 326 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
327 | - echo 'selected="selected"'; |
|
328 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
327 | + echo 'selected="selected"'; |
|
328 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
329 | 329 | <option <?php selected($maptype, 'TERRAIN');?> |
330 | 330 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
331 | 331 | </select> |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | </p> |
334 | 334 | |
335 | 335 | <?php |
336 | - $map_zoom_level = geodir_map_zoom_level(); |
|
337 | - ?> |
|
336 | + $map_zoom_level = geodir_map_zoom_level(); |
|
337 | + ?> |
|
338 | 338 | |
339 | 339 | <p> |
340 | 340 | <label |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>" |
345 | 345 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php |
346 | 346 | |
347 | - foreach ($map_zoom_level as $level) { |
|
348 | - $selected = ''; |
|
349 | - if ($level == $zoom) |
|
350 | - $selected = 'selected="selected"'; |
|
347 | + foreach ($map_zoom_level as $level) { |
|
348 | + $selected = ''; |
|
349 | + if ($level == $zoom) |
|
350 | + $selected = 'selected="selected"'; |
|
351 | 351 | |
352 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
352 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
353 | 353 | |
354 | - } ?> |
|
354 | + } ?> |
|
355 | 355 | |
356 | 356 | </select> |
357 | 357 | |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | for="<?php echo $this->get_field_id('autozoom'); ?>"> |
364 | 364 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>" |
365 | 365 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) { |
366 | - echo 'checked="checked"'; |
|
367 | - } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
366 | + echo 'checked="checked"'; |
|
367 | + } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
368 | 368 | </p> |
369 | 369 | |
370 | 370 | <p> |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | for="<?php echo $this->get_field_id('sticky'); ?>"> |
373 | 373 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>" |
374 | 374 | name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) { |
375 | - echo 'checked="checked"'; |
|
376 | - } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
375 | + echo 'checked="checked"'; |
|
376 | + } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
377 | 377 | </label> |
378 | 378 | </p> |
379 | 379 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | </p> --> |
400 | 400 | |
401 | 401 | <?php |
402 | - } |
|
402 | + } |
|
403 | 403 | } // class geodir_map_listingpage |
404 | 404 | |
405 | 405 | register_widget('geodir_map_listingpage'); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $post->marker_json JSON representation of the post marker info. |
46 | 46 | * @param object $post The post object. |
47 | 47 | */ |
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $json_content = substr(implode(',', $cat_content_info), 1); |
74 | 74 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
75 | 75 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
76 | + $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']'; |
|
77 | 77 | } else { |
78 | 78 | $list_json = '[{"totalcount":"0"}]'; |
79 | 79 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @param bool $display true if map should be displayed, false if not. |
163 | 163 | */ |
164 | - $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
|
165 | - if ( !$show_map ) { |
|
164 | + $show_map = apply_filters('geodir_show_map_listing', $display = true); |
|
165 | + if (!$show_map) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | $map_args['map_class_name'] = 'geodir-map-listing-page'; |
199 | 199 | $mapview = $maptype; |
200 | 200 | |
201 | - if ( geodir_is_page( 'search' ) ) { |
|
201 | + if (geodir_is_page('search')) { |
|
202 | 202 | $map_default_lat = ''; |
203 | 203 | $map_default_lng = ''; |
204 | - if ( isset( $_REQUEST['sgeo_lat'] ) && isset( $_REQUEST['sgeo_lon'] ) ) { |
|
205 | - $map_default_lat = (float)sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
206 | - $map_default_lng = (float)sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
204 | + if (isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon'])) { |
|
205 | + $map_default_lat = (float) sanitize_text_field($_REQUEST['sgeo_lat']); |
|
206 | + $map_default_lng = (float) sanitize_text_field($_REQUEST['sgeo_lon']); |
|
207 | 207 | } |
208 | - if ( empty( $map_default_lat ) && empty( $map_default_lng ) && ! empty( $_REQUEST['set_location_type'] ) && ! empty( $_REQUEST['set_location_val'] ) && function_exists( 'geodir_get_location_by_id' ) ) { |
|
209 | - $location = geodir_get_location_by_id( '', (int)$_REQUEST['set_location_val'] ); |
|
210 | - if ( ! empty( $location ) ) { |
|
208 | + if (empty($map_default_lat) && empty($map_default_lng) && !empty($_REQUEST['set_location_type']) && !empty($_REQUEST['set_location_val']) && function_exists('geodir_get_location_by_id')) { |
|
209 | + $location = geodir_get_location_by_id('', (int) $_REQUEST['set_location_val']); |
|
210 | + if (!empty($location)) { |
|
211 | 211 | $map_default_lat = $location->city_latitude; |
212 | 212 | $map_default_lng = $location->city_longitude; |
213 | 213 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function form($instance) { |
280 | 280 | // widget form in backend |
281 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
281 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
282 | 282 | |
283 | 283 | $width = strip_tags($instance['width']); |
284 | 284 | $heigh = strip_tags($instance['heigh']); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $sticky = strip_tags($instance['sticky']); |
289 | 289 | $scrollwheel = strip_tags($instance['scrollwheel']); |
290 | 290 | $showall = strip_tags($instance['showall']); |
291 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
291 | + $marker_cluster = (int) $instance['marker_cluster']; |
|
292 | 292 | ?> |
293 | 293 | <p> |
294 | 294 | <label |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
327 | 327 | echo 'selected="selected"'; |
328 | 328 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
329 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
329 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
330 | 330 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
331 | 331 | </select> |
332 | 332 | </label> |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | if ($level == $zoom) |
350 | 350 | $selected = 'selected="selected"'; |
351 | 351 | |
352 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
352 | + echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>'; |
|
353 | 353 | |
354 | 354 | } ?> |
355 | 355 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | for="<?php echo $this->get_field_id('scrollwheel'); ?>"> |
383 | 383 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>" |
384 | 384 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1" |
385 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
385 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
386 | 386 | </label> |
387 | 387 | </p> |
388 | 388 | <?php if (defined('GDCLUSTER_VERSION')) { ?> |
@@ -215,7 +215,9 @@ discard block |
||
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
218 | + if (empty($mapzoom)) { |
|
219 | + $mapzoom = $zoom; |
|
220 | + } |
|
219 | 221 | |
220 | 222 | // Set default map options |
221 | 223 | $map_args['ajax_url'] = geodir_get_ajax_url(); |
@@ -346,8 +348,9 @@ discard block |
||
346 | 348 | |
347 | 349 | foreach ($map_zoom_level as $level) { |
348 | 350 | $selected = ''; |
349 | - if ($level == $zoom) |
|
350 | - $selected = 'selected="selected"'; |
|
351 | + if ($level == $zoom) { |
|
352 | + $selected = 'selected="selected"'; |
|
353 | + } |
|
351 | 354 | |
352 | 355 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
353 | 356 |
@@ -316,6 +316,10 @@ |
||
316 | 316 | return $personal_data; |
317 | 317 | } |
318 | 318 | |
319 | + /** |
|
320 | + * @param string $email_address |
|
321 | + * @param integer $page |
|
322 | + */ |
|
319 | 323 | public static function posts_by_author( $email_address, $post_type, $page ) { |
320 | 324 | if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) { |
321 | 325 | return array(); |
@@ -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 | } |
@@ -103,6 +103,10 @@ |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | + /** |
|
107 | + * @param string $email_address |
|
108 | + * @param integer $page |
|
109 | + */ |
|
106 | 110 | public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) { |
107 | 111 | global $wpdb; |
108 | 112 |
@@ -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 |
@@ -14,83 +14,83 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_popular_post_category extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
18 | - * Register the popular post category widget. |
|
19 | - * |
|
20 | - * @since 1.0.0 |
|
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'popular_post_category', // Base ID |
|
27 | - __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Front-end display content for popular post category widget. |
|
34 | - * |
|
35 | - * @since 1.0.0 |
|
36 | - * @since 1.5.1 Declare function public. |
|
37 | - * |
|
38 | - * @param array $args Widget arguments. |
|
39 | - * @param array $instance Saved values from database. |
|
40 | - */ |
|
41 | - public function widget($args, $instance) |
|
42 | - { |
|
43 | - geodir_popular_post_category_output($args, $instance); |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Sanitize popular post category widget form values as they are saved. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * @since 1.5.1 Declare function public. |
|
51 | - * @since 1.5.1 Added default_post_type parameter. |
|
52 | - * @since 1.6.9 Added parent_only parameter. |
|
53 | - * |
|
54 | - * @param array $new_instance Values just sent to be saved. |
|
55 | - * @param array $old_instance Previously saved values from database. |
|
56 | - * |
|
57 | - * @return array Updated safe values to be saved. |
|
58 | - */ |
|
59 | - public function update($new_instance, $old_instance) |
|
60 | - { |
|
61 | - //save the widget |
|
62 | - $instance = $old_instance; |
|
63 | - $instance['title'] = strip_tags($new_instance['title']); |
|
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
65 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | - $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | - $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | - return $instance; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Back-end popular post category widget settings form. |
|
73 | - * |
|
74 | - * @since 1.0.0 |
|
75 | - * @since 1.5.1 Declare function public. |
|
76 | - * @since 1.5.1 Added option to set default post type. |
|
77 | - * @since 1.6.9 Added option to show parent categories only. |
|
78 | - * |
|
79 | - * @param array $instance Previously saved values from database. |
|
80 | - */ |
|
81 | - public function form($instance) |
|
82 | - { |
|
83 | - //widgetform in backend |
|
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | - |
|
86 | - $title = strip_tags($instance['title']); |
|
87 | - $category_limit = (int)$instance['category_limit']; |
|
88 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | - $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
17 | + /** |
|
18 | + * Register the popular post category widget. |
|
19 | + * |
|
20 | + * @since 1.0.0 |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'popular_post_category', // Base ID |
|
27 | + __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Front-end display content for popular post category widget. |
|
34 | + * |
|
35 | + * @since 1.0.0 |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | + * |
|
38 | + * @param array $args Widget arguments. |
|
39 | + * @param array $instance Saved values from database. |
|
40 | + */ |
|
41 | + public function widget($args, $instance) |
|
42 | + { |
|
43 | + geodir_popular_post_category_output($args, $instance); |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Sanitize popular post category widget form values as they are saved. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Added default_post_type parameter. |
|
52 | + * @since 1.6.9 Added parent_only parameter. |
|
53 | + * |
|
54 | + * @param array $new_instance Values just sent to be saved. |
|
55 | + * @param array $old_instance Previously saved values from database. |
|
56 | + * |
|
57 | + * @return array Updated safe values to be saved. |
|
58 | + */ |
|
59 | + public function update($new_instance, $old_instance) |
|
60 | + { |
|
61 | + //save the widget |
|
62 | + $instance = $old_instance; |
|
63 | + $instance['title'] = strip_tags($new_instance['title']); |
|
64 | + $category_limit = (int)$new_instance['category_limit']; |
|
65 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | + $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | + $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | + return $instance; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Back-end popular post category widget settings form. |
|
73 | + * |
|
74 | + * @since 1.0.0 |
|
75 | + * @since 1.5.1 Declare function public. |
|
76 | + * @since 1.5.1 Added option to set default post type. |
|
77 | + * @since 1.6.9 Added option to show parent categories only. |
|
78 | + * |
|
79 | + * @param array $instance Previously saved values from database. |
|
80 | + */ |
|
81 | + public function form($instance) |
|
82 | + { |
|
83 | + //widgetform in backend |
|
84 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | + |
|
86 | + $title = strip_tags($instance['title']); |
|
87 | + $category_limit = (int)$instance['category_limit']; |
|
88 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | + $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | + $parent_only = !empty($instance['parent_only']) ? true: false; |
|
91 | 91 | |
92 | - $post_type_options = geodir_get_posttypes('options'); |
|
93 | - ?> |
|
92 | + $post_type_options = geodir_get_posttypes('options'); |
|
93 | + ?> |
|
94 | 94 | <p> |
95 | 95 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
96 | 96 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
117 | 117 | </p> |
118 | 118 | <?php |
119 | - } |
|
119 | + } |
|
120 | 120 | } // class geodir_popular_post_category |
121 | 121 | |
122 | 122 | register_widget('geodir_popular_post_category'); |
@@ -130,40 +130,40 @@ discard block |
||
130 | 130 | class geodir_popular_postview extends WP_Widget |
131 | 131 | { |
132 | 132 | |
133 | - /** |
|
133 | + /** |
|
134 | 134 | * Register the popular posts widget. |
135 | 135 | * |
136 | 136 | * @since 1.0.0 |
137 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
137 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
138 | 138 | */ |
139 | - public function __construct() { |
|
140 | - $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | - parent::__construct( |
|
142 | - 'popular_post_view', // Base ID |
|
143 | - __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | - $widget_ops// Args |
|
145 | - ); |
|
146 | - } |
|
139 | + public function __construct() { |
|
140 | + $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | + parent::__construct( |
|
142 | + 'popular_post_view', // Base ID |
|
143 | + __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | + $widget_ops// Args |
|
145 | + ); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Front-end display content for popular posts widget. |
150 | 150 | * |
151 | 151 | * @since 1.0.0 |
152 | - * @since 1.5.1 Declare function public. |
|
152 | + * @since 1.5.1 Declare function public. |
|
153 | 153 | * |
154 | 154 | * @param array $args Widget arguments. |
155 | 155 | * @param array $instance Saved values from database. |
156 | 156 | */ |
157 | 157 | public function widget($args, $instance) |
158 | - { |
|
159 | - geodir_popular_postview_output($args, $instance); |
|
160 | - } |
|
158 | + { |
|
159 | + geodir_popular_postview_output($args, $instance); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Sanitize popular posts widget form values as they are saved. |
164 | 164 | * |
165 | 165 | * @since 1.0.0 |
166 | - * @since 1.5.1 Declare function public. |
|
166 | + * @since 1.5.1 Declare function public. |
|
167 | 167 | * |
168 | 168 | * @param array $new_instance Values just sent to be saved. |
169 | 169 | * @param array $old_instance Previously saved values from database. |
@@ -171,106 +171,106 @@ discard block |
||
171 | 171 | * @return array Updated safe values to be saved. |
172 | 172 | */ |
173 | 173 | public function update($new_instance, $old_instance) |
174 | - { |
|
175 | - //save the widget |
|
176 | - $instance = $old_instance; |
|
177 | - |
|
178 | - if ($new_instance['title'] == '') { |
|
179 | - $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | - //$instance['title'] = $title; |
|
181 | - } |
|
182 | - $instance['title'] = strip_tags($new_instance['title']); |
|
183 | - |
|
184 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | - //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | - $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | - $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | - $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
|
193 | - $instance['character_count'] = $new_instance['character_count']; |
|
194 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | - else |
|
197 | - $instance['add_location_filter'] = '0'; |
|
198 | - |
|
199 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
200 | - $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
201 | - $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
202 | - $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
203 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
204 | - $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0; |
|
205 | - |
|
206 | - return $instance; |
|
207 | - } |
|
174 | + { |
|
175 | + //save the widget |
|
176 | + $instance = $old_instance; |
|
177 | + |
|
178 | + if ($new_instance['title'] == '') { |
|
179 | + $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | + //$instance['title'] = $title; |
|
181 | + } |
|
182 | + $instance['title'] = strip_tags($new_instance['title']); |
|
183 | + |
|
184 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | + //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | + $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | + $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | + $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
|
193 | + $instance['character_count'] = $new_instance['character_count']; |
|
194 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | + else |
|
197 | + $instance['add_location_filter'] = '0'; |
|
198 | + |
|
199 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
200 | + $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
201 | + $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
202 | + $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
203 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
204 | + $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0; |
|
205 | + |
|
206 | + return $instance; |
|
207 | + } |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Back-end popular posts widget settings form. |
211 | 211 | * |
212 | 212 | * @since 1.0.0 |
213 | - * @since 1.5.1 Declare function public. |
|
213 | + * @since 1.5.1 Declare function public. |
|
214 | 214 | * |
215 | 215 | * @param array $instance Previously saved values from database. |
216 | 216 | */ |
217 | 217 | public function form($instance) |
218 | - { |
|
219 | - //widgetform in backend |
|
220 | - $instance = wp_parse_args((array)$instance, |
|
221 | - array('title' => '', |
|
222 | - 'post_type' => '', |
|
223 | - 'category' => array(), |
|
224 | - 'category_title' => '', |
|
225 | - 'list_sort' => '', |
|
226 | - 'title_tag' => 'h3', |
|
227 | - 'list_order' => '', |
|
228 | - 'post_number' => '5', |
|
229 | - 'layout' => 'gridview_onehalf', |
|
230 | - 'listing_width' => '', |
|
231 | - 'add_location_filter' => '1', |
|
232 | - 'character_count' => '20', |
|
233 | - 'show_featured_only' => '', |
|
234 | - 'show_special_only' => '', |
|
235 | - 'with_pics_only' => '', |
|
236 | - 'with_videos_only' => '', |
|
237 | - 'use_viewing_post_type' => '', |
|
238 | - 'hide_if_empty' => '' |
|
239 | - ) |
|
240 | - ); |
|
218 | + { |
|
219 | + //widgetform in backend |
|
220 | + $instance = wp_parse_args((array)$instance, |
|
221 | + array('title' => '', |
|
222 | + 'post_type' => '', |
|
223 | + 'category' => array(), |
|
224 | + 'category_title' => '', |
|
225 | + 'list_sort' => '', |
|
226 | + 'title_tag' => 'h3', |
|
227 | + 'list_order' => '', |
|
228 | + 'post_number' => '5', |
|
229 | + 'layout' => 'gridview_onehalf', |
|
230 | + 'listing_width' => '', |
|
231 | + 'add_location_filter' => '1', |
|
232 | + 'character_count' => '20', |
|
233 | + 'show_featured_only' => '', |
|
234 | + 'show_special_only' => '', |
|
235 | + 'with_pics_only' => '', |
|
236 | + 'with_videos_only' => '', |
|
237 | + 'use_viewing_post_type' => '', |
|
238 | + 'hide_if_empty' => '' |
|
239 | + ) |
|
240 | + ); |
|
241 | 241 | |
242 | - $title = strip_tags($instance['title']); |
|
242 | + $title = strip_tags($instance['title']); |
|
243 | 243 | |
244 | - $post_type = strip_tags($instance['post_type']); |
|
244 | + $post_type = strip_tags($instance['post_type']); |
|
245 | 245 | |
246 | - $category = $instance['category']; |
|
246 | + $category = $instance['category']; |
|
247 | 247 | |
248 | - $category_title = strip_tags($instance['category_title']); |
|
248 | + $category_title = strip_tags($instance['category_title']); |
|
249 | 249 | |
250 | - $list_sort = strip_tags($instance['list_sort']); |
|
250 | + $list_sort = strip_tags($instance['list_sort']); |
|
251 | 251 | |
252 | - $list_order = strip_tags($instance['list_order']); |
|
252 | + $list_order = strip_tags($instance['list_order']); |
|
253 | 253 | |
254 | - $title_tag = strip_tags($instance['title_tag']); |
|
254 | + $title_tag = strip_tags($instance['title_tag']); |
|
255 | 255 | |
256 | - $post_number = strip_tags($instance['post_number']); |
|
256 | + $post_number = strip_tags($instance['post_number']); |
|
257 | 257 | |
258 | - $layout = strip_tags($instance['layout']); |
|
258 | + $layout = strip_tags($instance['layout']); |
|
259 | 259 | |
260 | - $listing_width = strip_tags($instance['listing_width']); |
|
260 | + $listing_width = strip_tags($instance['listing_width']); |
|
261 | 261 | |
262 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
262 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
263 | 263 | |
264 | - $character_count = $instance['character_count']; |
|
264 | + $character_count = $instance['character_count']; |
|
265 | 265 | |
266 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
267 | - $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
268 | - $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
269 | - $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
270 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
271 | - $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false; |
|
266 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
267 | + $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
268 | + $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
269 | + $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
270 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
271 | + $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false; |
|
272 | 272 | |
273 | - ?> |
|
273 | + ?> |
|
274 | 274 | <p> |
275 | 275 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
276 | 276 | <small>(%posttype_singular_label% , |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | <?php foreach ($postypes as $postypes_obj) { ?> |
305 | 305 | |
306 | 306 | <option <?php if ($post_type == $postypes_obj) { |
307 | - echo 'selected="selected"'; |
|
308 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
309 | - echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
307 | + echo 'selected="selected"'; |
|
308 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
309 | + echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
310 | 310 | |
311 | 311 | <?php } ?> |
312 | 312 | |
@@ -321,30 +321,30 @@ discard block |
||
321 | 321 | |
322 | 322 | <?php |
323 | 323 | |
324 | - $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
324 | + $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
325 | 325 | |
326 | - $all_postypes = geodir_get_posttypes(); |
|
326 | + $all_postypes = geodir_get_posttypes(); |
|
327 | 327 | |
328 | - if (!in_array($post_type, $all_postypes)) |
|
329 | - $post_type = 'gd_place'; |
|
328 | + if (!in_array($post_type, $all_postypes)) |
|
329 | + $post_type = 'gd_place'; |
|
330 | 330 | |
331 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
332 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
331 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
332 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
333 | 333 | |
334 | - ?> |
|
334 | + ?> |
|
335 | 335 | |
336 | 336 | <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]" |
337 | 337 | onchange="geodir_popular_widget_cat_title(this)"> |
338 | 338 | |
339 | 339 | <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) { |
340 | - echo 'selected="selected"'; |
|
341 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
340 | + echo 'selected="selected"'; |
|
341 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
342 | 342 | <?php foreach ($categories as $category_obj) { |
343 | - $selected = ''; |
|
344 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | - echo $selected = 'selected="selected"'; |
|
343 | + $selected = ''; |
|
344 | + if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | + echo $selected = 'selected="selected"'; |
|
346 | 346 | |
347 | - ?> |
|
347 | + ?> |
|
348 | 348 | |
349 | 349 | <option <?php echo $selected; ?> |
350 | 350 | value="<?php echo $category_obj->term_id; ?>"><?php echo geodir_utf8_ucfirst($category_obj->name); ?></option> |
@@ -365,32 +365,32 @@ discard block |
||
365 | 365 | <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
366 | 366 | |
367 | 367 | <?php |
368 | - $list_sort_arr = array( |
|
369 | - "az" => __('A-Z', 'geodirectory'), |
|
370 | - "latest" => __('Latest', 'geodirectory'), |
|
371 | - "featured" => __('Featured', 'geodirectory'), |
|
372 | - "high_review" => __('Review', 'geodirectory'), |
|
373 | - "high_rating" => __('Rating', 'geodirectory'), |
|
374 | - "random" => __('Random', 'geodirectory'), |
|
375 | - ); |
|
376 | - |
|
377 | - /** |
|
378 | - * Filter the Popular post view widget sorting options. |
|
379 | - * |
|
380 | - * @since 1.6.22 |
|
381 | - * @param array $list_sort_arr The array of key value pairs of settings. |
|
382 | - * @param array $instance The array of widget settings. |
|
383 | - */ |
|
384 | - $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
385 | - ?> |
|
368 | + $list_sort_arr = array( |
|
369 | + "az" => __('A-Z', 'geodirectory'), |
|
370 | + "latest" => __('Latest', 'geodirectory'), |
|
371 | + "featured" => __('Featured', 'geodirectory'), |
|
372 | + "high_review" => __('Review', 'geodirectory'), |
|
373 | + "high_rating" => __('Rating', 'geodirectory'), |
|
374 | + "random" => __('Random', 'geodirectory'), |
|
375 | + ); |
|
376 | + |
|
377 | + /** |
|
378 | + * Filter the Popular post view widget sorting options. |
|
379 | + * |
|
380 | + * @since 1.6.22 |
|
381 | + * @param array $list_sort_arr The array of key value pairs of settings. |
|
382 | + * @param array $instance The array of widget settings. |
|
383 | + */ |
|
384 | + $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
385 | + ?> |
|
386 | 386 | |
387 | 387 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
388 | 388 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
389 | 389 | <?php |
390 | - foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | - echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
392 | - } |
|
393 | - ?> |
|
390 | + foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | + echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
392 | + } |
|
393 | + ?> |
|
394 | 394 | </select> |
395 | 395 | </label> |
396 | 396 | </p> |
@@ -399,28 +399,28 @@ discard block |
||
399 | 399 | <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory');?> |
400 | 400 | |
401 | 401 | <?php |
402 | - $title_tag_arr = array( |
|
403 | - "h3" => __('h3 (default)', 'geodirectory'), |
|
404 | - "h2" => __('h2 (if main content of page)', 'geodirectory'), |
|
405 | - ); |
|
406 | - |
|
407 | - /** |
|
408 | - * Filter the Popular post view widget title tag. |
|
409 | - * |
|
410 | - * @since 1.6.26 |
|
411 | - * @param array $title_tag_arr The array of key value pairs of settings. |
|
412 | - * @param array $instance The array of widget settings. |
|
413 | - */ |
|
414 | - $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
415 | - ?> |
|
402 | + $title_tag_arr = array( |
|
403 | + "h3" => __('h3 (default)', 'geodirectory'), |
|
404 | + "h2" => __('h2 (if main content of page)', 'geodirectory'), |
|
405 | + ); |
|
406 | + |
|
407 | + /** |
|
408 | + * Filter the Popular post view widget title tag. |
|
409 | + * |
|
410 | + * @since 1.6.26 |
|
411 | + * @param array $title_tag_arr The array of key value pairs of settings. |
|
412 | + * @param array $instance The array of widget settings. |
|
413 | + */ |
|
414 | + $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
415 | + ?> |
|
416 | 416 | |
417 | 417 | <select class="widefat" id="<?php echo $this->get_field_id('title_tag'); ?>" |
418 | 418 | name="<?php echo $this->get_field_name('title_tag'); ?>"> |
419 | 419 | <?php |
420 | - foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | - echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
422 | - } |
|
423 | - ?> |
|
420 | + foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | + echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
422 | + } |
|
423 | + ?> |
|
424 | 424 | </select> |
425 | 425 | </label> |
426 | 426 | </p> |
@@ -442,24 +442,24 @@ discard block |
||
442 | 442 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
443 | 443 | name="<?php echo $this->get_field_name('layout'); ?>"> |
444 | 444 | <option <?php if ($layout == 'gridview_onehalf') { |
445 | - echo 'selected="selected"'; |
|
446 | - } ?> |
|
445 | + echo 'selected="selected"'; |
|
446 | + } ?> |
|
447 | 447 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
448 | 448 | <option <?php if ($layout == 'gridview_onethird') { |
449 | - echo 'selected="selected"'; |
|
450 | - } ?> |
|
449 | + echo 'selected="selected"'; |
|
450 | + } ?> |
|
451 | 451 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
452 | 452 | <option <?php if ($layout == 'gridview_onefourth') { |
453 | - echo 'selected="selected"'; |
|
454 | - } ?> |
|
453 | + echo 'selected="selected"'; |
|
454 | + } ?> |
|
455 | 455 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
456 | 456 | <option <?php if ($layout == 'gridview_onefifth') { |
457 | - echo 'selected="selected"'; |
|
458 | - } ?> |
|
457 | + echo 'selected="selected"'; |
|
458 | + } ?> |
|
459 | 459 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
460 | 460 | <option <?php if ($layout == 'list') { |
461 | - echo 'selected="selected"'; |
|
462 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
461 | + echo 'selected="selected"'; |
|
462 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
463 | 463 | |
464 | 464 | </select> |
465 | 465 | </label> |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
530 | 530 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
531 | 531 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
532 | - echo 'checked="checked"'; |
|
533 | - } ?> value="1"/> |
|
532 | + echo 'checked="checked"'; |
|
533 | + } ?> value="1"/> |
|
534 | 534 | </label> |
535 | 535 | </p> |
536 | 536 | <p> |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | </script> |
579 | 579 | |
580 | 580 | <?php |
581 | - } |
|
581 | + } |
|
582 | 582 | } // class geodir_popular_postview |
583 | 583 | |
584 | 584 | register_widget('geodir_popular_postview'); |
585 | 585 | \ No newline at end of file |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //save the widget |
62 | 62 | $instance = $old_instance; |
63 | 63 | $instance['title'] = strip_tags($new_instance['title']); |
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
64 | + $category_limit = (int) $new_instance['category_limit']; |
|
65 | 65 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
66 | 66 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
67 | 67 | $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | public function form($instance) |
82 | 82 | { |
83 | 83 | //widgetform in backend |
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
84 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | 85 | |
86 | 86 | $title = strip_tags($instance['title']); |
87 | - $category_limit = (int)$instance['category_limit']; |
|
87 | + $category_limit = (int) $instance['category_limit']; |
|
88 | 88 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
89 | 89 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
90 | 90 | $parent_only = !empty($instance['parent_only']) ? true: false; |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | </label> |
98 | 98 | </p> |
99 | 99 | <p> |
100 | - <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?> |
|
100 | + <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?> |
|
101 | 101 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>"> |
102 | 102 | <?php foreach ($post_type_options as $name => $title) { ?> |
103 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
103 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
104 | 104 | <?php } ?> |
105 | 105 | </select> |
106 | 106 | </label> |
107 | 107 | </p> |
108 | 108 | <p> |
109 | 109 | <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?> |
110 | - <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/> |
|
110 | + <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/> |
|
111 | 111 | <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p> |
112 | 112 | </label> |
113 | 113 | </p> |
114 | 114 | <p> |
115 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" /> |
|
116 | - <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
|
115 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" /> |
|
116 | + <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label> |
|
117 | 117 | </p> |
118 | 118 | <?php |
119 | 119 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function form($instance) |
218 | 218 | { |
219 | 219 | //widgetform in backend |
220 | - $instance = wp_parse_args((array)$instance, |
|
220 | + $instance = wp_parse_args((array) $instance, |
|
221 | 221 | array('title' => '', |
222 | 222 | 'post_type' => '', |
223 | 223 | 'category' => array(), |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | |
273 | 273 | ?> |
274 | 274 | <p> |
275 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
275 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
276 | 276 | <small>(%posttype_singular_label% , |
277 | - %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>) |
|
277 | + %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>) |
|
278 | 278 | </small> |
279 | 279 | |
280 | 280 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | <p> |
287 | 287 | <label |
288 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
288 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
289 | 289 | |
290 | 290 | <?php $postypes = geodir_get_posttypes(); |
291 | 291 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | <p id="post_type_cats"> |
319 | 319 | <label |
320 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
320 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
321 | 321 | |
322 | 322 | <?php |
323 | 323 | |
@@ -356,13 +356,13 @@ discard block |
||
356 | 356 | |
357 | 357 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
358 | 358 | id="<?php echo $this->get_field_id('category_title'); ?>" |
359 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
359 | + value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/> |
|
360 | 360 | |
361 | 361 | </label> |
362 | 362 | </p> |
363 | 363 | |
364 | 364 | <p> |
365 | - <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
365 | + <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
366 | 366 | |
367 | 367 | <?php |
368 | 368 | $list_sort_arr = array( |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | * @param array $list_sort_arr The array of key value pairs of settings. |
382 | 382 | * @param array $instance The array of widget settings. |
383 | 383 | */ |
384 | - $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
384 | + $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort', $list_sort_arr, $instance); |
|
385 | 385 | ?> |
386 | 386 | |
387 | 387 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
388 | 388 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
389 | 389 | <?php |
390 | - foreach($list_sort_arr as $sort_val => $sort_title){ |
|
391 | - echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
390 | + foreach ($list_sort_arr as $sort_val => $sort_title) { |
|
391 | + echo "<option value='$sort_val' ".selected($list_sort, $sort_val)." >$sort_title</option>"; |
|
392 | 392 | } |
393 | 393 | ?> |
394 | 394 | </select> |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | </p> |
397 | 397 | |
398 | 398 | <p> |
399 | - <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory');?> |
|
399 | + <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory'); ?> |
|
400 | 400 | |
401 | 401 | <?php |
402 | 402 | $title_tag_arr = array( |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | * @param array $title_tag_arr The array of key value pairs of settings. |
412 | 412 | * @param array $instance The array of widget settings. |
413 | 413 | */ |
414 | - $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance); |
|
414 | + $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag', $title_tag_arr, $instance); |
|
415 | 415 | ?> |
416 | 416 | |
417 | 417 | <select class="widefat" id="<?php echo $this->get_field_id('title_tag'); ?>" |
418 | 418 | name="<?php echo $this->get_field_name('title_tag'); ?>"> |
419 | 419 | <?php |
420 | - foreach($title_tag_arr as $title_val => $title_title){ |
|
421 | - echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>"; |
|
420 | + foreach ($title_tag_arr as $title_val => $title_title) { |
|
421 | + echo "<option value='$title_val' ".selected($title_tag, $title_val)." >$title_title</option>"; |
|
422 | 422 | } |
423 | 423 | ?> |
424 | 424 | </select> |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <p> |
429 | 429 | |
430 | 430 | <label |
431 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
431 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
432 | 432 | |
433 | 433 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
434 | 434 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | |
439 | 439 | <p> |
440 | 440 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
441 | - <?php _e('Layout:', 'geodirectory');?> |
|
441 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
442 | 442 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
443 | 443 | name="<?php echo $this->get_field_name('layout'); ?>"> |
444 | 444 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | |
468 | 468 | <p> |
469 | 469 | <label |
470 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
470 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
471 | 471 | |
472 | 472 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
473 | 473 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | |
478 | 478 | <p> |
479 | 479 | <label |
480 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
480 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
481 | 481 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
482 | 482 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
483 | 483 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -486,41 +486,41 @@ discard block |
||
486 | 486 | |
487 | 487 | <p> |
488 | 488 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
489 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
489 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
490 | 490 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
491 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
491 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
492 | 492 | value="1"/> |
493 | 493 | </label> |
494 | 494 | </p> |
495 | 495 | <p> |
496 | 496 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
497 | - <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
|
497 | + <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" |
|
498 | 498 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
499 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
499 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
500 | 500 | value="1"/> |
501 | 501 | </label> |
502 | 502 | </p> |
503 | 503 | <p> |
504 | 504 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
505 | - <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
|
505 | + <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox" |
|
506 | 506 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
507 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
507 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?> |
|
508 | 508 | value="1"/> |
509 | 509 | </label> |
510 | 510 | </p> |
511 | 511 | <p> |
512 | 512 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
513 | - <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
|
513 | + <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox" |
|
514 | 514 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
515 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
515 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?> |
|
516 | 516 | value="1"/> |
517 | 517 | </label> |
518 | 518 | </p> |
519 | 519 | <p> |
520 | 520 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
521 | - <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
|
521 | + <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox" |
|
522 | 522 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
523 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
523 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?> |
|
524 | 524 | value="1"/> |
525 | 525 | </label> |
526 | 526 | </p> |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | |
571 | 571 | } |
572 | 572 | |
573 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
573 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
574 | 574 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
575 | 575 | |
576 | 576 | <?php } ?> |
@@ -191,10 +191,11 @@ discard block |
||
191 | 191 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
192 | 192 | $instance['title_tag'] = strip_tags($new_instance['title_tag']); |
193 | 193 | $instance['character_count'] = $new_instance['character_count']; |
194 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
195 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | - else |
|
197 | - $instance['add_location_filter'] = '0'; |
|
194 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
195 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
196 | + } else { |
|
197 | + $instance['add_location_filter'] = '0'; |
|
198 | + } |
|
198 | 199 | |
199 | 200 | $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
200 | 201 | $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
@@ -325,8 +326,9 @@ discard block |
||
325 | 326 | |
326 | 327 | $all_postypes = geodir_get_posttypes(); |
327 | 328 | |
328 | - if (!in_array($post_type, $all_postypes)) |
|
329 | - $post_type = 'gd_place'; |
|
329 | + if (!in_array($post_type, $all_postypes)) { |
|
330 | + $post_type = 'gd_place'; |
|
331 | + } |
|
330 | 332 | |
331 | 333 | $category_taxonomy = geodir_get_taxonomies($post_type); |
332 | 334 | $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
@@ -341,8 +343,9 @@ discard block |
||
341 | 343 | } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
342 | 344 | <?php foreach ($categories as $category_obj) { |
343 | 345 | $selected = ''; |
344 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
345 | - echo $selected = 'selected="selected"'; |
|
346 | + if (is_array($category) && in_array($category_obj->term_id, $category)) { |
|
347 | + echo $selected = 'selected="selected"'; |
|
348 | + } |
|
346 | 349 | |
347 | 350 | ?> |
348 | 351 | |
@@ -356,7 +359,12 @@ discard block |
||
356 | 359 | |
357 | 360 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
358 | 361 | id="<?php echo $this->get_field_id('category_title'); ?>" |
359 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
362 | + value="<?php if ($category_title != '') { |
|
363 | + echo $category_title; |
|
364 | +} else { |
|
365 | + echo __('All', 'geodirectory'); |
|
366 | +} |
|
367 | +?>"/> |
|
360 | 368 | |
361 | 369 | </label> |
362 | 370 | </p> |
@@ -488,7 +496,10 @@ discard block |
||
488 | 496 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
489 | 497 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
490 | 498 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
491 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
499 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
500 | + echo 'checked="checked"'; |
|
501 | +} |
|
502 | +?> |
|
492 | 503 | value="1"/> |
493 | 504 | </label> |
494 | 505 | </p> |
@@ -496,7 +507,10 @@ discard block |
||
496 | 507 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
497 | 508 | <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
498 | 509 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
499 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
510 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
511 | + echo 'checked="checked"'; |
|
512 | +} |
|
513 | +?> |
|
500 | 514 | value="1"/> |
501 | 515 | </label> |
502 | 516 | </p> |
@@ -504,7 +518,10 @@ discard block |
||
504 | 518 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
505 | 519 | <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
506 | 520 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
507 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
521 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) { |
|
522 | + echo 'checked="checked"'; |
|
523 | +} |
|
524 | +?> |
|
508 | 525 | value="1"/> |
509 | 526 | </label> |
510 | 527 | </p> |
@@ -512,7 +529,10 @@ discard block |
||
512 | 529 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
513 | 530 | <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
514 | 531 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
515 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
532 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) { |
|
533 | + echo 'checked="checked"'; |
|
534 | +} |
|
535 | +?> |
|
516 | 536 | value="1"/> |
517 | 537 | </label> |
518 | 538 | </p> |
@@ -520,7 +540,10 @@ discard block |
||
520 | 540 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
521 | 541 | <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
522 | 542 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
523 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
543 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) { |
|
544 | + echo 'checked="checked"'; |
|
545 | +} |
|
546 | +?> |
|
524 | 547 | value="1"/> |
525 | 548 | </label> |
526 | 549 | </p> |
@@ -71,31 +71,31 @@ |
||
71 | 71 | public function get_privacy_message() { |
72 | 72 | |
73 | 73 | $content = '<h2>' . __( 'Listings', 'geodirectory' ) . '</h2>' . |
74 | - '<p>' . __( 'We collect information about you during the add listing process on our site. This information may include, but is not limited to, your name, email address, phone number, address, locations details including GPS co-ordinates and any other details that might be requested from you for the purpose of adding your business/personal listings.', 'geodirectory' ) . '</p>' . |
|
75 | - '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
76 | - '<ul>' . |
|
77 | - '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request) and allow website users to search and view submitted listing information.', 'geodirectory' ) . '</li>' . |
|
78 | - '<li>' . __( '- Send you important account/order/service information.', 'geodirectory' ) . '</li>' . |
|
79 | - '<li>' . __( '- Provide a way for users to contact your listing via the provided contact information.', 'geodirectory' ) . '</li>' . |
|
80 | - '<li>' . __( '- Notify you of user interactions such as but not limited to review and contact notifications.', 'geodirectory' ) . '</li>' . |
|
81 | - '<li>' . __( '- Respond to your queries or complaints.', 'geodirectory' ) . '</li>' . |
|
82 | - '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'geodirectory' ) . '</li>' . |
|
83 | - '</ul>' . |
|
84 | - '<h2>' . __( 'Reviews', 'geodirectory' ) . '</h2>' . |
|
85 | - '<p>' . __( 'We collect information about you during the leave a review process on our site. This information may include, but is not limited to, your name, email address, IP address, website url, image(s), review ratings and review texts.', 'geodirectory' ) . '</p>' . |
|
86 | - '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
87 | - '<ul>' . |
|
88 | - '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request).', 'geodirectory' ) . '</li>' . |
|
89 | - '<li>' . __( '- Notify you of interactions such as approval or rejection of your review.', 'geodirectory' ) . '</li>' . |
|
90 | - '<li>' . __( '- Notify you of user interactions such as reply notifications.', 'geodirectory' ) . '</li>' . |
|
91 | - '</ul>' . |
|
92 | - '<h2>' . __( 'Listing contact forms', 'geodirectory' ) . '</h2>' . |
|
93 | - '<p>' . __( 'We may collect information about you when you submit a contact form to a listing. This information may include, but is not limited to, your name, email address, IP address and contact texts.', 'geodirectory' ) . '</p>' . |
|
94 | - '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
95 | - '<ul>' . |
|
96 | - '<li>' . __( '- Send your contact message and details to the listings contact email.', 'geodirectory' ) . '</li>' . |
|
97 | - '<li>' . __( '- Monitor the contact system for spam and abuse.', 'geodirectory' ) . '</li>' . |
|
98 | - '</ul>'; |
|
74 | + '<p>' . __( 'We collect information about you during the add listing process on our site. This information may include, but is not limited to, your name, email address, phone number, address, locations details including GPS co-ordinates and any other details that might be requested from you for the purpose of adding your business/personal listings.', 'geodirectory' ) . '</p>' . |
|
75 | + '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
76 | + '<ul>' . |
|
77 | + '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request) and allow website users to search and view submitted listing information.', 'geodirectory' ) . '</li>' . |
|
78 | + '<li>' . __( '- Send you important account/order/service information.', 'geodirectory' ) . '</li>' . |
|
79 | + '<li>' . __( '- Provide a way for users to contact your listing via the provided contact information.', 'geodirectory' ) . '</li>' . |
|
80 | + '<li>' . __( '- Notify you of user interactions such as but not limited to review and contact notifications.', 'geodirectory' ) . '</li>' . |
|
81 | + '<li>' . __( '- Respond to your queries or complaints.', 'geodirectory' ) . '</li>' . |
|
82 | + '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'geodirectory' ) . '</li>' . |
|
83 | + '</ul>' . |
|
84 | + '<h2>' . __( 'Reviews', 'geodirectory' ) . '</h2>' . |
|
85 | + '<p>' . __( 'We collect information about you during the leave a review process on our site. This information may include, but is not limited to, your name, email address, IP address, website url, image(s), review ratings and review texts.', 'geodirectory' ) . '</p>' . |
|
86 | + '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
87 | + '<ul>' . |
|
88 | + '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request).', 'geodirectory' ) . '</li>' . |
|
89 | + '<li>' . __( '- Notify you of interactions such as approval or rejection of your review.', 'geodirectory' ) . '</li>' . |
|
90 | + '<li>' . __( '- Notify you of user interactions such as reply notifications.', 'geodirectory' ) . '</li>' . |
|
91 | + '</ul>' . |
|
92 | + '<h2>' . __( 'Listing contact forms', 'geodirectory' ) . '</h2>' . |
|
93 | + '<p>' . __( 'We may collect information about you when you submit a contact form to a listing. This information may include, but is not limited to, your name, email address, IP address and contact texts.', 'geodirectory' ) . '</p>' . |
|
94 | + '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
95 | + '<ul>' . |
|
96 | + '<li>' . __( '- Send your contact message and details to the listings contact email.', 'geodirectory' ) . '</li>' . |
|
97 | + '<li>' . __( '- Monitor the contact system for spam and abuse.', 'geodirectory' ) . '</li>' . |
|
98 | + '</ul>'; |
|
99 | 99 | |
100 | 100 | |
101 | 101 | return apply_filters( 'geodir_privacy_policy_content', $content) ; |
@@ -285,6 +285,10 @@ |
||
285 | 285 | return apply_filters( 'geodir_privacy_allow_erase_favorites_data', $allow ); |
286 | 286 | } |
287 | 287 | |
288 | + /** |
|
289 | + * @param string $email_address |
|
290 | + * @param integer $page |
|
291 | + */ |
|
288 | 292 | public static function favorites_by_user( $email_address, $page ) { |
289 | 293 | if ( empty( $email_address ) ) { |
290 | 294 | return array(); |
@@ -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 Class. |
@@ -17,44 +17,44 @@ discard block |
||
17 | 17 | * Init - hook into events. |
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | - parent::__construct( __( 'GeoDirectory', 'geodirectory' ) ); |
|
20 | + parent::__construct(__('GeoDirectory', 'geodirectory')); |
|
21 | 21 | |
22 | 22 | // Include supporting classes. |
23 | - include_once( 'class-geodir-privacy-erasers.php' ); |
|
24 | - include_once( 'class-geodir-privacy-exporters.php' ); |
|
23 | + include_once('class-geodir-privacy-erasers.php'); |
|
24 | + include_once('class-geodir-privacy-exporters.php'); |
|
25 | 25 | |
26 | - $gd_post_types = geodir_get_posttypes( 'object' ); |
|
26 | + $gd_post_types = geodir_get_posttypes('object'); |
|
27 | 27 | |
28 | - if ( ! empty( $gd_post_types ) ) { |
|
29 | - foreach ( $gd_post_types as $post_type => $info ) { |
|
28 | + if (!empty($gd_post_types)) { |
|
29 | + foreach ($gd_post_types as $post_type => $info) { |
|
30 | 30 | $name = $info->labels->name; |
31 | 31 | |
32 | - if ( self::allow_export_post_type_data( $post_type ) ) { |
|
32 | + if (self::allow_export_post_type_data($post_type)) { |
|
33 | 33 | // This hook registers GeoDirectory data exporters. |
34 | - $this->add_exporter( 'geodirectory-post-' . $post_type, wp_sprintf( __( 'User %s', 'geodirectory' ), $name ), array( 'GeoDir_Privacy_Exporters', 'post_data_exporter' ) ); |
|
34 | + $this->add_exporter('geodirectory-post-'.$post_type, wp_sprintf(__('User %s', 'geodirectory'), $name), array('GeoDir_Privacy_Exporters', 'post_data_exporter')); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | 39 | // Handles custom anonomization types not included in core. |
40 | - add_filter( 'wp_privacy_anonymize_data', array( $this, 'anonymize_custom_data_types' ), 10, 3 ); |
|
40 | + add_filter('wp_privacy_anonymize_data', array($this, 'anonymize_custom_data_types'), 10, 3); |
|
41 | 41 | |
42 | - if ( self::allow_export_reviews_data() ) { |
|
42 | + if (self::allow_export_reviews_data()) { |
|
43 | 43 | // Review data export |
44 | - add_filter( 'wp_privacy_personal_data_export_page', array( 'GeoDir_Privacy_Exporters', 'review_data_exporter' ), 10, 7 ); |
|
44 | + add_filter('wp_privacy_personal_data_export_page', array('GeoDir_Privacy_Exporters', 'review_data_exporter'), 10, 7); |
|
45 | 45 | } |
46 | 46 | |
47 | - if ( self::allow_erase_reviews_data() ) { |
|
47 | + if (self::allow_erase_reviews_data()) { |
|
48 | 48 | // Review data erase |
49 | - $this->add_eraser( 'geodirectory-post-reviews', __( 'User Listing Reviews', 'geodirectory' ), array( 'GeoDir_Privacy_Erasers', 'review_data_eraser' ) ); |
|
49 | + $this->add_eraser('geodirectory-post-reviews', __('User Listing Reviews', 'geodirectory'), array('GeoDir_Privacy_Erasers', 'review_data_eraser')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Post favorites |
53 | - if ( self::allow_export_favorites_data() ) { |
|
54 | - $this->add_exporter( 'geodirectory-post-favorites', __( 'GeoDirectory Favorite Listings', 'geodirectory' ), array( 'GeoDir_Privacy_Exporters', 'favorites_data_exporter' ) ); |
|
53 | + if (self::allow_export_favorites_data()) { |
|
54 | + $this->add_exporter('geodirectory-post-favorites', __('GeoDirectory Favorite Listings', 'geodirectory'), array('GeoDir_Privacy_Exporters', 'favorites_data_exporter')); |
|
55 | 55 | } |
56 | - if ( self::allow_erase_favorites_data() ) { |
|
57 | - $this->add_eraser( 'geodirectory-post-favorites', __( 'GeoDirectory Favorite Listings', 'geodirectory' ), array( 'GeoDir_Privacy_Erasers', 'favorites_data_eraser' ) ); |
|
56 | + if (self::allow_erase_favorites_data()) { |
|
57 | + $this->add_eraser('geodirectory-post-favorites', __('GeoDirectory Favorite Listings', 'geodirectory'), array('GeoDir_Privacy_Erasers', 'favorites_data_eraser')); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -67,35 +67,35 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function get_privacy_message() { |
69 | 69 | |
70 | - $content = '<h2>' . __( 'Listings', 'geodirectory' ) . '</h2>' . |
|
71 | - '<p>' . __( 'We collect information about you during the add listing process on our site. This information may include, but is not limited to, your name, email address, phone number, address, locations details including GPS co-ordinates and any other details that might be requested from you for the purpose of adding your business/personal listings.', 'geodirectory' ) . '</p>' . |
|
72 | - '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
73 | - '<ul>' . |
|
74 | - '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request) and allow website users to search and view submitted listing information.', 'geodirectory' ) . '</li>' . |
|
75 | - '<li>' . __( '- Send you important account/order/service information.', 'geodirectory' ) . '</li>' . |
|
76 | - '<li>' . __( '- Provide a way for users to contact your listing via the provided contact information.', 'geodirectory' ) . '</li>' . |
|
77 | - '<li>' . __( '- Notify you of user interactions such as but not limited to review and contact notifications.', 'geodirectory' ) . '</li>' . |
|
78 | - '<li>' . __( '- Respond to your queries or complaints.', 'geodirectory' ) . '</li>' . |
|
79 | - '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'geodirectory' ) . '</li>' . |
|
80 | - '</ul>' . |
|
81 | - '<h2>' . __( 'Reviews', 'geodirectory' ) . '</h2>' . |
|
82 | - '<p>' . __( 'We collect information about you during the leave a review process on our site. This information may include, but is not limited to, your name, email address, IP address, website url, image(s), review ratings and review texts.', 'geodirectory' ) . '</p>' . |
|
83 | - '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
84 | - '<ul>' . |
|
85 | - '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request).', 'geodirectory' ) . '</li>' . |
|
86 | - '<li>' . __( '- Notify you of interactions such as approval or rejection of your review.', 'geodirectory' ) . '</li>' . |
|
87 | - '<li>' . __( '- Notify you of user interactions such as reply notifications.', 'geodirectory' ) . '</li>' . |
|
88 | - '</ul>' . |
|
89 | - '<h2>' . __( 'Listing contact forms', 'geodirectory' ) . '</h2>' . |
|
90 | - '<p>' . __( 'We may collect information about you when you submit a contact form to a listing. This information may include, but is not limited to, your name, email address, IP address and contact texts.', 'geodirectory' ) . '</p>' . |
|
91 | - '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' . |
|
92 | - '<ul>' . |
|
93 | - '<li>' . __( '- Send your contact message and details to the listings contact email.', 'geodirectory' ) . '</li>' . |
|
94 | - '<li>' . __( '- Monitor the contact system for spam and abuse.', 'geodirectory' ) . '</li>' . |
|
70 | + $content = '<h2>'.__('Listings', 'geodirectory').'</h2>'. |
|
71 | + '<p>'.__('We collect information about you during the add listing process on our site. This information may include, but is not limited to, your name, email address, phone number, address, locations details including GPS co-ordinates and any other details that might be requested from you for the purpose of adding your business/personal listings.', 'geodirectory').'</p>'. |
|
72 | + '<p>'.__('Handling this data also allows us to:', 'geodirectory').'</p>'. |
|
73 | + '<ul>'. |
|
74 | + '<li>'.__('- Display this information in a public facing manner (such as a web page or API request) and allow website users to search and view submitted listing information.', 'geodirectory').'</li>'. |
|
75 | + '<li>'.__('- Send you important account/order/service information.', 'geodirectory').'</li>'. |
|
76 | + '<li>'.__('- Provide a way for users to contact your listing via the provided contact information.', 'geodirectory').'</li>'. |
|
77 | + '<li>'.__('- Notify you of user interactions such as but not limited to review and contact notifications.', 'geodirectory').'</li>'. |
|
78 | + '<li>'.__('- Respond to your queries or complaints.', 'geodirectory').'</li>'. |
|
79 | + '<li>'.__('- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'geodirectory').'</li>'. |
|
80 | + '</ul>'. |
|
81 | + '<h2>'.__('Reviews', 'geodirectory').'</h2>'. |
|
82 | + '<p>'.__('We collect information about you during the leave a review process on our site. This information may include, but is not limited to, your name, email address, IP address, website url, image(s), review ratings and review texts.', 'geodirectory').'</p>'. |
|
83 | + '<p>'.__('Handling this data also allows us to:', 'geodirectory').'</p>'. |
|
84 | + '<ul>'. |
|
85 | + '<li>'.__('- Display this information in a public facing manner (such as a web page or API request).', 'geodirectory').'</li>'. |
|
86 | + '<li>'.__('- Notify you of interactions such as approval or rejection of your review.', 'geodirectory').'</li>'. |
|
87 | + '<li>'.__('- Notify you of user interactions such as reply notifications.', 'geodirectory').'</li>'. |
|
88 | + '</ul>'. |
|
89 | + '<h2>'.__('Listing contact forms', 'geodirectory').'</h2>'. |
|
90 | + '<p>'.__('We may collect information about you when you submit a contact form to a listing. This information may include, but is not limited to, your name, email address, IP address and contact texts.', 'geodirectory').'</p>'. |
|
91 | + '<p>'.__('Handling this data also allows us to:', 'geodirectory').'</p>'. |
|
92 | + '<ul>'. |
|
93 | + '<li>'.__('- Send your contact message and details to the listings contact email.', 'geodirectory').'</li>'. |
|
94 | + '<li>'.__('- Monitor the contact system for spam and abuse.', 'geodirectory').'</li>'. |
|
95 | 95 | '</ul>'; |
96 | 96 | |
97 | 97 | |
98 | - return apply_filters( 'geodir_privacy_policy_content', $content) ; |
|
98 | + return apply_filters('geodir_privacy_policy_content', $content); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | * @param string $data The data being anonymized. |
107 | 107 | * @return string Anonymized string. |
108 | 108 | */ |
109 | - public function anonymize_custom_data_types( $anonymous, $type, $data ) { |
|
110 | - switch ( $type ) { |
|
109 | + public function anonymize_custom_data_types($anonymous, $type, $data) { |
|
110 | + switch ($type) { |
|
111 | 111 | case 'phone': |
112 | - $anonymous = preg_replace( '/\d/u', '0', $data ); |
|
112 | + $anonymous = preg_replace('/\d/u', '0', $data); |
|
113 | 113 | break; |
114 | 114 | case 'numeric_id': |
115 | 115 | $anonymous = 0; |
@@ -122,46 +122,46 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | public static function personal_data_exporter_key() { |
125 | - if ( ! wp_doing_ajax() ) { |
|
125 | + if (!wp_doing_ajax()) { |
|
126 | 126 | return false; |
127 | 127 | } |
128 | 128 | |
129 | - if ( empty( $_POST['id'] ) ) { |
|
129 | + if (empty($_POST['id'])) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | $request_id = (int) $_POST['id']; |
133 | 133 | |
134 | - if ( $request_id < 1 ) { |
|
134 | + if ($request_id < 1) { |
|
135 | 135 | return false; |
136 | 136 | } |
137 | 137 | |
138 | - if ( ! current_user_can( 'export_others_personal_data' ) ) { |
|
138 | + if (!current_user_can('export_others_personal_data')) { |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Get the request data. |
143 | - $request = wp_get_user_request_data( $request_id ); |
|
143 | + $request = wp_get_user_request_data($request_id); |
|
144 | 144 | |
145 | - if ( ! $request || 'export_personal_data' !== $request->action_name ) { |
|
145 | + if (!$request || 'export_personal_data' !== $request->action_name) { |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | |
149 | 149 | $email_address = $request->email; |
150 | - if ( ! is_email( $email_address ) ) { |
|
150 | + if (!is_email($email_address)) { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | |
154 | - if ( ! isset( $_POST['exporter'] ) ) { |
|
154 | + if (!isset($_POST['exporter'])) { |
|
155 | 155 | return false; |
156 | 156 | } |
157 | 157 | $exporter_index = (int) $_POST['exporter']; |
158 | 158 | |
159 | - if ( ! isset( $_POST['page'] ) ) { |
|
159 | + if (!isset($_POST['page'])) { |
|
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | $page = (int) $_POST['page']; |
163 | 163 | |
164 | - $send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false; |
|
164 | + $send_as_email = isset($_POST['sendAsEmail']) ? ('true' === $_POST['sendAsEmail']) : false; |
|
165 | 165 | |
166 | 166 | /** |
167 | 167 | * Filters the array of exporter callbacks. |
@@ -182,37 +182,37 @@ discard block |
||
182 | 182 | * } |
183 | 183 | * } |
184 | 184 | */ |
185 | - $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); |
|
185 | + $exporters = apply_filters('wp_privacy_personal_data_exporters', array()); |
|
186 | 186 | |
187 | - if ( ! is_array( $exporters ) ) { |
|
187 | + if (!is_array($exporters)) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
191 | 191 | // Do we have any registered exporters? |
192 | - if ( 0 < count( $exporters ) ) { |
|
193 | - if ( $exporter_index < 1 ) { |
|
192 | + if (0 < count($exporters)) { |
|
193 | + if ($exporter_index < 1) { |
|
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
197 | - if ( $exporter_index > count( $exporters ) ) { |
|
197 | + if ($exporter_index > count($exporters)) { |
|
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | |
201 | - if ( $page < 1 ) { |
|
201 | + if ($page < 1) { |
|
202 | 202 | return false; |
203 | 203 | } |
204 | 204 | |
205 | - $exporter_keys = array_keys( $exporters ); |
|
206 | - $exporter_key = $exporter_keys[ $exporter_index - 1 ]; |
|
207 | - $exporter = $exporters[ $exporter_key ]; |
|
205 | + $exporter_keys = array_keys($exporters); |
|
206 | + $exporter_key = $exporter_keys[$exporter_index - 1]; |
|
207 | + $exporter = $exporters[$exporter_key]; |
|
208 | 208 | |
209 | - if ( ! is_array( $exporter ) || empty( $exporter_key ) ) { |
|
209 | + if (!is_array($exporter) || empty($exporter_key)) { |
|
210 | 210 | return false; |
211 | 211 | } |
212 | - if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) { |
|
212 | + if (!array_key_exists('exporter_friendly_name', $exporter)) { |
|
213 | 213 | return false; |
214 | 214 | } |
215 | - if ( ! array_key_exists( 'callback', $exporter ) ) { |
|
215 | + if (!array_key_exists('callback', $exporter)) { |
|
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param int $request_id The privacy request post ID associated with this request. |
231 | 231 | * @param bool $send_as_email Whether the final results of the export should be emailed to the user. |
232 | 232 | */ |
233 | - $exporter_key = apply_filters( 'geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email ); |
|
233 | + $exporter_key = apply_filters('geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email); |
|
234 | 234 | |
235 | 235 | return $exporter_key; |
236 | 236 | } |
@@ -238,66 +238,66 @@ discard block |
||
238 | 238 | public static function exporter_post_type() { |
239 | 239 | $exporter_key = self::personal_data_exporter_key(); |
240 | 240 | |
241 | - if ( empty( $exporter_key ) ) { |
|
241 | + if (empty($exporter_key)) { |
|
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | |
245 | - if ( strpos( $exporter_key, 'geodirectory-post-' ) !== 0 ) { |
|
245 | + if (strpos($exporter_key, 'geodirectory-post-') !== 0) { |
|
246 | 246 | return false; |
247 | 247 | } |
248 | 248 | |
249 | - $post_type = str_replace( 'geodirectory-post-', '', $exporter_key ); |
|
249 | + $post_type = str_replace('geodirectory-post-', '', $exporter_key); |
|
250 | 250 | |
251 | - if ( $post_type != '' && in_array( $post_type, geodir_get_posttypes() ) ) { |
|
251 | + if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) { |
|
252 | 252 | return $post_type; |
253 | 253 | } |
254 | 254 | |
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | |
258 | - public static function allow_export_post_type_data( $post_type ) { |
|
258 | + public static function allow_export_post_type_data($post_type) { |
|
259 | 259 | $allow = true; |
260 | 260 | |
261 | - return apply_filters( 'geodir_privacy_allow_export_post_type_data', $allow, $post_type ); |
|
261 | + return apply_filters('geodir_privacy_allow_export_post_type_data', $allow, $post_type); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | public static function allow_export_reviews_data() { |
265 | 265 | $allow = true; |
266 | 266 | |
267 | - return apply_filters( 'geodir_privacy_allow_export_reviews_data', $allow ); |
|
267 | + return apply_filters('geodir_privacy_allow_export_reviews_data', $allow); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | public static function allow_erase_reviews_data() { |
271 | 271 | $allow = true; |
272 | 272 | |
273 | - return apply_filters( 'geodir_privacy_allow_erase_reviews_data', $allow ); |
|
273 | + return apply_filters('geodir_privacy_allow_erase_reviews_data', $allow); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | public static function allow_export_favorites_data() { |
277 | 277 | $allow = true; |
278 | 278 | |
279 | - return apply_filters( 'geodir_privacy_allow_export_favorites_data', $allow ); |
|
279 | + return apply_filters('geodir_privacy_allow_export_favorites_data', $allow); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | public static function allow_erase_favorites_data() { |
283 | 283 | $allow = true; |
284 | 284 | |
285 | - return apply_filters( 'geodir_privacy_allow_erase_favorites_data', $allow ); |
|
285 | + return apply_filters('geodir_privacy_allow_erase_favorites_data', $allow); |
|
286 | 286 | } |
287 | 287 | |
288 | - public static function favorites_by_user( $email_address, $page ) { |
|
289 | - if ( empty( $email_address ) ) { |
|
288 | + public static function favorites_by_user($email_address, $page) { |
|
289 | + if (empty($email_address)) { |
|
290 | 290 | return array(); |
291 | 291 | } |
292 | 292 | |
293 | - $user = get_user_by( 'email', $email_address ); |
|
294 | - if ( empty( $user ) ) { |
|
293 | + $user = get_user_by('email', $email_address); |
|
294 | + if (empty($user)) { |
|
295 | 295 | return array(); |
296 | 296 | } |
297 | 297 | |
298 | - $favourites = geodir_get_user_favourites( $user->ID ); |
|
298 | + $favourites = geodir_get_user_favourites($user->ID); |
|
299 | 299 | |
300 | - return ( ! empty( $favourites ) && is_array( $favourites ) ? $favourites : array() ); |
|
300 | + return (!empty($favourites) && is_array($favourites) ? $favourites : array()); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 |
@@ -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 | * Abstract class that is intended to be extended by specific privacy class. |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param string $name Plugin identifier. |
45 | 45 | */ |
46 | - public function __construct( $name = '' ) { |
|
46 | + public function __construct($name = '') { |
|
47 | 47 | $this->name = $name; |
48 | 48 | $this->init(); |
49 | 49 | } |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | * Hook in events. |
53 | 53 | */ |
54 | 54 | protected function init() { |
55 | - add_action( 'admin_init', array( $this, 'add_privacy_message' ) ); |
|
55 | + add_action('admin_init', array($this, 'add_privacy_message')); |
|
56 | 56 | // Register data exporters |
57 | - add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ), 5 ); |
|
57 | + add_filter('wp_privacy_personal_data_exporters', array($this, 'register_exporters'), 5); |
|
58 | 58 | // Register data erasers |
59 | - add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_erasers' ) ); |
|
59 | + add_filter('wp_privacy_personal_data_erasers', array($this, 'register_erasers')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | public function add_privacy_message() { |
66 | 66 | $content = $this->get_privacy_message(); |
67 | 67 | |
68 | - if ( function_exists( 'wp_add_privacy_policy_content' ) && $content ) { |
|
69 | - wp_add_privacy_policy_content( $this->name, $this->get_privacy_message() ); |
|
68 | + if (function_exists('wp_add_privacy_policy_content') && $content) { |
|
69 | + wp_add_privacy_policy_content($this->name, $this->get_privacy_message()); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @param array $exporters List of exporter callbacks. |
87 | 87 | * @return array |
88 | 88 | */ |
89 | - public function register_exporters( $exporters = array() ) { |
|
90 | - foreach ( $this->exporters as $id => $exporter ) { |
|
91 | - $exporters[ $id ] = $exporter; |
|
89 | + public function register_exporters($exporters = array()) { |
|
90 | + foreach ($this->exporters as $id => $exporter) { |
|
91 | + $exporters[$id] = $exporter; |
|
92 | 92 | } |
93 | 93 | return $exporters; |
94 | 94 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * @param array $erasers List of eraser callbacks. |
100 | 100 | * @return array |
101 | 101 | */ |
102 | - public function register_erasers( $erasers = array() ) { |
|
103 | - foreach ( $this->erasers as $id => $eraser ) { |
|
104 | - $erasers[ $id ] = $eraser; |
|
102 | + public function register_erasers($erasers = array()) { |
|
103 | + foreach ($this->erasers as $id => $eraser) { |
|
104 | + $erasers[$id] = $eraser; |
|
105 | 105 | } |
106 | 106 | return $erasers; |
107 | 107 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | * @param string $name Exporter name. |
114 | 114 | * @param string $callback Exporter callback. |
115 | 115 | */ |
116 | - public function add_exporter( $id, $name, $callback ) { |
|
117 | - $this->exporters[ $id ] = array( |
|
116 | + public function add_exporter($id, $name, $callback) { |
|
117 | + $this->exporters[$id] = array( |
|
118 | 118 | 'exporter_friendly_name' => $name, |
119 | 119 | 'callback' => $callback, |
120 | 120 | ); |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @param string $name Exporter name. |
129 | 129 | * @param string $callback Exporter callback. |
130 | 130 | */ |
131 | - public function add_eraser( $id, $name, $callback ) { |
|
132 | - $this->erasers[ $id ] = array( |
|
131 | + public function add_eraser($id, $name, $callback) { |
|
132 | + $this->erasers[$id] = array( |
|
133 | 133 | 'eraser_friendly_name' => $name, |
134 | 134 | 'callback' => $callback, |
135 | 135 | ); |
@@ -136,7 +136,7 @@ |
||
136 | 136 | |
137 | 137 | global $wp_version; |
138 | 138 | // If curent WP Version >= 4.9.6. |
139 | -if ( version_compare( $wp_version, '4.9.6', '>=' ) ) { |
|
140 | - include_once( 'geodirectory-functions/privacy/abstract-geodir-privacy.php' ); |
|
141 | - include_once( 'geodirectory-functions/privacy/class-geodir-privacy.php' ); |
|
139 | +if (version_compare($wp_version, '4.9.6', '>=')) { |
|
140 | + include_once('geodirectory-functions/privacy/abstract-geodir-privacy.php'); |
|
141 | + include_once('geodirectory-functions/privacy/class-geodir-privacy.php'); |
|
142 | 142 | } |
143 | 143 | \ No newline at end of file |