@@ -248,8 +248,9 @@ discard block |
||
248 | 248 | |
249 | 249 | $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : ''; |
250 | 250 | |
251 | - if (!empty($comment_info)) |
|
252 | - $status = $comment_info->comment_approved; |
|
251 | + if (!empty($comment_info)) { |
|
252 | + $status = $comment_info->comment_approved; |
|
253 | + } |
|
253 | 254 | |
254 | 255 | if ($status == 'approve' || $status == 1) { |
255 | 256 | $status = 1; |
@@ -381,12 +382,14 @@ discard block |
||
381 | 382 | function geodir_wrap_comment_text($content, $comment = '') |
382 | 383 | { |
383 | 384 | $rating = 0; |
384 | - if (!empty($comment)) |
|
385 | - $rating = geodir_get_commentoverall($comment->comment_ID); |
|
385 | + if (!empty($comment)) { |
|
386 | + $rating = geodir_get_commentoverall($comment->comment_ID); |
|
387 | + } |
|
386 | 388 | if ($rating != 0 && !is_admin()) { |
387 | 389 | return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>'; |
388 | - } else |
|
389 | - return $content; |
|
390 | + } else { |
|
391 | + return $content; |
|
392 | + } |
|
390 | 393 | |
391 | 394 | } |
392 | 395 | |
@@ -475,11 +478,12 @@ discard block |
||
475 | 478 | $post_ratings = get_post_meta($post_id, 'overall_rating'); |
476 | 479 | } |
477 | 480 | |
478 | - if ($post_ratings) |
|
479 | - return $post_ratings; |
|
480 | - else |
|
481 | - return false; |
|
482 | -} |
|
481 | + if ($post_ratings) { |
|
482 | + return $post_ratings; |
|
483 | + } else { |
|
484 | + return false; |
|
485 | + } |
|
486 | + } |
|
483 | 487 | |
484 | 488 | |
485 | 489 | /** |
@@ -504,11 +508,12 @@ discard block |
||
504 | 508 | ) |
505 | 509 | ); |
506 | 510 | |
507 | - if (!empty($reatings)) |
|
508 | - return $reatings; |
|
509 | - else |
|
510 | - return false; |
|
511 | -} |
|
511 | + if (!empty($reatings)) { |
|
512 | + return $reatings; |
|
513 | + } else { |
|
514 | + return false; |
|
515 | + } |
|
516 | + } |
|
512 | 517 | |
513 | 518 | /** |
514 | 519 | * Get review total of a Post. |
@@ -532,11 +537,12 @@ discard block |
||
532 | 537 | ) |
533 | 538 | ); |
534 | 539 | |
535 | - if (!empty($results)) |
|
536 | - return $results; |
|
537 | - else |
|
538 | - return false; |
|
539 | -} |
|
540 | + if (!empty($results)) { |
|
541 | + return $results; |
|
542 | + } else { |
|
543 | + return false; |
|
544 | + } |
|
545 | + } |
|
540 | 546 | |
541 | 547 | /** |
542 | 548 | * Get review count by user ID. |
@@ -559,11 +565,12 @@ discard block |
||
559 | 565 | ) |
560 | 566 | ); |
561 | 567 | |
562 | - if (!empty($results)) |
|
563 | - return $results; |
|
564 | - else |
|
565 | - return false; |
|
566 | -} |
|
568 | + if (!empty($results)) { |
|
569 | + return $results; |
|
570 | + } else { |
|
571 | + return false; |
|
572 | + } |
|
573 | + } |
|
567 | 574 | |
568 | 575 | /** |
569 | 576 | * Get average overall rating of a Post. |
@@ -597,11 +604,12 @@ discard block |
||
597 | 604 | ) |
598 | 605 | ); |
599 | 606 | |
600 | - if (!empty($results)) |
|
601 | - return $results; |
|
602 | - else |
|
603 | - return false; |
|
604 | -} |
|
607 | + if (!empty($results)) { |
|
608 | + return $results; |
|
609 | + } else { |
|
610 | + return false; |
|
611 | + } |
|
612 | + } |
|
605 | 613 | |
606 | 614 | /** |
607 | 615 | * Get review count of a Post. |
@@ -625,11 +633,12 @@ discard block |
||
625 | 633 | ) |
626 | 634 | ); |
627 | 635 | |
628 | - if (!empty($results)) |
|
629 | - return $results; |
|
630 | - else |
|
631 | - return false; |
|
632 | -} |
|
636 | + if (!empty($results)) { |
|
637 | + return $results; |
|
638 | + } else { |
|
639 | + return false; |
|
640 | + } |
|
641 | + } |
|
633 | 642 | |
634 | 643 | /** |
635 | 644 | * Get comments count of a Post. |
@@ -655,11 +664,12 @@ discard block |
||
655 | 664 | ); |
656 | 665 | |
657 | 666 | |
658 | - if (!empty($results)) |
|
659 | - return $results; |
|
660 | - else |
|
661 | - return false; |
|
662 | -} |
|
667 | + if (!empty($results)) { |
|
668 | + return $results; |
|
669 | + } else { |
|
670 | + return false; |
|
671 | + } |
|
672 | + } |
|
663 | 673 | |
664 | 674 | /** |
665 | 675 | * Get overall rating of a comment. |
@@ -683,11 +693,12 @@ discard block |
||
683 | 693 | ) |
684 | 694 | ); |
685 | 695 | |
686 | - if ($reatings) |
|
687 | - return $reatings; |
|
688 | - else |
|
689 | - return false; |
|
690 | -} |
|
696 | + if ($reatings) { |
|
697 | + return $reatings; |
|
698 | + } else { |
|
699 | + return false; |
|
700 | + } |
|
701 | + } |
|
691 | 702 | |
692 | 703 | /** |
693 | 704 | * Returns average overall rating of a Post. Depreciated since ver 1.3.6. |
@@ -930,8 +941,9 @@ discard block |
||
930 | 941 | $active_tabs = get_option('geodir_detail_page_tabs_excluded'); |
931 | 942 | |
932 | 943 | $is_display = true; |
933 | - if (!empty($active_tabs) && in_array('reviews', $active_tabs)) |
|
934 | - $is_display = false; |
|
944 | + if (!empty($active_tabs) && in_array('reviews', $active_tabs)) { |
|
945 | + $is_display = false; |
|
946 | + } |
|
935 | 947 | |
936 | 948 | /** |
937 | 949 | * Filter to change display value. |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function geodir_comment_meta_row_action($a) |
33 | 33 | { |
34 | - global $comment; |
|
35 | - |
|
36 | - $rating = geodir_get_commentoverall($comment->comment_ID); |
|
37 | - if ($rating != 0) { |
|
38 | - //echo '<div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$comment->comment_ID.'"></div>'; |
|
39 | - echo geodir_get_rating_stars($rating, $comment->comment_ID); |
|
40 | - } |
|
41 | - return $a; |
|
34 | + global $comment; |
|
35 | + |
|
36 | + $rating = geodir_get_commentoverall($comment->comment_ID); |
|
37 | + if ($rating != 0) { |
|
38 | + //echo '<div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$comment->comment_ID.'"></div>'; |
|
39 | + echo geodir_get_rating_stars($rating, $comment->comment_ID); |
|
40 | + } |
|
41 | + return $a; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | add_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box'); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function geodir_comment_add_meta_box($comment) |
55 | 55 | { |
56 | - add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high'); |
|
56 | + add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function geodir_comment_rating_meta($comment) |
69 | 69 | { |
70 | - $post_type = get_post_type($comment->comment_post_ID); |
|
70 | + $post_type = get_post_type($comment->comment_post_ID); |
|
71 | 71 | if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0) { |
72 | 72 | $rating = geodir_get_commentoverall($comment->comment_ID); |
73 | 73 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function geodir_comment_rating_fields() |
109 | 109 | { |
110 | - global $post; |
|
110 | + global $post; |
|
111 | 111 | |
112 | - $post_types = geodir_get_posttypes(); |
|
112 | + $post_types = geodir_get_posttypes(); |
|
113 | 113 | |
114 | - if (in_array($post->post_type, $post_types)) { |
|
115 | - $star_texts = array(); |
|
114 | + if (in_array($post->post_type, $post_types)) { |
|
115 | + $star_texts = array(); |
|
116 | 116 | $star_texts[] = __('Terrible', 'geodirectory'); |
117 | 117 | $star_texts[] = __('Poor', 'geodirectory'); |
118 | 118 | $star_texts[] = __('Average', 'geodirectory'); |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | $star_texts[] = __('Excellent', 'geodirectory'); |
121 | 121 | |
122 | 122 | $gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts); |
123 | - echo $gd_rating_html; |
|
124 | - ?> |
|
123 | + echo $gd_rating_html; |
|
124 | + ?> |
|
125 | 125 | <input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="0"/><?php |
126 | - } |
|
126 | + } |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | function geodir_comment_replaylink($link) |
140 | 140 | { |
141 | 141 | |
142 | - $link = '<div class="gd_comment_replaylink">' . $link . '</div>'; |
|
142 | + $link = '<div class="gd_comment_replaylink">' . $link . '</div>'; |
|
143 | 143 | |
144 | - return $link; |
|
144 | + return $link; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | add_filter('cancel_comment_reply_link', 'geodir_cancle_replaylink'); |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | function geodir_cancle_replaylink($link) |
157 | 157 | { |
158 | 158 | |
159 | - $link = '<span class="gd-cancel-replaylink">' . $link . '</span>'; |
|
159 | + $link = '<span class="gd-cancel-replaylink">' . $link . '</span>'; |
|
160 | 160 | |
161 | - return $link; |
|
161 | + return $link; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | add_action('comment_post', 'geodir_save_rating'); |
@@ -174,29 +174,29 @@ discard block |
||
174 | 174 | */ |
175 | 175 | function geodir_save_rating($comment = 0) |
176 | 176 | { |
177 | - global $wpdb, $user_ID, $plugin_prefix; |
|
177 | + global $wpdb, $user_ID, $plugin_prefix; |
|
178 | 178 | |
179 | - $comment_info = get_comment($comment); |
|
179 | + $comment_info = get_comment($comment); |
|
180 | 180 | |
181 | - $post_id = $comment_info->comment_post_ID; |
|
182 | - $status = $comment_info->comment_approved; |
|
183 | - $rating_ip = getenv("REMOTE_ADDR"); |
|
181 | + $post_id = $comment_info->comment_post_ID; |
|
182 | + $status = $comment_info->comment_approved; |
|
183 | + $rating_ip = getenv("REMOTE_ADDR"); |
|
184 | 184 | |
185 | - $post = geodir_get_post_info($post_id); |
|
185 | + $post = geodir_get_post_info($post_id); |
|
186 | 186 | |
187 | - if ($post->post_status == 'publish') { |
|
188 | - $post_status = '1'; |
|
189 | - } else { |
|
190 | - $post_status = '0'; |
|
191 | - } |
|
187 | + if ($post->post_status == 'publish') { |
|
188 | + $post_status = '1'; |
|
189 | + } else { |
|
190 | + $post_status = '0'; |
|
191 | + } |
|
192 | 192 | |
193 | - if (isset($_REQUEST['geodir_overallrating'])) { |
|
194 | - $overall_rating = $_REQUEST['geodir_overallrating']; |
|
193 | + if (isset($_REQUEST['geodir_overallrating'])) { |
|
194 | + $overall_rating = $_REQUEST['geodir_overallrating']; |
|
195 | 195 | |
196 | 196 | if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) { |
197 | - $overall_rating = $overall_rating > 0 ? $overall_rating : '0'; |
|
197 | + $overall_rating = $overall_rating > 0 ? $overall_rating : '0'; |
|
198 | 198 | |
199 | - $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET |
|
199 | + $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET |
|
200 | 200 | post_id = %d, |
201 | 201 | post_type = %s, |
202 | 202 | post_title = %s, |
@@ -214,35 +214,35 @@ discard block |
||
214 | 214 | post_latitude = %s, |
215 | 215 | comment_content = %s |
216 | 216 | ", |
217 | - array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content) |
|
218 | - ); |
|
219 | - |
|
220 | - $wpdb->query($sqlqry); |
|
221 | - |
|
222 | - /** |
|
223 | - * Called after saving the comment. |
|
224 | - * |
|
225 | - * @since 1.0.0 |
|
226 | - * @package GeoDirectory |
|
227 | - * @param array $_REQUEST { |
|
228 | - * Attributes of the $_REQUEST variable. |
|
229 | - * |
|
230 | - * @type string $geodir_overallrating Overall rating. |
|
231 | - * @type string $comment Comment text. |
|
232 | - * @type string $submit Submit button text. |
|
233 | - * @type string $comment_post_ID Comment post ID. |
|
234 | - * @type string $comment_parent Comment Parent ID. |
|
235 | - * @type string $_wp_unfiltered_html_comment Unfiltered html comment string. |
|
236 | - * |
|
237 | - * } |
|
238 | - */ |
|
239 | - do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post'); |
|
240 | - |
|
241 | - if ($status) { |
|
242 | - geodir_update_postrating($post_id); |
|
243 | - } |
|
244 | - } |
|
245 | - } |
|
217 | + array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content) |
|
218 | + ); |
|
219 | + |
|
220 | + $wpdb->query($sqlqry); |
|
221 | + |
|
222 | + /** |
|
223 | + * Called after saving the comment. |
|
224 | + * |
|
225 | + * @since 1.0.0 |
|
226 | + * @package GeoDirectory |
|
227 | + * @param array $_REQUEST { |
|
228 | + * Attributes of the $_REQUEST variable. |
|
229 | + * |
|
230 | + * @type string $geodir_overallrating Overall rating. |
|
231 | + * @type string $comment Comment text. |
|
232 | + * @type string $submit Submit button text. |
|
233 | + * @type string $comment_post_ID Comment post ID. |
|
234 | + * @type string $comment_parent Comment Parent ID. |
|
235 | + * @type string $_wp_unfiltered_html_comment Unfiltered html comment string. |
|
236 | + * |
|
237 | + * } |
|
238 | + */ |
|
239 | + do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post'); |
|
240 | + |
|
241 | + if ($status) { |
|
242 | + geodir_update_postrating($post_id); |
|
243 | + } |
|
244 | + } |
|
245 | + } |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -260,51 +260,51 @@ discard block |
||
260 | 260 | */ |
261 | 261 | function geodir_update_rating_status_change($comment_id, $status) |
262 | 262 | { |
263 | - if ($status == 'delete') { |
|
264 | - return; |
|
265 | - } |
|
266 | - global $wpdb, $plugin_prefix, $user_ID; |
|
263 | + if ($status == 'delete') { |
|
264 | + return; |
|
265 | + } |
|
266 | + global $wpdb, $plugin_prefix, $user_ID; |
|
267 | 267 | |
268 | - $comment_info = get_comment($comment_id); |
|
268 | + $comment_info = get_comment($comment_id); |
|
269 | 269 | |
270 | - $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : ''; |
|
270 | + $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : ''; |
|
271 | 271 | |
272 | - if (!empty($comment_info)) |
|
273 | - $status = $comment_info->comment_approved; |
|
272 | + if (!empty($comment_info)) |
|
273 | + $status = $comment_info->comment_approved; |
|
274 | 274 | |
275 | - if ($status == 'approve' || $status == 1) { |
|
276 | - $status = 1; |
|
277 | - } else { |
|
278 | - $status = 0; |
|
279 | - } |
|
275 | + if ($status == 'approve' || $status == 1) { |
|
276 | + $status = 1; |
|
277 | + } else { |
|
278 | + $status = 0; |
|
279 | + } |
|
280 | 280 | |
281 | - $comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : ''; |
|
282 | - $old_rating = geodir_get_commentoverall($comment_info_ID); |
|
281 | + $comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : ''; |
|
282 | + $old_rating = geodir_get_commentoverall($comment_info_ID); |
|
283 | 283 | |
284 | - $post_type = get_post_type($post_id); |
|
284 | + $post_type = get_post_type($post_id); |
|
285 | 285 | |
286 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
286 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
287 | 287 | |
288 | - if ($comment_id) { |
|
288 | + if ($comment_id) { |
|
289 | 289 | |
290 | - $overall_rating = $old_rating; |
|
290 | + $overall_rating = $old_rating; |
|
291 | 291 | |
292 | - if (isset($old_rating)) { |
|
292 | + if (isset($old_rating)) { |
|
293 | 293 | |
294 | - $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET |
|
294 | + $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET |
|
295 | 295 | overall_rating = %f, |
296 | 296 | status = %s, |
297 | 297 | comment_content = %s |
298 | 298 | WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id)); |
299 | 299 | |
300 | - $wpdb->query($sqlqry); |
|
300 | + $wpdb->query($sqlqry); |
|
301 | 301 | |
302 | - //update rating |
|
303 | - geodir_update_postrating($post_id, $post_type); |
|
302 | + //update rating |
|
303 | + geodir_update_postrating($post_id, $post_type); |
|
304 | 304 | |
305 | - } |
|
305 | + } |
|
306 | 306 | |
307 | - } |
|
307 | + } |
|
308 | 308 | |
309 | 309 | } |
310 | 310 | |
@@ -323,41 +323,41 @@ discard block |
||
323 | 323 | function geodir_update_rating($comment_id = 0) |
324 | 324 | { |
325 | 325 | |
326 | - global $wpdb, $plugin_prefix, $user_ID; |
|
326 | + global $wpdb, $plugin_prefix, $user_ID; |
|
327 | 327 | |
328 | - $comment_info = get_comment($comment_id); |
|
328 | + $comment_info = get_comment($comment_id); |
|
329 | 329 | |
330 | - $post_id = $comment_info->comment_post_ID; |
|
331 | - $status = $comment_info->comment_approved; |
|
332 | - $old_rating = geodir_get_commentoverall($comment_info->comment_ID); |
|
330 | + $post_id = $comment_info->comment_post_ID; |
|
331 | + $status = $comment_info->comment_approved; |
|
332 | + $old_rating = geodir_get_commentoverall($comment_info->comment_ID); |
|
333 | 333 | |
334 | - $post_type = get_post_type($post_id); |
|
334 | + $post_type = get_post_type($post_id); |
|
335 | 335 | |
336 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
336 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
337 | 337 | |
338 | - if (isset($_REQUEST['geodir_overallrating'])) { |
|
338 | + if (isset($_REQUEST['geodir_overallrating'])) { |
|
339 | 339 | |
340 | - $overall_rating = $_REQUEST['geodir_overallrating']; |
|
340 | + $overall_rating = $_REQUEST['geodir_overallrating']; |
|
341 | 341 | |
342 | - if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) { |
|
343 | - $overall_rating = $overall_rating > 0 ? $overall_rating : '0'; |
|
342 | + if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) { |
|
343 | + $overall_rating = $overall_rating > 0 ? $overall_rating : '0'; |
|
344 | 344 | |
345 | - if (isset($old_rating)) { |
|
345 | + if (isset($old_rating)) { |
|
346 | 346 | |
347 | - $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET |
|
347 | + $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET |
|
348 | 348 | overall_rating = %f, |
349 | 349 | status = %s, |
350 | 350 | comment_content = %s |
351 | 351 | WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id)); |
352 | 352 | |
353 | - $wpdb->query($sqlqry); |
|
353 | + $wpdb->query($sqlqry); |
|
354 | 354 | |
355 | - //update rating |
|
356 | - geodir_update_postrating($post_id, $post_type); |
|
355 | + //update rating |
|
356 | + geodir_update_postrating($post_id, $post_type); |
|
357 | 357 | |
358 | - } |
|
359 | - } |
|
360 | - } |
|
358 | + } |
|
359 | + } |
|
360 | + } |
|
361 | 361 | |
362 | 362 | |
363 | 363 | } |
@@ -373,19 +373,19 @@ discard block |
||
373 | 373 | */ |
374 | 374 | function geodir_comment_delete_comment($comment_id) |
375 | 375 | { |
376 | - global $wpdb; |
|
376 | + global $wpdb; |
|
377 | 377 | |
378 | - $review_info = geodir_get_review($comment_id); |
|
379 | - if ($review_info) { |
|
380 | - geodir_update_postrating($review_info->post_id); |
|
381 | - } |
|
378 | + $review_info = geodir_get_review($comment_id); |
|
379 | + if ($review_info) { |
|
380 | + geodir_update_postrating($review_info->post_id); |
|
381 | + } |
|
382 | 382 | |
383 | - $wpdb->query( |
|
384 | - $wpdb->prepare( |
|
385 | - "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d", |
|
386 | - array($comment_id) |
|
387 | - ) |
|
388 | - ); |
|
383 | + $wpdb->query( |
|
384 | + $wpdb->prepare( |
|
385 | + "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d", |
|
386 | + array($comment_id) |
|
387 | + ) |
|
388 | + ); |
|
389 | 389 | |
390 | 390 | } |
391 | 391 | |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | */ |
402 | 402 | function geodir_wrap_comment_text($content, $comment = '') |
403 | 403 | { |
404 | - $rating = 0; |
|
405 | - if (!empty($comment)) |
|
406 | - $rating = geodir_get_commentoverall($comment->comment_ID); |
|
407 | - if ($rating != 0 && !is_admin()) { |
|
408 | - return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>'; |
|
409 | - } else |
|
410 | - return $content; |
|
404 | + $rating = 0; |
|
405 | + if (!empty($comment)) |
|
406 | + $rating = geodir_get_commentoverall($comment->comment_ID); |
|
407 | + if ($rating != 0 && !is_admin()) { |
|
408 | + return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>'; |
|
409 | + } else |
|
410 | + return $content; |
|
411 | 411 | |
412 | 412 | } |
413 | 413 | |
@@ -425,41 +425,41 @@ discard block |
||
425 | 425 | */ |
426 | 426 | function geodir_update_postrating($post_id = 0, $post_type = '', $delete = false) |
427 | 427 | { |
428 | - global $wpdb, $plugin_prefix, $comment; |
|
429 | - if (!$post_type) { |
|
430 | - $post_type = get_post_type($post_id); |
|
431 | - } |
|
432 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
433 | - $post_newrating = geodir_get_post_rating($post_id, 1); |
|
434 | - $post_newrating_count = geodir_get_review_count_total($post_id); |
|
428 | + global $wpdb, $plugin_prefix, $comment; |
|
429 | + if (!$post_type) { |
|
430 | + $post_type = get_post_type($post_id); |
|
431 | + } |
|
432 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
433 | + $post_newrating = geodir_get_post_rating($post_id, 1); |
|
434 | + $post_newrating_count = geodir_get_review_count_total($post_id); |
|
435 | 435 | |
436 | 436 | |
437 | - //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ; |
|
437 | + //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ; |
|
438 | 438 | |
439 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) { |
|
439 | + if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) { |
|
440 | 440 | |
441 | - $wpdb->query( |
|
442 | - $wpdb->prepare( |
|
443 | - "UPDATE " . $detail_table . " SET |
|
441 | + $wpdb->query( |
|
442 | + $wpdb->prepare( |
|
443 | + "UPDATE " . $detail_table . " SET |
|
444 | 444 | overall_rating = %f, |
445 | 445 | rating_count = %f |
446 | 446 | where post_id = %d", |
447 | - array($post_newrating, $post_newrating_count, $post_id) |
|
448 | - ) |
|
449 | - ); |
|
450 | - |
|
451 | - update_post_meta($post_id, 'overall_rating', $post_newrating); |
|
452 | - update_post_meta($post_id, 'rating_count', $post_newrating_count); |
|
453 | - } |
|
454 | - /** |
|
455 | - * Called after Updating post overall rating and rating count. |
|
456 | - * |
|
457 | - * @since 1.0.0 |
|
458 | - * @since 1.4.3 Added `$post_id` param. |
|
459 | - * @package GeoDirectory |
|
460 | - * @param int $post_id The post ID. |
|
461 | - */ |
|
462 | - do_action('geodir_update_postrating',$post_id); |
|
447 | + array($post_newrating, $post_newrating_count, $post_id) |
|
448 | + ) |
|
449 | + ); |
|
450 | + |
|
451 | + update_post_meta($post_id, 'overall_rating', $post_newrating); |
|
452 | + update_post_meta($post_id, 'rating_count', $post_newrating_count); |
|
453 | + } |
|
454 | + /** |
|
455 | + * Called after Updating post overall rating and rating count. |
|
456 | + * |
|
457 | + * @since 1.0.0 |
|
458 | + * @since 1.4.3 Added `$post_id` param. |
|
459 | + * @package GeoDirectory |
|
460 | + * @param int $post_id The post ID. |
|
461 | + */ |
|
462 | + do_action('geodir_update_postrating',$post_id); |
|
463 | 463 | |
464 | 464 | } |
465 | 465 | |
@@ -477,29 +477,29 @@ discard block |
||
477 | 477 | */ |
478 | 478 | function geodir_get_postoverall($post_id = 0) |
479 | 479 | { |
480 | - global $wpdb, $plugin_prefix; |
|
480 | + global $wpdb, $plugin_prefix; |
|
481 | 481 | |
482 | - $post_type = get_post_type($post_id); |
|
483 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
482 | + $post_type = get_post_type($post_id); |
|
483 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
484 | 484 | |
485 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) { |
|
485 | + if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) { |
|
486 | 486 | |
487 | - $post_ratings = $wpdb->get_var( |
|
488 | - $wpdb->prepare( |
|
489 | - "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d", |
|
490 | - array($post_id) |
|
491 | - ) |
|
492 | - ); |
|
487 | + $post_ratings = $wpdb->get_var( |
|
488 | + $wpdb->prepare( |
|
489 | + "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d", |
|
490 | + array($post_id) |
|
491 | + ) |
|
492 | + ); |
|
493 | 493 | |
494 | 494 | |
495 | - } else { |
|
496 | - $post_ratings = get_post_meta($post_id, 'overall_rating'); |
|
497 | - } |
|
495 | + } else { |
|
496 | + $post_ratings = get_post_meta($post_id, 'overall_rating'); |
|
497 | + } |
|
498 | 498 | |
499 | - if ($post_ratings) |
|
500 | - return $post_ratings; |
|
501 | - else |
|
502 | - return false; |
|
499 | + if ($post_ratings) |
|
500 | + return $post_ratings; |
|
501 | + else |
|
502 | + return false; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -516,19 +516,19 @@ discard block |
||
516 | 516 | */ |
517 | 517 | function geodir_get_review($comment_id = 0) |
518 | 518 | { |
519 | - global $wpdb; |
|
520 | - |
|
521 | - $reatings = $wpdb->get_row( |
|
522 | - $wpdb->prepare( |
|
523 | - "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d", |
|
524 | - array($comment_id) |
|
525 | - ) |
|
526 | - ); |
|
527 | - |
|
528 | - if (!empty($reatings)) |
|
529 | - return $reatings; |
|
530 | - else |
|
531 | - return false; |
|
519 | + global $wpdb; |
|
520 | + |
|
521 | + $reatings = $wpdb->get_row( |
|
522 | + $wpdb->prepare( |
|
523 | + "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d", |
|
524 | + array($comment_id) |
|
525 | + ) |
|
526 | + ); |
|
527 | + |
|
528 | + if (!empty($reatings)) |
|
529 | + return $reatings; |
|
530 | + else |
|
531 | + return false; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | /** |
@@ -544,19 +544,19 @@ discard block |
||
544 | 544 | */ |
545 | 545 | function geodir_get_review_total($post_id = 0) |
546 | 546 | { |
547 | - global $wpdb; |
|
548 | - |
|
549 | - $results = $wpdb->get_var( |
|
550 | - $wpdb->prepare( |
|
551 | - "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
552 | - array($post_id) |
|
553 | - ) |
|
554 | - ); |
|
555 | - |
|
556 | - if (!empty($results)) |
|
557 | - return $results; |
|
558 | - else |
|
559 | - return false; |
|
547 | + global $wpdb; |
|
548 | + |
|
549 | + $results = $wpdb->get_var( |
|
550 | + $wpdb->prepare( |
|
551 | + "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
552 | + array($post_id) |
|
553 | + ) |
|
554 | + ); |
|
555 | + |
|
556 | + if (!empty($results)) |
|
557 | + return $results; |
|
558 | + else |
|
559 | + return false; |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | /** |
@@ -572,18 +572,18 @@ discard block |
||
572 | 572 | */ |
573 | 573 | function geodir_get_review_count_by_user_id($user_id = 0) |
574 | 574 | { |
575 | - global $wpdb; |
|
576 | - $results = $wpdb->get_var( |
|
577 | - $wpdb->prepare( |
|
578 | - "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0", |
|
579 | - array($user_id) |
|
580 | - ) |
|
581 | - ); |
|
582 | - |
|
583 | - if (!empty($results)) |
|
584 | - return $results; |
|
585 | - else |
|
586 | - return false; |
|
575 | + global $wpdb; |
|
576 | + $results = $wpdb->get_var( |
|
577 | + $wpdb->prepare( |
|
578 | + "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0", |
|
579 | + array($user_id) |
|
580 | + ) |
|
581 | + ); |
|
582 | + |
|
583 | + if (!empty($results)) |
|
584 | + return $results; |
|
585 | + else |
|
586 | + return false; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -601,27 +601,27 @@ discard block |
||
601 | 601 | */ |
602 | 602 | function geodir_get_post_rating($post_id = 0, $force_query = 0) |
603 | 603 | { |
604 | - global $wpdb, $post; |
|
605 | - |
|
606 | - if (isset($post->ID) && $post->ID == $post_id && !$force_query) { |
|
607 | - if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) { |
|
608 | - return $post->overall_rating; |
|
609 | - } else { |
|
610 | - return 0; |
|
611 | - } |
|
612 | - } |
|
613 | - |
|
614 | - $results = $wpdb->get_var( |
|
615 | - $wpdb->prepare( |
|
616 | - "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
617 | - array($post_id) |
|
618 | - ) |
|
619 | - ); |
|
620 | - |
|
621 | - if (!empty($results)) |
|
622 | - return $results; |
|
623 | - else |
|
624 | - return false; |
|
604 | + global $wpdb, $post; |
|
605 | + |
|
606 | + if (isset($post->ID) && $post->ID == $post_id && !$force_query) { |
|
607 | + if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) { |
|
608 | + return $post->overall_rating; |
|
609 | + } else { |
|
610 | + return 0; |
|
611 | + } |
|
612 | + } |
|
613 | + |
|
614 | + $results = $wpdb->get_var( |
|
615 | + $wpdb->prepare( |
|
616 | + "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
617 | + array($post_id) |
|
618 | + ) |
|
619 | + ); |
|
620 | + |
|
621 | + if (!empty($results)) |
|
622 | + return $results; |
|
623 | + else |
|
624 | + return false; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
@@ -637,19 +637,19 @@ discard block |
||
637 | 637 | */ |
638 | 638 | function geodir_get_review_count_total($post_id = 0) |
639 | 639 | { |
640 | - global $wpdb; |
|
641 | - |
|
642 | - $results = $wpdb->get_var( |
|
643 | - $wpdb->prepare( |
|
644 | - "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
645 | - array($post_id) |
|
646 | - ) |
|
647 | - ); |
|
648 | - |
|
649 | - if (!empty($results)) |
|
650 | - return $results; |
|
651 | - else |
|
652 | - return false; |
|
640 | + global $wpdb; |
|
641 | + |
|
642 | + $results = $wpdb->get_var( |
|
643 | + $wpdb->prepare( |
|
644 | + "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
645 | + array($post_id) |
|
646 | + ) |
|
647 | + ); |
|
648 | + |
|
649 | + if (!empty($results)) |
|
650 | + return $results; |
|
651 | + else |
|
652 | + return false; |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | /** |
@@ -666,20 +666,20 @@ discard block |
||
666 | 666 | */ |
667 | 667 | function geodir_get_comments_number($post_id = 0) |
668 | 668 | { |
669 | - global $wpdb; |
|
669 | + global $wpdb; |
|
670 | 670 | |
671 | - $results = $wpdb->get_var( |
|
672 | - $wpdb->prepare( |
|
673 | - "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
674 | - array($post_id) |
|
675 | - ) |
|
676 | - ); |
|
671 | + $results = $wpdb->get_var( |
|
672 | + $wpdb->prepare( |
|
673 | + "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
674 | + array($post_id) |
|
675 | + ) |
|
676 | + ); |
|
677 | 677 | |
678 | 678 | |
679 | - if (!empty($results)) |
|
680 | - return $results; |
|
681 | - else |
|
682 | - return false; |
|
679 | + if (!empty($results)) |
|
680 | + return $results; |
|
681 | + else |
|
682 | + return false; |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | /** |
@@ -695,19 +695,19 @@ discard block |
||
695 | 695 | */ |
696 | 696 | function geodir_get_commentoverall($comment_id = 0) |
697 | 697 | { |
698 | - global $wpdb; |
|
699 | - |
|
700 | - $reatings = $wpdb->get_var( |
|
701 | - $wpdb->prepare( |
|
702 | - "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d", |
|
703 | - array($comment_id) |
|
704 | - ) |
|
705 | - ); |
|
706 | - |
|
707 | - if ($reatings) |
|
708 | - return $reatings; |
|
709 | - else |
|
710 | - return false; |
|
698 | + global $wpdb; |
|
699 | + |
|
700 | + $reatings = $wpdb->get_var( |
|
701 | + $wpdb->prepare( |
|
702 | + "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d", |
|
703 | + array($comment_id) |
|
704 | + ) |
|
705 | + ); |
|
706 | + |
|
707 | + if ($reatings) |
|
708 | + return $reatings; |
|
709 | + else |
|
710 | + return false; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | /** |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | */ |
722 | 722 | function geodir_get_commentoverall_number($post_id = 0) |
723 | 723 | { |
724 | - return geodir_get_post_rating($post_id); |
|
724 | + return geodir_get_post_rating($post_id); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -739,98 +739,98 @@ discard block |
||
739 | 739 | */ |
740 | 740 | function geodir_comment_template($comment_template) |
741 | 741 | { |
742 | - global $post; |
|
743 | - |
|
744 | - $post_types = geodir_get_posttypes(); |
|
745 | - |
|
746 | - if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) { |
|
747 | - return; |
|
748 | - } |
|
749 | - if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business |
|
750 | - $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available |
|
751 | - if (!$template) { |
|
752 | - $template = dirname(__FILE__) . '/reviews.php'; |
|
753 | - } |
|
754 | - return $template; |
|
755 | - } |
|
742 | + global $post; |
|
743 | + |
|
744 | + $post_types = geodir_get_posttypes(); |
|
745 | + |
|
746 | + if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) { |
|
747 | + return; |
|
748 | + } |
|
749 | + if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business |
|
750 | + $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available |
|
751 | + if (!$template) { |
|
752 | + $template = dirname(__FILE__) . '/reviews.php'; |
|
753 | + } |
|
754 | + return $template; |
|
755 | + } |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | add_filter("comments_template", "geodir_comment_template"); |
759 | 759 | |
760 | 760 | |
761 | 761 | if (!function_exists('geodir_comment')) { |
762 | - /** |
|
763 | - * Comment HTML markup. |
|
764 | - * |
|
765 | - * @since 1.0.0 |
|
766 | - * @package GeoDirectory |
|
767 | - * @global object $post The current post object. |
|
768 | - * @param object $comment The comment object. |
|
769 | - * @param string|array $args { |
|
770 | - * Optional. Formatting options. |
|
771 | - * |
|
772 | - * @type object $walker Instance of a Walker class to list comments. Default null. |
|
773 | - * @type int $max_depth The maximum comments depth. Default empty. |
|
774 | - * @type string $style The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'. |
|
775 | - * @type string $callback Callback function to use. Default null. |
|
776 | - * @type string $end-callback Callback function to use at the end. Default null. |
|
777 | - * @type string $type Type of comments to list. |
|
778 | - * Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'. |
|
779 | - * @type int $page Page ID to list comments for. Default empty. |
|
780 | - * @type int $per_page Number of comments to list per page. Default empty. |
|
781 | - * @type int $avatar_size Height and width dimensions of the avatar size. Default 32. |
|
782 | - * @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'. |
|
783 | - * @type bool $reverse_children Whether to reverse child comments in the list. Default null. |
|
784 | - * @type string $format How to format the comments list. |
|
785 | - * Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'. |
|
786 | - * @type bool $short_ping Whether to output short pings. Default false. |
|
787 | - * @type bool $echo Whether to echo the output or return it. Default true. |
|
788 | - * } |
|
789 | - * @param int $depth Depth of comment. |
|
790 | - */ |
|
791 | - function geodir_comment($comment, $args, $depth) |
|
792 | - { |
|
793 | - $GLOBALS['comment'] = $comment; |
|
794 | - switch ($comment->comment_type) : |
|
795 | - case 'pingback' : |
|
796 | - case 'trackback' : |
|
797 | - // Display trackbacks differently than normal comments. |
|
798 | - ?> |
|
762 | + /** |
|
763 | + * Comment HTML markup. |
|
764 | + * |
|
765 | + * @since 1.0.0 |
|
766 | + * @package GeoDirectory |
|
767 | + * @global object $post The current post object. |
|
768 | + * @param object $comment The comment object. |
|
769 | + * @param string|array $args { |
|
770 | + * Optional. Formatting options. |
|
771 | + * |
|
772 | + * @type object $walker Instance of a Walker class to list comments. Default null. |
|
773 | + * @type int $max_depth The maximum comments depth. Default empty. |
|
774 | + * @type string $style The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'. |
|
775 | + * @type string $callback Callback function to use. Default null. |
|
776 | + * @type string $end-callback Callback function to use at the end. Default null. |
|
777 | + * @type string $type Type of comments to list. |
|
778 | + * Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'. |
|
779 | + * @type int $page Page ID to list comments for. Default empty. |
|
780 | + * @type int $per_page Number of comments to list per page. Default empty. |
|
781 | + * @type int $avatar_size Height and width dimensions of the avatar size. Default 32. |
|
782 | + * @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'. |
|
783 | + * @type bool $reverse_children Whether to reverse child comments in the list. Default null. |
|
784 | + * @type string $format How to format the comments list. |
|
785 | + * Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'. |
|
786 | + * @type bool $short_ping Whether to output short pings. Default false. |
|
787 | + * @type bool $echo Whether to echo the output or return it. Default true. |
|
788 | + * } |
|
789 | + * @param int $depth Depth of comment. |
|
790 | + */ |
|
791 | + function geodir_comment($comment, $args, $depth) |
|
792 | + { |
|
793 | + $GLOBALS['comment'] = $comment; |
|
794 | + switch ($comment->comment_type) : |
|
795 | + case 'pingback' : |
|
796 | + case 'trackback' : |
|
797 | + // Display trackbacks differently than normal comments. |
|
798 | + ?> |
|
799 | 799 | <li <?php comment_class('geodir-comment'); ?> id="comment-<?php comment_ID(); ?>"> |
800 | 800 | <p><?php _e('Pingback:', 'geodirectory'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'geodirectory'), '<span class="edit-link">', '</span>'); ?></p> |
801 | 801 | <?php |
802 | - break; |
|
803 | - default : |
|
804 | - // Proceed with normal comments. |
|
805 | - global $post; |
|
806 | - ?> |
|
802 | + break; |
|
803 | + default : |
|
804 | + // Proceed with normal comments. |
|
805 | + global $post; |
|
806 | + ?> |
|
807 | 807 | <li <?php comment_class('geodir-comment'); ?> id="li-comment-<?php comment_ID(); ?>"> |
808 | 808 | <article id="comment-<?php comment_ID(); ?>" class="comment hreview"> |
809 | 809 | <header class="comment-meta comment-author vcard"> |
810 | 810 | <?php |
811 | - /** |
|
812 | - * Filter to modify comment avatar size |
|
813 | - * |
|
814 | - * You can use this filter to change comment avatar size. |
|
815 | - * |
|
816 | - * @since 1.0.0 |
|
817 | - * @package GeoDirectory |
|
818 | - */ |
|
819 | - $avatar_size = apply_filters('geodir_comment_avatar_size', 44); |
|
820 | - echo get_avatar($comment, $avatar_size); |
|
821 | - printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>', |
|
822 | - get_comment_author_link(), |
|
823 | - // If current post author is also comment author, make it known visually. |
|
824 | - ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : '' |
|
825 | - ); |
|
826 | - echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>"; |
|
827 | - printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>', |
|
828 | - esc_url(get_comment_link($comment->comment_ID)), |
|
829 | - get_comment_time('c'), |
|
830 | - /* translators: 1: date, 2: time */ |
|
831 | - sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time()) |
|
832 | - ); |
|
833 | - ?> |
|
811 | + /** |
|
812 | + * Filter to modify comment avatar size |
|
813 | + * |
|
814 | + * You can use this filter to change comment avatar size. |
|
815 | + * |
|
816 | + * @since 1.0.0 |
|
817 | + * @package GeoDirectory |
|
818 | + */ |
|
819 | + $avatar_size = apply_filters('geodir_comment_avatar_size', 44); |
|
820 | + echo get_avatar($comment, $avatar_size); |
|
821 | + printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>', |
|
822 | + get_comment_author_link(), |
|
823 | + // If current post author is also comment author, make it known visually. |
|
824 | + ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : '' |
|
825 | + ); |
|
826 | + echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>"; |
|
827 | + printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>', |
|
828 | + esc_url(get_comment_link($comment->comment_ID)), |
|
829 | + get_comment_time('c'), |
|
830 | + /* translators: 1: date, 2: time */ |
|
831 | + sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time()) |
|
832 | + ); |
|
833 | + ?> |
|
834 | 834 | </header> |
835 | 835 | <!-- .comment-meta --> |
836 | 836 | |
@@ -854,47 +854,47 @@ discard block |
||
854 | 854 | </article> |
855 | 855 | <!-- #comment-## --> |
856 | 856 | <?php |
857 | - break; |
|
858 | - endswitch; // end comment_type check |
|
859 | - } |
|
857 | + break; |
|
858 | + endswitch; // end comment_type check |
|
859 | + } |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
863 | 863 | add_filter('get_comments_number', 'geodir_fix_comment_count', 10, 2); |
864 | 864 | if (!function_exists('geodir_fix_comment_count')) { |
865 | - /** |
|
866 | - * Fix comment count by not listing replies as reviews |
|
867 | - * |
|
868 | - * @since 1.0.0 |
|
869 | - * @package GeoDirectory |
|
870 | - * @global object $post The current post object. |
|
871 | - * @param int $count The comment count. |
|
872 | - * @param int $post_id The post ID. |
|
873 | - * @todo $post is unreachable since the function return the count before that variable. |
|
874 | - * @return bool|null|string The comment count. |
|
875 | - */ |
|
876 | - function geodir_fix_comment_count($count, $post_id) |
|
877 | - { |
|
878 | - if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) { |
|
879 | - global $post; |
|
880 | - $post_types = geodir_get_posttypes(); |
|
881 | - |
|
882 | - if (in_array(get_post_type($post_id), $post_types)) { |
|
883 | - $review_count = geodir_get_review_count_total($post_id); |
|
884 | - return $review_count; |
|
885 | - |
|
886 | - if ($post && isset($post->rating_count)) { |
|
887 | - return $post->rating_count; |
|
888 | - } else { |
|
889 | - return geodir_get_comments_number($post_id); |
|
890 | - } |
|
891 | - } else { |
|
892 | - return $count; |
|
893 | - } |
|
894 | - } else { |
|
895 | - return $count; |
|
896 | - } |
|
897 | - } |
|
865 | + /** |
|
866 | + * Fix comment count by not listing replies as reviews |
|
867 | + * |
|
868 | + * @since 1.0.0 |
|
869 | + * @package GeoDirectory |
|
870 | + * @global object $post The current post object. |
|
871 | + * @param int $count The comment count. |
|
872 | + * @param int $post_id The post ID. |
|
873 | + * @todo $post is unreachable since the function return the count before that variable. |
|
874 | + * @return bool|null|string The comment count. |
|
875 | + */ |
|
876 | + function geodir_fix_comment_count($count, $post_id) |
|
877 | + { |
|
878 | + if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) { |
|
879 | + global $post; |
|
880 | + $post_types = geodir_get_posttypes(); |
|
881 | + |
|
882 | + if (in_array(get_post_type($post_id), $post_types)) { |
|
883 | + $review_count = geodir_get_review_count_total($post_id); |
|
884 | + return $review_count; |
|
885 | + |
|
886 | + if ($post && isset($post->rating_count)) { |
|
887 | + return $post->rating_count; |
|
888 | + } else { |
|
889 | + return geodir_get_comments_number($post_id); |
|
890 | + } |
|
891 | + } else { |
|
892 | + return $count; |
|
893 | + } |
|
894 | + } else { |
|
895 | + return $count; |
|
896 | + } |
|
897 | + } |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | /** |
@@ -911,11 +911,11 @@ discard block |
||
911 | 911 | */ |
912 | 912 | function geodir_get_rating_stars($rating, $post_id, $small = false) |
913 | 913 | { |
914 | - $a_rating = $rating / 5 * 100; |
|
914 | + $a_rating = $rating / 5 * 100; |
|
915 | 915 | |
916 | - if ($small) { |
|
917 | - $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>'; |
|
918 | - } else { |
|
916 | + if ($small) { |
|
917 | + $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>'; |
|
918 | + } else { |
|
919 | 919 | if (function_exists('geodir_reviewrating_draw_overall_rating')) { |
920 | 920 | // Show rating stars from review rating manager |
921 | 921 | $r_html = geodir_reviewrating_draw_overall_rating($rating); |
@@ -933,8 +933,8 @@ discard block |
||
933 | 933 | } |
934 | 934 | $r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>'; |
935 | 935 | } |
936 | - } |
|
937 | - return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5); |
|
936 | + } |
|
937 | + return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5); |
|
938 | 938 | } |
939 | 939 | |
940 | 940 | /** |
@@ -948,23 +948,23 @@ discard block |
||
948 | 948 | function geodir_is_reviews_show($pageview = '') |
949 | 949 | { |
950 | 950 | |
951 | - $active_tabs = get_option('geodir_detail_page_tabs_excluded'); |
|
952 | - |
|
953 | - $is_display = true; |
|
954 | - if (!empty($active_tabs) && in_array('reviews', $active_tabs)) |
|
955 | - $is_display = false; |
|
956 | - |
|
957 | - /** |
|
958 | - * Filter to change display value. |
|
959 | - * |
|
960 | - * You can use this filter to change the is_display value. |
|
961 | - * |
|
962 | - * @since 1.0.0 |
|
963 | - * @package GeoDirectory |
|
964 | - * @param bool $is_display Display ratings when set to true. |
|
965 | - * @param string $pageview The view template. Ex: listview, gridview etc. |
|
966 | - */ |
|
967 | - return apply_filters('geodir_is_reviews_show', $is_display, $pageview); |
|
951 | + $active_tabs = get_option('geodir_detail_page_tabs_excluded'); |
|
952 | + |
|
953 | + $is_display = true; |
|
954 | + if (!empty($active_tabs) && in_array('reviews', $active_tabs)) |
|
955 | + $is_display = false; |
|
956 | + |
|
957 | + /** |
|
958 | + * Filter to change display value. |
|
959 | + * |
|
960 | + * You can use this filter to change the is_display value. |
|
961 | + * |
|
962 | + * @since 1.0.0 |
|
963 | + * @package GeoDirectory |
|
964 | + * @param bool $is_display Display ratings when set to true. |
|
965 | + * @param string $pageview The view template. Ex: listview, gridview etc. |
|
966 | + */ |
|
967 | + return apply_filters('geodir_is_reviews_show', $is_display, $pageview); |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | |
@@ -972,9 +972,9 @@ discard block |
||
972 | 972 | * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types |
973 | 973 | */ |
974 | 974 | if(function_exists('dsq_can_replace')) { |
975 | - remove_filter('comments_template', 'dsq_comments_template'); |
|
976 | - add_filter('comments_template', 'dsq_comments_template', 100); |
|
977 | - add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1); |
|
975 | + remove_filter('comments_template', 'dsq_comments_template'); |
|
976 | + add_filter('comments_template', 'dsq_comments_template', 100); |
|
977 | + add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | |
@@ -988,13 +988,13 @@ discard block |
||
988 | 988 | * @return string `1` if active `0` if disabled. |
989 | 989 | */ |
990 | 990 | function geodir_option_disqus_active($disqus_active){ |
991 | - global $post; |
|
992 | - $all_postypes = geodir_get_posttypes(); |
|
991 | + global $post; |
|
992 | + $all_postypes = geodir_get_posttypes(); |
|
993 | 993 | |
994 | - if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){ |
|
995 | - $disqus_active = '0'; |
|
996 | - } |
|
994 | + if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){ |
|
995 | + $disqus_active = '0'; |
|
996 | + } |
|
997 | 997 | |
998 | - return $disqus_active; |
|
998 | + return $disqus_active; |
|
999 | 999 | } |
1000 | 1000 |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | function geodir_comment_rating_meta($comment) |
69 | 69 | { |
70 | 70 | $post_type = get_post_type($comment->comment_post_ID); |
71 | - if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0) { |
|
71 | + if (in_array($post_type, (array) geodir_get_posttypes()) && (int) $comment->comment_parent == 0) { |
|
72 | 72 | $rating = geodir_get_commentoverall($comment->comment_ID); |
73 | 73 | |
74 | - if ((int)get_option('geodir_reviewrating_enable_font_awesome') == 1) { |
|
74 | + if ((int) get_option('geodir_reviewrating_enable_font_awesome') == 1) { |
|
75 | 75 | $star_texts = array(); |
76 | 76 | $star_texts[] = __('Terrible', 'geodirectory'); |
77 | 77 | $star_texts[] = __('Poor', 'geodirectory'); |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | echo geodir_font_awesome_rating_form_html('', $star_texts, $rating); |
83 | 83 | } else { |
84 | 84 | if ($rating) { |
85 | - echo '<div class="gd_rating" data-average="' . $rating . '" data-id="5">'; |
|
85 | + echo '<div class="gd_rating" data-average="'.$rating.'" data-id="5">'; |
|
86 | 86 | |
87 | 87 | } else { |
88 | 88 | echo '<div class="gd_rating" data-average="0" data-id="5"></div>'; |
89 | 89 | } |
90 | 90 | } |
91 | - echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="' . $rating . '" />'; |
|
91 | + echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="'.$rating.'" />'; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | function geodir_comment_replaylink($link) |
140 | 140 | { |
141 | 141 | |
142 | - $link = '<div class="gd_comment_replaylink">' . $link . '</div>'; |
|
142 | + $link = '<div class="gd_comment_replaylink">'.$link.'</div>'; |
|
143 | 143 | |
144 | 144 | return $link; |
145 | 145 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | function geodir_cancle_replaylink($link) |
157 | 157 | { |
158 | 158 | |
159 | - $link = '<span class="gd-cancel-replaylink">' . $link . '</span>'; |
|
159 | + $link = '<span class="gd-cancel-replaylink">'.$link.'</span>'; |
|
160 | 160 | |
161 | 161 | return $link; |
162 | 162 | } |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | if (isset($_REQUEST['geodir_overallrating'])) { |
194 | 194 | $overall_rating = $_REQUEST['geodir_overallrating']; |
195 | 195 | |
196 | - if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) { |
|
196 | + if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) { |
|
197 | 197 | $overall_rating = $overall_rating > 0 ? $overall_rating : '0'; |
198 | 198 | |
199 | - $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET |
|
199 | + $sqlqry = $wpdb->prepare("INSERT INTO ".GEODIR_REVIEW_TABLE." SET |
|
200 | 200 | post_id = %d, |
201 | 201 | post_type = %s, |
202 | 202 | post_title = %s, |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | $post_type = get_post_type($post_id); |
285 | 285 | |
286 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
286 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
287 | 287 | |
288 | 288 | if ($comment_id) { |
289 | 289 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | if (isset($old_rating)) { |
293 | 293 | |
294 | - $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET |
|
294 | + $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET |
|
295 | 295 | overall_rating = %f, |
296 | 296 | status = %s, |
297 | 297 | comment_content = %s |
@@ -333,18 +333,18 @@ discard block |
||
333 | 333 | |
334 | 334 | $post_type = get_post_type($post_id); |
335 | 335 | |
336 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
336 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
337 | 337 | |
338 | 338 | if (isset($_REQUEST['geodir_overallrating'])) { |
339 | 339 | |
340 | 340 | $overall_rating = $_REQUEST['geodir_overallrating']; |
341 | 341 | |
342 | - if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) { |
|
342 | + if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) { |
|
343 | 343 | $overall_rating = $overall_rating > 0 ? $overall_rating : '0'; |
344 | 344 | |
345 | 345 | if (isset($old_rating)) { |
346 | 346 | |
347 | - $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET |
|
347 | + $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET |
|
348 | 348 | overall_rating = %f, |
349 | 349 | status = %s, |
350 | 350 | comment_content = %s |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | $wpdb->query( |
384 | 384 | $wpdb->prepare( |
385 | - "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d", |
|
385 | + "DELETE FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d", |
|
386 | 386 | array($comment_id) |
387 | 387 | ) |
388 | 388 | ); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | if (!empty($comment)) |
406 | 406 | $rating = geodir_get_commentoverall($comment->comment_ID); |
407 | 407 | if ($rating != 0 && !is_admin()) { |
408 | - return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>'; |
|
408 | + return '<div><div class="gd-rating-text">'.__('Overall Rating', 'geodirectory').': <div class="rating">'.$rating.'</div></div>'.geodir_get_rating_stars($rating, $comment->comment_ID).'</div><div class="description">'.$content.'</div>'; |
|
409 | 409 | } else |
410 | 410 | return $content; |
411 | 411 | |
@@ -429,18 +429,18 @@ discard block |
||
429 | 429 | if (!$post_type) { |
430 | 430 | $post_type = get_post_type($post_id); |
431 | 431 | } |
432 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
432 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
433 | 433 | $post_newrating = geodir_get_post_rating($post_id, 1); |
434 | 434 | $post_newrating_count = geodir_get_review_count_total($post_id); |
435 | 435 | |
436 | 436 | |
437 | 437 | //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ; |
438 | 438 | |
439 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) { |
|
439 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) { |
|
440 | 440 | |
441 | 441 | $wpdb->query( |
442 | 442 | $wpdb->prepare( |
443 | - "UPDATE " . $detail_table . " SET |
|
443 | + "UPDATE ".$detail_table." SET |
|
444 | 444 | overall_rating = %f, |
445 | 445 | rating_count = %f |
446 | 446 | where post_id = %d", |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @package GeoDirectory |
460 | 460 | * @param int $post_id The post ID. |
461 | 461 | */ |
462 | - do_action('geodir_update_postrating',$post_id); |
|
462 | + do_action('geodir_update_postrating', $post_id); |
|
463 | 463 | |
464 | 464 | } |
465 | 465 | |
@@ -480,13 +480,13 @@ discard block |
||
480 | 480 | global $wpdb, $plugin_prefix; |
481 | 481 | |
482 | 482 | $post_type = get_post_type($post_id); |
483 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
483 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
484 | 484 | |
485 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) { |
|
485 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) { |
|
486 | 486 | |
487 | 487 | $post_ratings = $wpdb->get_var( |
488 | 488 | $wpdb->prepare( |
489 | - "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d", |
|
489 | + "SELECT overall_rating FROM ".$detail_table." WHERE post_id = %d", |
|
490 | 490 | array($post_id) |
491 | 491 | ) |
492 | 492 | ); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | |
521 | 521 | $reatings = $wpdb->get_row( |
522 | 522 | $wpdb->prepare( |
523 | - "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d", |
|
523 | + "SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d", |
|
524 | 524 | array($comment_id) |
525 | 525 | ) |
526 | 526 | ); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | |
549 | 549 | $results = $wpdb->get_var( |
550 | 550 | $wpdb->prepare( |
551 | - "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
551 | + "SELECT SUM(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
552 | 552 | array($post_id) |
553 | 553 | ) |
554 | 554 | ); |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | global $wpdb; |
576 | 576 | $results = $wpdb->get_var( |
577 | 577 | $wpdb->prepare( |
578 | - "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0", |
|
578 | + "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d AND status=1 AND overall_rating>0", |
|
579 | 579 | array($user_id) |
580 | 580 | ) |
581 | 581 | ); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | |
614 | 614 | $results = $wpdb->get_var( |
615 | 615 | $wpdb->prepare( |
616 | - "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
616 | + "SELECT COALESCE(avg(overall_rating),0) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
617 | 617 | array($post_id) |
618 | 618 | ) |
619 | 619 | ); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | |
642 | 642 | $results = $wpdb->get_var( |
643 | 643 | $wpdb->prepare( |
644 | - "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
644 | + "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
645 | 645 | array($post_id) |
646 | 646 | ) |
647 | 647 | ); |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | |
671 | 671 | $results = $wpdb->get_var( |
672 | 672 | $wpdb->prepare( |
673 | - "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
673 | + "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0", |
|
674 | 674 | array($post_id) |
675 | 675 | ) |
676 | 676 | ); |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | |
700 | 700 | $reatings = $wpdb->get_var( |
701 | 701 | $wpdb->prepare( |
702 | - "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d", |
|
702 | + "SELECT overall_rating FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d", |
|
703 | 703 | array($comment_id) |
704 | 704 | ) |
705 | 705 | ); |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business |
750 | 750 | $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available |
751 | 751 | if (!$template) { |
752 | - $template = dirname(__FILE__) . '/reviews.php'; |
|
752 | + $template = dirname(__FILE__).'/reviews.php'; |
|
753 | 753 | } |
754 | 754 | return $template; |
755 | 755 | } |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>', |
822 | 822 | get_comment_author_link(), |
823 | 823 | // If current post author is also comment author, make it known visually. |
824 | - ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : '' |
|
824 | + ($comment->user_id === $post->post_author) ? '<span>'.__('Post author', 'geodirectory').'</span>' : '' |
|
825 | 825 | ); |
826 | 826 | echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>"; |
827 | 827 | printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>', |
@@ -914,24 +914,24 @@ discard block |
||
914 | 914 | $a_rating = $rating / 5 * 100; |
915 | 915 | |
916 | 916 | if ($small) { |
917 | - $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>'; |
|
917 | + $r_html = '<div class="rating"><div class="gd_rating_map" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: '.$a_rating.'%;"></div><div class="geodir_Star_small"></div></div></div>'; |
|
918 | 918 | } else { |
919 | 919 | if (function_exists('geodir_reviewrating_draw_overall_rating')) { |
920 | 920 | // Show rating stars from review rating manager |
921 | 921 | $r_html = geodir_reviewrating_draw_overall_rating($rating); |
922 | 922 | } else { |
923 | - $rating_img = '<img alt="rating icon" src="' . get_option('geodir_default_rating_star_icon') . '" />'; |
|
923 | + $rating_img = '<img alt="rating icon" src="'.get_option('geodir_default_rating_star_icon').'" />'; |
|
924 | 924 | |
925 | 925 | /* fix rating star for safari */ |
926 | 926 | $star_width = 23 * 5; |
927 | 927 | //global $is_safari, $is_iphone, $ios, $is_chrome; |
928 | 928 | //$attach_style = ( $is_safari || $is_iphone || $ios || $is_chrome ) && $star_width > 0 ? 'width:' . $star_width . 'px;max-width:none' : ''; |
929 | 929 | if ($star_width > 0) { |
930 | - $attach_style = 'max-width:' . $star_width . 'px'; |
|
930 | + $attach_style = 'max-width:'.$star_width.'px'; |
|
931 | 931 | } else { |
932 | 932 | $attach_style = ''; |
933 | 933 | } |
934 | - $r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>'; |
|
934 | + $r_html = '<div class="geodir-rating" style="'.$attach_style.'"><div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingAverage" style="width: '.$a_rating.'%;"></div><div class="geodir_Star">'.$rating_img.$rating_img.$rating_img.$rating_img.$rating_img.'</div></div></div>'; |
|
935 | 935 | } |
936 | 936 | } |
937 | 937 | return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5); |
@@ -971,10 +971,10 @@ discard block |
||
971 | 971 | /* |
972 | 972 | * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types |
973 | 973 | */ |
974 | -if(function_exists('dsq_can_replace')) { |
|
974 | +if (function_exists('dsq_can_replace')) { |
|
975 | 975 | remove_filter('comments_template', 'dsq_comments_template'); |
976 | 976 | add_filter('comments_template', 'dsq_comments_template', 100); |
977 | - add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1); |
|
977 | + add_filter('pre_option_disqus_active', 'geodir_option_disqus_active', 10, 1); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | |
@@ -987,11 +987,11 @@ discard block |
||
987 | 987 | * @param string $disqus_active Hook called before DB call for option so this is empty. |
988 | 988 | * @return string `1` if active `0` if disabled. |
989 | 989 | */ |
990 | -function geodir_option_disqus_active($disqus_active){ |
|
990 | +function geodir_option_disqus_active($disqus_active) { |
|
991 | 991 | global $post; |
992 | 992 | $all_postypes = geodir_get_posttypes(); |
993 | 993 | |
994 | - if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){ |
|
994 | + if (isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type, $all_postypes)) { |
|
995 | 995 | $disqus_active = '0'; |
996 | 996 | } |
997 | 997 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function gd_strip_breadcrumb_wrappers($breadcrumb) |
20 | 20 | { |
21 | - $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); |
|
21 | + $breadcrumb = str_replace(array("<li>", "</li>"), "", $breadcrumb); |
|
22 | 22 | $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); |
23 | 23 | $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); |
24 | 24 | return $breadcrumb; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | return $separator; |
40 | 40 | } |
41 | 41 | |
42 | -add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change'); |
|
42 | +add_action('avada_override_current_page_title_bar', 'gd_avada_current_page_title_bar_change'); |
|
43 | 43 | /** |
44 | 44 | * new title bar functions for gd pages. |
45 | 45 | * |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | { |
52 | 52 | if (geodir_is_geodir_page()) { |
53 | 53 | gd_avada_current_page_title_bar(); |
54 | - }else{ |
|
55 | - avada_current_page_title_bar( $c_pageID ); |
|
54 | + } else { |
|
55 | + avada_current_page_title_bar($c_pageID); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } |
@@ -113,7 +113,7 @@ |
||
113 | 113 | * @since 1.0.0 |
114 | 114 | * @package GeoDirectory |
115 | 115 | * @param array $classes Class array. |
116 | - * @return array Modified class array. |
|
116 | + * @return string[] Modified class array. |
|
117 | 117 | */ |
118 | 118 | function geodir_x_body_class($classes) |
119 | 119 | { |
@@ -353,7 +353,7 @@ |
||
353 | 353 | |
354 | 354 | if(!$cpt_left){ |
355 | 355 | $cpt_left = "gd-cpt-flat"; |
356 | - }else{ |
|
356 | + } else{ |
|
357 | 357 | $cpt_left = ''; |
358 | 358 | } |
359 | 359 |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function gd_strip_breadcrumb_wrappers($breadcrumb) |
20 | 20 | { |
21 | - $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); |
|
22 | - $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); |
|
23 | - $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); |
|
24 | - return $breadcrumb; |
|
21 | + $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); |
|
22 | + $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); |
|
23 | + $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); |
|
24 | + return $breadcrumb; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | add_filter('geodir_breadcrumb_separator', 'gd_change_breadcrumb_separator'); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function gd_change_breadcrumb_separator($separator) |
37 | 37 | { |
38 | - $separator = ' / '; |
|
39 | - return $separator; |
|
38 | + $separator = ' / '; |
|
39 | + return $separator; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change'); |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function gd_avada_current_page_title_bar_change($c_pageID) |
51 | 51 | { |
52 | - if (geodir_is_geodir_page()) { |
|
53 | - gd_avada_current_page_title_bar(); |
|
54 | - }else{ |
|
55 | - avada_current_page_title_bar( $c_pageID ); |
|
56 | - } |
|
52 | + if (geodir_is_geodir_page()) { |
|
53 | + gd_avada_current_page_title_bar(); |
|
54 | + }else{ |
|
55 | + avada_current_page_title_bar( $c_pageID ); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | |
@@ -65,46 +65,46 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function gd_avada_current_page_title_bar() |
67 | 67 | { |
68 | - ob_start(); |
|
69 | - geodir_breadcrumb(); |
|
70 | - $secondary_content = ob_get_contents(); |
|
71 | - ob_get_clean(); |
|
72 | - |
|
73 | - $title = ''; |
|
74 | - $subtitle = ''; |
|
75 | - |
|
76 | - if (geodir_is_page('listing')) { |
|
77 | - ob_start(); // Start buffering; |
|
78 | - geodir_action_listings_title(); |
|
79 | - $title = ob_get_clean(); |
|
80 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
81 | - } |
|
82 | - |
|
83 | - if (geodir_is_page('add-listing')) { |
|
84 | - ob_start(); // Start buffering; |
|
85 | - geodir_action_add_listing_page_title(); |
|
86 | - $title = ob_get_clean(); |
|
87 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
88 | - } |
|
89 | - |
|
90 | - if (geodir_is_page('author')) { |
|
91 | - ob_start(); // Start buffering; |
|
92 | - geodir_action_author_page_title(); |
|
93 | - $title = ob_get_clean(); |
|
94 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
95 | - } |
|
96 | - |
|
97 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
98 | - $title = get_the_title(); |
|
99 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
100 | - } |
|
101 | - |
|
102 | - if (geodir_is_page('search')) { |
|
103 | - ob_start(); // Start buffering; |
|
104 | - geodir_action_search_page_title(); |
|
105 | - $title = ob_get_clean(); |
|
106 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
107 | - } |
|
68 | + ob_start(); |
|
69 | + geodir_breadcrumb(); |
|
70 | + $secondary_content = ob_get_contents(); |
|
71 | + ob_get_clean(); |
|
72 | + |
|
73 | + $title = ''; |
|
74 | + $subtitle = ''; |
|
75 | + |
|
76 | + if (geodir_is_page('listing')) { |
|
77 | + ob_start(); // Start buffering; |
|
78 | + geodir_action_listings_title(); |
|
79 | + $title = ob_get_clean(); |
|
80 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
81 | + } |
|
82 | + |
|
83 | + if (geodir_is_page('add-listing')) { |
|
84 | + ob_start(); // Start buffering; |
|
85 | + geodir_action_add_listing_page_title(); |
|
86 | + $title = ob_get_clean(); |
|
87 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
88 | + } |
|
89 | + |
|
90 | + if (geodir_is_page('author')) { |
|
91 | + ob_start(); // Start buffering; |
|
92 | + geodir_action_author_page_title(); |
|
93 | + $title = ob_get_clean(); |
|
94 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
95 | + } |
|
96 | + |
|
97 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
98 | + $title = get_the_title(); |
|
99 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
100 | + } |
|
101 | + |
|
102 | + if (geodir_is_page('search')) { |
|
103 | + ob_start(); // Start buffering; |
|
104 | + geodir_action_search_page_title(); |
|
105 | + $title = ob_get_clean(); |
|
106 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -115,34 +115,34 @@ discard block |
||
115 | 115 | */ |
116 | 116 | function gd_compat_php_avada() |
117 | 117 | { |
118 | - // change widget wrappers |
|
119 | - //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 ); |
|
120 | - //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 ); |
|
121 | - |
|
122 | - // REMOVE BREADCRUMB |
|
123 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
124 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
125 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
126 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
127 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
128 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
129 | - |
|
130 | - // REMOVE PAGE TITLES |
|
131 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
132 | - remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
133 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
134 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
135 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
136 | - |
|
137 | - // make top section wide |
|
138 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
139 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
140 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
141 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
142 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
143 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
144 | - |
|
145 | - //gd_compat_add_top_section_back(); |
|
118 | + // change widget wrappers |
|
119 | + //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 ); |
|
120 | + //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 ); |
|
121 | + |
|
122 | + // REMOVE BREADCRUMB |
|
123 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
124 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
125 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
126 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
127 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
128 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
129 | + |
|
130 | + // REMOVE PAGE TITLES |
|
131 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
132 | + remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
133 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
134 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
135 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
136 | + |
|
137 | + // make top section wide |
|
138 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
139 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
140 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
141 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
142 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
143 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
144 | + |
|
145 | + //gd_compat_add_top_section_back(); |
|
146 | 146 | |
147 | 147 | } |
148 | 148 | |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | function gd_compat_add_top_section_back() |
157 | 157 | { |
158 | 158 | |
159 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
160 | - geodir_action_geodir_sidebar_home_top(); |
|
161 | - } elseif (geodir_is_page('listing')) { |
|
162 | - geodir_action_geodir_sidebar_listings_top(); |
|
163 | - } elseif (geodir_is_page('detail')) { |
|
164 | - geodir_action_geodir_sidebar_detail_top(); |
|
165 | - } elseif (geodir_is_page('search')) { |
|
166 | - geodir_action_geodir_sidebar_search_top(); |
|
167 | - } elseif (geodir_is_page('author')) { |
|
168 | - geodir_action_geodir_sidebar_author_top(); |
|
169 | - } |
|
159 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
160 | + geodir_action_geodir_sidebar_home_top(); |
|
161 | + } elseif (geodir_is_page('listing')) { |
|
162 | + geodir_action_geodir_sidebar_listings_top(); |
|
163 | + } elseif (geodir_is_page('detail')) { |
|
164 | + geodir_action_geodir_sidebar_detail_top(); |
|
165 | + } elseif (geodir_is_page('search')) { |
|
166 | + geodir_action_geodir_sidebar_search_top(); |
|
167 | + } elseif (geodir_is_page('author')) { |
|
168 | + geodir_action_geodir_sidebar_author_top(); |
|
169 | + } |
|
170 | 170 | |
171 | 171 | |
172 | 172 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | */ |
184 | 184 | function gd_compat_body_class($classes) |
185 | 185 | { |
186 | - if (geodir_is_geodir_page()) { |
|
187 | - $classes[] = 'wpgeo-avada'; |
|
188 | - } else { |
|
189 | - $classes[] = ''; |
|
190 | - } |
|
191 | - return $classes; |
|
186 | + if (geodir_is_geodir_page()) { |
|
187 | + $classes[] = 'wpgeo-avada'; |
|
188 | + } else { |
|
189 | + $classes[] = ''; |
|
190 | + } |
|
191 | + return $classes; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | function geodir_before_widget_compat($var) |
204 | 204 | { |
205 | - return '<div id="%1$s" class="geodir-widget %2$s">'; |
|
205 | + return '<div id="%1$s" class="geodir-widget %2$s">'; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function geodir_after_widget_compat($var) |
217 | 217 | { |
218 | - return '</div>'; |
|
218 | + return '</div>'; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | add_filter('geodir_search_form_class', 'geodir_search_form_class_avada'); |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | */ |
230 | 230 | function geodir_search_form_class_avada($class) |
231 | 231 | { |
232 | - $class .= ' search'; |
|
233 | - return $class; |
|
232 | + $class .= ' search'; |
|
233 | + return $class; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 |
@@ -76,22 +76,19 @@ discard block |
||
76 | 76 | if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));} |
77 | 77 | if(!$ga_end){$ga_end = date('Y-m-d');} |
78 | 78 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
79 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){ |
|
79 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){ |
|
80 | 80 | if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));} |
81 | 81 | if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));} |
82 | 82 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
83 | - } |
|
84 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){ |
|
83 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){ |
|
85 | 84 | if(!$ga_start){$ga_start = date('Y')."-01-01";} |
86 | 85 | if(!$ga_end){$ga_end = date('Y-m-d');} |
87 | 86 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
88 | - } |
|
89 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){ |
|
87 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){ |
|
90 | 88 | if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";} |
91 | 89 | if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";} |
92 | 90 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
93 | - } |
|
94 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
91 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
95 | 92 | if(!$ga_start){$ga_start = "14daysAgo";} |
96 | 93 | if(!$ga_end){$ga_end = "yesterday";} |
97 | 94 | $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
@@ -144,7 +141,7 @@ discard block |
||
144 | 141 | if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid |
145 | 142 | |
146 | 143 | return $at; |
147 | - }else{//else get new access token |
|
144 | + } else{//else get new access token |
|
148 | 145 | |
149 | 146 | $refresh_at = get_option('gd_ga_refresh_token'); |
150 | 147 | if(!$refresh_at){ |
@@ -167,7 +164,7 @@ discard block |
||
167 | 164 | update_option('gd_ga_access_token', $parts->access_token); |
168 | 165 | return $parts->access_token; |
169 | 166 | |
170 | - }else{ |
|
167 | + } else{ |
|
171 | 168 | echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit; |
172 | 169 | } |
173 | 170 |
@@ -17,34 +17,34 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function geodir_sec2hms($sec, $padHours = false) |
19 | 19 | { |
20 | - // holds formatted string |
|
21 | - $hms = ""; |
|
22 | - // there are 3600 seconds in an hour, so if we |
|
23 | - // divide total seconds by 3600 and throw away |
|
24 | - // the remainder, we've got the number of hours |
|
25 | - $hours = intval(intval($sec) / 3600); |
|
26 | - |
|
27 | - // add to $hms, with a leading 0 if asked for |
|
28 | - $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':'; |
|
29 | - |
|
30 | - // dividing the total seconds by 60 will give us |
|
31 | - // the number of minutes, but we're interested in |
|
32 | - // minutes past the hour: to get that, we need to |
|
33 | - // divide by 60 again and keep the remainder |
|
34 | - $minutes = intval(($sec / 60) % 60); |
|
35 | - |
|
36 | - // then add to $hms (with a leading 0 if needed) |
|
37 | - $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':'; |
|
38 | - |
|
39 | - // seconds are simple - just divide the total |
|
40 | - // seconds by 60 and keep the remainder |
|
41 | - $seconds = intval($sec % 60); |
|
42 | - |
|
43 | - // add to $hms, again with a leading 0 if needed |
|
44 | - $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT); |
|
45 | - |
|
46 | - // done! |
|
47 | - return $hms; |
|
20 | + // holds formatted string |
|
21 | + $hms = ""; |
|
22 | + // there are 3600 seconds in an hour, so if we |
|
23 | + // divide total seconds by 3600 and throw away |
|
24 | + // the remainder, we've got the number of hours |
|
25 | + $hours = intval(intval($sec) / 3600); |
|
26 | + |
|
27 | + // add to $hms, with a leading 0 if asked for |
|
28 | + $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':'; |
|
29 | + |
|
30 | + // dividing the total seconds by 60 will give us |
|
31 | + // the number of minutes, but we're interested in |
|
32 | + // minutes past the hour: to get that, we need to |
|
33 | + // divide by 60 again and keep the remainder |
|
34 | + $minutes = intval(($sec / 60) % 60); |
|
35 | + |
|
36 | + // then add to $hms (with a leading 0 if needed) |
|
37 | + $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':'; |
|
38 | + |
|
39 | + // seconds are simple - just divide the total |
|
40 | + // seconds by 60 and keep the remainder |
|
41 | + $seconds = intval($sec % 60); |
|
42 | + |
|
43 | + // add to $hms, again with a leading 0 if needed |
|
44 | + $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT); |
|
45 | + |
|
46 | + // done! |
|
47 | + return $hms; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -61,117 +61,117 @@ discard block |
||
61 | 61 | { |
62 | 62 | |
63 | 63 | |
64 | - // NOTE: the id is in the form ga:12345 and not just 12345 |
|
65 | - // if you do e.g. 12345 then no data will be returned |
|
66 | - // read http://www.electrictoolbox.com/get-id-for-google-analytics-api/ for info about how to get this id from the GA web interface |
|
67 | - // or load the accounts (see below) and get it from there |
|
68 | - // if you don't specify an id here, then you'll get the "Badly formatted request to the Google Analytics API..." error message |
|
69 | - $id = trim(get_option('geodir_ga_id')); |
|
70 | - |
|
71 | - $at = geodir_ga_get_token(); |
|
72 | - |
|
73 | - $start_date = ''; |
|
74 | - $end_date = ''; |
|
75 | - $dimensions = "&filters=ga:pagePath==" . $page; |
|
76 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){ |
|
77 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));} |
|
78 | - if(!$ga_end){$ga_end = date('Y-m-d');} |
|
79 | - $dimensions = "&dimensions=ga:date,ga:nthDay"; |
|
80 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){ |
|
81 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));} |
|
82 | - if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));} |
|
83 | - $dimensions = "&dimensions=ga:date,ga:nthDay"; |
|
84 | - } |
|
85 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){ |
|
86 | - if(!$ga_start){$ga_start = date('Y')."-01-01";} |
|
87 | - if(!$ga_end){$ga_end = date('Y-m-d');} |
|
88 | - $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
|
89 | - } |
|
90 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){ |
|
91 | - if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";} |
|
92 | - if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";} |
|
93 | - $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
|
94 | - } |
|
95 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
96 | - if(!$ga_start){$ga_start = "14daysAgo";} |
|
97 | - if(!$ga_end){$ga_end = "yesterday";} |
|
98 | - $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
|
99 | - } |
|
100 | - |
|
101 | - $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?"; |
|
102 | - $ids = "ids=".$id; |
|
103 | - if(!$start_date){$start_date = "&start-date=".$ga_start;} |
|
104 | - if(!$end_date){$end_date = "&end-date=".$ga_end;} |
|
105 | - $metrics = "&metrics=ga:pageviews"; |
|
106 | - $filters = "&filters=ga:pagePath==".$page; |
|
107 | - $access_token = "&access_token=".$at; |
|
108 | - |
|
109 | - $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token; |
|
110 | - |
|
111 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){ |
|
112 | - $metrics = "&metrics=rt:activeUsers"; |
|
113 | - $dimensions = "&filters=ga:pagePath==".$page; |
|
114 | - |
|
115 | - $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions; |
|
116 | - } |
|
117 | - |
|
118 | - $response = wp_remote_get($use_url,array('timeout' => 15)); |
|
119 | - |
|
120 | - // Make countries translatable |
|
121 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
122 | - $c_arr = json_decode($response['body']); |
|
123 | - if(is_array($c_arr->rows)){ |
|
124 | - $new_rows = array(); |
|
125 | - foreach($c_arr->rows as $wow){ |
|
126 | - $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]); |
|
127 | - } |
|
128 | - $c_arr->rows = $new_rows; |
|
129 | - } |
|
130 | - $response['body'] = json_encode($c_arr); |
|
131 | - } |
|
132 | - |
|
133 | - echo $response['body']; |
|
134 | - exit; |
|
64 | + // NOTE: the id is in the form ga:12345 and not just 12345 |
|
65 | + // if you do e.g. 12345 then no data will be returned |
|
66 | + // read http://www.electrictoolbox.com/get-id-for-google-analytics-api/ for info about how to get this id from the GA web interface |
|
67 | + // or load the accounts (see below) and get it from there |
|
68 | + // if you don't specify an id here, then you'll get the "Badly formatted request to the Google Analytics API..." error message |
|
69 | + $id = trim(get_option('geodir_ga_id')); |
|
70 | + |
|
71 | + $at = geodir_ga_get_token(); |
|
72 | + |
|
73 | + $start_date = ''; |
|
74 | + $end_date = ''; |
|
75 | + $dimensions = "&filters=ga:pagePath==" . $page; |
|
76 | + if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){ |
|
77 | + if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));} |
|
78 | + if(!$ga_end){$ga_end = date('Y-m-d');} |
|
79 | + $dimensions = "&dimensions=ga:date,ga:nthDay"; |
|
80 | + }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){ |
|
81 | + if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));} |
|
82 | + if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));} |
|
83 | + $dimensions = "&dimensions=ga:date,ga:nthDay"; |
|
84 | + } |
|
85 | + elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){ |
|
86 | + if(!$ga_start){$ga_start = date('Y')."-01-01";} |
|
87 | + if(!$ga_end){$ga_end = date('Y-m-d');} |
|
88 | + $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
|
89 | + } |
|
90 | + elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){ |
|
91 | + if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";} |
|
92 | + if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";} |
|
93 | + $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
|
94 | + } |
|
95 | + elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
96 | + if(!$ga_start){$ga_start = "14daysAgo";} |
|
97 | + if(!$ga_end){$ga_end = "yesterday";} |
|
98 | + $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
|
99 | + } |
|
100 | + |
|
101 | + $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?"; |
|
102 | + $ids = "ids=".$id; |
|
103 | + if(!$start_date){$start_date = "&start-date=".$ga_start;} |
|
104 | + if(!$end_date){$end_date = "&end-date=".$ga_end;} |
|
105 | + $metrics = "&metrics=ga:pageviews"; |
|
106 | + $filters = "&filters=ga:pagePath==".$page; |
|
107 | + $access_token = "&access_token=".$at; |
|
108 | + |
|
109 | + $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token; |
|
110 | + |
|
111 | + if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){ |
|
112 | + $metrics = "&metrics=rt:activeUsers"; |
|
113 | + $dimensions = "&filters=ga:pagePath==".$page; |
|
114 | + |
|
115 | + $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions; |
|
116 | + } |
|
117 | + |
|
118 | + $response = wp_remote_get($use_url,array('timeout' => 15)); |
|
119 | + |
|
120 | + // Make countries translatable |
|
121 | + if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
122 | + $c_arr = json_decode($response['body']); |
|
123 | + if(is_array($c_arr->rows)){ |
|
124 | + $new_rows = array(); |
|
125 | + foreach($c_arr->rows as $wow){ |
|
126 | + $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]); |
|
127 | + } |
|
128 | + $c_arr->rows = $new_rows; |
|
129 | + } |
|
130 | + $response['body'] = json_encode($c_arr); |
|
131 | + } |
|
132 | + |
|
133 | + echo $response['body']; |
|
134 | + exit; |
|
135 | 135 | |
136 | 136 | }// end GA function |
137 | 137 | |
138 | 138 | |
139 | 139 | function geodir_ga_get_token(){ |
140 | - $at = get_option('gd_ga_access_token'); |
|
141 | - $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at; |
|
142 | - $response = wp_remote_get($use_url,array('timeout' => 15)); |
|
140 | + $at = get_option('gd_ga_access_token'); |
|
141 | + $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at; |
|
142 | + $response = wp_remote_get($use_url,array('timeout' => 15)); |
|
143 | 143 | |
144 | - if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid |
|
144 | + if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid |
|
145 | 145 | |
146 | - return $at; |
|
147 | - }else{//else get new access token |
|
146 | + return $at; |
|
147 | + }else{//else get new access token |
|
148 | 148 | |
149 | - $refresh_at = get_option('gd_ga_refresh_token'); |
|
150 | - if(!$refresh_at){ |
|
151 | - echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit; |
|
152 | - } |
|
149 | + $refresh_at = get_option('gd_ga_refresh_token'); |
|
150 | + if(!$refresh_at){ |
|
151 | + echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit; |
|
152 | + } |
|
153 | 153 | |
154 | - $rat_url = "https://www.googleapis.com/oauth2/v3/token?"; |
|
155 | - $client_id = "client_id=".get_option('geodir_ga_client_id'); |
|
156 | - $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
|
157 | - $refresh_token = "&refresh_token=".$refresh_at; |
|
158 | - $grant_type = "&grant_type=refresh_token"; |
|
154 | + $rat_url = "https://www.googleapis.com/oauth2/v3/token?"; |
|
155 | + $client_id = "client_id=".get_option('geodir_ga_client_id'); |
|
156 | + $client_secret = "&client_secret=".get_option('geodir_ga_client_secret'); |
|
157 | + $refresh_token = "&refresh_token=".$refresh_at; |
|
158 | + $grant_type = "&grant_type=refresh_token"; |
|
159 | 159 | |
160 | - $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type; |
|
160 | + $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type; |
|
161 | 161 | |
162 | - $rat_response = wp_remote_post($rat_url_use,array('timeout' => 15)); |
|
163 | - if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) { |
|
164 | - $parts = json_decode($rat_response['body']); |
|
162 | + $rat_response = wp_remote_post($rat_url_use,array('timeout' => 15)); |
|
163 | + if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) { |
|
164 | + $parts = json_decode($rat_response['body']); |
|
165 | 165 | |
166 | 166 | |
167 | - update_option('gd_ga_access_token', $parts->access_token); |
|
168 | - return $parts->access_token; |
|
167 | + update_option('gd_ga_access_token', $parts->access_token); |
|
168 | + return $parts->access_token; |
|
169 | 169 | |
170 | - }else{ |
|
171 | - echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit; |
|
172 | - } |
|
170 | + }else{ |
|
171 | + echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit; |
|
172 | + } |
|
173 | 173 | |
174 | 174 | |
175 | - } |
|
175 | + } |
|
176 | 176 | |
177 | 177 | } |
178 | 178 | \ No newline at end of file |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $hours = intval(intval($sec) / 3600); |
26 | 26 | |
27 | 27 | // add to $hms, with a leading 0 if asked for |
28 | - $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':'; |
|
28 | + $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT).':' : $hours.':'; |
|
29 | 29 | |
30 | 30 | // dividing the total seconds by 60 will give us |
31 | 31 | // the number of minutes, but we're interested in |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $minutes = intval(($sec / 60) % 60); |
35 | 35 | |
36 | 36 | // then add to $hms (with a leading 0 if needed) |
37 | - $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':'; |
|
37 | + $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT).':'; |
|
38 | 38 | |
39 | 39 | // seconds are simple - just divide the total |
40 | 40 | // seconds by 60 and keep the remainder |
@@ -72,58 +72,58 @@ discard block |
||
72 | 72 | |
73 | 73 | $start_date = ''; |
74 | 74 | $end_date = ''; |
75 | - $dimensions = "&filters=ga:pagePath==" . $page; |
|
76 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){ |
|
77 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));} |
|
78 | - if(!$ga_end){$ga_end = date('Y-m-d');} |
|
75 | + $dimensions = "&filters=ga:pagePath==".$page; |
|
76 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisweek') { |
|
77 | + if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-6 day")); } |
|
78 | + if (!$ga_end) {$ga_end = date('Y-m-d'); } |
|
79 | 79 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
80 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){ |
|
81 | - if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));} |
|
82 | - if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));} |
|
80 | + }elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastweek') { |
|
81 | + if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-13 day")); } |
|
82 | + if (!$ga_end) {$ga_end = date('Y-m-d', strtotime("-7 day")); } |
|
83 | 83 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
84 | 84 | } |
85 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){ |
|
86 | - if(!$ga_start){$ga_start = date('Y')."-01-01";} |
|
87 | - if(!$ga_end){$ga_end = date('Y-m-d');} |
|
85 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisyear') { |
|
86 | + if (!$ga_start) {$ga_start = date('Y')."-01-01"; } |
|
87 | + if (!$ga_end) {$ga_end = date('Y-m-d'); } |
|
88 | 88 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
89 | 89 | } |
90 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){ |
|
91 | - if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";} |
|
92 | - if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";} |
|
90 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastyear') { |
|
91 | + if (!$ga_start) {$ga_start = date('Y', strtotime("-1 year"))."-01-01"; } |
|
92 | + if (!$ga_end) {$ga_end = date('Y', strtotime("-1 year"))."-12-31"; } |
|
93 | 93 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
94 | 94 | } |
95 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
96 | - if(!$ga_start){$ga_start = "14daysAgo";} |
|
97 | - if(!$ga_end){$ga_end = "yesterday";} |
|
95 | + elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') { |
|
96 | + if (!$ga_start) {$ga_start = "14daysAgo"; } |
|
97 | + if (!$ga_end) {$ga_end = "yesterday"; } |
|
98 | 98 | $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
99 | 99 | } |
100 | 100 | |
101 | 101 | $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?"; |
102 | 102 | $ids = "ids=".$id; |
103 | - if(!$start_date){$start_date = "&start-date=".$ga_start;} |
|
104 | - if(!$end_date){$end_date = "&end-date=".$ga_end;} |
|
103 | + if (!$start_date) {$start_date = "&start-date=".$ga_start; } |
|
104 | + if (!$end_date) {$end_date = "&end-date=".$ga_end; } |
|
105 | 105 | $metrics = "&metrics=ga:pageviews"; |
106 | 106 | $filters = "&filters=ga:pagePath==".$page; |
107 | 107 | $access_token = "&access_token=".$at; |
108 | 108 | |
109 | 109 | $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token; |
110 | 110 | |
111 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){ |
|
111 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'realtime') { |
|
112 | 112 | $metrics = "&metrics=rt:activeUsers"; |
113 | 113 | $dimensions = "&filters=ga:pagePath==".$page; |
114 | 114 | |
115 | 115 | $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions; |
116 | 116 | } |
117 | 117 | |
118 | - $response = wp_remote_get($use_url,array('timeout' => 15)); |
|
118 | + $response = wp_remote_get($use_url, array('timeout' => 15)); |
|
119 | 119 | |
120 | 120 | // Make countries translatable |
121 | - if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){ |
|
121 | + if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') { |
|
122 | 122 | $c_arr = json_decode($response['body']); |
123 | - if(is_array($c_arr->rows)){ |
|
123 | + if (is_array($c_arr->rows)) { |
|
124 | 124 | $new_rows = array(); |
125 | - foreach($c_arr->rows as $wow){ |
|
126 | - $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]); |
|
125 | + foreach ($c_arr->rows as $wow) { |
|
126 | + $new_rows[] = array(__($wow[0], 'geodirectory'), $wow[1]); |
|
127 | 127 | } |
128 | 128 | $c_arr->rows = $new_rows; |
129 | 129 | } |
@@ -136,19 +136,19 @@ discard block |
||
136 | 136 | }// end GA function |
137 | 137 | |
138 | 138 | |
139 | -function geodir_ga_get_token(){ |
|
139 | +function geodir_ga_get_token() { |
|
140 | 140 | $at = get_option('gd_ga_access_token'); |
141 | 141 | $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at; |
142 | - $response = wp_remote_get($use_url,array('timeout' => 15)); |
|
142 | + $response = wp_remote_get($use_url, array('timeout' => 15)); |
|
143 | 143 | |
144 | - if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid |
|
144 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) {//access token is valid |
|
145 | 145 | |
146 | 146 | return $at; |
147 | - }else{//else get new access token |
|
147 | + } else {//else get new access token |
|
148 | 148 | |
149 | 149 | $refresh_at = get_option('gd_ga_refresh_token'); |
150 | - if(!$refresh_at){ |
|
151 | - echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit; |
|
150 | + if (!$refresh_at) { |
|
151 | + echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory'))); exit; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $rat_url = "https://www.googleapis.com/oauth2/v3/token?"; |
@@ -159,16 +159,16 @@ discard block |
||
159 | 159 | |
160 | 160 | $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type; |
161 | 161 | |
162 | - $rat_response = wp_remote_post($rat_url_use,array('timeout' => 15)); |
|
163 | - if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) { |
|
162 | + $rat_response = wp_remote_post($rat_url_use, array('timeout' => 15)); |
|
163 | + if (!empty($rat_response['response']['code']) && $rat_response['response']['code'] == 200) { |
|
164 | 164 | $parts = json_decode($rat_response['body']); |
165 | 165 | |
166 | 166 | |
167 | 167 | update_option('gd_ga_access_token', $parts->access_token); |
168 | 168 | return $parts->access_token; |
169 | 169 | |
170 | - }else{ |
|
171 | - echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit; |
|
170 | + } else { |
|
171 | + echo json_encode(array('error'=>__('Login failed', 'geodirectory'))); exit; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $slug = $post->post_name; |
154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
155 | 155 | $login_url = trailingslashit($home_url)."$slug/"; |
156 | - }else{ |
|
156 | + } else{ |
|
157 | 157 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
158 | 158 | } |
159 | 159 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $slug = $post->post_name; |
203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
204 | 204 | $info_url = trailingslashit($home_url)."$slug/"; |
205 | - }else{ |
|
205 | + } else{ |
|
206 | 206 | $info_url = trailingslashit($home_url); |
207 | 207 | } |
208 | 208 |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | * @return int|null Return the page ID if present or null if not. |
15 | 15 | */ |
16 | 16 | function geodir_add_listing_page_id(){ |
17 | - $gd_page_id = get_option('geodir_add_listing_page'); |
|
17 | + $gd_page_id = get_option('geodir_add_listing_page'); |
|
18 | 18 | |
19 | - if (function_exists('icl_object_id')) { |
|
20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | - } |
|
19 | + if (function_exists('icl_object_id')) { |
|
20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | + } |
|
22 | 22 | |
23 | - return $gd_page_id; |
|
23 | + return $gd_page_id; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | * @return int|null Return the page ID if present or null if not. |
32 | 32 | */ |
33 | 33 | function geodir_preview_page_id(){ |
34 | - $gd_page_id = get_option('geodir_preview_page'); |
|
34 | + $gd_page_id = get_option('geodir_preview_page'); |
|
35 | 35 | |
36 | - if (function_exists('icl_object_id')) { |
|
37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | - } |
|
36 | + if (function_exists('icl_object_id')) { |
|
37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | + } |
|
39 | 39 | |
40 | - return $gd_page_id; |
|
40 | + return $gd_page_id; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * @return int|null Return the page ID if present or null if not. |
49 | 49 | */ |
50 | 50 | function geodir_success_page_id(){ |
51 | - $gd_page_id = get_option('geodir_success_page'); |
|
51 | + $gd_page_id = get_option('geodir_success_page'); |
|
52 | 52 | |
53 | - if (function_exists('icl_object_id')) { |
|
54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | - } |
|
53 | + if (function_exists('icl_object_id')) { |
|
54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | + } |
|
56 | 56 | |
57 | - return $gd_page_id; |
|
57 | + return $gd_page_id; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * @return int|null Return the page ID if present or null if not. |
66 | 66 | */ |
67 | 67 | function geodir_location_page_id(){ |
68 | - $gd_page_id = get_option('geodir_location_page'); |
|
68 | + $gd_page_id = get_option('geodir_location_page'); |
|
69 | 69 | |
70 | - if (function_exists('icl_object_id')) { |
|
71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | - } |
|
70 | + if (function_exists('icl_object_id')) { |
|
71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | + } |
|
73 | 73 | |
74 | - return $gd_page_id; |
|
74 | + return $gd_page_id; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | * @return int|null Return the page ID if present or null if not. |
83 | 83 | */ |
84 | 84 | function geodir_home_page_id(){ |
85 | - $gd_page_id = get_option('geodir_home_page'); |
|
85 | + $gd_page_id = get_option('geodir_home_page'); |
|
86 | 86 | |
87 | - if (function_exists('icl_object_id')) { |
|
88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | - } |
|
87 | + if (function_exists('icl_object_id')) { |
|
88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | + } |
|
90 | 90 | |
91 | - return $gd_page_id; |
|
91 | + return $gd_page_id; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @return int|null Return the page ID if present or null if not. |
100 | 100 | */ |
101 | 101 | function geodir_info_page_id(){ |
102 | - $gd_page_id = get_option('geodir_info_page'); |
|
102 | + $gd_page_id = get_option('geodir_info_page'); |
|
103 | 103 | |
104 | - if (function_exists('icl_object_id')) { |
|
105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | - } |
|
104 | + if (function_exists('icl_object_id')) { |
|
105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | + } |
|
107 | 107 | |
108 | - return $gd_page_id; |
|
108 | + return $gd_page_id; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | * @return int|null Return the page ID if present or null if not. |
117 | 117 | */ |
118 | 118 | function geodir_login_page_id(){ |
119 | - $gd_page_id = get_option('geodir_login_page'); |
|
119 | + $gd_page_id = get_option('geodir_login_page'); |
|
120 | 120 | |
121 | - if (function_exists('icl_object_id')) { |
|
122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | - } |
|
121 | + if (function_exists('icl_object_id')) { |
|
122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | + } |
|
124 | 124 | |
125 | - return $gd_page_id; |
|
125 | + return $gd_page_id; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -134,45 +134,45 @@ discard block |
||
134 | 134 | * @return int|null Return the page ID if present or null if not. |
135 | 135 | */ |
136 | 136 | function geodir_login_url($args=array()){ |
137 | - $gd_page_id = get_option('geodir_login_page'); |
|
138 | - |
|
139 | - if (function_exists('icl_object_id')) { |
|
140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | - } |
|
142 | - |
|
143 | - if (function_exists('geodir_location_geo_home_link')) { |
|
144 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
145 | - } |
|
146 | - $home_url = get_home_url(); |
|
147 | - if (function_exists('geodir_location_geo_home_link')) { |
|
148 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
149 | - } |
|
150 | - |
|
151 | - if($gd_page_id){ |
|
152 | - $post = get_post($gd_page_id); |
|
153 | - $slug = $post->post_name; |
|
154 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
155 | - $login_url = trailingslashit($home_url)."$slug/"; |
|
156 | - }else{ |
|
157 | - $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
158 | - } |
|
159 | - |
|
160 | - if($args){ |
|
161 | - $login_url = add_query_arg($args,$login_url ); |
|
162 | - } |
|
163 | - |
|
164 | - /** |
|
165 | - * Filter the GeoDirectory login page url. |
|
166 | - * |
|
167 | - * This filter can be used to change the GeoDirectory page url. |
|
168 | - * |
|
169 | - * @since 1.5.3 |
|
170 | - * @package GeoDirectory |
|
171 | - * @param string $login_url The url of the login page. |
|
172 | - * @param array $args The array of query args used. |
|
173 | - * @param int $gd_page_id The page id of the GD login page. |
|
174 | - */ |
|
175 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
137 | + $gd_page_id = get_option('geodir_login_page'); |
|
138 | + |
|
139 | + if (function_exists('icl_object_id')) { |
|
140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | + } |
|
142 | + |
|
143 | + if (function_exists('geodir_location_geo_home_link')) { |
|
144 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
145 | + } |
|
146 | + $home_url = get_home_url(); |
|
147 | + if (function_exists('geodir_location_geo_home_link')) { |
|
148 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
149 | + } |
|
150 | + |
|
151 | + if($gd_page_id){ |
|
152 | + $post = get_post($gd_page_id); |
|
153 | + $slug = $post->post_name; |
|
154 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
155 | + $login_url = trailingslashit($home_url)."$slug/"; |
|
156 | + }else{ |
|
157 | + $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
158 | + } |
|
159 | + |
|
160 | + if($args){ |
|
161 | + $login_url = add_query_arg($args,$login_url ); |
|
162 | + } |
|
163 | + |
|
164 | + /** |
|
165 | + * Filter the GeoDirectory login page url. |
|
166 | + * |
|
167 | + * This filter can be used to change the GeoDirectory page url. |
|
168 | + * |
|
169 | + * @since 1.5.3 |
|
170 | + * @package GeoDirectory |
|
171 | + * @param string $login_url The url of the login page. |
|
172 | + * @param array $args The array of query args used. |
|
173 | + * @param int $gd_page_id The page id of the GD login page. |
|
174 | + */ |
|
175 | + return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -183,34 +183,34 @@ discard block |
||
183 | 183 | * @return string Info page url. |
184 | 184 | */ |
185 | 185 | function geodir_info_url($args=array()){ |
186 | - $gd_page_id = get_option('geodir_info_page'); |
|
187 | - |
|
188 | - if (function_exists('icl_object_id')) { |
|
189 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
190 | - } |
|
191 | - |
|
192 | - if (function_exists('geodir_location_geo_home_link')) { |
|
193 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
194 | - } |
|
195 | - $home_url = get_home_url(); |
|
196 | - if (function_exists('geodir_location_geo_home_link')) { |
|
197 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
198 | - } |
|
199 | - |
|
200 | - if($gd_page_id){ |
|
201 | - $post = get_post($gd_page_id); |
|
202 | - $slug = $post->post_name; |
|
203 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
204 | - $info_url = trailingslashit($home_url)."$slug/"; |
|
205 | - }else{ |
|
206 | - $info_url = trailingslashit($home_url); |
|
207 | - } |
|
208 | - |
|
209 | - if($args){ |
|
210 | - $info_url = add_query_arg($args,$info_url ); |
|
211 | - } |
|
212 | - |
|
213 | - return $info_url; |
|
186 | + $gd_page_id = get_option('geodir_info_page'); |
|
187 | + |
|
188 | + if (function_exists('icl_object_id')) { |
|
189 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
190 | + } |
|
191 | + |
|
192 | + if (function_exists('geodir_location_geo_home_link')) { |
|
193 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
194 | + } |
|
195 | + $home_url = get_home_url(); |
|
196 | + if (function_exists('geodir_location_geo_home_link')) { |
|
197 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
198 | + } |
|
199 | + |
|
200 | + if($gd_page_id){ |
|
201 | + $post = get_post($gd_page_id); |
|
202 | + $slug = $post->post_name; |
|
203 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
204 | + $info_url = trailingslashit($home_url)."$slug/"; |
|
205 | + }else{ |
|
206 | + $info_url = trailingslashit($home_url); |
|
207 | + } |
|
208 | + |
|
209 | + if($args){ |
|
210 | + $info_url = add_query_arg($args,$info_url ); |
|
211 | + } |
|
212 | + |
|
213 | + return $info_url; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | * @return string Returns converted string. |
227 | 227 | */ |
228 | 228 | function geodir_ucwords($string, $charset='UTF-8') { |
229 | - if (function_exists('mb_convert_case')) { |
|
230 | - return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
231 | - } else { |
|
232 | - return ucwords($string); |
|
233 | - } |
|
229 | + if (function_exists('mb_convert_case')) { |
|
230 | + return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
231 | + } else { |
|
232 | + return ucwords($string); |
|
233 | + } |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | * @return string Returns converted string. |
247 | 247 | */ |
248 | 248 | function geodir_strtolower($string, $charset='UTF-8') { |
249 | - if (function_exists('mb_convert_case')) { |
|
250 | - return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
251 | - } else { |
|
252 | - return strtolower($string); |
|
253 | - } |
|
249 | + if (function_exists('mb_convert_case')) { |
|
250 | + return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
251 | + } else { |
|
252 | + return strtolower($string); |
|
253 | + } |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | * @return string Returns converted string. |
267 | 267 | */ |
268 | 268 | function geodir_strtoupper($string, $charset='UTF-8') { |
269 | - if (function_exists('mb_convert_case')) { |
|
270 | - return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
271 | - } else { |
|
272 | - return strtoupper($string); |
|
273 | - } |
|
269 | + if (function_exists('mb_convert_case')) { |
|
270 | + return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
271 | + } else { |
|
272 | + return strtoupper($string); |
|
273 | + } |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | * @package GeoDirectory |
450 | 450 | */ |
451 | 451 | function _gd_die_handler() { |
452 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
453 | - return '_gd_die_handler'; |
|
454 | - } else { |
|
455 | - die(); |
|
456 | - } |
|
452 | + if ( defined( 'GD_TESTING_MODE' ) ) { |
|
453 | + return '_gd_die_handler'; |
|
454 | + } else { |
|
455 | + die(); |
|
456 | + } |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | /** |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @param int $status Optional. Status code. |
469 | 469 | */ |
470 | 470 | function gd_die( $message = '', $title = '', $status = 400 ) { |
471 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
472 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
473 | - wp_die( $message, $title, array( 'response' => $status )); |
|
471 | + add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
472 | + add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
473 | + wp_die( $message, $title, array( 'response' => $status )); |
|
474 | 474 | } |
475 | 475 | \ No newline at end of file |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | * @since 1.4.6 |
14 | 14 | * @return int|null Return the page ID if present or null if not. |
15 | 15 | */ |
16 | -function geodir_add_listing_page_id(){ |
|
16 | +function geodir_add_listing_page_id() { |
|
17 | 17 | $gd_page_id = get_option('geodir_add_listing_page'); |
18 | 18 | |
19 | 19 | if (function_exists('icl_object_id')) { |
20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | return $gd_page_id; |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * @since 1.4.6 |
31 | 31 | * @return int|null Return the page ID if present or null if not. |
32 | 32 | */ |
33 | -function geodir_preview_page_id(){ |
|
33 | +function geodir_preview_page_id() { |
|
34 | 34 | $gd_page_id = get_option('geodir_preview_page'); |
35 | 35 | |
36 | 36 | if (function_exists('icl_object_id')) { |
37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $gd_page_id; |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @since 1.4.6 |
48 | 48 | * @return int|null Return the page ID if present or null if not. |
49 | 49 | */ |
50 | -function geodir_success_page_id(){ |
|
50 | +function geodir_success_page_id() { |
|
51 | 51 | $gd_page_id = get_option('geodir_success_page'); |
52 | 52 | |
53 | 53 | if (function_exists('icl_object_id')) { |
54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return $gd_page_id; |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * @since 1.4.6 |
65 | 65 | * @return int|null Return the page ID if present or null if not. |
66 | 66 | */ |
67 | -function geodir_location_page_id(){ |
|
67 | +function geodir_location_page_id() { |
|
68 | 68 | $gd_page_id = get_option('geodir_location_page'); |
69 | 69 | |
70 | 70 | if (function_exists('icl_object_id')) { |
71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $gd_page_id; |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @since 1.5.4 |
82 | 82 | * @return int|null Return the page ID if present or null if not. |
83 | 83 | */ |
84 | -function geodir_home_page_id(){ |
|
84 | +function geodir_home_page_id() { |
|
85 | 85 | $gd_page_id = get_option('geodir_home_page'); |
86 | 86 | |
87 | 87 | if (function_exists('icl_object_id')) { |
88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $gd_page_id; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @since 1.5.3 |
99 | 99 | * @return int|null Return the page ID if present or null if not. |
100 | 100 | */ |
101 | -function geodir_info_page_id(){ |
|
101 | +function geodir_info_page_id() { |
|
102 | 102 | $gd_page_id = get_option('geodir_info_page'); |
103 | 103 | |
104 | 104 | if (function_exists('icl_object_id')) { |
105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return $gd_page_id; |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | * @since 1.5.3 |
116 | 116 | * @return int|null Return the page ID if present or null if not. |
117 | 117 | */ |
118 | -function geodir_login_page_id(){ |
|
118 | +function geodir_login_page_id() { |
|
119 | 119 | $gd_page_id = get_option('geodir_login_page'); |
120 | 120 | |
121 | 121 | if (function_exists('icl_object_id')) { |
122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $gd_page_id; |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | * @since 1.5.3 |
134 | 134 | * @return int|null Return the page ID if present or null if not. |
135 | 135 | */ |
136 | -function geodir_login_url($args=array()){ |
|
136 | +function geodir_login_url($args = array()) { |
|
137 | 137 | $gd_page_id = get_option('geodir_login_page'); |
138 | 138 | |
139 | 139 | if (function_exists('icl_object_id')) { |
140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -148,17 +148,17 @@ discard block |
||
148 | 148 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
149 | 149 | } |
150 | 150 | |
151 | - if($gd_page_id){ |
|
151 | + if ($gd_page_id) { |
|
152 | 152 | $post = get_post($gd_page_id); |
153 | 153 | $slug = $post->post_name; |
154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
155 | 155 | $login_url = trailingslashit($home_url)."$slug/"; |
156 | - }else{ |
|
156 | + } else { |
|
157 | 157 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
158 | 158 | } |
159 | 159 | |
160 | - if($args){ |
|
161 | - $login_url = add_query_arg($args,$login_url ); |
|
160 | + if ($args) { |
|
161 | + $login_url = add_query_arg($args, $login_url); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param array $args The array of query args used. |
173 | 173 | * @param int $gd_page_id The page id of the GD login page. |
174 | 174 | */ |
175 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
175 | + return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | * @since 1.5.4 |
183 | 183 | * @return string Info page url. |
184 | 184 | */ |
185 | -function geodir_info_url($args=array()){ |
|
185 | +function geodir_info_url($args = array()) { |
|
186 | 186 | $gd_page_id = get_option('geodir_info_page'); |
187 | 187 | |
188 | 188 | if (function_exists('icl_object_id')) { |
189 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
189 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
198 | 198 | } |
199 | 199 | |
200 | - if($gd_page_id){ |
|
200 | + if ($gd_page_id) { |
|
201 | 201 | $post = get_post($gd_page_id); |
202 | 202 | $slug = $post->post_name; |
203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
204 | 204 | $info_url = trailingslashit($home_url)."$slug/"; |
205 | - }else{ |
|
205 | + } else { |
|
206 | 206 | $info_url = trailingslashit($home_url); |
207 | 207 | } |
208 | 208 | |
209 | - if($args){ |
|
210 | - $info_url = add_query_arg($args,$info_url ); |
|
209 | + if ($args) { |
|
210 | + $info_url = add_query_arg($args, $info_url); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | return $info_url; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param string $charset Character set to use for conversion. |
226 | 226 | * @return string Returns converted string. |
227 | 227 | */ |
228 | -function geodir_ucwords($string, $charset='UTF-8') { |
|
228 | +function geodir_ucwords($string, $charset = 'UTF-8') { |
|
229 | 229 | if (function_exists('mb_convert_case')) { |
230 | 230 | return mb_convert_case($string, MB_CASE_TITLE, $charset); |
231 | 231 | } else { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param string $charset Character set to use for conversion. |
246 | 246 | * @return string Returns converted string. |
247 | 247 | */ |
248 | -function geodir_strtolower($string, $charset='UTF-8') { |
|
248 | +function geodir_strtolower($string, $charset = 'UTF-8') { |
|
249 | 249 | if (function_exists('mb_convert_case')) { |
250 | 250 | return mb_convert_case($string, MB_CASE_LOWER, $charset); |
251 | 251 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @param string $charset Character set to use for conversion. |
266 | 266 | * @return string Returns converted string. |
267 | 267 | */ |
268 | -function geodir_strtoupper($string, $charset='UTF-8') { |
|
268 | +function geodir_strtoupper($string, $charset = 'UTF-8') { |
|
269 | 269 | if (function_exists('mb_convert_case')) { |
270 | 270 | return mb_convert_case($string, MB_CASE_UPPER, $charset); |
271 | 271 | } else { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | $url = trim($parts[0]); |
298 | 298 | if ($formatted && $url != '') { |
299 | - $url = str_replace( ' ', '%20', $url ); |
|
299 | + $url = str_replace(' ', '%20', $url); |
|
300 | 300 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); |
301 | 301 | |
302 | 302 | if (0 !== stripos($url, 'mailto:')) { |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | |
307 | 307 | $url = str_replace(';//', '://', $url); |
308 | 308 | |
309 | - if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
310 | - $url = 'http://' . $url; |
|
309 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
310 | + $url = 'http://'.$url; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | $url = wp_kses_normalize_entities($url); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | * @package GeoDirectory |
450 | 450 | */ |
451 | 451 | function _gd_die_handler() { |
452 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
452 | + if (defined('GD_TESTING_MODE')) { |
|
453 | 453 | return '_gd_die_handler'; |
454 | 454 | } else { |
455 | 455 | die(); |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | * @param string $title Optional. Error title. |
468 | 468 | * @param int $status Optional. Status code. |
469 | 469 | */ |
470 | -function gd_die( $message = '', $title = '', $status = 400 ) { |
|
471 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
472 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
473 | - wp_die( $message, $title, array( 'response' => $status )); |
|
470 | +function gd_die($message = '', $title = '', $status = 400) { |
|
471 | + add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3); |
|
472 | + add_filter('wp_die_handler', '_gd_die_handler', 10, 3); |
|
473 | + wp_die($message, $title, array('response' => $status)); |
|
474 | 474 | } |
475 | 475 | \ No newline at end of file |
@@ -107,11 +107,13 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - if (!empty($field_default_cat)) |
|
111 | - $field_default_cat = ''; |
|
110 | + if (!empty($field_default_cat)) { |
|
111 | + $field_default_cat = ''; |
|
112 | + } |
|
112 | 113 | |
113 | - if (!empty($cat_find_array)) |
|
114 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
114 | + if (!empty($cat_find_array)) { |
|
115 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
116 | + } |
|
115 | 117 | |
116 | 118 | $main_query_array = $map_cat_ids_array; |
117 | 119 | |
@@ -143,8 +145,9 @@ discard block |
||
143 | 145 | $gd_posttype = " AND p.post_type = %s"; |
144 | 146 | $main_query_array[] = $_REQUEST['gd_posttype']; |
145 | 147 | |
146 | - } else |
|
147 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
148 | + } else { |
|
149 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
150 | + } |
|
148 | 151 | |
149 | 152 | $join = ", " . $table . " AS pd "; |
150 | 153 | |
@@ -309,8 +312,7 @@ discard block |
||
309 | 312 | |
310 | 313 | if (!empty($cat_content_info)) { |
311 | 314 | return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
312 | - } |
|
313 | - else { |
|
315 | + } else { |
|
314 | 316 | return '[{"totalcount":"0"}]'; |
315 | 317 | } |
316 | 318 | } |
317 | 319 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
11 | 11 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
12 | 12 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
13 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
13 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
14 | 14 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
15 | 15 | die; |
16 | 16 | } |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | global $wpdb, $plugin_prefix, $gd_session; |
31 | 31 | |
32 | 32 | if ($_REQUEST['m_id'] != '') { |
33 | - $pid = (int)$_REQUEST['m_id']; |
|
33 | + $pid = (int) $_REQUEST['m_id']; |
|
34 | 34 | } else { |
35 | 35 | echo __('No marker data found', 'geodirectory'); |
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
39 | 39 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) { |
40 | - $post = (object)$gd_ses_listing; |
|
40 | + $post = (object) $gd_ses_listing; |
|
41 | 41 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
42 | 42 | } else { |
43 | 43 | $geodir_post_type = get_post_type($pid); |
44 | 44 | |
45 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
45 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
46 | 46 | |
47 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid)); |
|
47 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid)); |
|
48 | 48 | |
49 | 49 | $postinfo = $wpdb->get_results($sql); |
50 | 50 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
87 | 87 | |
88 | 88 | $map_cat_ids_array = array('0'); |
89 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
89 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)"); |
|
90 | 90 | |
91 | 91 | |
92 | 92 | $field_default_cat = ''; |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
95 | 95 | |
96 | 96 | if (!empty($map_cat_arr)) { |
97 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
97 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category "; |
|
98 | 98 | |
99 | 99 | $map_cat_ids_array = explode(',', $map_cat_arr); |
100 | 100 | $cat_find_array = array(); |
101 | 101 | foreach ($map_cat_ids_array as $cat_id) { |
102 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
103 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
102 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
103 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
104 | 104 | $main_query_array[] = $cat_id; |
105 | 105 | } |
106 | 106 | |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | $field_default_cat = ''; |
112 | 112 | |
113 | 113 | if (!empty($cat_find_array)) |
114 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
114 | + $search .= "AND (".implode(' OR ', $cat_find_array).")"; |
|
115 | 115 | |
116 | 116 | $main_query_array = $map_cat_ids_array; |
117 | 117 | |
118 | 118 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
119 | 119 | $search .= " AND p.post_title LIKE %s"; |
120 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
120 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | |
140 | 140 | $gd_posttype = ''; |
141 | 141 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
142 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
142 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
143 | 143 | $gd_posttype = " AND p.post_type = %s"; |
144 | 144 | $main_query_array[] = $_REQUEST['gd_posttype']; |
145 | 145 | |
146 | 146 | } else |
147 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
147 | + $table = $plugin_prefix.'gd_place_detail'; |
|
148 | 148 | |
149 | - $join = ", " . $table . " AS pd "; |
|
149 | + $join = ", ".$table." AS pd "; |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Filter the SQL JOIN clause for the markers data |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $search = apply_filters('geodir_home_map_listing_where', $search); |
168 | 168 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
169 | - $cat_type = $post_type . 'category'; |
|
169 | + $cat_type = $post_type.'category'; |
|
170 | 170 | if ($post_type == 'gd_event') { |
171 | 171 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
172 | 172 | } else { |
173 | 173 | $event_select = ""; |
174 | 174 | } |
175 | 175 | |
176 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
176 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
177 | 177 | /** |
178 | 178 | * Filter the SQL SELECT clause to retrive fields data |
179 | 179 | * |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
195 | 195 | |
196 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
|
196 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array); |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Filter the SQL query to retrive markers data |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $e = 0; |
256 | 256 | foreach ($recurring_dates as $date) { |
257 | 257 | if (strtotime($date) >= $today) { |
258 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
258 | + $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($date)); |
|
259 | 259 | |
260 | 260 | $e++; |
261 | 261 | if ($e == 3) { // only show 3 event dates |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
270 | 270 | |
271 | 271 | if ($end_date != '' && strtotime($end_date) >= $today) { |
272 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
272 | + $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($start_date)).' -> '.date_i18n($geodir_date_format, strtotime($end_date)); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
285 | 285 | $title = str_replace($srcharr, $replarr, $post_title); |
286 | 286 | |
287 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}'; |
|
287 | + $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$catinfo_obj->default_category.'","i":"'.$icon.'"'.$mark_extra.'}'; |
|
288 | 288 | $post_ids[] = $catinfo_obj->post_id; |
289 | 289 | } |
290 | 290 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $totalcount = count(array_unique($post_ids)); |
309 | 309 | |
310 | 310 | if (!empty($cat_content_info)) { |
311 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
311 | + return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']'; |
|
312 | 312 | } |
313 | 313 | else { |
314 | 314 | return '[{"totalcount":"0"}]'; |
@@ -7,61 +7,61 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') { |
10 | - $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
11 | - $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
12 | - $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
13 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
14 | - echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
15 | - die; |
|
10 | + $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
11 | + $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
12 | + $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
13 | + $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
14 | + echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
15 | + die; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | // Send the content-type header with correct encoding |
19 | 19 | if (!defined('GD_TESTING_MODE')) { |
20 | - header("Content-type: text/javascript; charset=utf-8"); |
|
20 | + header("Content-type: text/javascript; charset=utf-8"); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories |
24 | - echo get_markers(); |
|
25 | - gd_die(); |
|
24 | + echo get_markers(); |
|
25 | + gd_die(); |
|
26 | 26 | } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html |
27 | - /** |
|
28 | - * @global object $wpdb WordPress Database object. |
|
29 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
30 | - * @global object $gd_session GeoDirectory Session object. |
|
31 | - */ |
|
32 | - global $wpdb, $plugin_prefix, $gd_session; |
|
33 | - |
|
34 | - if ($_REQUEST['m_id'] != '') { |
|
35 | - $pid = (int)$_REQUEST['m_id']; |
|
36 | - } else { |
|
37 | - echo __('No marker data found', 'geodirectory'); |
|
38 | - exit; |
|
39 | - } |
|
40 | - |
|
41 | - if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) { |
|
42 | - $post = (object)$gd_ses_listing; |
|
43 | - echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
44 | - } else { |
|
45 | - $geodir_post_type = get_post_type($pid); |
|
46 | - |
|
47 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
48 | - |
|
49 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid)); |
|
50 | - |
|
51 | - $postinfo = $wpdb->get_results($sql); |
|
52 | - |
|
53 | - $data_arr = array(); |
|
54 | - |
|
55 | - if ($postinfo) { |
|
56 | - $srcharr = array("'", "/", "-", '"', '\\'); |
|
57 | - $replarr = array("′", "⁄", "–", "“", ''); |
|
58 | - |
|
59 | - foreach ($postinfo as $postinfo_obj) { |
|
60 | - echo geodir_get_infowindow_html($postinfo_obj); |
|
61 | - } |
|
62 | - } |
|
63 | - } |
|
64 | - exit; |
|
27 | + /** |
|
28 | + * @global object $wpdb WordPress Database object. |
|
29 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
30 | + * @global object $gd_session GeoDirectory Session object. |
|
31 | + */ |
|
32 | + global $wpdb, $plugin_prefix, $gd_session; |
|
33 | + |
|
34 | + if ($_REQUEST['m_id'] != '') { |
|
35 | + $pid = (int)$_REQUEST['m_id']; |
|
36 | + } else { |
|
37 | + echo __('No marker data found', 'geodirectory'); |
|
38 | + exit; |
|
39 | + } |
|
40 | + |
|
41 | + if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) { |
|
42 | + $post = (object)$gd_ses_listing; |
|
43 | + echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
44 | + } else { |
|
45 | + $geodir_post_type = get_post_type($pid); |
|
46 | + |
|
47 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
48 | + |
|
49 | + $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid)); |
|
50 | + |
|
51 | + $postinfo = $wpdb->get_results($sql); |
|
52 | + |
|
53 | + $data_arr = array(); |
|
54 | + |
|
55 | + if ($postinfo) { |
|
56 | + $srcharr = array("'", "/", "-", '"', '\\'); |
|
57 | + $replarr = array("′", "⁄", "–", "“", ''); |
|
58 | + |
|
59 | + foreach ($postinfo as $postinfo_obj) { |
|
60 | + echo geodir_get_infowindow_html($postinfo_obj); |
|
61 | + } |
|
62 | + } |
|
63 | + } |
|
64 | + exit; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -77,80 +77,80 @@ discard block |
||
77 | 77 | * @return string |
78 | 78 | */ |
79 | 79 | function get_markers() { |
80 | - global $wpdb, $plugin_prefix, $geodir_cat_icons; |
|
80 | + global $wpdb, $plugin_prefix, $geodir_cat_icons; |
|
81 | 81 | |
82 | - $search = ''; |
|
83 | - $main_query_array; |
|
82 | + $search = ''; |
|
83 | + $main_query_array; |
|
84 | 84 | |
85 | - $srcharr = array("'", "/", "-", '"', '\\'); |
|
86 | - $replarr = array("′", "⁄", "–", "“", ''); |
|
85 | + $srcharr = array("'", "/", "-", '"', '\\'); |
|
86 | + $replarr = array("′", "⁄", "–", "“", ''); |
|
87 | 87 | |
88 | - $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
88 | + $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
89 | 89 | |
90 | - $map_cat_ids_array = array('0'); |
|
91 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
90 | + $map_cat_ids_array = array('0'); |
|
91 | + $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)"); |
|
92 | 92 | |
93 | 93 | |
94 | - $field_default_cat = ''; |
|
95 | - if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') { |
|
96 | - $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
94 | + $field_default_cat = ''; |
|
95 | + if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') { |
|
96 | + $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
97 | 97 | |
98 | - if (!empty($map_cat_arr)) { |
|
99 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
98 | + if (!empty($map_cat_arr)) { |
|
99 | + $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category "; |
|
100 | 100 | |
101 | - $map_cat_ids_array = explode(',', $map_cat_arr); |
|
102 | - $cat_find_array = array(); |
|
103 | - foreach ($map_cat_ids_array as $cat_id) { |
|
104 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
105 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
106 | - $main_query_array[] = $cat_id; |
|
107 | - } |
|
101 | + $map_cat_ids_array = explode(',', $map_cat_arr); |
|
102 | + $cat_find_array = array(); |
|
103 | + foreach ($map_cat_ids_array as $cat_id) { |
|
104 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
105 | + $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
106 | + $main_query_array[] = $cat_id; |
|
107 | + } |
|
108 | 108 | |
109 | - } |
|
110 | - } |
|
109 | + } |
|
110 | + } |
|
111 | 111 | |
112 | - if (!empty($field_default_cat)) |
|
113 | - $field_default_cat = ''; |
|
112 | + if (!empty($field_default_cat)) |
|
113 | + $field_default_cat = ''; |
|
114 | 114 | |
115 | - if (!empty($cat_find_array)) |
|
116 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
115 | + if (!empty($cat_find_array)) |
|
116 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
117 | 117 | |
118 | - $main_query_array = $map_cat_ids_array; |
|
118 | + $main_query_array = $map_cat_ids_array; |
|
119 | 119 | |
120 | - if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
|
121 | - $search .= " AND p.post_title LIKE %s"; |
|
122 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Filter the marker query search SQL, values are replaces with %s or %d. |
|
127 | - * |
|
128 | - * @since 1.5.3 |
|
129 | - * |
|
130 | - * @param string $search The SQL query for search/where. |
|
131 | - */ |
|
132 | - $search = apply_filters('geodir_marker_search', $search); |
|
133 | - /** |
|
134 | - * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
135 | - * |
|
136 | - * @since 1.5.3 |
|
137 | - * |
|
138 | - * @param array $main_query_array The SQL query values for search/where. |
|
139 | - */ |
|
140 | - $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array); |
|
141 | - |
|
142 | - $gd_posttype = ''; |
|
143 | - if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
|
144 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
145 | - $gd_posttype = " AND p.post_type = %s"; |
|
146 | - $main_query_array[] = $_REQUEST['gd_posttype']; |
|
147 | - |
|
148 | - } else |
|
149 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
150 | - |
|
151 | - $join = ", " . $table . " AS pd "; |
|
152 | - |
|
153 | - /** |
|
120 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) { |
|
121 | + $search .= " AND p.post_title LIKE %s"; |
|
122 | + $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Filter the marker query search SQL, values are replaces with %s or %d. |
|
127 | + * |
|
128 | + * @since 1.5.3 |
|
129 | + * |
|
130 | + * @param string $search The SQL query for search/where. |
|
131 | + */ |
|
132 | + $search = apply_filters('geodir_marker_search', $search); |
|
133 | + /** |
|
134 | + * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
135 | + * |
|
136 | + * @since 1.5.3 |
|
137 | + * |
|
138 | + * @param array $main_query_array The SQL query values for search/where. |
|
139 | + */ |
|
140 | + $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array); |
|
141 | + |
|
142 | + $gd_posttype = ''; |
|
143 | + if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') { |
|
144 | + $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
145 | + $gd_posttype = " AND p.post_type = %s"; |
|
146 | + $main_query_array[] = $_REQUEST['gd_posttype']; |
|
147 | + |
|
148 | + } else |
|
149 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
150 | + |
|
151 | + $join = ", " . $table . " AS pd "; |
|
152 | + |
|
153 | + /** |
|
154 | 154 | * Filter the SQL JOIN clause for the markers data |
155 | 155 | * |
156 | 156 | * @since 1.0.0 |
@@ -167,16 +167,16 @@ discard block |
||
167 | 167 | * @param string $search Row of searched fields to use in WHERE clause. |
168 | 168 | */ |
169 | 169 | $search = apply_filters('geodir_home_map_listing_where', $search); |
170 | - $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
|
171 | - $cat_type = $post_type . 'category'; |
|
172 | - if ($post_type == 'gd_event') { |
|
173 | - $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
174 | - } else { |
|
175 | - $event_select = ""; |
|
176 | - } |
|
177 | - |
|
178 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
179 | - /** |
|
170 | + $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
|
171 | + $cat_type = $post_type . 'category'; |
|
172 | + if ($post_type == 'gd_event') { |
|
173 | + $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
174 | + } else { |
|
175 | + $event_select = ""; |
|
176 | + } |
|
177 | + |
|
178 | + $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
179 | + /** |
|
180 | 180 | * Filter the SQL SELECT clause to retrive fields data |
181 | 181 | * |
182 | 182 | * @since 1.0.0 |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
197 | 197 | |
198 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
|
198 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
|
199 | 199 | |
200 | 200 | /** |
201 | 201 | * Filter the SQL query to retrive markers data |
@@ -207,112 +207,112 @@ discard block |
||
207 | 207 | */ |
208 | 208 | $catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search); |
209 | 209 | |
210 | - $catinfo = $wpdb->get_results($catsql); |
|
210 | + $catinfo = $wpdb->get_results($catsql); |
|
211 | 211 | |
212 | - $cat_content_info = array(); |
|
213 | - $content_data = array(); |
|
214 | - $post_ids = array(); |
|
215 | - |
|
216 | - /** |
|
217 | - * Called before marker data is processed into JSON. |
|
218 | - * |
|
219 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
220 | - * |
|
221 | - * @since 1.5.3 |
|
222 | - * @param object $catinfo The posts object containing all marker data. |
|
223 | - * @see 'geodir_after_marker_post_process' |
|
224 | - */ |
|
225 | - $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo); |
|
226 | - |
|
227 | - /** |
|
228 | - * Called before marker data is processed into JSON. |
|
229 | - * |
|
230 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
231 | - * |
|
232 | - * @since 1.4.9 |
|
233 | - * @param object $catinfo The posts object containing all marker data. |
|
234 | - * @see 'geodir_after_marker_post_process' |
|
235 | - */ |
|
236 | - do_action('geodir_before_marker_post_process_action', $catinfo); |
|
237 | - |
|
238 | - // Sort any posts into a ajax array |
|
239 | - if (!empty($catinfo)) { |
|
240 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
241 | - global $geodir_date_format; |
|
242 | - |
|
243 | - $today = strtotime(date_i18n('Y-m-d')); |
|
212 | + $cat_content_info = array(); |
|
213 | + $content_data = array(); |
|
214 | + $post_ids = array(); |
|
215 | + |
|
216 | + /** |
|
217 | + * Called before marker data is processed into JSON. |
|
218 | + * |
|
219 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
220 | + * |
|
221 | + * @since 1.5.3 |
|
222 | + * @param object $catinfo The posts object containing all marker data. |
|
223 | + * @see 'geodir_after_marker_post_process' |
|
224 | + */ |
|
225 | + $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo); |
|
226 | + |
|
227 | + /** |
|
228 | + * Called before marker data is processed into JSON. |
|
229 | + * |
|
230 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
231 | + * |
|
232 | + * @since 1.4.9 |
|
233 | + * @param object $catinfo The posts object containing all marker data. |
|
234 | + * @see 'geodir_after_marker_post_process' |
|
235 | + */ |
|
236 | + do_action('geodir_before_marker_post_process_action', $catinfo); |
|
237 | + |
|
238 | + // Sort any posts into a ajax array |
|
239 | + if (!empty($catinfo)) { |
|
240 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
241 | + global $geodir_date_format; |
|
242 | + |
|
243 | + $today = strtotime(date_i18n('Y-m-d')); |
|
244 | 244 | |
245 | - foreach ($catinfo as $catinfo_obj) { |
|
246 | - $post_title = $catinfo_obj->post_title; |
|
245 | + foreach ($catinfo as $catinfo_obj) { |
|
246 | + $post_title = $catinfo_obj->post_title; |
|
247 | 247 | |
248 | - if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) { |
|
249 | - $event_dates = ''; |
|
250 | - $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
248 | + if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) { |
|
249 | + $event_dates = ''; |
|
250 | + $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
251 | 251 | |
252 | - $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
253 | - if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) { |
|
254 | - $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
252 | + $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
253 | + if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) { |
|
254 | + $recurring_dates = explode(',', $recurring_data['event_recurring_dates']); |
|
255 | 255 | |
256 | - if (!empty($recurring_dates)) { |
|
257 | - $e = 0; |
|
258 | - foreach ($recurring_dates as $date) { |
|
259 | - if (strtotime($date) >= $today) { |
|
260 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
256 | + if (!empty($recurring_dates)) { |
|
257 | + $e = 0; |
|
258 | + foreach ($recurring_dates as $date) { |
|
259 | + if (strtotime($date) >= $today) { |
|
260 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
261 | 261 | |
262 | - $e++; |
|
263 | - if ($e == 3) { // only show 3 event dates |
|
264 | - break; |
|
265 | - } |
|
266 | - } |
|
267 | - } |
|
268 | - } |
|
269 | - } else { |
|
270 | - $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : ''; |
|
271 | - $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
|
262 | + $e++; |
|
263 | + if ($e == 3) { // only show 3 event dates |
|
264 | + break; |
|
265 | + } |
|
266 | + } |
|
267 | + } |
|
268 | + } |
|
269 | + } else { |
|
270 | + $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : ''; |
|
271 | + $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
|
272 | 272 | |
273 | - if ($end_date != '' && strtotime($end_date) >= $today) { |
|
274 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
275 | - } |
|
276 | - } |
|
277 | - |
|
278 | - if (empty($event_dates)) { |
|
279 | - continue; |
|
280 | - } |
|
273 | + if ($end_date != '' && strtotime($end_date) >= $today) { |
|
274 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
275 | + } |
|
276 | + } |
|
277 | + |
|
278 | + if (empty($event_dates)) { |
|
279 | + continue; |
|
280 | + } |
|
281 | 281 | |
282 | - $post_title .= $event_dates; |
|
283 | - } |
|
284 | - |
|
285 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : ''; |
|
286 | - $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
287 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
288 | - |
|
289 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}'; |
|
290 | - $post_ids[] = $catinfo_obj->post_id; |
|
291 | - } |
|
292 | - } |
|
293 | - |
|
294 | - /** |
|
295 | - * Called after marker data is processed into JSON. |
|
296 | - * |
|
297 | - * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
298 | - * |
|
299 | - * @since 1.4.9 |
|
300 | - * @param array $content_data The array containing all markers in JSON format. |
|
301 | - * @param object $catinfo The posts object containing all marker data. |
|
302 | - * @see 'geodir_before_marker_post_process' |
|
303 | - */ |
|
304 | - do_action('geodir_after_marker_post_process', $content_data, $catinfo); |
|
305 | - |
|
306 | - if (!empty($content_data)) { |
|
307 | - $cat_content_info[] = implode(',', $content_data); |
|
308 | - } |
|
309 | - |
|
310 | - $totalcount = count(array_unique($post_ids)); |
|
311 | - |
|
312 | - if (!empty($cat_content_info)) { |
|
313 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
314 | - } |
|
315 | - else { |
|
316 | - return '[{"totalcount":"0"}]'; |
|
317 | - } |
|
282 | + $post_title .= $event_dates; |
|
283 | + } |
|
284 | + |
|
285 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : ''; |
|
286 | + $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
287 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
288 | + |
|
289 | + $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}'; |
|
290 | + $post_ids[] = $catinfo_obj->post_id; |
|
291 | + } |
|
292 | + } |
|
293 | + |
|
294 | + /** |
|
295 | + * Called after marker data is processed into JSON. |
|
296 | + * |
|
297 | + * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
298 | + * |
|
299 | + * @since 1.4.9 |
|
300 | + * @param array $content_data The array containing all markers in JSON format. |
|
301 | + * @param object $catinfo The posts object containing all marker data. |
|
302 | + * @see 'geodir_before_marker_post_process' |
|
303 | + */ |
|
304 | + do_action('geodir_after_marker_post_process', $content_data, $catinfo); |
|
305 | + |
|
306 | + if (!empty($content_data)) { |
|
307 | + $cat_content_info[] = implode(',', $content_data); |
|
308 | + } |
|
309 | + |
|
310 | + $totalcount = count(array_unique($post_ids)); |
|
311 | + |
|
312 | + if (!empty($cat_content_info)) { |
|
313 | + return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']'; |
|
314 | + } |
|
315 | + else { |
|
316 | + return '[{"totalcount":"0"}]'; |
|
317 | + } |
|
318 | 318 | } |
319 | 319 | \ No newline at end of file |
@@ -45,9 +45,10 @@ discard block |
||
45 | 45 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
46 | 46 | if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') { |
47 | 47 | $mapzoom = 4; |
48 | - if (isset($_REQUEST['add_hood'])) |
|
49 | - $mapzoom = 10; |
|
50 | -} |
|
48 | + if (isset($_REQUEST['add_hood'])) { |
|
49 | + $mapzoom = 10; |
|
50 | + } |
|
51 | + } |
|
51 | 52 | |
52 | 53 | /** |
53 | 54 | * Filter the auto change address fields values |
@@ -641,8 +642,9 @@ discard block |
||
641 | 642 | </script> |
642 | 643 | <?php |
643 | 644 | $set_button_class = 'geodir_button'; |
644 | -if (is_admin()) |
|
645 | - $set_button_class = 'button-primary'; |
|
645 | +if (is_admin()) { |
|
646 | + $set_button_class = 'button-primary'; |
|
647 | +} |
|
646 | 648 | ?> |
647 | 649 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" |
648 | 650 | value="<?php _e($map_title, 'geodirectory'); ?>" style="float:none;"/> |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | $defaultcity = isset($default_location->city) ? $default_location->city : ''; |
35 | 35 | $lat_lng_blank = false; |
36 | 36 | if ($lat == '' && $lng == '') { |
37 | - $lat_lng_blank = true; |
|
38 | - $city = $defaultcity; |
|
39 | - $region = isset($default_location->region) ? $default_location->region : ''; |
|
40 | - $country = isset($default_location->country) ? $default_location->country : ''; |
|
41 | - $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
42 | - $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
37 | + $lat_lng_blank = true; |
|
38 | + $city = $defaultcity; |
|
39 | + $region = isset($default_location->region) ? $default_location->region : ''; |
|
40 | + $country = isset($default_location->country) ? $default_location->country : ''; |
|
41 | + $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
42 | + $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
43 | 43 | } |
44 | 44 | $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
45 | 45 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
46 | 46 | if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') { |
47 | - $mapzoom = 4; |
|
48 | - if (isset($_REQUEST['add_hood'])) |
|
49 | - $mapzoom = 10; |
|
47 | + $mapzoom = 4; |
|
48 | + if (isset($_REQUEST['add_hood'])) |
|
49 | + $mapzoom = 10; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * Fires at the start of the add javascript on the add lsitings map. |
66 | 66 | * |
67 | 67 | * @since 1.0.0 |
68 | - * @param string $prefix The prefix for all elements. |
|
68 | + * @param string $prefix The prefix for all elements. |
|
69 | 69 | */ |
70 | 70 | do_action('geodir_add_listing_js_start', $prefix); |
71 | 71 | ?> |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | * @param string $prefix Identifier used as a prefix for field name |
413 | 413 | */ |
414 | 414 | do_action('geodir_update_marker_address', $prefix); |
415 | - echo $updateMarkerAddress = ob_get_clean(); |
|
416 | - ?> |
|
415 | + echo $updateMarkerAddress = ob_get_clean(); |
|
416 | + ?> |
|
417 | 417 | } |
418 | 418 | function geodir_codeAddress(set_on_map) { |
419 | 419 | var address = jQuery('#<?php echo $prefix.'address';?>').val(); |
@@ -440,9 +440,9 @@ discard block |
||
440 | 440 | } |
441 | 441 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
442 | 442 | <?php ob_start(); |
443 | - $defaultregion =isset($default_location->region) ? $default_location->region : ''; |
|
444 | - $defaultcountry =isset($default_location->country) ? $default_location->country : ''; |
|
445 | - ?> |
|
443 | + $defaultregion =isset($default_location->region) ? $default_location->region : ''; |
|
444 | + $defaultcountry =isset($default_location->country) ? $default_location->country : ''; |
|
445 | + ?> |
|
446 | 446 | if (set_on_map && is_restrict) { |
447 | 447 | if (zip != '' && address != '') { |
448 | 448 | address = address + ',' + zip; |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | if (typeof address === 'undefined') |
452 | 452 | address = ''; |
453 | 453 | <?php |
454 | - if(is_admin() && isset($_REQUEST['tab'])){?> |
|
454 | + if(is_admin() && isset($_REQUEST['tab'])){?> |
|
455 | 455 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') { |
456 | 456 | address = ''; |
457 | 457 | } |
458 | 458 | <?php |
459 | - }?> |
|
459 | + }?> |
|
460 | 460 | |
461 | 461 | if (ISO2 == 'GB') { |
462 | 462 | address = address + ',' + city + ',' + country + ',' + zip; // UK is funny with regions |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @param string $codeAddress Row of address to use in google map. |
474 | 474 | */ |
475 | - echo apply_filters('geodir_codeaddress', $codeAddress); |
|
476 | - ?> |
|
475 | + echo apply_filters('geodir_codeaddress', $codeAddress); |
|
476 | + ?> |
|
477 | 477 | geocoder.geocode({'address': address, 'country': ISO2}, |
478 | 478 | function (results, status) { |
479 | 479 | //console.log(results); |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | google.maps.event.addDomListener(maxMap, 'click', gdMaxMap); |
580 | 580 | |
581 | 581 | <?php |
582 | - if($is_map_restrict) |
|
583 | - { |
|
584 | - ?> |
|
582 | + if($is_map_restrict) |
|
583 | + { |
|
584 | + ?> |
|
585 | 585 | var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>'; |
586 | 586 | geocoder.geocode({'address': CITY_ADDRESS}, |
587 | 587 | function (results, status) { |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | <?php |
643 | 643 | $set_button_class = 'geodir_button'; |
644 | 644 | if (is_admin()) |
645 | - $set_button_class = 'button-primary'; |
|
645 | + $set_button_class = 'button-primary'; |
|
646 | 646 | ?> |
647 | 647 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" |
648 | 648 | value="<?php _e($map_title, 'geodirectory'); ?>" style="float:none;"/> |
@@ -71,16 +71,16 @@ discard block |
||
71 | 71 | ?> |
72 | 72 | user_address = false; |
73 | 73 | |
74 | - jQuery('#<?php echo $prefix.'address';?>').keypress(function () { |
|
74 | + jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () { |
|
75 | 75 | user_address = true; |
76 | 76 | }); |
77 | 77 | |
78 | 78 | baseMarker = ''; |
79 | 79 | geocoder = ''; |
80 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
81 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
82 | - <?php if($lat_lng_blank){$lat='';$lng='';}?> |
|
83 | - var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>; |
|
80 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
81 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
82 | + <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?> |
|
83 | + var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>; |
|
84 | 84 | var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>; |
85 | 85 | var oldstr_address; |
86 | 86 | var oldstr_zip; |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | */ |
334 | 334 | do_action('geodir_add_listing_geocode_js_vars'); |
335 | 335 | ?> |
336 | - <?php if($is_map_restrict){ ?> |
|
337 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') { |
|
338 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>'); |
|
339 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
336 | + <?php if ($is_map_restrict) { ?> |
|
337 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') { |
|
338 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>'); |
|
339 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
340 | 340 | jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>')); |
341 | 341 | baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>')); |
342 | 342 | updateMarkerPosition(baseMarker.getPosition()); |
@@ -345,62 +345,62 @@ discard block |
||
345 | 345 | <?php } ?> |
346 | 346 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
347 | 347 | } else { |
348 | - updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>'); |
|
348 | + updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>'); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | |
352 | 352 | } |
353 | 353 | function centerMap() { |
354 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
354 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
355 | 355 | jQuery.goMap.map.panTo(baseMarker.getPosition()); |
356 | 356 | } |
357 | 357 | function centerMarker() { |
358 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
358 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
359 | 359 | var center = jQuery.goMap.map.getCenter(); |
360 | 360 | baseMarker.setPosition(center); |
361 | 361 | } |
362 | 362 | function updateMapZoom(zoom) { |
363 | - jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom); |
|
363 | + jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom); |
|
364 | 364 | } |
365 | 365 | function updateMarkerPosition(markerlatLng) { |
366 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
366 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
367 | 367 | //$.goMap.setMap({latitude:markerlatLng.lat(), longitude:markerlatLng.lng()}); |
368 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat()); |
|
369 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng()); |
|
368 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat()); |
|
369 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng()); |
|
370 | 370 | } |
371 | 371 | function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) { |
372 | - var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>'; |
|
373 | - <?php ob_start();?> |
|
374 | - var old_country = jQuery("#<?php echo $prefix.'country';?>").val(); |
|
375 | - var old_region = jQuery("#<?php echo $prefix.'region';?>").val(); |
|
372 | + var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>'; |
|
373 | + <?php ob_start(); ?> |
|
374 | + var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val(); |
|
375 | + var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val(); |
|
376 | 376 | //if (getAddress){ |
377 | - if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') { |
|
378 | - jQuery("#<?php echo $prefix.'address';?>").val(getAddress); |
|
377 | + if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') { |
|
378 | + jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress); |
|
379 | 379 | } |
380 | 380 | if (getAddress) { |
381 | 381 | oldstr_address = getAddress; |
382 | 382 | } |
383 | 383 | // } |
384 | 384 | //if (getZip){ |
385 | - jQuery("#<?php echo $prefix.'zip';?>").val(getZip); |
|
385 | + jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip); |
|
386 | 386 | if (getZip) { |
387 | 387 | oldstr_zip = getZip; |
388 | 388 | } |
389 | 389 | //} |
390 | 390 | if (set_map_val_in_fields) { |
391 | 391 | if (getCountry) { |
392 | - jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true); |
|
393 | - jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated"); |
|
392 | + jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true); |
|
393 | + jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated"); |
|
394 | 394 | |
395 | 395 | } |
396 | 396 | if (getState) { |
397 | - if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) { |
|
398 | - jQuery("#<?php echo $prefix.'region';?>").val(getState); |
|
397 | + if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) { |
|
398 | + jQuery("#<?php echo $prefix.'region'; ?>").val(getState); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | if (getCity) { |
402 | - if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) { |
|
403 | - jQuery("#<?php echo $prefix.'city';?>").val(getCity); |
|
402 | + if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) { |
|
403 | + jQuery("#<?php echo $prefix.'city'; ?>").val(getCity); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | } |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | ?> |
417 | 417 | } |
418 | 418 | function geodir_codeAddress(set_on_map) { |
419 | - var address = jQuery('#<?php echo $prefix.'address';?>').val(); |
|
420 | - var zip = jQuery('#<?php echo $prefix.'zip';?>').val(); |
|
421 | - var city = jQuery('#<?php echo $prefix.'city';?>').val(); |
|
422 | - var region = jQuery('#<?php echo $prefix.'region';?>').val(); |
|
423 | - var country = jQuery('#<?php echo $prefix.'country';?>').val(); |
|
424 | - var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected'); |
|
419 | + var address = jQuery('#<?php echo $prefix.'address'; ?>').val(); |
|
420 | + var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val(); |
|
421 | + var city = jQuery('#<?php echo $prefix.'city'; ?>').val(); |
|
422 | + var region = jQuery('#<?php echo $prefix.'region'; ?>').val(); |
|
423 | + var country = jQuery('#<?php echo $prefix.'country'; ?>').val(); |
|
424 | + var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected'); |
|
425 | 425 | var ISO2 = country_selected.data('country_code'); |
426 | 426 | if (ISO2 == '--') { |
427 | 427 | ISO2 = ''; |
@@ -430,18 +430,18 @@ discard block |
||
430 | 430 | zip = ''; |
431 | 431 | } |
432 | 432 | if (typeof city == "undefined") { |
433 | - city = '<?php echo addslashes_gpc($city);?>'; |
|
433 | + city = '<?php echo addslashes_gpc($city); ?>'; |
|
434 | 434 | } |
435 | 435 | if (typeof region == "undefined") { |
436 | - region = '<?php echo addslashes_gpc($region);?>'; |
|
436 | + region = '<?php echo addslashes_gpc($region); ?>'; |
|
437 | 437 | } |
438 | 438 | if (typeof country == "undefined") { |
439 | - country = '<?php echo addslashes_gpc($country);?>'; |
|
439 | + country = '<?php echo addslashes_gpc($country); ?>'; |
|
440 | 440 | } |
441 | 441 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
442 | 442 | <?php ob_start(); |
443 | - $defaultregion =isset($default_location->region) ? $default_location->region : ''; |
|
444 | - $defaultcountry =isset($default_location->country) ? $default_location->country : ''; |
|
443 | + $defaultregion = isset($default_location->region) ? $default_location->region : ''; |
|
444 | + $defaultcountry = isset($default_location->country) ? $default_location->country : ''; |
|
445 | 445 | ?> |
446 | 446 | if (set_on_map && is_restrict) { |
447 | 447 | if (zip != '' && address != '') { |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | if (typeof address === 'undefined') |
452 | 452 | address = ''; |
453 | 453 | <?php |
454 | - if(is_admin() && isset($_REQUEST['tab'])){?> |
|
454 | + if (is_admin() && isset($_REQUEST['tab'])) {?> |
|
455 | 455 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') { |
456 | 456 | address = ''; |
457 | 457 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | function (results, status) { |
479 | 479 | //console.log(results); |
480 | 480 | console.log(status); |
481 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
481 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
482 | 482 | if (status == google.maps.GeocoderStatus.OK) { |
483 | 483 | baseMarker.setPosition(results[0].geometry.location); |
484 | 484 | jQuery.goMap.map.setCenter(results[0].geometry.location); |
@@ -496,20 +496,20 @@ discard block |
||
496 | 496 | geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2}); |
497 | 497 | //} |
498 | 498 | } else { |
499 | - alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status); |
|
499 | + alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status); |
|
500 | 500 | } |
501 | 501 | }); |
502 | 502 | } |
503 | 503 | function gdMaxMap() { |
504 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
504 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
505 | 505 | |
506 | - jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen'); |
|
506 | + jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen'); |
|
507 | 507 | jQuery('.map_category').toggleClass('map_category_fullscreen'); |
508 | - jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen'); |
|
508 | + jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen'); |
|
509 | 509 | jQuery('body').toggleClass('body_fullscreen'); |
510 | - jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen'); |
|
511 | - jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen'); |
|
512 | - jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen'); |
|
510 | + jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen'); |
|
511 | + jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen'); |
|
512 | + jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen'); |
|
513 | 513 | jQuery('.TopLeft').toggleClass('TopLeft_fullscreen'); |
514 | 514 | window.setTimeout(function () { |
515 | 515 | //var center = $.goMap.getCenter(); |
@@ -518,22 +518,22 @@ discard block |
||
518 | 518 | }, 100); |
519 | 519 | } |
520 | 520 | jQuery(function ($) { |
521 | - $("#<?php echo $prefix.'map';?>").goMap({ |
|
522 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
523 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
524 | - zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT, |
|
521 | + $("#<?php echo $prefix.'map'; ?>").goMap({ |
|
522 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
523 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
524 | + zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT, |
|
525 | 525 | maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN |
526 | 526 | <?php /*?>maptype: '<?php echo ($mapview) ? $mapview : 'ROADMAP';?>', <?php */?> |
527 | 527 | streetViewControl: true, |
528 | - <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?> |
|
528 | + <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?> |
|
529 | 529 | }); |
530 | 530 | geocoder = new google.maps.Geocoder(); |
531 | 531 | |
532 | 532 | baseMarker = $.goMap.createMarker({ |
533 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
534 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
533 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
534 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
535 | 535 | id: 'baseMarker', |
536 | - icon: '<?php echo get_option('geodir_default_marker_icon');?>', |
|
536 | + icon: '<?php echo get_option('geodir_default_marker_icon'); ?>', |
|
537 | 537 | <?php /*?>icon: { |
538 | 538 | image: new google.maps.MarkerImage ( |
539 | 539 | '<?php echo get_option('geodir_default_marker_icon');?>', |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | },<?php */?> |
544 | 544 | draggable: true |
545 | 545 | }); |
546 | - $("#<?php echo $prefix;?>set_address_button").click(function () { |
|
546 | + $("#<?php echo $prefix; ?>set_address_button").click(function () { |
|
547 | 547 | var set_on_map = true; |
548 | 548 | geodir_codeAddress(set_on_map); |
549 | 549 | }); |
@@ -558,14 +558,14 @@ discard block |
||
558 | 558 | google.maps.event.addListener(baseMarker, 'dragend', function () { |
559 | 559 | // updateMarkerStatus('Drag ended'); |
560 | 560 | centerMap(); |
561 | - <?php if($auto_change_address_fields_pin_move){?> |
|
561 | + <?php if ($auto_change_address_fields_pin_move) {?> |
|
562 | 562 | geocodePosition(baseMarker.getPosition()); |
563 | 563 | <?php }?> |
564 | 564 | updateMarkerPosition(baseMarker.getPosition()); |
565 | 565 | }); |
566 | 566 | google.maps.event.addListener($.goMap.map, 'dragend', function () { |
567 | 567 | // updateMarkerStatus('Drag ended'); |
568 | - <?php if($auto_change_address_fields_pin_move){?> |
|
568 | + <?php if ($auto_change_address_fields_pin_move) {?> |
|
569 | 569 | geocodePosition(baseMarker.getPosition()); |
570 | 570 | <?php }?> |
571 | 571 | centerMarker(); |
@@ -575,17 +575,17 @@ discard block |
||
575 | 575 | updateMapZoom($.goMap.map.zoom); |
576 | 576 | }); |
577 | 577 | |
578 | - var maxMap = document.getElementById('<?php echo $prefix;?>triggermap'); |
|
578 | + var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap'); |
|
579 | 579 | google.maps.event.addDomListener(maxMap, 'click', gdMaxMap); |
580 | 580 | |
581 | 581 | <?php |
582 | - if($is_map_restrict) |
|
582 | + if ($is_map_restrict) |
|
583 | 583 | { |
584 | 584 | ?> |
585 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>'; |
|
585 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>'; |
|
586 | 586 | geocoder.geocode({'address': CITY_ADDRESS}, |
587 | 587 | function (results, status) { |
588 | - $("#<?php echo $prefix.'map';?>").goMap(); |
|
588 | + $("#<?php echo $prefix.'map'; ?>").goMap(); |
|
589 | 589 | if (status == google.maps.GeocoderStatus.OK) { |
590 | 590 | // Bounds for North America |
591 | 591 | var bound_lat_lng = String(results[0].geometry.bounds); |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3]) |
597 | 597 | ); |
598 | 598 | } else { |
599 | - alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status); |
|
599 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status); |
|
600 | 600 | } |
601 | 601 | }); |
602 | 602 | <?php }?> |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | });<?php */?> |
634 | 634 | // Limit the zoom level |
635 | 635 | google.maps.event.addListener($.goMap.map, 'zoom_changed', function () { |
636 | - $("#<?php echo $prefix.'map';?>").goMap(); |
|
636 | + $("#<?php echo $prefix.'map'; ?>").goMap(); |
|
637 | 637 | if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel); |
638 | 638 | }); |
639 | 639 | }); |
@@ -651,10 +651,10 @@ discard block |
||
651 | 651 | <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span> |
652 | 652 | </div> |
653 | 653 | <div class="TopRight"></div> |
654 | - <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px"> |
|
654 | + <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px"> |
|
655 | 655 | <!-- new map start --> |
656 | 656 | <div class="iprelative"> |
657 | - <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" |
|
657 | + <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" |
|
658 | 658 | class="form_row clearfix"></div> |
659 | 659 | <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div> |
660 | 660 | <div id="<?php echo $prefix; ?>advmap_counter"></div> |
@@ -223,10 +223,11 @@ discard block |
||
223 | 223 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
224 | 224 | <?php } |
225 | 225 | |
226 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
227 | - $show_entire_cat_panel = "none"; |
|
228 | - else |
|
229 | - $show_entire_cat_panel = "''"; |
|
226 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) { |
|
227 | + $show_entire_cat_panel = "none"; |
|
228 | + } else { |
|
229 | + $show_entire_cat_panel = "''"; |
|
230 | + } |
|
230 | 231 | ?> |
231 | 232 | |
232 | 233 | <?php if ($geodir_map_options['enable_map_direction']) { ?> |
@@ -288,8 +289,9 @@ discard block |
||
288 | 289 | } |
289 | 290 | |
290 | 291 | $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt'); |
291 | - if (empty($geodir_default_map_search_pt)) |
|
292 | - $geodir_default_map_search_pt = 'gd_place'; |
|
292 | + if (empty($geodir_default_map_search_pt)) { |
|
293 | + $geodir_default_map_search_pt = 'gd_place'; |
|
294 | + } |
|
293 | 295 | |
294 | 296 | /** |
295 | 297 | * Filter the post type to retrive data for map |
@@ -67,77 +67,77 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function geodir_draw_map($map_args = array()) |
69 | 69 | { |
70 | - global $map_canvas_arr; |
|
71 | - $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
72 | - $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
73 | - |
|
74 | - $default_location = geodir_get_default_location(); |
|
75 | - |
|
76 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
77 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
78 | - $map_default_zoom = 12; |
|
79 | - // map options default values |
|
80 | - $width = 950; |
|
81 | - $height = 450; |
|
82 | - $child_collapse = '0'; |
|
83 | - $sticky = ''; |
|
84 | - $enable_cat_filters = false; |
|
85 | - $enable_text_search = false; |
|
86 | - $enable_post_type_filters = false; |
|
87 | - $enable_location_filters = false; |
|
88 | - $enable_jason_on_load = false; |
|
89 | - $enable_map_direction = false; |
|
90 | - $enable_marker_cluster = false; |
|
91 | - $enable_map_resize_button = false; |
|
92 | - $maptype = 'ROADMAP'; |
|
93 | - |
|
94 | - $geodir_map_options = array( |
|
95 | - 'width' => $width, |
|
96 | - 'height' => $height, |
|
97 | - 'child_collapse' => $child_collapse, |
|
98 | - 'sticky' => $sticky, |
|
99 | - 'enable_map_resize_button' => $enable_map_resize_button, |
|
100 | - 'enable_cat_filters' => $enable_cat_filters, |
|
101 | - 'enable_text_search' => $enable_text_search, |
|
102 | - 'enable_post_type_filters' => $enable_post_type_filters, |
|
103 | - 'enable_location_filters' => $enable_location_filters, |
|
104 | - 'enable_jason_on_load' => $enable_jason_on_load, |
|
105 | - 'enable_map_direction' => $enable_map_direction, |
|
106 | - 'enable_marker_cluster' => $enable_marker_cluster, |
|
107 | - 'ajax_url' => geodir_get_ajax_url(), |
|
108 | - 'map_canvas_name' => $map_canvas_name, |
|
109 | - 'inputText' => __('Title or Keyword', 'geodirectory'), |
|
110 | - 'latitude' => $map_default_lat, |
|
111 | - 'longitude' => $map_default_lng, |
|
112 | - 'zoom' => $map_default_zoom, |
|
113 | - 'scrollwheel' => true, |
|
114 | - 'streetViewControl' => true, |
|
115 | - 'maptype' => $maptype, |
|
116 | - 'showPreview' => '0', |
|
117 | - 'maxZoom' => 21, |
|
118 | - 'autozoom' => true, |
|
119 | - 'bubble_size' => 'small', |
|
120 | - 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
121 | - 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN') |
|
122 | - ); |
|
123 | - |
|
124 | - if (!empty($map_args)) { |
|
125 | - foreach ($map_args as $map_option_key => $map_option_value) { |
|
126 | - $geodir_map_options[$map_option_key] = $map_option_value; |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
|
131 | - } else { |
|
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
133 | - } |
|
134 | - |
|
135 | - if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
|
136 | - } else { |
|
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
70 | + global $map_canvas_arr; |
|
71 | + $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
72 | + $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
73 | + |
|
74 | + $default_location = geodir_get_default_location(); |
|
75 | + |
|
76 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
77 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
78 | + $map_default_zoom = 12; |
|
79 | + // map options default values |
|
80 | + $width = 950; |
|
81 | + $height = 450; |
|
82 | + $child_collapse = '0'; |
|
83 | + $sticky = ''; |
|
84 | + $enable_cat_filters = false; |
|
85 | + $enable_text_search = false; |
|
86 | + $enable_post_type_filters = false; |
|
87 | + $enable_location_filters = false; |
|
88 | + $enable_jason_on_load = false; |
|
89 | + $enable_map_direction = false; |
|
90 | + $enable_marker_cluster = false; |
|
91 | + $enable_map_resize_button = false; |
|
92 | + $maptype = 'ROADMAP'; |
|
93 | + |
|
94 | + $geodir_map_options = array( |
|
95 | + 'width' => $width, |
|
96 | + 'height' => $height, |
|
97 | + 'child_collapse' => $child_collapse, |
|
98 | + 'sticky' => $sticky, |
|
99 | + 'enable_map_resize_button' => $enable_map_resize_button, |
|
100 | + 'enable_cat_filters' => $enable_cat_filters, |
|
101 | + 'enable_text_search' => $enable_text_search, |
|
102 | + 'enable_post_type_filters' => $enable_post_type_filters, |
|
103 | + 'enable_location_filters' => $enable_location_filters, |
|
104 | + 'enable_jason_on_load' => $enable_jason_on_load, |
|
105 | + 'enable_map_direction' => $enable_map_direction, |
|
106 | + 'enable_marker_cluster' => $enable_marker_cluster, |
|
107 | + 'ajax_url' => geodir_get_ajax_url(), |
|
108 | + 'map_canvas_name' => $map_canvas_name, |
|
109 | + 'inputText' => __('Title or Keyword', 'geodirectory'), |
|
110 | + 'latitude' => $map_default_lat, |
|
111 | + 'longitude' => $map_default_lng, |
|
112 | + 'zoom' => $map_default_zoom, |
|
113 | + 'scrollwheel' => true, |
|
114 | + 'streetViewControl' => true, |
|
115 | + 'maptype' => $maptype, |
|
116 | + 'showPreview' => '0', |
|
117 | + 'maxZoom' => 21, |
|
118 | + 'autozoom' => true, |
|
119 | + 'bubble_size' => 'small', |
|
120 | + 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
121 | + 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN') |
|
122 | + ); |
|
123 | + |
|
124 | + if (!empty($map_args)) { |
|
125 | + foreach ($map_args as $map_option_key => $map_option_value) { |
|
126 | + $geodir_map_options[$map_option_key] = $map_option_value; |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
|
131 | + } else { |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
133 | + } |
|
134 | + |
|
135 | + if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
|
136 | + } else { |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | 141 | * Filter the options to use in google map. |
142 | 142 | * |
143 | 143 | * @since 1.0.0 |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | */ |
147 | 147 | $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options); |
148 | 148 | |
149 | - $map_canvas_arr[$map_canvas_name] = array(); |
|
149 | + $map_canvas_arr[$map_canvas_name] = array(); |
|
150 | 150 | |
151 | - /** |
|
151 | + /** |
|
152 | 152 | * Filter the post types to display data on map. |
153 | 153 | * |
154 | 154 | * @since 1.0.0 |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
168 | 168 | |
169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | - // Set default map options |
|
169 | + if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | + // Set default map options |
|
171 | 171 | |
172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
173 | 173 | |
174 | - wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
|
174 | + wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
|
175 | 175 | |
176 | - if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') { |
|
177 | - $map_width = '100%'; |
|
178 | - } else { |
|
179 | - $map_width = $geodir_map_options['width']; |
|
180 | - } |
|
176 | + if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') { |
|
177 | + $map_width = '100%'; |
|
178 | + } else { |
|
179 | + $map_width = $geodir_map_options['width']; |
|
180 | + } |
|
181 | 181 | |
182 | - /** |
|
182 | + /** |
|
183 | 183 | * Filter the width of map. |
184 | 184 | * |
185 | 185 | * @since 1.0.0 |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param int $map_width Width of map box, eg: gd_place. |
188 | 188 | */ |
189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width); |
190 | - ?> |
|
190 | + ?> |
|
191 | 191 | <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
192 | 192 | <div class="stick_trigger_container"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
@@ -219,15 +219,15 @@ discard block |
||
219 | 219 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
220 | 220 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
221 | 221 | <?php } else { |
222 | - ?> |
|
222 | + ?> |
|
223 | 223 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
224 | 224 | <?php } |
225 | 225 | |
226 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
227 | - $show_entire_cat_panel = "none"; |
|
228 | - else |
|
229 | - $show_entire_cat_panel = "''"; |
|
230 | - ?> |
|
226 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
227 | + $show_entire_cat_panel = "none"; |
|
228 | + else |
|
229 | + $show_entire_cat_panel = "''"; |
|
230 | + ?> |
|
231 | 231 | |
232 | 232 | <?php if ($geodir_map_options['enable_map_direction']) { ?> |
233 | 233 | |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')"> |
279 | 279 | <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option> |
280 | 280 | <option <?php if (get_option('geodir_search_dist_1') == 'km') { |
281 | - echo 'selected="selected"'; |
|
282 | - } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option> |
|
281 | + echo 'selected="selected"'; |
|
282 | + } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option> |
|
283 | 283 | </select> |
284 | 284 | </div> |
285 | 285 | |
@@ -302,13 +302,13 @@ discard block |
||
302 | 302 | ?> |
303 | 303 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
304 | 304 | <?php |
305 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
306 | - $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
|
305 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
306 | + $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
|
307 | 307 | $map_cat_class = ''; |
308 | 308 | if ($geodir_map_options['enable_post_type_filters']) { |
309 | 309 | $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
310 | 310 | } |
311 | - ?> |
|
311 | + ?> |
|
312 | 312 | <div |
313 | 313 | class="map-category-listing<?php echo $map_cat_class;?>"> |
314 | 314 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?> |
327 | 327 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
328 | 328 | <?php } else {$child_collapse = "0"; |
329 | - ?> |
|
329 | + ?> |
|
330 | 330 | <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
331 | 331 | <?php } ?> |
332 | 332 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
@@ -349,17 +349,17 @@ discard block |
||
349 | 349 | <!-- map-category-listings--> |
350 | 350 | |
351 | 351 | <?php |
352 | - if ($geodir_map_options['enable_location_filters']) { |
|
352 | + if ($geodir_map_options['enable_location_filters']) { |
|
353 | 353 | $country = get_query_var('gd_country'); |
354 | 354 | $region = get_query_var('gd_region'); |
355 | 355 | $city = get_query_var('gd_city'); |
356 | 356 | |
357 | - //fix for location/me page |
|
358 | - $country = $country != 'me' ? $country : ''; |
|
357 | + //fix for location/me page |
|
358 | + $country = $country != 'me' ? $country : ''; |
|
359 | 359 | $region = $region != 'me' ? $region : ''; |
360 | 360 | $city = $country != 'me' ? $city : ''; |
361 | - $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
362 | - ?> |
|
361 | + $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
362 | + ?> |
|
363 | 363 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
364 | 364 | <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
365 | 365 | value="<?php echo $country;?>"/> |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
371 | 371 | value="<?php echo $gd_neighbourhood;?>"/> |
372 | 372 | <?php } else { //end of location filter |
373 | - ?> |
|
373 | + ?> |
|
374 | 374 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
375 | 375 | <?php }?> |
376 | 376 | |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | |
382 | 382 | |
383 | 383 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
384 | - $post_types = geodir_get_posttypes('object'); |
|
385 | - if (count((array)($post_types)) > 1) { |
|
386 | - ?> |
|
384 | + $post_types = geodir_get_posttypes('object'); |
|
385 | + if (count((array)($post_types)) > 1) { |
|
386 | + ?> |
|
387 | 387 | <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
388 | 388 | style="max-width:<?php echo $map_width;?>!important;"> |
389 | 389 | |
@@ -391,15 +391,15 @@ discard block |
||
391 | 391 | <div class="geodir-map-posttype-list"><?php } ?> |
392 | 392 | <ul class="clearfix place-list"> |
393 | 393 | <?php |
394 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
394 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
395 | 395 | |
396 | - foreach ($post_types as $post_type => $args) { |
|
397 | - if (!in_array($post_type, $exclude_post_types)) { |
|
398 | - $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
396 | + foreach ($post_types as $post_type => $args) { |
|
397 | + if (!in_array($post_type, $exclude_post_types)) { |
|
398 | + $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
399 | 399 | echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
400 | - } |
|
401 | - } |
|
402 | - ?> |
|
400 | + } |
|
401 | + } |
|
402 | + ?> |
|
403 | 403 | </ul> |
404 | 404 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
405 | 405 | </div><?php } ?> |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | |
414 | 414 | </div> <!-- map-places-listings--> |
415 | 415 | <?php } |
416 | - } // end of post type filter if |
|
417 | - ?> |
|
416 | + } // end of post type filter if |
|
417 | + ?> |
|
418 | 418 | |
419 | 419 | </div> |
420 | 420 | </div> <!--end of stick trigger container--> |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | </script> |
430 | 430 | <?php |
431 | 431 | |
432 | - if (strpos($geodir_map_options['height'], 'vh')) { |
|
433 | - ?> |
|
432 | + if (strpos($geodir_map_options['height'], 'vh')) { |
|
433 | + ?> |
|
434 | 434 | <script> |
435 | 435 | (function () { |
436 | 436 | var screenH = jQuery(window).height(); |
@@ -452,8 +452,8 @@ discard block |
||
452 | 452 | |
453 | 453 | <?php |
454 | 454 | |
455 | - } elseif (strpos($geodir_map_options['height'], 'px')) { |
|
456 | - ?> |
|
455 | + } elseif (strpos($geodir_map_options['height'], 'px')) { |
|
456 | + ?> |
|
457 | 457 | <script> |
458 | 458 | (function () { |
459 | 459 | var screenH = jQuery(window).height(); |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | }()); |
469 | 469 | </script> |
470 | 470 | <?php |
471 | - } |
|
471 | + } |
|
472 | 472 | |
473 | - /** |
|
474 | - * Action that runs after all the map code has been output; |
|
475 | - * |
|
476 | - * @since 1.5.3 |
|
477 | - * |
|
478 | - * @param array $geodir_map_options Array of map settings. |
|
479 | - * @param string $map_canvas_name The canvas name and ID for the map. |
|
480 | - */ |
|
481 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
473 | + /** |
|
474 | + * Action that runs after all the map code has been output; |
|
475 | + * |
|
476 | + * @since 1.5.3 |
|
477 | + * |
|
478 | + * @param array $geodir_map_options Array of map settings. |
|
479 | + * @param string $map_canvas_name The canvas name and ID for the map. |
|
480 | + */ |
|
481 | + do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
482 | 482 | |
483 | 483 | |
484 | - endif; // Exclude posttypes if end |
|
484 | + endif; // Exclude posttypes if end |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | ?> |
488 | 488 | \ No newline at end of file |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | |
130 | 130 | if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
131 | 131 | } else { |
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'].'px'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
136 | 136 | } else { |
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'].'px'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
168 | 168 | |
169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
169 | + if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | 170 | // Set default map options |
171 | 171 | |
172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true); |
|
173 | 173 | |
174 | 174 | wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
175 | 175 | |
@@ -188,39 +188,39 @@ discard block |
||
188 | 188 | */ |
189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width); |
190 | 190 | ?> |
191 | - <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
|
191 | + <div id="catcher_<?php echo $map_canvas_name; ?>"></div> |
|
192 | 192 | <div class="stick_trigger_container"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
194 | - <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>" |
|
195 | - id="sticky_map_<?php echo $map_canvas_name;?>" |
|
196 | - style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
194 | + <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>" |
|
195 | + id="sticky_map_<?php echo $map_canvas_name; ?>" |
|
196 | + style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
197 | 197 | |
198 | 198 | <div class="map_background"> |
199 | 199 | <div class="top_banner_section_in clearfix"> |
200 | - <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div> |
|
201 | - <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div> |
|
202 | - <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper" |
|
203 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
200 | + <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div> |
|
201 | + <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div> |
|
202 | + <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper" |
|
203 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
204 | 204 | <!-- new map start --> |
205 | 205 | <div class="iprelative"> |
206 | - <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>" |
|
207 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
208 | - <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div" |
|
209 | - style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
206 | + <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>" |
|
207 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
208 | + <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div" |
|
209 | + style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
210 | 210 | <!--<div id="home_map_counter"></div> --> |
211 | - <div id="<?php echo $map_canvas_name;?>_map_nofound" |
|
211 | + <div id="<?php echo $map_canvas_name; ?>_map_nofound" |
|
212 | 212 | class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
213 | 213 | </div> |
214 | 214 | <!-- new map end --> |
215 | 215 | </div> |
216 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
216 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
217 | 217 | </div> |
218 | 218 | </div> |
219 | 219 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
220 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
220 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
221 | 221 | <?php } else { |
222 | 222 | ?> |
223 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
223 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
224 | 224 | <?php } |
225 | 225 | |
226 | 226 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/> |
241 | 241 | |
242 | 242 | <script> |
243 | - <?php if(geodir_is_page('detail')){?> |
|
243 | + <?php if (geodir_is_page('detail')) {?> |
|
244 | 244 | jQuery(function () { |
245 | 245 | gd_initialize_ac(); |
246 | 246 | }); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | // Create the autocomplete object, restricting the search |
251 | 251 | // to geographical location types. |
252 | 252 | autocomplete = new google.maps.places.Autocomplete( |
253 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')), |
|
253 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')), |
|
254 | 254 | {types: ['geocode']}); |
255 | 255 | // When the user selects an address from the dropdown, |
256 | 256 | // populate the address fields in the form. |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
302 | 302 | ?> |
303 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
303 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
304 | 304 | <?php |
305 | 305 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
306 | 306 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
@@ -310,12 +310,12 @@ discard block |
||
310 | 310 | } |
311 | 311 | ?> |
312 | 312 | <div |
313 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
313 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
314 | 314 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
315 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
316 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
317 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?> |
|
318 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
315 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
316 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
317 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?> |
|
318 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
319 | 319 | <input |
320 | 320 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}" |
321 | 321 | type="text" |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
328 | 328 | <?php } else {$child_collapse = "0"; |
329 | 329 | ?> |
330 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
330 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
331 | 331 | <?php } ?> |
332 | 332 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
333 | 333 | <div class="toggle"> |
334 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
334 | + <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
335 | 335 | <script>jQuery( document ).ready(function() { |
336 | 336 | geodir_show_sub_cat_collapse_button(); |
337 | 337 | });</script> |
@@ -360,21 +360,21 @@ discard block |
||
360 | 360 | $city = $country != 'me' ? $city : ''; |
361 | 361 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
362 | 362 | ?> |
363 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
364 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
365 | - value="<?php echo $country;?>"/> |
|
366 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
367 | - value="<?php echo $region;?>"/> |
|
368 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
369 | - value="<?php echo $city;?>"/> |
|
370 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
371 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
363 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
364 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
365 | + value="<?php echo $country; ?>"/> |
|
366 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
367 | + value="<?php echo $region; ?>"/> |
|
368 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
369 | + value="<?php echo $city; ?>"/> |
|
370 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
371 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
372 | 372 | <?php } else { //end of location filter |
373 | 373 | ?> |
374 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
374 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
375 | 375 | <?php }?> |
376 | 376 | |
377 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
377 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
378 | 378 | |
379 | 379 | <input type="hidden" name="limitstart" value=""/> |
380 | 380 | |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | |
383 | 383 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
384 | 384 | $post_types = geodir_get_posttypes('object'); |
385 | - if (count((array)($post_types)) > 1) { |
|
385 | + if (count((array) ($post_types)) > 1) { |
|
386 | 386 | ?> |
387 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
388 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
387 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
388 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
389 | 389 | |
390 | 390 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
391 | 391 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | foreach ($post_types as $post_type => $args) { |
397 | 397 | if (!in_array($post_type, $exclude_post_types)) { |
398 | 398 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
399 | - echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
|
399 | + echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__(ucfirst($args->labels->name), 'geodirectory').'</a></li>'; |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | ?> |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | <script type="text/javascript"> |
422 | 422 | |
423 | 423 | jQuery(document).ready(function () { |
424 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice |
|
425 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false); |
|
426 | - map_sticky('<?php echo $map_canvas_name;?>'); |
|
424 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice |
|
425 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false); |
|
426 | + map_sticky('<?php echo $map_canvas_name; ?>'); |
|
427 | 427 | }); |
428 | 428 | |
429 | 429 | </script> |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | <script> |
435 | 435 | (function () { |
436 | 436 | var screenH = jQuery(window).height(); |
437 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>"; |
|
437 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>"; |
|
438 | 438 | |
439 | 439 | var ptypeH = ''; |
440 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
441 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
440 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
441 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
442 | 442 | } |
443 | 443 | |
444 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
445 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
446 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px'); |
|
447 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
448 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
444 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
445 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
446 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px'); |
|
447 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
448 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
449 | 449 | |
450 | 450 | }()); |
451 | 451 | </script> |
@@ -457,13 +457,13 @@ discard block |
||
457 | 457 | <script> |
458 | 458 | (function () { |
459 | 459 | var screenH = jQuery(window).height(); |
460 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>"; |
|
460 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>"; |
|
461 | 461 | var ptypeH = ''; |
462 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
463 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
462 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
463 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
464 | 464 | } |
465 | 465 | |
466 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
466 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
467 | 467 | |
468 | 468 | }()); |
469 | 469 | </script> |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | * @param array $geodir_map_options Array of map settings. |
479 | 479 | * @param string $map_canvas_name The canvas name and ID for the map. |
480 | 480 | */ |
481 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
481 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name); |
|
482 | 482 | |
483 | 483 | |
484 | 484 | endif; // Exclude posttypes if end |
@@ -16,8 +16,9 @@ |
||
16 | 16 | * the visitor has not yet entered the password we will |
17 | 17 | * return early without loading the comments. |
18 | 18 | */ |
19 | -if (post_password_required()) |
|
20 | - return; |
|
19 | +if (post_password_required()) { |
|
20 | + return; |
|
21 | +} |
|
21 | 22 | ?> |
22 | 23 | |
23 | 24 | <div id="comments" class="comments-area"> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * return early without loading the comments. |
18 | 18 | */ |
19 | 19 | if (post_password_required()) |
20 | - return; |
|
20 | + return; |
|
21 | 21 | ?> |
22 | 22 | |
23 | 23 | <div id="comments" class="comments-area"> |
@@ -25,35 +25,35 @@ discard block |
||
25 | 25 | <?php // You can start editing here -- including this comment! ?> |
26 | 26 | |
27 | 27 | <?php |
28 | - /** |
|
29 | - * Called before displaying reviews. |
|
30 | - * |
|
31 | - * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div. |
|
32 | - * |
|
33 | - * @since 1.5.7 |
|
34 | - */ |
|
35 | - do_action('geodir_before_review_list'); ?> |
|
28 | + /** |
|
29 | + * Called before displaying reviews. |
|
30 | + * |
|
31 | + * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div. |
|
32 | + * |
|
33 | + * @since 1.5.7 |
|
34 | + */ |
|
35 | + do_action('geodir_before_review_list'); ?> |
|
36 | 36 | |
37 | 37 | <?php if (have_comments()) : ?> |
38 | 38 | <h2 class="comments-title"> |
39 | 39 | <?php |
40 | - printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">“%2$s”</span>', '%1$s Reviews <span>on</span> <span class="r-title"> “%2$s”</span>', get_comments_number(), 'geodirectory'), |
|
41 | - number_format_i18n(get_comments_number()), get_the_title()); |
|
42 | - ?> |
|
40 | + printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">“%2$s”</span>', '%1$s Reviews <span>on</span> <span class="r-title"> “%2$s”</span>', get_comments_number(), 'geodirectory'), |
|
41 | + number_format_i18n(get_comments_number()), get_the_title()); |
|
42 | + ?> |
|
43 | 43 | </h2> |
44 | 44 | |
45 | 45 | <?php |
46 | - /** |
|
47 | - * Called after displaying review listing title. |
|
48 | - * |
|
49 | - * @since 1.5.7 |
|
50 | - */ |
|
51 | - do_action('geodir_after_review_list_title'); ?> |
|
46 | + /** |
|
47 | + * Called after displaying review listing title. |
|
48 | + * |
|
49 | + * @since 1.5.7 |
|
50 | + */ |
|
51 | + do_action('geodir_after_review_list_title'); ?> |
|
52 | 52 | |
53 | 53 | <ol class="commentlist"> |
54 | 54 | <?php $reverse_top_level = is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php') ? false : null; ?> |
55 | 55 | <?php wp_list_comments(array('callback' => 'geodir_comment', 'reverse_top_level' => $reverse_top_level, 'style' => 'ol')); |
56 | - ?> |
|
56 | + ?> |
|
57 | 57 | </ol><!-- .commentlist --> |
58 | 58 | |
59 | 59 | <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?> |
@@ -68,51 +68,51 @@ discard block |
||
68 | 68 | <?php endif; // check for comment navigation ?> |
69 | 69 | |
70 | 70 | <?php |
71 | - /* If there are no comments and comments are closed, let's leave a note. |
|
71 | + /* If there are no comments and comments are closed, let's leave a note. |
|
72 | 72 | * But we only want the note on posts and pages that had comments in the first place. |
73 | 73 | */ |
74 | - if (!comments_open() && get_comments_number()) : ?> |
|
74 | + if (!comments_open() && get_comments_number()) : ?> |
|
75 | 75 | <p class="nocomments"><?php _e('Reviews are closed.', 'geodirectory'); ?></p> |
76 | 76 | <?php endif; ?> |
77 | 77 | |
78 | 78 | <?php endif; // have_comments() ?> |
79 | 79 | |
80 | 80 | <?php |
81 | - /** |
|
82 | - * Called before displaying "Leave a review form". |
|
83 | - * |
|
84 | - * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div. |
|
85 | - * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div. |
|
86 | - * |
|
87 | - * @since 1.5.7 |
|
88 | - */ |
|
89 | - do_action('geodir_before_review_form'); ?> |
|
81 | + /** |
|
82 | + * Called before displaying "Leave a review form". |
|
83 | + * |
|
84 | + * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div. |
|
85 | + * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div. |
|
86 | + * |
|
87 | + * @since 1.5.7 |
|
88 | + */ |
|
89 | + do_action('geodir_before_review_form'); ?> |
|
90 | 90 | |
91 | 91 | <?php |
92 | - /** |
|
93 | - * Filters comment form args |
|
94 | - * |
|
95 | - * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args. |
|
96 | - * |
|
97 | - * @since 1.0.0 |
|
98 | - */ |
|
99 | - $args = apply_filters('geodir_review_form_args', array( |
|
100 | - 'title_reply' => __('Leave a Review', 'geodirectory'), |
|
101 | - 'label_submit' => __('Post Review', 'geodirectory'), |
|
102 | - 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', |
|
103 | - 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>' |
|
104 | - )); |
|
105 | - comment_form($args); |
|
106 | - ?> |
|
92 | + /** |
|
93 | + * Filters comment form args |
|
94 | + * |
|
95 | + * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args. |
|
96 | + * |
|
97 | + * @since 1.0.0 |
|
98 | + */ |
|
99 | + $args = apply_filters('geodir_review_form_args', array( |
|
100 | + 'title_reply' => __('Leave a Review', 'geodirectory'), |
|
101 | + 'label_submit' => __('Post Review', 'geodirectory'), |
|
102 | + 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', |
|
103 | + 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>' |
|
104 | + )); |
|
105 | + comment_form($args); |
|
106 | + ?> |
|
107 | 107 | |
108 | 108 | <?php |
109 | - /** |
|
110 | - * Called after displaying "Leave a review form". |
|
111 | - * |
|
112 | - * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div. |
|
113 | - * |
|
114 | - * @since 1.5.7 |
|
115 | - */ |
|
116 | - do_action('geodir_after_review_form'); ?> |
|
109 | + /** |
|
110 | + * Called after displaying "Leave a review form". |
|
111 | + * |
|
112 | + * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div. |
|
113 | + * |
|
114 | + * @since 1.5.7 |
|
115 | + */ |
|
116 | + do_action('geodir_after_review_form'); ?> |
|
117 | 117 | |
118 | 118 | </div><!-- #comments .comments-area --> |
119 | 119 | \ No newline at end of file |
@@ -99,8 +99,8 @@ |
||
99 | 99 | $args = apply_filters('geodir_review_form_args', array( |
100 | 100 | 'title_reply' => __('Leave a Review', 'geodirectory'), |
101 | 101 | 'label_submit' => __('Post Review', 'geodirectory'), |
102 | - 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', |
|
103 | - 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>' |
|
102 | + 'comment_field' => '<p class="comment-form-comment"><label for="comment">'.__('Review text', 'geodirectory').'</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', |
|
103 | + 'must_log_in' => '<p class="must-log-in">'.sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()).'</p>' |
|
104 | 104 | )); |
105 | 105 | comment_form($args); |
106 | 106 | ?> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
14 | +if (!defined('ABSPATH')) exit; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Return the current cache expire setting. |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @param string $data |
38 | 38 | */ |
39 | -function wp_session_decode( $data ) { |
|
39 | +function wp_session_decode($data) { |
|
40 | 40 | $wp_session = WP_Session::get_instance(); |
41 | 41 | |
42 | - return $wp_session->json_in( $data ); |
|
42 | + return $wp_session->json_in($data); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | -function wp_session_regenerate_id( $delete_old_session = false ) { |
|
63 | +function wp_session_regenerate_id($delete_old_session = false) { |
|
64 | 64 | $wp_session = WP_Session::get_instance(); |
65 | 65 | |
66 | - $wp_session->regenerate_id( $delete_old_session ); |
|
66 | + $wp_session->regenerate_id($delete_old_session); |
|
67 | 67 | |
68 | 68 | return true; |
69 | 69 | } |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | */ |
78 | 78 | function wp_session_start() { |
79 | 79 | $wp_session = WP_Session::get_instance(); |
80 | - do_action( 'wp_session_start' ); |
|
80 | + do_action('wp_session_start'); |
|
81 | 81 | |
82 | 82 | return $wp_session->session_started(); |
83 | 83 | } |
84 | -add_action( 'plugins_loaded', 'wp_session_start' ); |
|
84 | +add_action('plugins_loaded', 'wp_session_start'); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Return the current session status. |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | function wp_session_status() { |
92 | 92 | $wp_session = WP_Session::get_instance(); |
93 | 93 | |
94 | - if ( $wp_session->session_started() ) { |
|
94 | + if ($wp_session->session_started()) { |
|
95 | 95 | return PHP_SESSION_ACTIVE; |
96 | 96 | } |
97 | 97 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | $wp_session = WP_Session::get_instance(); |
115 | 115 | |
116 | 116 | $wp_session->write_data(); |
117 | - do_action( 'wp_session_commit' ); |
|
117 | + do_action('wp_session_commit'); |
|
118 | 118 | } |
119 | -add_action( 'shutdown', 'wp_session_write_close' ); |
|
119 | +add_action('shutdown', 'wp_session_write_close'); |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Clean up expired sessions by removing data and their expiration entries from |
@@ -128,51 +128,51 @@ discard block |
||
128 | 128 | function wp_session_cleanup() { |
129 | 129 | global $wpdb; |
130 | 130 | |
131 | - if ( defined( 'WP_SETUP_CONFIG' ) ) { |
|
131 | + if (defined('WP_SETUP_CONFIG')) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if ( ! defined( 'WP_INSTALLING' ) ) { |
|
136 | - $expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" ); |
|
135 | + if (!defined('WP_INSTALLING')) { |
|
136 | + $expiration_keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'"); |
|
137 | 137 | |
138 | - $now = current_time( 'timestamp' ); |
|
138 | + $now = current_time('timestamp'); |
|
139 | 139 | $expired_sessions = array(); |
140 | 140 | |
141 | - foreach( $expiration_keys as $expiration ) { |
|
141 | + foreach ($expiration_keys as $expiration) { |
|
142 | 142 | |
143 | 143 | // If the session has expired |
144 | - if ( $now > intval( $expiration->option_value ) ) { |
|
144 | + if ($now > intval($expiration->option_value)) { |
|
145 | 145 | |
146 | 146 | // Get the session ID by parsing the option_name |
147 | - $session_id = substr( $expiration->option_name, 20 ); |
|
147 | + $session_id = substr($expiration->option_name, 20); |
|
148 | 148 | |
149 | - if( (int) -1 === (int) $session_id || ! preg_match( '/^[a-f0-9]{32}$/', $session_id ) ) { |
|
149 | + if ((int) -1 === (int) $session_id || !preg_match('/^[a-f0-9]{32}$/', $session_id)) { |
|
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $expired_sessions[] = $expiration->option_name; |
154 | - $expired_sessions[] = esc_sql( "_wp_session_$session_id" ); |
|
154 | + $expired_sessions[] = esc_sql("_wp_session_$session_id"); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Delete all expired sessions in a single query |
159 | - if ( ! empty( $expired_sessions ) ) { |
|
160 | - $option_names = implode( "','", $expired_sessions ); |
|
161 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" ); |
|
159 | + if (!empty($expired_sessions)) { |
|
160 | + $option_names = implode("','", $expired_sessions); |
|
161 | + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')"); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | // Allow other plugins to hook in to the garbage collection process. |
166 | - do_action( 'wp_session_cleanup' ); |
|
166 | + do_action('wp_session_cleanup'); |
|
167 | 167 | } |
168 | -add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' ); |
|
168 | +add_action('wp_session_garbage_collection', 'wp_session_cleanup'); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Register the garbage collector as a twice daily event. |
172 | 172 | */ |
173 | 173 | function wp_session_register_garbage_collection() { |
174 | - if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) { |
|
175 | - wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'wp_session_garbage_collection' ); |
|
174 | + if (!wp_next_scheduled('wp_session_garbage_collection')) { |
|
175 | + wp_schedule_event(current_time('timestamp'), 'twicedaily', 'wp_session_garbage_collection'); |
|
176 | 176 | } |
177 | 177 | } |
178 | -add_action( 'wp', 'wp_session_register_garbage_collection' ); |
|
178 | +add_action('wp', 'wp_session_register_garbage_collection'); |
@@ -11,7 +11,9 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
14 | +if ( ! defined( 'ABSPATH' ) ) { |
|
15 | + exit; |
|
16 | +} |
|
15 | 17 | |
16 | 18 | /** |
17 | 19 | * Return the current cache expire setting. |