@@ -14,15 +14,15 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | if (get_current_user_id()) { |
| 16 | 16 | |
| 17 | - $_redirect = home_url(); |
|
| 18 | - if (isset($_REQUEST['redirect_add_listing'])) { |
|
| 19 | - $_redirect = $_REQUEST['redirect_add_listing']; |
|
| 20 | - } elseif (!empty($_REQUEST['redirect_to'])) { |
|
| 21 | - $_redirect = $_REQUEST['redirect_to']; |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - wp_safe_redirect($_redirect , 302); |
|
| 25 | - exit; |
|
| 17 | + $_redirect = home_url(); |
|
| 18 | + if (isset($_REQUEST['redirect_add_listing'])) { |
|
| 19 | + $_redirect = $_REQUEST['redirect_add_listing']; |
|
| 20 | + } elseif (!empty($_REQUEST['redirect_to'])) { |
|
| 21 | + $_redirect = $_REQUEST['redirect_to']; |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + wp_safe_redirect($_redirect , 302); |
|
| 25 | + exit; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // call header |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $_redirect = $_REQUEST['redirect_to']; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - wp_safe_redirect($_redirect , 302); |
|
| 24 | + wp_safe_redirect($_redirect, 302); |
|
| 25 | 25 | exit; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -39,8 +39,9 @@ discard block |
||
| 39 | 39 | if (get_option('geodir_show_listing_nav')) {
|
| 40 | 40 | |
| 41 | 41 | $menu_class = ''; |
| 42 | - if (geodir_is_page('listing'))
|
|
| 43 | - $menu_class = 'current-menu-item'; |
|
| 42 | + if (geodir_is_page('listing')) { |
|
| 43 | + $menu_class = 'current-menu-item'; |
|
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | |
| 46 | 47 | //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
@@ -52,8 +53,9 @@ discard block |
||
| 52 | 53 | if (in_array($post_type, $show_post_type_main_nav)) {
|
| 53 | 54 | if (get_post_type_archive_link($post_type)) {
|
| 54 | 55 | $menu_class = ''; |
| 55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 56 | - $menu_class = 'current-menu-item'; |
|
| 56 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
| 57 | + $menu_class = 'current-menu-item'; |
|
| 58 | + } |
|
| 57 | 59 | /** |
| 58 | 60 | * Filter the menu li class. |
| 59 | 61 | * |
@@ -130,8 +132,9 @@ discard block |
||
| 130 | 132 | if (get_post_type_archive_link($post_type)) {
|
| 131 | 133 | |
| 132 | 134 | $menu_class = ''; |
| 133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 134 | - $menu_class = 'current-menu-item'; |
|
| 135 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
| 136 | + $menu_class = 'current-menu-item'; |
|
| 137 | + } |
|
| 135 | 138 | |
| 136 | 139 | $items .= '<li class="' . $sub_li_class . '"> |
| 137 | 140 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
@@ -159,8 +162,9 @@ discard block |
||
| 159 | 162 | if (get_option('geodir_show_addlisting_nav')) {
|
| 160 | 163 | |
| 161 | 164 | $menu_class = ''; |
| 162 | - if (geodir_is_page('add-listing'))
|
|
| 163 | - $menu_class = 'current-menu-item'; |
|
| 165 | + if (geodir_is_page('add-listing')) { |
|
| 166 | + $menu_class = 'current-menu-item'; |
|
| 167 | + } |
|
| 164 | 168 | |
| 165 | 169 | //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
| 166 | 170 | $post_types = geodir_get_posttypes('object');
|
@@ -176,8 +180,9 @@ discard block |
||
| 176 | 180 | if (geodir_get_addlisting_link($post_type)) {
|
| 177 | 181 | |
| 178 | 182 | $menu_class = ''; |
| 179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 180 | - $menu_class = 'current-menu-item'; |
|
| 183 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
| 184 | + $menu_class = 'current-menu-item'; |
|
| 185 | + } |
|
| 181 | 186 | /** |
| 182 | 187 | * Filter the menu li class. |
| 183 | 188 | * |
@@ -261,8 +266,9 @@ discard block |
||
| 261 | 266 | if (geodir_get_addlisting_link($post_type)) {
|
| 262 | 267 | |
| 263 | 268 | $menu_class = ''; |
| 264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 265 | - $menu_class = 'current-menu-item'; |
|
| 269 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
| 270 | + $menu_class = 'current-menu-item'; |
|
| 271 | + } |
|
| 266 | 272 | /** |
| 267 | 273 | * Filter the menu li class. |
| 268 | 274 | * |
@@ -319,8 +325,9 @@ discard block |
||
| 319 | 325 | } |
| 320 | 326 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
| 321 | 327 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
|
| 322 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
| 323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 328 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) { |
|
| 329 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
| 330 | + } |
|
| 324 | 331 | |
| 325 | 332 | return $menu; |
| 326 | 333 | |
@@ -407,17 +414,20 @@ discard block |
||
| 407 | 414 | $geodir_post_type = get_query_var('post_type');
|
| 408 | 415 | |
| 409 | 416 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
| 410 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 411 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 412 | - elseif (isset($_REQUEST['listing_type'])) |
|
| 413 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 417 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
| 418 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 419 | + } elseif (isset($_REQUEST['listing_type'])) { |
|
| 420 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 421 | + } |
|
| 414 | 422 | } |
| 415 | 423 | |
| 416 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
|
|
| 417 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 424 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) { |
|
| 425 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 426 | + } |
|
| 418 | 427 | |
| 419 | - if (is_tax()) |
|
| 420 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 428 | + if (is_tax()) { |
|
| 429 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 430 | + } |
|
| 421 | 431 | |
| 422 | 432 | // Retrive post type for map marker html ajax request on preview page. |
| 423 | 433 | if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
|
@@ -431,8 +441,9 @@ discard block |
||
| 431 | 441 | $all_postypes = geodir_get_posttypes(); |
| 432 | 442 | $all_postypes = stripslashes_deep($all_postypes); |
| 433 | 443 | |
| 434 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
| 435 | - $geodir_post_type = ''; |
|
| 444 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) { |
|
| 445 | + $geodir_post_type = ''; |
|
| 446 | + } |
|
| 436 | 447 | |
| 437 | 448 | if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
| 438 | 449 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
@@ -517,11 +528,12 @@ discard block |
||
| 517 | 528 | endswitch; |
| 518 | 529 | } |
| 519 | 530 | |
| 520 | - if (!empty($post_types)) |
|
| 521 | - return $post_types; |
|
| 522 | - else |
|
| 523 | - return array(); |
|
| 524 | -} |
|
| 531 | + if (!empty($post_types)) { |
|
| 532 | + return $post_types; |
|
| 533 | + } else { |
|
| 534 | + return array(); |
|
| 535 | + } |
|
| 536 | + } |
|
| 525 | 537 | |
| 526 | 538 | /** |
| 527 | 539 | * Get Custom Post Type info. |
@@ -538,9 +550,10 @@ discard block |
||
| 538 | 550 | $post_types = stripslashes_deep($post_types); |
| 539 | 551 | if (!empty($post_types) && $post_type != '') {
|
| 540 | 552 | return $post_types[$post_type]; |
| 541 | - } else |
|
| 542 | - return false; |
|
| 543 | -} |
|
| 553 | + } else { |
|
| 554 | + return false; |
|
| 555 | + } |
|
| 556 | + } |
|
| 544 | 557 | |
| 545 | 558 | if (!function_exists('geodir_get_taxonomies')) {
|
| 546 | 559 | /** |
@@ -626,10 +639,11 @@ discard block |
||
| 626 | 639 | . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
| 627 | 640 | } |
| 628 | 641 | |
| 629 | - if ($echo) |
|
| 630 | - echo $html; |
|
| 631 | - else |
|
| 632 | - return $html; |
|
| 642 | + if ($echo) { |
|
| 643 | + echo $html; |
|
| 644 | + } else { |
|
| 645 | + return $html; |
|
| 646 | + } |
|
| 633 | 647 | } |
| 634 | 648 | } |
| 635 | 649 | |
@@ -663,11 +677,12 @@ discard block |
||
| 663 | 677 | |
| 664 | 678 | } |
| 665 | 679 | |
| 666 | - if (!empty($listing_slug)) |
|
| 667 | - return $listing_slug; |
|
| 668 | - else |
|
| 669 | - return false; |
|
| 670 | -} |
|
| 680 | + if (!empty($listing_slug)) { |
|
| 681 | + return $listing_slug; |
|
| 682 | + } else { |
|
| 683 | + return false; |
|
| 684 | + } |
|
| 685 | + } |
|
| 671 | 686 | |
| 672 | 687 | |
| 673 | 688 | /** |
@@ -698,16 +713,18 @@ discard block |
||
| 698 | 713 | if (!empty($taxonomies)) {
|
| 699 | 714 | foreach (geodir_get_posttypes() as $pt) {
|
| 700 | 715 | $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
| 701 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
| 702 | - $post_type[] = $pt; |
|
| 716 | + if (array_intersect($taxonomies, $object_taxonomies)) { |
|
| 717 | + $post_type[] = $pt; |
|
| 718 | + } |
|
| 703 | 719 | } |
| 704 | 720 | } |
| 705 | 721 | |
| 706 | - if (!empty($post_type)) |
|
| 707 | - return $post_type[0]; |
|
| 708 | - else |
|
| 709 | - return false; |
|
| 710 | -} |
|
| 722 | + if (!empty($post_type)) { |
|
| 723 | + return $post_type[0]; |
|
| 724 | + } else { |
|
| 725 | + return false; |
|
| 726 | + } |
|
| 727 | + } |
|
| 711 | 728 | |
| 712 | 729 | if (!function_exists('geodir_custom_taxonomy_walker')) {
|
| 713 | 730 | /** |
@@ -763,18 +780,18 @@ discard block |
||
| 763 | 780 | $checked = ''; |
| 764 | 781 | |
| 765 | 782 | if (in_array($cat_term->term_id, $search_terms)) {
|
| 766 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 767 | - $checked = 'selected="selected"'; |
|
| 768 | - else |
|
| 769 | - $checked = 'checked="checked"'; |
|
| 783 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 784 | + $checked = 'selected="selected"'; |
|
| 785 | + } else { |
|
| 786 | + $checked = 'checked="checked"'; |
|
| 787 | + } |
|
| 770 | 788 | } |
| 771 | 789 | |
| 772 | - if ($cat_display == 'radio') |
|
| 773 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 774 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 775 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 776 | - |
|
| 777 | - else {
|
|
| 790 | + if ($cat_display == 'radio') { |
|
| 791 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 792 | + } elseif ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 793 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 794 | + } else {
|
|
| 778 | 795 | $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
| 779 | 796 | } |
| 780 | 797 | |
@@ -783,8 +800,9 @@ discard block |
||
| 783 | 800 | |
| 784 | 801 | } |
| 785 | 802 | |
| 786 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
| 787 | - $out .= '</div>'; |
|
| 803 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
| 804 | + $out .= '</div>'; |
|
| 805 | + } |
|
| 788 | 806 | |
| 789 | 807 | return $out; |
| 790 | 808 | } |
@@ -810,18 +828,21 @@ discard block |
||
| 810 | 828 | global $exclude_cats, $gd_session; |
| 811 | 829 | |
| 812 | 830 | $cat_exclude = ''; |
| 813 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
| 814 | - $cat_exclude = serialize($exclude_cats); |
|
| 831 | + if (is_array($exclude_cats) && !empty($exclude_cats)) { |
|
| 832 | + $cat_exclude = serialize($exclude_cats); |
|
| 833 | + } |
|
| 815 | 834 | |
| 816 | 835 | if (isset($_REQUEST['backandedit'])) {
|
| 817 | 836 | $post = (object)$gd_session->get('listing');
|
| 818 | 837 | |
| 819 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
| 820 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
| 838 | + if (!is_array($post->post_category[$cat_taxonomy])) { |
|
| 839 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
| 840 | + } |
|
| 821 | 841 | |
| 822 | 842 | $post_categories = $post->post_category_str; |
| 823 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
| 824 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 843 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
| 844 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 845 | + } |
|
| 825 | 846 | |
| 826 | 847 | } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
|
| 827 | 848 | global $post; |
@@ -1012,8 +1033,9 @@ discard block |
||
| 1012 | 1033 | if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
| 1013 | 1034 | $post_cat_str = $post_categories[$cat_taxonomy]; |
| 1014 | 1035 | $post_cat_array = explode("#", $post_cat_str);
|
| 1015 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
| 1016 | - $style = "display:none;"; |
|
| 1036 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) { |
|
| 1037 | + $style = "display:none;"; |
|
| 1038 | + } |
|
| 1017 | 1039 | } |
| 1018 | 1040 | ?> |
| 1019 | 1041 | <div class="main_cat_list" style=" <?php if (isset($style)) {
|
@@ -1048,7 +1070,7 @@ discard block |
||
| 1048 | 1070 | |
| 1049 | 1071 | if(is_array( $exclude_cats)){
|
| 1050 | 1072 | $exclude_cats = array_map( 'intval', $exclude_cats ); |
| 1051 | - }else{
|
|
| 1073 | + } else{
|
|
| 1052 | 1074 | $exclude_cats = intval($exclude_cats); |
| 1053 | 1075 | } |
| 1054 | 1076 | |
@@ -1078,7 +1100,10 @@ discard block |
||
| 1078 | 1100 | |
| 1079 | 1101 | <div class="post_default_category"> |
| 1080 | 1102 | <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
| 1081 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
| 1103 | + onchange="update_listing_cat()" <?php if ($default) { |
|
| 1104 | + echo ' checked="checked" '; |
|
| 1105 | +} |
|
| 1106 | +?> /> |
|
| 1082 | 1107 | <span> |
| 1083 | 1108 | <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
|
| 1084 | 1109 | </span> |
@@ -1178,8 +1203,9 @@ discard block |
||
| 1178 | 1203 | $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
| 1179 | 1204 | |
| 1180 | 1205 | $option_selected = ''; |
| 1181 | - if (!$selected) |
|
| 1182 | - $option_slected = ' selected="selected" '; |
|
| 1206 | + if (!$selected) { |
|
| 1207 | + $option_slected = ' selected="selected" '; |
|
| 1208 | + } |
|
| 1183 | 1209 | |
| 1184 | 1210 | echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
| 1185 | 1211 | |
@@ -1187,8 +1213,9 @@ discard block |
||
| 1187 | 1213 | |
| 1188 | 1214 | foreach ($cat_terms as $cat_term) {
|
| 1189 | 1215 | $option_selected = ''; |
| 1190 | - if ($selected == $cat_term->term_id) |
|
| 1191 | - $option_selected = ' selected="selected" '; |
|
| 1216 | + if ($selected == $cat_term->term_id) { |
|
| 1217 | + $option_selected = ' selected="selected" '; |
|
| 1218 | + } |
|
| 1192 | 1219 | |
| 1193 | 1220 | // Count child terms |
| 1194 | 1221 | $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
@@ -1253,8 +1280,9 @@ discard block |
||
| 1253 | 1280 | |
| 1254 | 1281 | $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
| 1255 | 1282 | |
| 1256 | - if (!$listing_slug = get_option('geodir_listing_prefix'))
|
|
| 1257 | - $listing_slug = 'places'; |
|
| 1283 | + if (!$listing_slug = get_option('geodir_listing_prefix')) { |
|
| 1284 | + $listing_slug = 'places'; |
|
| 1285 | + } |
|
| 1258 | 1286 | |
| 1259 | 1287 | /** |
| 1260 | 1288 | * Taxonomies |
@@ -1566,8 +1594,9 @@ discard block |
||
| 1566 | 1594 | 'city_slug' => $post->city_slug |
| 1567 | 1595 | ); |
| 1568 | 1596 | |
| 1569 | - } else |
|
| 1570 | - $post_location = geodir_get_location(); |
|
| 1597 | + } else { |
|
| 1598 | + $post_location = geodir_get_location(); |
|
| 1599 | + } |
|
| 1571 | 1600 | |
| 1572 | 1601 | |
| 1573 | 1602 | } else {
|
@@ -1596,8 +1625,9 @@ discard block |
||
| 1596 | 1625 | ); |
| 1597 | 1626 | |
| 1598 | 1627 | } |
| 1599 | - } else |
|
| 1600 | - $post_location = geodir_get_location(); |
|
| 1628 | + } else { |
|
| 1629 | + $post_location = geodir_get_location(); |
|
| 1630 | + } |
|
| 1601 | 1631 | } |
| 1602 | 1632 | |
| 1603 | 1633 | |
@@ -1636,16 +1666,17 @@ discard block |
||
| 1636 | 1666 | |
| 1637 | 1667 | if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
|
| 1638 | 1668 | $post_terms = absint($_POST['post_default_category']); |
| 1639 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1669 | + } elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1640 | 1670 | $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
|
| 1641 | 1671 | $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
| 1642 | - }elseif (isset($post->{$taxonomies})) {
|
|
| 1672 | + } elseif (isset($post->{$taxonomies})) {
|
|
| 1643 | 1673 | $post_terms = explode(",", trim($post->{$taxonomies}, ","));
|
| 1644 | 1674 | $post_terms = $post_terms[0]; |
| 1645 | 1675 | } |
| 1646 | 1676 | |
| 1647 | - if (!$post_terms) |
|
| 1648 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1677 | + if (!$post_terms) { |
|
| 1678 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1679 | + } |
|
| 1649 | 1680 | |
| 1650 | 1681 | if (!$post_terms) {
|
| 1651 | 1682 | $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
@@ -1659,8 +1690,9 @@ discard block |
||
| 1659 | 1690 | |
| 1660 | 1691 | $term = get_term_by('id', $post_terms, $taxonomies);
|
| 1661 | 1692 | |
| 1662 | - if (!empty($term)) |
|
| 1663 | - $term_request = $term->slug; |
|
| 1693 | + if (!empty($term)) { |
|
| 1694 | + $term_request = $term->slug; |
|
| 1695 | + } |
|
| 1664 | 1696 | //$term_request = $term->slug.'/'; |
| 1665 | 1697 | } |
| 1666 | 1698 | |
@@ -1675,9 +1707,13 @@ discard block |
||
| 1675 | 1707 | $request_term .= $term_request; |
| 1676 | 1708 | |
| 1677 | 1709 | } else {
|
| 1678 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
| 1710 | + if (isset($location_request) && $location_request != '') { |
|
| 1711 | + $request_term = $location_request; |
|
| 1712 | + } |
|
| 1679 | 1713 | |
| 1680 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
| 1714 | + if (isset($term_request) && $term_request != '') { |
|
| 1715 | + $request_term .= $term_request; |
|
| 1716 | + } |
|
| 1681 | 1717 | } |
| 1682 | 1718 | $request_term = trim($request_term, '/'); |
| 1683 | 1719 | |
@@ -1686,10 +1722,11 @@ discard block |
||
| 1686 | 1722 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
|
| 1687 | 1723 | } |
| 1688 | 1724 | |
| 1689 | - if (!empty($request_term)) |
|
| 1690 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1691 | - else |
|
| 1692 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1725 | + if (!empty($request_term)) { |
|
| 1726 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
| 1727 | + } else { |
|
| 1728 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
| 1729 | + } |
|
| 1693 | 1730 | //echo $post_link ; |
| 1694 | 1731 | } |
| 1695 | 1732 | // temp cache the permalink |
@@ -1881,11 +1918,12 @@ discard block |
||
| 1881 | 1918 | |
| 1882 | 1919 | $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
| 1883 | 1920 | |
| 1884 | - if ($echo) |
|
| 1885 | - echo $label; |
|
| 1886 | - else |
|
| 1887 | - return $label; |
|
| 1888 | -} |
|
| 1921 | + if ($echo) { |
|
| 1922 | + echo $label; |
|
| 1923 | + } else { |
|
| 1924 | + return $label; |
|
| 1925 | + } |
|
| 1926 | + } |
|
| 1889 | 1927 | |
| 1890 | 1928 | /** |
| 1891 | 1929 | * Print or Get post type plural label. |
@@ -1901,18 +1939,20 @@ discard block |
||
| 1901 | 1939 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
|
| 1902 | 1940 | $all_postypes = geodir_get_posttypes(); |
| 1903 | 1941 | |
| 1904 | - if (!in_array($post_type, $all_postypes)) |
|
| 1905 | - return false; |
|
| 1942 | + if (!in_array($post_type, $all_postypes)) { |
|
| 1943 | + return false; |
|
| 1944 | + } |
|
| 1906 | 1945 | |
| 1907 | 1946 | $obj_post_type = get_post_type_object($post_type); |
| 1908 | 1947 | |
| 1909 | 1948 | $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
| 1910 | 1949 | |
| 1911 | - if ($echo) |
|
| 1912 | - echo $label; |
|
| 1913 | - else |
|
| 1914 | - return $label; |
|
| 1915 | -} |
|
| 1950 | + if ($echo) { |
|
| 1951 | + echo $label; |
|
| 1952 | + } else { |
|
| 1953 | + return $label; |
|
| 1954 | + } |
|
| 1955 | + } |
|
| 1916 | 1956 | |
| 1917 | 1957 | /** |
| 1918 | 1958 | * Checks whether a term exists or not. |
@@ -1935,19 +1975,22 @@ discard block |
||
| 1935 | 1975 | $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
| 1936 | 1976 | |
| 1937 | 1977 | if (is_int($term)) {
|
| 1938 | - if (0 == $term) |
|
| 1939 | - return 0; |
|
| 1978 | + if (0 == $term) { |
|
| 1979 | + return 0; |
|
| 1980 | + } |
|
| 1940 | 1981 | $where = 't.term_id = %d'; |
| 1941 | - if (!empty($taxonomy)) |
|
| 1942 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1943 | - else |
|
| 1944 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1982 | + if (!empty($taxonomy)) { |
|
| 1983 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1984 | + } else { |
|
| 1985 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1986 | + } |
|
| 1945 | 1987 | } |
| 1946 | 1988 | |
| 1947 | 1989 | $term = trim(wp_unslash($term)); |
| 1948 | 1990 | |
| 1949 | - if ('' === $slug = sanitize_title($term))
|
|
| 1950 | - return 0; |
|
| 1991 | + if ('' === $slug = sanitize_title($term)) { |
|
| 1992 | + return 0; |
|
| 1993 | + } |
|
| 1951 | 1994 | |
| 1952 | 1995 | $where = 't.slug = %s'; |
| 1953 | 1996 | |
@@ -1964,14 +2007,16 @@ discard block |
||
| 1964 | 2007 | $where_fields[] = $taxonomy; |
| 1965 | 2008 | |
| 1966 | 2009 | |
| 1967 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
|
|
| 1968 | - return $result; |
|
| 2010 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) { |
|
| 2011 | + return $result; |
|
| 2012 | + } |
|
| 1969 | 2013 | |
| 1970 | 2014 | return false; |
| 1971 | 2015 | } |
| 1972 | 2016 | |
| 1973 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
|
|
| 1974 | - return $result; |
|
| 2017 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) { |
|
| 2018 | + return $result; |
|
| 2019 | + } |
|
| 1975 | 2020 | |
| 1976 | 2021 | return false; |
| 1977 | 2022 | } |
@@ -33,265 +33,265 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function geodir_add_nav_menu_items() |
| 35 | 35 | {
|
| 36 | - $items = ''; |
|
| 37 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
| 38 | - |
|
| 39 | - if (get_option('geodir_show_listing_nav')) {
|
|
| 40 | - |
|
| 41 | - $menu_class = ''; |
|
| 42 | - if (geodir_is_page('listing'))
|
|
| 43 | - $menu_class = 'current-menu-item'; |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 47 | - $post_types = geodir_get_posttypes('object');
|
|
| 48 | - $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
|
|
| 49 | - if (!empty($post_types)) {
|
|
| 50 | - foreach ($post_types as $post_type => $args) {
|
|
| 51 | - if (!empty($show_post_type_main_nav)) {
|
|
| 52 | - if (in_array($post_type, $show_post_type_main_nav)) {
|
|
| 53 | - if (get_post_type_archive_link($post_type)) {
|
|
| 54 | - $menu_class = ''; |
|
| 55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 56 | - $menu_class = 'current-menu-item'; |
|
| 57 | - /** |
|
| 58 | - * Filter the menu li class. |
|
| 59 | - * |
|
| 60 | - * @since 1.0.0 |
|
| 61 | - * @param string $menu_class The menu HTML class. |
|
| 62 | - */ |
|
| 63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 64 | - /** |
|
| 65 | - * Filter the menu a class. |
|
| 66 | - * |
|
| 67 | - * @since 1.0.0 |
|
| 68 | - */ |
|
| 69 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 70 | - $items .= '<li class="' . $li_class . '"> |
|
| 36 | + $items = ''; |
|
| 37 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
| 38 | + |
|
| 39 | + if (get_option('geodir_show_listing_nav')) {
|
|
| 40 | + |
|
| 41 | + $menu_class = ''; |
|
| 42 | + if (geodir_is_page('listing'))
|
|
| 43 | + $menu_class = 'current-menu-item'; |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 47 | + $post_types = geodir_get_posttypes('object');
|
|
| 48 | + $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
|
|
| 49 | + if (!empty($post_types)) {
|
|
| 50 | + foreach ($post_types as $post_type => $args) {
|
|
| 51 | + if (!empty($show_post_type_main_nav)) {
|
|
| 52 | + if (in_array($post_type, $show_post_type_main_nav)) {
|
|
| 53 | + if (get_post_type_archive_link($post_type)) {
|
|
| 54 | + $menu_class = ''; |
|
| 55 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 56 | + $menu_class = 'current-menu-item'; |
|
| 57 | + /** |
|
| 58 | + * Filter the menu li class. |
|
| 59 | + * |
|
| 60 | + * @since 1.0.0 |
|
| 61 | + * @param string $menu_class The menu HTML class. |
|
| 62 | + */ |
|
| 63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 64 | + /** |
|
| 65 | + * Filter the menu a class. |
|
| 66 | + * |
|
| 67 | + * @since 1.0.0 |
|
| 68 | + */ |
|
| 69 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 70 | + $items .= '<li class="' . $li_class . '"> |
|
| 71 | 71 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
| 72 | 72 | ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
| 73 | 73 | </a> |
| 74 | 74 | </li>'; |
| 75 | - } |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 81 | - |
|
| 82 | - $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 83 | - $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
| 84 | - if ($is_listing_sub_meny_exists) {
|
|
| 85 | - /** |
|
| 86 | - * Filter the menu li class. |
|
| 87 | - * |
|
| 88 | - * @since 1.0.0 |
|
| 89 | - * @param string $menu_class The menu HTML class. |
|
| 90 | - */ |
|
| 91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
|
|
| 92 | - /** |
|
| 93 | - * Filter the sub menu li class. |
|
| 94 | - * |
|
| 95 | - * @since 1.0.0 |
|
| 96 | - * @param string $menu_class The menu HTML class. |
|
| 97 | - */ |
|
| 98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 99 | - /** |
|
| 100 | - * Filter the sub menu ul class. |
|
| 101 | - * |
|
| 102 | - * @since 1.0.0 |
|
| 103 | - */ |
|
| 104 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 105 | - /** |
|
| 106 | - * Filter the menu a class. |
|
| 107 | - * |
|
| 108 | - * @since 1.0.0 |
|
| 109 | - */ |
|
| 110 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 111 | - /** |
|
| 112 | - * Filter the sub menu a class. |
|
| 113 | - * |
|
| 114 | - * @since 1.0.0 |
|
| 115 | - */ |
|
| 116 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 117 | - $items .= '<li class="' . $li_class . '"> |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 81 | + |
|
| 82 | + $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 83 | + $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
| 84 | + if ($is_listing_sub_meny_exists) {
|
|
| 85 | + /** |
|
| 86 | + * Filter the menu li class. |
|
| 87 | + * |
|
| 88 | + * @since 1.0.0 |
|
| 89 | + * @param string $menu_class The menu HTML class. |
|
| 90 | + */ |
|
| 91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
|
|
| 92 | + /** |
|
| 93 | + * Filter the sub menu li class. |
|
| 94 | + * |
|
| 95 | + * @since 1.0.0 |
|
| 96 | + * @param string $menu_class The menu HTML class. |
|
| 97 | + */ |
|
| 98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 99 | + /** |
|
| 100 | + * Filter the sub menu ul class. |
|
| 101 | + * |
|
| 102 | + * @since 1.0.0 |
|
| 103 | + */ |
|
| 104 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 105 | + /** |
|
| 106 | + * Filter the menu a class. |
|
| 107 | + * |
|
| 108 | + * @since 1.0.0 |
|
| 109 | + */ |
|
| 110 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 111 | + /** |
|
| 112 | + * Filter the sub menu a class. |
|
| 113 | + * |
|
| 114 | + * @since 1.0.0 |
|
| 115 | + */ |
|
| 116 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 117 | + $items .= '<li class="' . $li_class . '"> |
|
| 118 | 118 | <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
|
| 119 | 119 | <ul class="' . $sub_ul_class . '">'; |
| 120 | - $post_types = geodir_get_posttypes('object');
|
|
| 120 | + $post_types = geodir_get_posttypes('object');
|
|
| 121 | 121 | |
| 122 | - $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 122 | + $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 123 | 123 | |
| 124 | - if (!empty($post_types)) {
|
|
| 125 | - global $geodir_add_location_url; |
|
| 126 | - $geodir_add_location_url = true; |
|
| 127 | - foreach ($post_types as $post_type => $args) {
|
|
| 128 | - if (!empty($show_listing_post_types)) {
|
|
| 129 | - if (in_array($post_type, $show_listing_post_types)) {
|
|
| 130 | - if (get_post_type_archive_link($post_type)) {
|
|
| 124 | + if (!empty($post_types)) {
|
|
| 125 | + global $geodir_add_location_url; |
|
| 126 | + $geodir_add_location_url = true; |
|
| 127 | + foreach ($post_types as $post_type => $args) {
|
|
| 128 | + if (!empty($show_listing_post_types)) {
|
|
| 129 | + if (in_array($post_type, $show_listing_post_types)) {
|
|
| 130 | + if (get_post_type_archive_link($post_type)) {
|
|
| 131 | 131 | |
| 132 | - $menu_class = ''; |
|
| 133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 134 | - $menu_class = 'current-menu-item'; |
|
| 132 | + $menu_class = ''; |
|
| 133 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 134 | + $menu_class = 'current-menu-item'; |
|
| 135 | 135 | |
| 136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
| 136 | + $items .= '<li class="' . $sub_li_class . '"> |
|
| 137 | 137 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
| 138 | 138 | ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
| 139 | 139 | </a> |
| 140 | 140 | </li>'; |
| 141 | - } |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - $geodir_add_location_url = NULL; |
|
| 146 | - } |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + $geodir_add_location_url = NULL; |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - $items .= ' </ul> '; |
|
| 149 | - /** |
|
| 150 | - * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
| 151 | - * |
|
| 152 | - * @since 1.5.9 |
|
| 153 | - */ |
|
| 154 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 155 | - $items .= '</li>'; |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - if (get_option('geodir_show_addlisting_nav')) {
|
|
| 160 | - |
|
| 161 | - $menu_class = ''; |
|
| 162 | - if (geodir_is_page('add-listing'))
|
|
| 163 | - $menu_class = 'current-menu-item'; |
|
| 164 | - |
|
| 165 | - //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 166 | - $post_types = geodir_get_posttypes('object');
|
|
| 167 | - $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
|
|
| 168 | - $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 169 | - |
|
| 170 | - if (!empty($post_types)) {
|
|
| 171 | - foreach ($post_types as $post_type => $args) {
|
|
| 172 | - if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 173 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 174 | - if (!empty($show_add_listing_post_types_main_nav)) {
|
|
| 175 | - if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
|
|
| 176 | - if (geodir_get_addlisting_link($post_type)) {
|
|
| 177 | - |
|
| 178 | - $menu_class = ''; |
|
| 179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 180 | - $menu_class = 'current-menu-item'; |
|
| 181 | - /** |
|
| 182 | - * Filter the menu li class. |
|
| 183 | - * |
|
| 184 | - * @since 1.0.0 |
|
| 185 | - * @param string $menu_class The menu HTML class. |
|
| 186 | - */ |
|
| 187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 188 | - /** |
|
| 189 | - * Filter the menu a class. |
|
| 190 | - * |
|
| 191 | - * @since 1.0.0 |
|
| 192 | - */ |
|
| 193 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 194 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 195 | - $items .= '<li class="' . $li_class . '"> |
|
| 148 | + $items .= ' </ul> '; |
|
| 149 | + /** |
|
| 150 | + * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
| 151 | + * |
|
| 152 | + * @since 1.5.9 |
|
| 153 | + */ |
|
| 154 | + $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 155 | + $items .= '</li>'; |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + if (get_option('geodir_show_addlisting_nav')) {
|
|
| 160 | + |
|
| 161 | + $menu_class = ''; |
|
| 162 | + if (geodir_is_page('add-listing'))
|
|
| 163 | + $menu_class = 'current-menu-item'; |
|
| 164 | + |
|
| 165 | + //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 166 | + $post_types = geodir_get_posttypes('object');
|
|
| 167 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
|
|
| 168 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 169 | + |
|
| 170 | + if (!empty($post_types)) {
|
|
| 171 | + foreach ($post_types as $post_type => $args) {
|
|
| 172 | + if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 173 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 174 | + if (!empty($show_add_listing_post_types_main_nav)) {
|
|
| 175 | + if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
|
|
| 176 | + if (geodir_get_addlisting_link($post_type)) {
|
|
| 177 | + |
|
| 178 | + $menu_class = ''; |
|
| 179 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 180 | + $menu_class = 'current-menu-item'; |
|
| 181 | + /** |
|
| 182 | + * Filter the menu li class. |
|
| 183 | + * |
|
| 184 | + * @since 1.0.0 |
|
| 185 | + * @param string $menu_class The menu HTML class. |
|
| 186 | + */ |
|
| 187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 188 | + /** |
|
| 189 | + * Filter the menu a class. |
|
| 190 | + * |
|
| 191 | + * @since 1.0.0 |
|
| 192 | + */ |
|
| 193 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 194 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 195 | + $items .= '<li class="' . $li_class . '"> |
|
| 196 | 196 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
| 197 | 197 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
| 198 | 198 | </a> |
| 199 | 199 | </li>'; |
| 200 | - } |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - } |
|
| 207 | - //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 211 | - $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
| 212 | - if ($is_add_listing_sub_meny_exists) {
|
|
| 213 | - |
|
| 214 | - if (get_option('geodir_show_addlisting_nav')) {
|
|
| 215 | - /** |
|
| 216 | - * Filter the menu li class. |
|
| 217 | - * |
|
| 218 | - * @since 1.0.0 |
|
| 219 | - * @param string $menu_class The menu HTML class. |
|
| 220 | - */ |
|
| 221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
|
|
| 222 | - /** |
|
| 223 | - * Filter the sub menu li class. |
|
| 224 | - * |
|
| 225 | - * @since 1.0.0 |
|
| 226 | - * @param string $menu_class The menu HTML class. |
|
| 227 | - */ |
|
| 228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 229 | - /** |
|
| 230 | - * Filter the sub menu ul class. |
|
| 231 | - * |
|
| 232 | - * @since 1.0.0 |
|
| 233 | - */ |
|
| 234 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 235 | - /** |
|
| 236 | - * Filter the menu a class. |
|
| 237 | - * |
|
| 238 | - * @since 1.0.0 |
|
| 239 | - */ |
|
| 240 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 241 | - /** |
|
| 242 | - * Filter the sub menu a class. |
|
| 243 | - * |
|
| 244 | - * @since 1.0.0 |
|
| 245 | - */ |
|
| 246 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 247 | - $items .= '<li class="' . $li_class . '"> |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 211 | + $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
| 212 | + if ($is_add_listing_sub_meny_exists) {
|
|
| 213 | + |
|
| 214 | + if (get_option('geodir_show_addlisting_nav')) {
|
|
| 215 | + /** |
|
| 216 | + * Filter the menu li class. |
|
| 217 | + * |
|
| 218 | + * @since 1.0.0 |
|
| 219 | + * @param string $menu_class The menu HTML class. |
|
| 220 | + */ |
|
| 221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
|
|
| 222 | + /** |
|
| 223 | + * Filter the sub menu li class. |
|
| 224 | + * |
|
| 225 | + * @since 1.0.0 |
|
| 226 | + * @param string $menu_class The menu HTML class. |
|
| 227 | + */ |
|
| 228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 229 | + /** |
|
| 230 | + * Filter the sub menu ul class. |
|
| 231 | + * |
|
| 232 | + * @since 1.0.0 |
|
| 233 | + */ |
|
| 234 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 235 | + /** |
|
| 236 | + * Filter the menu a class. |
|
| 237 | + * |
|
| 238 | + * @since 1.0.0 |
|
| 239 | + */ |
|
| 240 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 241 | + /** |
|
| 242 | + * Filter the sub menu a class. |
|
| 243 | + * |
|
| 244 | + * @since 1.0.0 |
|
| 245 | + */ |
|
| 246 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 247 | + $items .= '<li class="' . $li_class . '"> |
|
| 248 | 248 | <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
|
| 249 | 249 | <ul class="' . $sub_ul_class . '">'; |
| 250 | 250 | |
| 251 | - $post_types = geodir_get_posttypes('object');
|
|
| 252 | - |
|
| 253 | - $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 254 | - |
|
| 255 | - if (!empty($post_types)) {
|
|
| 256 | - foreach ($post_types as $post_type => $args) {
|
|
| 257 | - if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 258 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 259 | - if (!empty($show_add_listing_post_types)) {
|
|
| 260 | - if (in_array($post_type, $show_add_listing_post_types)) {
|
|
| 261 | - if (geodir_get_addlisting_link($post_type)) {
|
|
| 262 | - |
|
| 263 | - $menu_class = ''; |
|
| 264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 265 | - $menu_class = 'current-menu-item'; |
|
| 266 | - /** |
|
| 267 | - * Filter the menu li class. |
|
| 268 | - * |
|
| 269 | - * @since 1.0.0 |
|
| 270 | - * @param string $menu_class The menu HTML class. |
|
| 271 | - */ |
|
| 272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 273 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 274 | - $items .= '<li class="' . $sub_li_class . '"> |
|
| 251 | + $post_types = geodir_get_posttypes('object');
|
|
| 252 | + |
|
| 253 | + $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 254 | + |
|
| 255 | + if (!empty($post_types)) {
|
|
| 256 | + foreach ($post_types as $post_type => $args) {
|
|
| 257 | + if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 258 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 259 | + if (!empty($show_add_listing_post_types)) {
|
|
| 260 | + if (in_array($post_type, $show_add_listing_post_types)) {
|
|
| 261 | + if (geodir_get_addlisting_link($post_type)) {
|
|
| 262 | + |
|
| 263 | + $menu_class = ''; |
|
| 264 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 265 | + $menu_class = 'current-menu-item'; |
|
| 266 | + /** |
|
| 267 | + * Filter the menu li class. |
|
| 268 | + * |
|
| 269 | + * @since 1.0.0 |
|
| 270 | + * @param string $menu_class The menu HTML class. |
|
| 271 | + */ |
|
| 272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 273 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 274 | + $items .= '<li class="' . $sub_li_class . '"> |
|
| 275 | 275 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
| 276 | 276 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
| 277 | 277 | </a> |
| 278 | 278 | </li>'; |
| 279 | - } |
|
| 280 | - } |
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | - $items .= ' </ul> '; |
|
| 288 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 289 | - $items .= '</li>'; |
|
| 287 | + $items .= ' </ul> '; |
|
| 288 | + $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 289 | + $items .= '</li>'; |
|
| 290 | 290 | |
| 291 | - } |
|
| 292 | - } |
|
| 293 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
| 294 | - return $items; |
|
| 291 | + } |
|
| 292 | + } |
|
| 293 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
| 294 | + return $items; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
@@ -309,20 +309,20 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | function geodir_pagemenu_items($menu, $args) |
| 311 | 311 | {
|
| 312 | - $locations = get_nav_menu_locations(); |
|
| 313 | - $geodir_theme_location = get_option('geodir_theme_location_nav');
|
|
| 314 | - $geodir_theme_location_nav = array(); |
|
| 315 | - if (empty($locations) && empty($geodir_theme_location)) {
|
|
| 316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 317 | - $geodir_theme_location_nav[] = $args['theme_location']; |
|
| 318 | - update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
|
|
| 319 | - } |
|
| 320 | - //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
| 312 | + $locations = get_nav_menu_locations(); |
|
| 313 | + $geodir_theme_location = get_option('geodir_theme_location_nav');
|
|
| 314 | + $geodir_theme_location_nav = array(); |
|
| 315 | + if (empty($locations) && empty($geodir_theme_location)) {
|
|
| 316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 317 | + $geodir_theme_location_nav[] = $args['theme_location']; |
|
| 318 | + update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
|
|
| 319 | + } |
|
| 320 | + //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
| 321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
|
| 322 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
| 323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 322 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
| 323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 324 | 324 | |
| 325 | - return $menu; |
|
| 325 | + return $menu; |
|
| 326 | 326 | |
| 327 | 327 | } |
| 328 | 328 | |
@@ -342,18 +342,18 @@ discard block |
||
| 342 | 342 | function geodir_menu_items($items, $args) |
| 343 | 343 | {
|
| 344 | 344 | |
| 345 | - $location = $args->theme_location; |
|
| 345 | + $location = $args->theme_location; |
|
| 346 | 346 | |
| 347 | - $geodir_theme_location = get_option('geodir_theme_location_nav');
|
|
| 347 | + $geodir_theme_location = get_option('geodir_theme_location_nav');
|
|
| 348 | 348 | |
| 349 | - if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
|
|
| 349 | + if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
|
|
| 350 | 350 | |
| 351 | - $items = $items . geodir_add_nav_menu_items(); |
|
| 352 | - return $items; |
|
| 351 | + $items = $items . geodir_add_nav_menu_items(); |
|
| 352 | + return $items; |
|
| 353 | 353 | |
| 354 | - } else {
|
|
| 355 | - return $items; |
|
| 356 | - } |
|
| 354 | + } else {
|
|
| 355 | + return $items; |
|
| 356 | + } |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -368,25 +368,25 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | function geodir_get_category_all_array() |
| 370 | 370 | {
|
| 371 | - global $wpdb; |
|
| 372 | - $return_array = array(); |
|
| 373 | - |
|
| 374 | - $taxonomies = geodir_get_taxonomies(); |
|
| 375 | - $taxonomies = implode("','", $taxonomies);
|
|
| 376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 377 | - |
|
| 378 | - $pn_categories = $wpdb->get_results( |
|
| 379 | - $wpdb->prepare( |
|
| 380 | - "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
| 381 | - array($wpdb->terms . term_id) |
|
| 382 | - ) |
|
| 383 | - ); |
|
| 384 | - |
|
| 385 | - foreach ($pn_categories as $pn_categories_obj) {
|
|
| 386 | - $return_array[] = array("id" => $pn_categories_obj->cat_ID,
|
|
| 387 | - "title" => $pn_categories_obj->name,); |
|
| 388 | - } |
|
| 389 | - return $return_array; |
|
| 371 | + global $wpdb; |
|
| 372 | + $return_array = array(); |
|
| 373 | + |
|
| 374 | + $taxonomies = geodir_get_taxonomies(); |
|
| 375 | + $taxonomies = implode("','", $taxonomies);
|
|
| 376 | + $taxonomies = "'" . $taxonomies . "'"; |
|
| 377 | + |
|
| 378 | + $pn_categories = $wpdb->get_results( |
|
| 379 | + $wpdb->prepare( |
|
| 380 | + "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
| 381 | + array($wpdb->terms . term_id) |
|
| 382 | + ) |
|
| 383 | + ); |
|
| 384 | + |
|
| 385 | + foreach ($pn_categories as $pn_categories_obj) {
|
|
| 386 | + $return_array[] = array("id" => $pn_categories_obj->cat_ID,
|
|
| 387 | + "title" => $pn_categories_obj->name,); |
|
| 388 | + } |
|
| 389 | + return $return_array; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | |
@@ -402,49 +402,49 @@ discard block |
||
| 402 | 402 | * @return string The post type. |
| 403 | 403 | */ |
| 404 | 404 | function geodir_get_current_posttype() {
|
| 405 | - global $wp_query, $post, $geodir_post_type; |
|
| 405 | + global $wp_query, $post, $geodir_post_type; |
|
| 406 | 406 | |
| 407 | - $geodir_post_type = get_query_var('post_type');
|
|
| 407 | + $geodir_post_type = get_query_var('post_type');
|
|
| 408 | 408 | |
| 409 | - if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
|
| 410 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 411 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 412 | - elseif (isset($_REQUEST['listing_type'])) |
|
| 413 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 414 | - } |
|
| 409 | + if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
|
| 410 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 411 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 412 | + elseif (isset($_REQUEST['listing_type'])) |
|
| 413 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 414 | + } |
|
| 415 | 415 | |
| 416 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
|
|
| 417 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 416 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
|
|
| 417 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 418 | 418 | |
| 419 | - if (is_tax()) |
|
| 420 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 419 | + if (is_tax()) |
|
| 420 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 421 | 421 | |
| 422 | - // Retrive post type for map marker html ajax request on preview page. |
|
| 423 | - if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
|
|
| 424 | - if (!empty($post->post_type)) {
|
|
| 425 | - $geodir_post_type = $post->post_type; |
|
| 426 | - } else if (!empty($post->listing_type)) {
|
|
| 427 | - $geodir_post_type = $post->listing_type; |
|
| 428 | - } |
|
| 429 | - } |
|
| 422 | + // Retrive post type for map marker html ajax request on preview page. |
|
| 423 | + if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
|
|
| 424 | + if (!empty($post->post_type)) {
|
|
| 425 | + $geodir_post_type = $post->post_type; |
|
| 426 | + } else if (!empty($post->listing_type)) {
|
|
| 427 | + $geodir_post_type = $post->listing_type; |
|
| 428 | + } |
|
| 429 | + } |
|
| 430 | 430 | |
| 431 | - $all_postypes = geodir_get_posttypes(); |
|
| 432 | - $all_postypes = stripslashes_deep($all_postypes); |
|
| 431 | + $all_postypes = geodir_get_posttypes(); |
|
| 432 | + $all_postypes = stripslashes_deep($all_postypes); |
|
| 433 | 433 | |
| 434 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
| 435 | - $geodir_post_type = ''; |
|
| 434 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
| 435 | + $geodir_post_type = ''; |
|
| 436 | 436 | |
| 437 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 438 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 439 | - } |
|
| 437 | + if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 438 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 439 | + } |
|
| 440 | 440 | |
| 441 | 441 | |
| 442 | - /** |
|
| 443 | - * Filter the default CPT return. |
|
| 444 | - * |
|
| 445 | - * @since 1.6.9 |
|
| 446 | - */ |
|
| 447 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 442 | + /** |
|
| 443 | + * Filter the default CPT return. |
|
| 444 | + * |
|
| 445 | + * @since 1.6.9 |
|
| 446 | + */ |
|
| 447 | + return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -458,22 +458,22 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | function geodir_get_default_posttype() |
| 460 | 460 | {
|
| 461 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 462 | - |
|
| 463 | - $stype = false; |
|
| 464 | - foreach ( $post_types as $post_type => $info ) {
|
|
| 465 | - global $wpdb; |
|
| 466 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 467 | - if ( $has_posts ) {
|
|
| 468 | - $stype = $post_type; break; |
|
| 469 | - } |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - if(!$stype){
|
|
| 473 | - $stype = 'gd_place'; |
|
| 474 | - } |
|
| 475 | - |
|
| 476 | - return $stype; |
|
| 461 | + $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 462 | + |
|
| 463 | + $stype = false; |
|
| 464 | + foreach ( $post_types as $post_type => $info ) {
|
|
| 465 | + global $wpdb; |
|
| 466 | + $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 467 | + if ( $has_posts ) {
|
|
| 468 | + $stype = $post_type; break; |
|
| 469 | + } |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + if(!$stype){
|
|
| 473 | + $stype = 'gd_place'; |
|
| 474 | + } |
|
| 475 | + |
|
| 476 | + return $stype; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -487,21 +487,21 @@ discard block |
||
| 487 | 487 | */ |
| 488 | 488 | function geodir_get_posttypes($output = 'names') |
| 489 | 489 | {
|
| 490 | - $post_types = array(); |
|
| 491 | - $post_types = get_option('geodir_post_types');
|
|
| 492 | - $post_types = stripslashes_deep($post_types); |
|
| 493 | - if (!empty($post_types)) {
|
|
| 494 | - switch ($output): |
|
| 495 | - case 'object': |
|
| 496 | - case 'Object': |
|
| 497 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 498 | - break; |
|
| 499 | - case 'array': |
|
| 500 | - case 'Array': |
|
| 501 | - $post_types = (array)$post_types; |
|
| 502 | - break; |
|
| 490 | + $post_types = array(); |
|
| 491 | + $post_types = get_option('geodir_post_types');
|
|
| 492 | + $post_types = stripslashes_deep($post_types); |
|
| 493 | + if (!empty($post_types)) {
|
|
| 494 | + switch ($output): |
|
| 495 | + case 'object': |
|
| 496 | + case 'Object': |
|
| 497 | + $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 498 | + break; |
|
| 499 | + case 'array': |
|
| 500 | + case 'Array': |
|
| 501 | + $post_types = (array)$post_types; |
|
| 502 | + break; |
|
| 503 | 503 | case 'options': |
| 504 | - $post_types = (array)$post_types; |
|
| 504 | + $post_types = (array)$post_types; |
|
| 505 | 505 | |
| 506 | 506 | $options = array(); |
| 507 | 507 | if (!empty($post_types)) {
|
@@ -510,17 +510,17 @@ discard block |
||
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | $post_types = $options; |
| 513 | - break; |
|
| 514 | - default: |
|
| 515 | - $post_types = array_keys($post_types); |
|
| 516 | - break; |
|
| 517 | - endswitch; |
|
| 518 | - } |
|
| 519 | - |
|
| 520 | - if (!empty($post_types)) |
|
| 521 | - return $post_types; |
|
| 522 | - else |
|
| 523 | - return array(); |
|
| 513 | + break; |
|
| 514 | + default: |
|
| 515 | + $post_types = array_keys($post_types); |
|
| 516 | + break; |
|
| 517 | + endswitch; |
|
| 518 | + } |
|
| 519 | + |
|
| 520 | + if (!empty($post_types)) |
|
| 521 | + return $post_types; |
|
| 522 | + else |
|
| 523 | + return array(); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | /** |
@@ -533,104 +533,104 @@ discard block |
||
| 533 | 533 | */ |
| 534 | 534 | function geodir_get_posttype_info($post_type = '') |
| 535 | 535 | {
|
| 536 | - $post_types = array(); |
|
| 537 | - $post_types = get_option('geodir_post_types');
|
|
| 538 | - $post_types = stripslashes_deep($post_types); |
|
| 539 | - if (!empty($post_types) && $post_type != '') {
|
|
| 540 | - return $post_types[$post_type]; |
|
| 541 | - } else |
|
| 542 | - return false; |
|
| 536 | + $post_types = array(); |
|
| 537 | + $post_types = get_option('geodir_post_types');
|
|
| 538 | + $post_types = stripslashes_deep($post_types); |
|
| 539 | + if (!empty($post_types) && $post_type != '') {
|
|
| 540 | + return $post_types[$post_type]; |
|
| 541 | + } else |
|
| 542 | + return false; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | if (!function_exists('geodir_get_taxonomies')) {
|
| 546 | - /** |
|
| 547 | - * Get all custom taxonomies. |
|
| 548 | - * |
|
| 549 | - * @since 1.0.0 |
|
| 550 | - * @package GeoDirectory |
|
| 551 | - * @param string $post_type The post type. |
|
| 552 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 553 | - * @return array|bool Taxonomies on success. false on failure. |
|
| 554 | - */ |
|
| 555 | - function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) {
|
|
| 556 | - $taxonomies = array(); |
|
| 557 | - $gd_taxonomies = array(); |
|
| 558 | - |
|
| 559 | - if ($taxonomies = get_option('geodir_taxonomies')) {
|
|
| 560 | - $gd_taxonomies = array_keys($taxonomies); |
|
| 561 | - |
|
| 562 | - if ($post_type != '') {
|
|
| 563 | - $gd_taxonomies = array(); |
|
| 564 | - } |
|
| 546 | + /** |
|
| 547 | + * Get all custom taxonomies. |
|
| 548 | + * |
|
| 549 | + * @since 1.0.0 |
|
| 550 | + * @package GeoDirectory |
|
| 551 | + * @param string $post_type The post type. |
|
| 552 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 553 | + * @return array|bool Taxonomies on success. false on failure. |
|
| 554 | + */ |
|
| 555 | + function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) {
|
|
| 556 | + $taxonomies = array(); |
|
| 557 | + $gd_taxonomies = array(); |
|
| 558 | + |
|
| 559 | + if ($taxonomies = get_option('geodir_taxonomies')) {
|
|
| 560 | + $gd_taxonomies = array_keys($taxonomies); |
|
| 561 | + |
|
| 562 | + if ($post_type != '') {
|
|
| 563 | + $gd_taxonomies = array(); |
|
| 564 | + } |
|
| 565 | 565 | |
| 566 | - $i = 0; |
|
| 567 | - foreach ($taxonomies as $taxonomy => $args) {
|
|
| 568 | - if ($post_type != '' && $args['object_type'] == $post_type) {
|
|
| 569 | - $gd_taxonomies[] = $taxonomy; |
|
| 570 | - } |
|
| 566 | + $i = 0; |
|
| 567 | + foreach ($taxonomies as $taxonomy => $args) {
|
|
| 568 | + if ($post_type != '' && $args['object_type'] == $post_type) {
|
|
| 569 | + $gd_taxonomies[] = $taxonomy; |
|
| 570 | + } |
|
| 571 | 571 | |
| 572 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
|
|
| 573 | - if (array_search($taxonomy, $gd_taxonomies) !== false) {
|
|
| 574 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
| 575 | - } |
|
| 576 | - } |
|
| 577 | - } |
|
| 572 | + if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
|
|
| 573 | + if (array_search($taxonomy, $gd_taxonomies) !== false) {
|
|
| 574 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
| 575 | + } |
|
| 576 | + } |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | - $gd_taxonomies = array_values($gd_taxonomies); |
|
| 580 | - } |
|
| 581 | - |
|
| 582 | - /** |
|
| 583 | - * Filter the taxonomies. |
|
| 584 | - * |
|
| 585 | - * @since 1.0.0 |
|
| 586 | - * @param array $gd_taxonomies The taxonomy array. |
|
| 587 | - */ |
|
| 588 | - $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
|
|
| 589 | - |
|
| 590 | - if (!empty($taxonomies)) {
|
|
| 591 | - return $taxonomies; |
|
| 592 | - } else {
|
|
| 593 | - return false; |
|
| 594 | - } |
|
| 595 | - } |
|
| 579 | + $gd_taxonomies = array_values($gd_taxonomies); |
|
| 580 | + } |
|
| 581 | + |
|
| 582 | + /** |
|
| 583 | + * Filter the taxonomies. |
|
| 584 | + * |
|
| 585 | + * @since 1.0.0 |
|
| 586 | + * @param array $gd_taxonomies The taxonomy array. |
|
| 587 | + */ |
|
| 588 | + $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
|
|
| 589 | + |
|
| 590 | + if (!empty($taxonomies)) {
|
|
| 591 | + return $taxonomies; |
|
| 592 | + } else {
|
|
| 593 | + return false; |
|
| 594 | + } |
|
| 595 | + } |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | if (!function_exists(' geodir_get_categories_dl')) {
|
| 599 | - /** |
|
| 600 | - * Get categories dropdown HTML. |
|
| 601 | - * |
|
| 602 | - * @since 1.0.0 |
|
| 603 | - * @package GeoDirectory |
|
| 604 | - * @param string $post_type The post type. |
|
| 605 | - * @param string $selected The selected value. |
|
| 606 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 607 | - * @param bool $echo Prints the HTML when set to true. Default: true. |
|
| 608 | - * @return void|string Dropdown HTML. |
|
| 609 | - */ |
|
| 610 | - function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
| 611 | - {
|
|
| 612 | - |
|
| 613 | - $html = ''; |
|
| 614 | - $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
| 615 | - |
|
| 616 | - $categories = get_terms($taxonomies); |
|
| 617 | - |
|
| 618 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 619 | - |
|
| 620 | - foreach ($categories as $category_obj) {
|
|
| 621 | - $select_opt = ''; |
|
| 622 | - if ($selected == $category_obj->term_id) {
|
|
| 623 | - $select_opt = 'selected="selected"'; |
|
| 624 | - } |
|
| 625 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 626 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
| 627 | - } |
|
| 628 | - |
|
| 629 | - if ($echo) |
|
| 630 | - echo $html; |
|
| 631 | - else |
|
| 632 | - return $html; |
|
| 633 | - } |
|
| 599 | + /** |
|
| 600 | + * Get categories dropdown HTML. |
|
| 601 | + * |
|
| 602 | + * @since 1.0.0 |
|
| 603 | + * @package GeoDirectory |
|
| 604 | + * @param string $post_type The post type. |
|
| 605 | + * @param string $selected The selected value. |
|
| 606 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 607 | + * @param bool $echo Prints the HTML when set to true. Default: true. |
|
| 608 | + * @return void|string Dropdown HTML. |
|
| 609 | + */ |
|
| 610 | + function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
| 611 | + {
|
|
| 612 | + |
|
| 613 | + $html = ''; |
|
| 614 | + $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
| 615 | + |
|
| 616 | + $categories = get_terms($taxonomies); |
|
| 617 | + |
|
| 618 | + $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 619 | + |
|
| 620 | + foreach ($categories as $category_obj) {
|
|
| 621 | + $select_opt = ''; |
|
| 622 | + if ($selected == $category_obj->term_id) {
|
|
| 623 | + $select_opt = 'selected="selected"'; |
|
| 624 | + } |
|
| 625 | + $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 626 | + . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
| 627 | + } |
|
| 628 | + |
|
| 629 | + if ($echo) |
|
| 630 | + echo $html; |
|
| 631 | + else |
|
| 632 | + return $html; |
|
| 633 | + } |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | |
@@ -645,28 +645,28 @@ discard block |
||
| 645 | 645 | function geodir_get_listing_slug($object_type = '') |
| 646 | 646 | {
|
| 647 | 647 | |
| 648 | - $listing_slug = ''; |
|
| 648 | + $listing_slug = ''; |
|
| 649 | 649 | |
| 650 | - $post_types = get_option('geodir_post_types');
|
|
| 651 | - $taxonomies = get_option('geodir_taxonomies');
|
|
| 650 | + $post_types = get_option('geodir_post_types');
|
|
| 651 | + $taxonomies = get_option('geodir_taxonomies');
|
|
| 652 | 652 | |
| 653 | 653 | |
| 654 | - if ($object_type != '') {
|
|
| 655 | - if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
|
|
| 654 | + if ($object_type != '') {
|
|
| 655 | + if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
|
|
| 656 | 656 | |
| 657 | - $object_info = $post_types[$object_type]; |
|
| 658 | - $listing_slug = $object_info['listing_slug']; |
|
| 659 | - } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
|
|
| 660 | - $object_info = $taxonomies[$object_type]; |
|
| 661 | - $listing_slug = $object_info['listing_slug']; |
|
| 662 | - } |
|
| 657 | + $object_info = $post_types[$object_type]; |
|
| 658 | + $listing_slug = $object_info['listing_slug']; |
|
| 659 | + } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
|
|
| 660 | + $object_info = $taxonomies[$object_type]; |
|
| 661 | + $listing_slug = $object_info['listing_slug']; |
|
| 662 | + } |
|
| 663 | 663 | |
| 664 | - } |
|
| 664 | + } |
|
| 665 | 665 | |
| 666 | - if (!empty($listing_slug)) |
|
| 667 | - return $listing_slug; |
|
| 668 | - else |
|
| 669 | - return false; |
|
| 666 | + if (!empty($listing_slug)) |
|
| 667 | + return $listing_slug; |
|
| 668 | + else |
|
| 669 | + return false; |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | |
@@ -681,212 +681,212 @@ discard block |
||
| 681 | 681 | */ |
| 682 | 682 | function geodir_get_taxonomy_posttype($taxonomy = '') |
| 683 | 683 | {
|
| 684 | - global $wp_query; |
|
| 685 | - |
|
| 686 | - $post_type = array(); |
|
| 687 | - $taxonomies = array(); |
|
| 688 | - |
|
| 689 | - if (!empty($taxonomy)) {
|
|
| 690 | - $taxonomies[] = $taxonomy; |
|
| 691 | - } elseif (isset($wp_query->tax_query->queries)) {
|
|
| 692 | - $tax_arr = $wp_query->tax_query->queries; |
|
| 693 | - //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
| 694 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 695 | - $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
| 696 | - } |
|
| 697 | - |
|
| 698 | - if (!empty($taxonomies)) {
|
|
| 699 | - foreach (geodir_get_posttypes() as $pt) {
|
|
| 700 | - $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
| 701 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
| 702 | - $post_type[] = $pt; |
|
| 703 | - } |
|
| 704 | - } |
|
| 705 | - |
|
| 706 | - if (!empty($post_type)) |
|
| 707 | - return $post_type[0]; |
|
| 708 | - else |
|
| 709 | - return false; |
|
| 684 | + global $wp_query; |
|
| 685 | + |
|
| 686 | + $post_type = array(); |
|
| 687 | + $taxonomies = array(); |
|
| 688 | + |
|
| 689 | + if (!empty($taxonomy)) {
|
|
| 690 | + $taxonomies[] = $taxonomy; |
|
| 691 | + } elseif (isset($wp_query->tax_query->queries)) {
|
|
| 692 | + $tax_arr = $wp_query->tax_query->queries; |
|
| 693 | + //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
| 694 | + if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 695 | + $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
| 696 | + } |
|
| 697 | + |
|
| 698 | + if (!empty($taxonomies)) {
|
|
| 699 | + foreach (geodir_get_posttypes() as $pt) {
|
|
| 700 | + $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
| 701 | + if (array_intersect($taxonomies, $object_taxonomies)) |
|
| 702 | + $post_type[] = $pt; |
|
| 703 | + } |
|
| 704 | + } |
|
| 705 | + |
|
| 706 | + if (!empty($post_type)) |
|
| 707 | + return $post_type[0]; |
|
| 708 | + else |
|
| 709 | + return false; |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | if (!function_exists('geodir_custom_taxonomy_walker')) {
|
| 713 | - /** |
|
| 714 | - * Custom taxonomy walker function. |
|
| 715 | - * |
|
| 716 | - * @since 1.0.0 |
|
| 717 | - * @package GeoDirectory |
|
| 718 | - * @param string $cat_taxonomy The taxonomy name. |
|
| 719 | - * @param int $cat_parent The parent term ID. |
|
| 720 | - * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
| 721 | - * @param int $pading CSS padding in pixels. |
|
| 722 | - * @return string|void taxonomy HTML. |
|
| 723 | - */ |
|
| 724 | - function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
| 725 | - {
|
|
| 726 | - global $cat_display, $post_cat, $exclude_cats; |
|
| 727 | - |
|
| 728 | - $search_terms = trim($post_cat, ","); |
|
| 729 | - |
|
| 730 | - $search_terms = explode(",", $search_terms);
|
|
| 731 | - |
|
| 732 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
|
|
| 733 | - |
|
| 734 | - $display = ''; |
|
| 735 | - $onchange = ''; |
|
| 736 | - $term_check = ''; |
|
| 737 | - $main_list_class = ''; |
|
| 738 | - $out = ''; |
|
| 739 | - //If there are terms, start displaying |
|
| 740 | - if (count($cat_terms) > 0) {
|
|
| 741 | - //Displaying as a list |
|
| 742 | - $p = $pading * 20; |
|
| 743 | - $pading++; |
|
| 744 | - |
|
| 745 | - |
|
| 746 | - if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
|
| 747 | - if ($cat_parent == 0) {
|
|
| 748 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 749 | - $main_list_class = 'class="main_list_selecter"'; |
|
| 750 | - } else {
|
|
| 751 | - //$display = 'display:none'; |
|
| 752 | - $list_class = 'sub_list gd-sub-cats-list'; |
|
| 753 | - } |
|
| 754 | - } |
|
| 713 | + /** |
|
| 714 | + * Custom taxonomy walker function. |
|
| 715 | + * |
|
| 716 | + * @since 1.0.0 |
|
| 717 | + * @package GeoDirectory |
|
| 718 | + * @param string $cat_taxonomy The taxonomy name. |
|
| 719 | + * @param int $cat_parent The parent term ID. |
|
| 720 | + * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
| 721 | + * @param int $pading CSS padding in pixels. |
|
| 722 | + * @return string|void taxonomy HTML. |
|
| 723 | + */ |
|
| 724 | + function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
| 725 | + {
|
|
| 726 | + global $cat_display, $post_cat, $exclude_cats; |
|
| 727 | + |
|
| 728 | + $search_terms = trim($post_cat, ","); |
|
| 729 | + |
|
| 730 | + $search_terms = explode(",", $search_terms);
|
|
| 731 | + |
|
| 732 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
|
|
| 733 | + |
|
| 734 | + $display = ''; |
|
| 735 | + $onchange = ''; |
|
| 736 | + $term_check = ''; |
|
| 737 | + $main_list_class = ''; |
|
| 738 | + $out = ''; |
|
| 739 | + //If there are terms, start displaying |
|
| 740 | + if (count($cat_terms) > 0) {
|
|
| 741 | + //Displaying as a list |
|
| 742 | + $p = $pading * 20; |
|
| 743 | + $pading++; |
|
| 744 | + |
|
| 745 | + |
|
| 746 | + if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
|
| 747 | + if ($cat_parent == 0) {
|
|
| 748 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 749 | + $main_list_class = 'class="main_list_selecter"'; |
|
| 750 | + } else {
|
|
| 751 | + //$display = 'display:none'; |
|
| 752 | + $list_class = 'sub_list gd-sub-cats-list'; |
|
| 753 | + } |
|
| 754 | + } |
|
| 755 | 755 | |
| 756 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
|
| 757 | - $p = 0; |
|
| 758 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 759 | - } |
|
| 756 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
|
| 757 | + $p = 0; |
|
| 758 | + $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 759 | + } |
|
| 760 | 760 | |
| 761 | - foreach ($cat_terms as $cat_term) {
|
|
| 761 | + foreach ($cat_terms as $cat_term) {
|
|
| 762 | 762 | |
| 763 | - $checked = ''; |
|
| 763 | + $checked = ''; |
|
| 764 | 764 | |
| 765 | - if (in_array($cat_term->term_id, $search_terms)) {
|
|
| 766 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 767 | - $checked = 'selected="selected"'; |
|
| 768 | - else |
|
| 769 | - $checked = 'checked="checked"'; |
|
| 770 | - } |
|
| 765 | + if (in_array($cat_term->term_id, $search_terms)) {
|
|
| 766 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 767 | + $checked = 'selected="selected"'; |
|
| 768 | + else |
|
| 769 | + $checked = 'checked="checked"'; |
|
| 770 | + } |
|
| 771 | 771 | |
| 772 | - if ($cat_display == 'radio') |
|
| 773 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 774 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 775 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 772 | + if ($cat_display == 'radio') |
|
| 773 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 774 | + elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 775 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 776 | 776 | |
| 777 | - else {
|
|
| 778 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 779 | - } |
|
| 777 | + else {
|
|
| 778 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 779 | + } |
|
| 780 | 780 | |
| 781 | - // Call recurson to print sub cats |
|
| 782 | - $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
| 781 | + // Call recurson to print sub cats |
|
| 782 | + $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
| 783 | 783 | |
| 784 | - } |
|
| 784 | + } |
|
| 785 | 785 | |
| 786 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
| 787 | - $out .= '</div>'; |
|
| 786 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
| 787 | + $out .= '</div>'; |
|
| 788 | 788 | |
| 789 | - return $out; |
|
| 790 | - } |
|
| 791 | - return; |
|
| 792 | - } |
|
| 789 | + return $out; |
|
| 790 | + } |
|
| 791 | + return; |
|
| 792 | + } |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | if (!function_exists('geodir_custom_taxonomy_walker2')) {
|
| 796 | - /** |
|
| 797 | - * Custom taxonomy walker function. |
|
| 798 | - * |
|
| 799 | - * @since 1.0.0 |
|
| 800 | - * @package GeoDirectory |
|
| 801 | - * @global object $post WordPress Post object. |
|
| 802 | - * @global object $gd_session GeoDirectory Session object. |
|
| 803 | - * @param string $cat_taxonomy The taxonomy name. |
|
| 804 | - * @param string $cat_limit Number of categories to display. |
|
| 805 | - */ |
|
| 806 | - function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
| 807 | - {
|
|
| 808 | - $post_category = ''; |
|
| 809 | - $post_category_str = ''; |
|
| 810 | - global $exclude_cats, $gd_session; |
|
| 811 | - |
|
| 812 | - $cat_exclude = ''; |
|
| 813 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
| 814 | - $cat_exclude = serialize($exclude_cats); |
|
| 815 | - |
|
| 816 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 817 | - $post = (object)$gd_session->get('listing');
|
|
| 818 | - |
|
| 819 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
| 820 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
| 821 | - |
|
| 822 | - $post_categories = $post->post_category_str; |
|
| 823 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
| 824 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 825 | - |
|
| 826 | - } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
|
|
| 827 | - global $post; |
|
| 828 | - |
|
| 829 | - $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
| 830 | - if (empty($post_category) && isset($post->{$cat_taxonomy})) {
|
|
| 831 | - $post_category = $post->{$cat_taxonomy};
|
|
| 832 | - } |
|
| 796 | + /** |
|
| 797 | + * Custom taxonomy walker function. |
|
| 798 | + * |
|
| 799 | + * @since 1.0.0 |
|
| 800 | + * @package GeoDirectory |
|
| 801 | + * @global object $post WordPress Post object. |
|
| 802 | + * @global object $gd_session GeoDirectory Session object. |
|
| 803 | + * @param string $cat_taxonomy The taxonomy name. |
|
| 804 | + * @param string $cat_limit Number of categories to display. |
|
| 805 | + */ |
|
| 806 | + function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
| 807 | + {
|
|
| 808 | + $post_category = ''; |
|
| 809 | + $post_category_str = ''; |
|
| 810 | + global $exclude_cats, $gd_session; |
|
| 811 | + |
|
| 812 | + $cat_exclude = ''; |
|
| 813 | + if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
| 814 | + $cat_exclude = serialize($exclude_cats); |
|
| 815 | + |
|
| 816 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 817 | + $post = (object)$gd_session->get('listing');
|
|
| 818 | + |
|
| 819 | + if (!is_array($post->post_category[$cat_taxonomy])) |
|
| 820 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
| 821 | + |
|
| 822 | + $post_categories = $post->post_category_str; |
|
| 823 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
| 824 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 825 | + |
|
| 826 | + } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
|
|
| 827 | + global $post; |
|
| 828 | + |
|
| 829 | + $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
| 830 | + if (empty($post_category) && isset($post->{$cat_taxonomy})) {
|
|
| 831 | + $post_category = $post->{$cat_taxonomy};
|
|
| 832 | + } |
|
| 833 | 833 | |
| 834 | - $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
| 834 | + $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
| 835 | 835 | |
| 836 | - if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 837 | - foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
|
|
| 838 | - if (is_numeric($cat_part)) {
|
|
| 839 | - $cat_part_arr[] = $cat_part; |
|
| 840 | - } |
|
| 841 | - } |
|
| 842 | - if (is_array($cat_part_arr)) {
|
|
| 843 | - $post_category = implode(',', $cat_part_arr);
|
|
| 844 | - } |
|
| 845 | - } |
|
| 836 | + if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 837 | + foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
|
|
| 838 | + if (is_numeric($cat_part)) {
|
|
| 839 | + $cat_part_arr[] = $cat_part; |
|
| 840 | + } |
|
| 841 | + } |
|
| 842 | + if (is_array($cat_part_arr)) {
|
|
| 843 | + $post_category = implode(',', $cat_part_arr);
|
|
| 844 | + } |
|
| 845 | + } |
|
| 846 | 846 | |
| 847 | - if (!empty($post_category)) {
|
|
| 848 | - $cat1 = array_filter(explode(',', $post_category));
|
|
| 849 | - $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 847 | + if (!empty($post_category)) {
|
|
| 848 | + $cat1 = array_filter(explode(',', $post_category));
|
|
| 849 | + $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 850 | 850 | |
| 851 | - } |
|
| 851 | + } |
|
| 852 | 852 | |
| 853 | - if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
|
|
| 853 | + if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
|
|
| 854 | 854 | |
| 855 | - $post_category_upd = explode(',', $post_category);
|
|
| 856 | - $post_category_change = ''; |
|
| 857 | - foreach ($post_category_upd as $cat) {
|
|
| 855 | + $post_category_upd = explode(',', $post_category);
|
|
| 856 | + $post_category_change = ''; |
|
| 857 | + foreach ($post_category_upd as $cat) {
|
|
| 858 | 858 | |
| 859 | - if (!in_array($cat, $exclude_cats) && $cat != '') {
|
|
| 860 | - $post_category_change .= ',' . $cat; |
|
| 861 | - } |
|
| 862 | - } |
|
| 863 | - $post_category = $post_category_change; |
|
| 864 | - } |
|
| 859 | + if (!in_array($cat, $exclude_cats) && $cat != '') {
|
|
| 860 | + $post_category_change .= ',' . $cat; |
|
| 861 | + } |
|
| 862 | + } |
|
| 863 | + $post_category = $post_category_change; |
|
| 864 | + } |
|
| 865 | 865 | |
| 866 | 866 | |
| 867 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 868 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 869 | - } |
|
| 870 | - } |
|
| 867 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 868 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 869 | + } |
|
| 870 | + } |
|
| 871 | 871 | |
| 872 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 872 | + echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 873 | 873 | |
| 874 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 874 | + echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 875 | 875 | |
| 876 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 876 | + echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 877 | 877 | |
| 878 | 878 | |
| 879 | - ?> |
|
| 879 | + ?> |
|
| 880 | 880 | <div class="cat_sublist"> |
| 881 | 881 | <?php |
| 882 | 882 | |
| 883 | - $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 883 | + $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 884 | 884 | |
| 885 | - if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 885 | + if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 886 | 886 | |
| 887 | - geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
| 888 | - } |
|
| 889 | - ?> |
|
| 887 | + geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
| 888 | + } |
|
| 889 | + ?> |
|
| 890 | 890 | </div> |
| 891 | 891 | <script type="text/javascript"> |
| 892 | 892 | |
@@ -1009,22 +1009,22 @@ discard block |
||
| 1009 | 1009 | |
| 1010 | 1010 | </script> |
| 1011 | 1011 | <?php |
| 1012 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 1013 | - $post_cat_str = $post_categories[$cat_taxonomy]; |
|
| 1014 | - $post_cat_array = explode("#", $post_cat_str);
|
|
| 1015 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
| 1016 | - $style = "display:none;"; |
|
| 1017 | - } |
|
| 1018 | - ?> |
|
| 1012 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 1013 | + $post_cat_str = $post_categories[$cat_taxonomy]; |
|
| 1014 | + $post_cat_array = explode("#", $post_cat_str);
|
|
| 1015 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
| 1016 | + $style = "display:none;"; |
|
| 1017 | + } |
|
| 1018 | + ?> |
|
| 1019 | 1019 | <div class="main_cat_list" style=" <?php if (isset($style)) {
|
| 1020 | - echo $style; |
|
| 1021 | - }?> "> |
|
| 1020 | + echo $style; |
|
| 1021 | + }?> "> |
|
| 1022 | 1022 | <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
| 1023 | - ?> |
|
| 1023 | + ?> |
|
| 1024 | 1024 | </div> |
| 1025 | 1025 | <?php |
| 1026 | 1026 | |
| 1027 | - } |
|
| 1027 | + } |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | /** |
@@ -1041,23 +1041,23 @@ discard block |
||
| 1041 | 1041 | */ |
| 1042 | 1042 | function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '') |
| 1043 | 1043 | {
|
| 1044 | - global $exclude_cats; |
|
| 1044 | + global $exclude_cats; |
|
| 1045 | 1045 | |
| 1046 | - if ($exclude != '') {
|
|
| 1047 | - $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
| 1046 | + if ($exclude != '') {
|
|
| 1047 | + $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
| 1048 | 1048 | |
| 1049 | - if(is_array( $exclude_cats)){
|
|
| 1050 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1051 | - }else{
|
|
| 1052 | - $exclude_cats = intval($exclude_cats); |
|
| 1053 | - } |
|
| 1049 | + if(is_array( $exclude_cats)){
|
|
| 1050 | + $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1051 | + }else{
|
|
| 1052 | + $exclude_cats = intval($exclude_cats); |
|
| 1053 | + } |
|
| 1054 | 1054 | |
| 1055 | - } |
|
| 1055 | + } |
|
| 1056 | 1056 | |
| 1057 | - if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
| 1058 | - (!is_array($exclude_cats) || empty($exclude_cats)) |
|
| 1059 | - ) {
|
|
| 1060 | - ?> |
|
| 1057 | + if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
| 1058 | + (!is_array($exclude_cats) || empty($exclude_cats)) |
|
| 1059 | + ) {
|
|
| 1060 | + ?> |
|
| 1061 | 1061 | |
| 1062 | 1062 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
| 1063 | 1063 | |
@@ -1086,8 +1086,8 @@ discard block |
||
| 1086 | 1086 | |
| 1087 | 1087 | <br/> |
| 1088 | 1088 | <?php |
| 1089 | - $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1090 | - if (!empty($cat_terms)) { ?>
|
|
| 1089 | + $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1090 | + if (!empty($cat_terms)) { ?>
|
|
| 1091 | 1091 | <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
|
| 1092 | 1092 | <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?> |
| 1093 | 1093 | <?php } ?> |
@@ -1109,53 +1109,53 @@ discard block |
||
| 1109 | 1109 | function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories) |
| 1110 | 1110 | {
|
| 1111 | 1111 | |
| 1112 | - if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
|
|
| 1113 | - $post_cat_str = $post_categories[$request_taxonomy]; |
|
| 1114 | - $post_cat_array = explode("#", $post_cat_str);
|
|
| 1115 | - if (is_array($post_cat_array)) {
|
|
| 1116 | - $post_cat_array = array_unique( $post_cat_array ); |
|
| 1112 | + if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
|
|
| 1113 | + $post_cat_str = $post_categories[$request_taxonomy]; |
|
| 1114 | + $post_cat_array = explode("#", $post_cat_str);
|
|
| 1115 | + if (is_array($post_cat_array)) {
|
|
| 1116 | + $post_cat_array = array_unique( $post_cat_array ); |
|
| 1117 | 1117 | |
| 1118 | 1118 | foreach ($post_cat_array as $post_cat_html) {
|
| 1119 | 1119 | |
| 1120 | - $post_cat_info = explode(":", $post_cat_html);
|
|
| 1121 | - $post_maincat_str = $post_cat_info[0]; |
|
| 1120 | + $post_cat_info = explode(":", $post_cat_html);
|
|
| 1121 | + $post_maincat_str = $post_cat_info[0]; |
|
| 1122 | 1122 | |
| 1123 | - if (!empty($post_maincat_str)) {
|
|
| 1124 | - $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1125 | - $post_maincat_id = $post_maincat_info[0]; |
|
| 1126 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1127 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1128 | - } |
|
| 1129 | - $post_sub_catid = ''; |
|
| 1130 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1131 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1132 | - } |
|
| 1123 | + if (!empty($post_maincat_str)) {
|
|
| 1124 | + $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1125 | + $post_maincat_id = $post_maincat_info[0]; |
|
| 1126 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1127 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1128 | + } |
|
| 1129 | + $post_sub_catid = ''; |
|
| 1130 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1131 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1132 | + } |
|
| 1133 | 1133 | |
| 1134 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1134 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1135 | 1135 | |
| 1136 | - } |
|
| 1137 | - } else {
|
|
| 1136 | + } |
|
| 1137 | + } else {
|
|
| 1138 | 1138 | |
| 1139 | - $post_cat_info = explode(":", $post_cat_str);
|
|
| 1140 | - $post_maincat_str = $post_cat_info[0]; |
|
| 1139 | + $post_cat_info = explode(":", $post_cat_str);
|
|
| 1140 | + $post_maincat_str = $post_cat_info[0]; |
|
| 1141 | 1141 | |
| 1142 | - $post_sub_catid = ''; |
|
| 1142 | + $post_sub_catid = ''; |
|
| 1143 | 1143 | |
| 1144 | - if (!empty($post_maincat_str)) {
|
|
| 1145 | - $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1146 | - $post_maincat_id = $post_maincat_info[0]; |
|
| 1147 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1148 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1149 | - } |
|
| 1144 | + if (!empty($post_maincat_str)) {
|
|
| 1145 | + $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1146 | + $post_maincat_id = $post_maincat_info[0]; |
|
| 1147 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1148 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1149 | + } |
|
| 1150 | 1150 | |
| 1151 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1152 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1153 | - } |
|
| 1151 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1152 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1153 | + } |
|
| 1154 | 1154 | |
| 1155 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1155 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1156 | 1156 | |
| 1157 | - } |
|
| 1158 | - } |
|
| 1157 | + } |
|
| 1158 | + } |
|
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | /** |
@@ -1169,35 +1169,35 @@ discard block |
||
| 1169 | 1169 | */ |
| 1170 | 1170 | function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false) |
| 1171 | 1171 | {
|
| 1172 | - global $exclude_cats; |
|
| 1172 | + global $exclude_cats; |
|
| 1173 | 1173 | |
| 1174 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1174 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1175 | 1175 | |
| 1176 | - if (!empty($cat_terms)) {
|
|
| 1177 | - $onchange = ''; |
|
| 1178 | - $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
| 1176 | + if (!empty($cat_terms)) {
|
|
| 1177 | + $onchange = ''; |
|
| 1178 | + $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
| 1179 | 1179 | |
| 1180 | - $option_selected = ''; |
|
| 1181 | - if (!$selected) |
|
| 1182 | - $option_slected = ' selected="selected" '; |
|
| 1180 | + $option_selected = ''; |
|
| 1181 | + if (!$selected) |
|
| 1182 | + $option_slected = ' selected="selected" '; |
|
| 1183 | 1183 | |
| 1184 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1184 | + echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1185 | 1185 | |
| 1186 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1186 | + echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1187 | 1187 | |
| 1188 | - foreach ($cat_terms as $cat_term) {
|
|
| 1189 | - $option_selected = ''; |
|
| 1190 | - if ($selected == $cat_term->term_id) |
|
| 1191 | - $option_selected = ' selected="selected" '; |
|
| 1188 | + foreach ($cat_terms as $cat_term) {
|
|
| 1189 | + $option_selected = ''; |
|
| 1190 | + if ($selected == $cat_term->term_id) |
|
| 1191 | + $option_selected = ' selected="selected" '; |
|
| 1192 | 1192 | |
| 1193 | - // Count child terms |
|
| 1194 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1195 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1193 | + // Count child terms |
|
| 1194 | + $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1195 | + $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1196 | 1196 | |
| 1197 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 1198 | - } |
|
| 1199 | - echo '</select>'; |
|
| 1200 | - } |
|
| 1197 | + echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 1198 | + } |
|
| 1199 | + echo '</select>'; |
|
| 1200 | + } |
|
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | /** |
@@ -1213,28 +1213,28 @@ discard block |
||
| 1213 | 1213 | */ |
| 1214 | 1214 | function geodir_custom_update_messages($messages) |
| 1215 | 1215 | {
|
| 1216 | - global $post, $post_ID; |
|
| 1217 | - |
|
| 1218 | - $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
|
|
| 1219 | - |
|
| 1220 | - foreach ($post_types as $post_type => $post_object) {
|
|
| 1221 | - |
|
| 1222 | - $messages[$post_type] = array( |
|
| 1223 | - 0 => '', // Unused. Messages start at index 1. |
|
| 1224 | - 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1225 | - 2 => __('Custom field updated.', 'geodirectory'),
|
|
| 1226 | - 3 => __('Custom field deleted.', 'geodirectory'),
|
|
| 1227 | - 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1228 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
|
|
| 1229 | - 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1230 | - 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1231 | - 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
|
| 1232 | - 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1233 | - 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
|
| 1234 | - ); |
|
| 1235 | - } |
|
| 1236 | - |
|
| 1237 | - return $messages; |
|
| 1216 | + global $post, $post_ID; |
|
| 1217 | + |
|
| 1218 | + $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
|
|
| 1219 | + |
|
| 1220 | + foreach ($post_types as $post_type => $post_object) {
|
|
| 1221 | + |
|
| 1222 | + $messages[$post_type] = array( |
|
| 1223 | + 0 => '', // Unused. Messages start at index 1. |
|
| 1224 | + 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1225 | + 2 => __('Custom field updated.', 'geodirectory'),
|
|
| 1226 | + 3 => __('Custom field deleted.', 'geodirectory'),
|
|
| 1227 | + 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1228 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
|
|
| 1229 | + 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1230 | + 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1231 | + 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
|
| 1232 | + 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1233 | + 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
|
| 1234 | + ); |
|
| 1235 | + } |
|
| 1236 | + |
|
| 1237 | + return $messages; |
|
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | |
@@ -1249,182 +1249,182 @@ discard block |
||
| 1249 | 1249 | function geodir_register_defaults() |
| 1250 | 1250 | {
|
| 1251 | 1251 | |
| 1252 | - global $wpdb; |
|
| 1253 | - |
|
| 1254 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1255 | - |
|
| 1256 | - if (!$listing_slug = get_option('geodir_listing_prefix'))
|
|
| 1257 | - $listing_slug = 'places'; |
|
| 1258 | - |
|
| 1259 | - /** |
|
| 1260 | - * Taxonomies |
|
| 1261 | - **/ |
|
| 1262 | - //if ( ! taxonomy_exists('gd_place_tags') )
|
|
| 1263 | - {
|
|
| 1264 | - |
|
| 1265 | - $gd_placetags = array(); |
|
| 1266 | - $gd_placetags['object_type'] = 'gd_place'; |
|
| 1267 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1268 | - $gd_placetags['args'] = array( |
|
| 1269 | - 'public' => true, |
|
| 1270 | - 'hierarchical' => false, |
|
| 1271 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1272 | - 'query_var' => true, |
|
| 1273 | - |
|
| 1274 | - 'labels' => array( |
|
| 1275 | - 'name' => __('Place Tags', 'geodirectory'),
|
|
| 1276 | - 'singular_name' => __('Place Tag', 'geodirectory'),
|
|
| 1277 | - 'search_items' => __('Search Place Tags', 'geodirectory'),
|
|
| 1278 | - 'popular_items' => __('Popular Place Tags', 'geodirectory'),
|
|
| 1279 | - 'all_items' => __('All Place Tags', 'geodirectory'),
|
|
| 1280 | - 'edit_item' => __('Edit Place Tag', 'geodirectory'),
|
|
| 1281 | - 'update_item' => __('Update Place Tag', 'geodirectory'),
|
|
| 1282 | - 'add_new_item' => __('Add New Place Tag', 'geodirectory'),
|
|
| 1283 | - 'new_item_name' => __('New Place Tag Name', 'geodirectory'),
|
|
| 1284 | - 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
|
|
| 1285 | - 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
|
|
| 1286 | - 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
|
|
| 1287 | - ), |
|
| 1288 | - ); |
|
| 1289 | - |
|
| 1290 | - |
|
| 1291 | - $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1292 | - $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
| 1293 | - update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1294 | - |
|
| 1295 | - |
|
| 1296 | - // Update post types and delete tmp options |
|
| 1297 | - flush_rewrite_rules(); |
|
| 1298 | - |
|
| 1299 | - } |
|
| 1300 | - |
|
| 1301 | - //if ( ! taxonomy_exists('gd_placecategory') )
|
|
| 1302 | - {
|
|
| 1303 | - |
|
| 1304 | - $gd_placecategory = array(); |
|
| 1305 | - $gd_placecategory['object_type'] = 'gd_place'; |
|
| 1306 | - $gd_placecategory['listing_slug'] = $listing_slug; |
|
| 1307 | - $gd_placecategory['args'] = array( |
|
| 1308 | - 'public' => true, |
|
| 1309 | - 'hierarchical' => true, |
|
| 1310 | - 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
|
|
| 1311 | - 'query_var' => true, |
|
| 1312 | - 'labels' => array( |
|
| 1313 | - 'name' => __('Place Categories', 'geodirectory'),
|
|
| 1314 | - 'singular_name' => __('Place Category', 'geodirectory'),
|
|
| 1315 | - 'search_items' => __('Search Place Categories', 'geodirectory'),
|
|
| 1316 | - 'popular_items' => __('Popular Place Categories', 'geodirectory'),
|
|
| 1317 | - 'all_items' => __('All Place Categories', 'geodirectory'),
|
|
| 1318 | - 'edit_item' => __('Edit Place Category', 'geodirectory'),
|
|
| 1319 | - 'update_item' => __('Update Place Category', 'geodirectory'),
|
|
| 1320 | - 'add_new_item' => __('Add New Place Category', 'geodirectory'),
|
|
| 1321 | - 'new_item_name' => __('New Place Category', 'geodirectory'),
|
|
| 1322 | - 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
|
|
| 1323 | - ), |
|
| 1324 | - ); |
|
| 1325 | - |
|
| 1326 | - |
|
| 1327 | - $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1328 | - $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
| 1329 | - update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1330 | - |
|
| 1331 | - |
|
| 1332 | - flush_rewrite_rules(); |
|
| 1333 | - } |
|
| 1334 | - |
|
| 1335 | - /** |
|
| 1336 | - * Post Types |
|
| 1337 | - **/ |
|
| 1338 | - |
|
| 1339 | - //if ( ! post_type_exists('gd_place') )
|
|
| 1340 | - {
|
|
| 1341 | - |
|
| 1342 | - $labels = array( |
|
| 1343 | - 'name' => __('Places', 'geodirectory'),
|
|
| 1344 | - 'singular_name' => __('Place', 'geodirectory'),
|
|
| 1345 | - 'add_new' => __('Add New', 'geodirectory'),
|
|
| 1346 | - 'add_new_item' => __('Add New Place', 'geodirectory'),
|
|
| 1347 | - 'edit_item' => __('Edit Place', 'geodirectory'),
|
|
| 1348 | - 'new_item' => __('New Place', 'geodirectory'),
|
|
| 1349 | - 'view_item' => __('View Place', 'geodirectory'),
|
|
| 1350 | - 'search_items' => __('Search Places', 'geodirectory'),
|
|
| 1351 | - 'not_found' => __('No Place Found', 'geodirectory'),
|
|
| 1352 | - 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
|
|
| 1353 | - |
|
| 1354 | - $place_default = array( |
|
| 1355 | - 'labels' => $labels, |
|
| 1356 | - 'can_export' => true, |
|
| 1357 | - 'capability_type' => 'post', |
|
| 1358 | - 'description' => 'Place post type.', |
|
| 1359 | - 'has_archive' => $listing_slug, |
|
| 1360 | - 'hierarchical' => false, |
|
| 1361 | - 'map_meta_cap' => true, |
|
| 1362 | - 'menu_icon' => $menu_icon, |
|
| 1363 | - 'public' => true, |
|
| 1364 | - 'query_var' => true, |
|
| 1365 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1366 | - 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
|
| 1367 | - 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
|
| 1368 | - |
|
| 1369 | - //Update custom post types |
|
| 1370 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 1371 | - $geodir_post_types['gd_place'] = $place_default; |
|
| 1372 | - update_option('geodir_post_types', $geodir_post_types);
|
|
| 1373 | - |
|
| 1374 | - // Update post types and delete tmp options |
|
| 1375 | - flush_rewrite_rules(); |
|
| 1376 | - } |
|
| 1377 | - |
|
| 1378 | - |
|
| 1379 | - geodir_register_taxonomies(); |
|
| 1380 | - geodir_register_post_types(); |
|
| 1381 | - |
|
| 1382 | - //die; |
|
| 1252 | + global $wpdb; |
|
| 1253 | + |
|
| 1254 | + $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1255 | + |
|
| 1256 | + if (!$listing_slug = get_option('geodir_listing_prefix'))
|
|
| 1257 | + $listing_slug = 'places'; |
|
| 1258 | + |
|
| 1259 | + /** |
|
| 1260 | + * Taxonomies |
|
| 1261 | + **/ |
|
| 1262 | + //if ( ! taxonomy_exists('gd_place_tags') )
|
|
| 1263 | + {
|
|
| 1264 | + |
|
| 1265 | + $gd_placetags = array(); |
|
| 1266 | + $gd_placetags['object_type'] = 'gd_place'; |
|
| 1267 | + $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1268 | + $gd_placetags['args'] = array( |
|
| 1269 | + 'public' => true, |
|
| 1270 | + 'hierarchical' => false, |
|
| 1271 | + 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1272 | + 'query_var' => true, |
|
| 1273 | + |
|
| 1274 | + 'labels' => array( |
|
| 1275 | + 'name' => __('Place Tags', 'geodirectory'),
|
|
| 1276 | + 'singular_name' => __('Place Tag', 'geodirectory'),
|
|
| 1277 | + 'search_items' => __('Search Place Tags', 'geodirectory'),
|
|
| 1278 | + 'popular_items' => __('Popular Place Tags', 'geodirectory'),
|
|
| 1279 | + 'all_items' => __('All Place Tags', 'geodirectory'),
|
|
| 1280 | + 'edit_item' => __('Edit Place Tag', 'geodirectory'),
|
|
| 1281 | + 'update_item' => __('Update Place Tag', 'geodirectory'),
|
|
| 1282 | + 'add_new_item' => __('Add New Place Tag', 'geodirectory'),
|
|
| 1283 | + 'new_item_name' => __('New Place Tag Name', 'geodirectory'),
|
|
| 1284 | + 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
|
|
| 1285 | + 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
|
|
| 1286 | + 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
|
|
| 1287 | + ), |
|
| 1288 | + ); |
|
| 1289 | + |
|
| 1290 | + |
|
| 1291 | + $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1292 | + $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
| 1293 | + update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1294 | + |
|
| 1295 | + |
|
| 1296 | + // Update post types and delete tmp options |
|
| 1297 | + flush_rewrite_rules(); |
|
| 1298 | + |
|
| 1299 | + } |
|
| 1300 | + |
|
| 1301 | + //if ( ! taxonomy_exists('gd_placecategory') )
|
|
| 1302 | + {
|
|
| 1303 | + |
|
| 1304 | + $gd_placecategory = array(); |
|
| 1305 | + $gd_placecategory['object_type'] = 'gd_place'; |
|
| 1306 | + $gd_placecategory['listing_slug'] = $listing_slug; |
|
| 1307 | + $gd_placecategory['args'] = array( |
|
| 1308 | + 'public' => true, |
|
| 1309 | + 'hierarchical' => true, |
|
| 1310 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
|
|
| 1311 | + 'query_var' => true, |
|
| 1312 | + 'labels' => array( |
|
| 1313 | + 'name' => __('Place Categories', 'geodirectory'),
|
|
| 1314 | + 'singular_name' => __('Place Category', 'geodirectory'),
|
|
| 1315 | + 'search_items' => __('Search Place Categories', 'geodirectory'),
|
|
| 1316 | + 'popular_items' => __('Popular Place Categories', 'geodirectory'),
|
|
| 1317 | + 'all_items' => __('All Place Categories', 'geodirectory'),
|
|
| 1318 | + 'edit_item' => __('Edit Place Category', 'geodirectory'),
|
|
| 1319 | + 'update_item' => __('Update Place Category', 'geodirectory'),
|
|
| 1320 | + 'add_new_item' => __('Add New Place Category', 'geodirectory'),
|
|
| 1321 | + 'new_item_name' => __('New Place Category', 'geodirectory'),
|
|
| 1322 | + 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
|
|
| 1323 | + ), |
|
| 1324 | + ); |
|
| 1325 | + |
|
| 1326 | + |
|
| 1327 | + $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1328 | + $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
| 1329 | + update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1330 | + |
|
| 1331 | + |
|
| 1332 | + flush_rewrite_rules(); |
|
| 1333 | + } |
|
| 1334 | + |
|
| 1335 | + /** |
|
| 1336 | + * Post Types |
|
| 1337 | + **/ |
|
| 1338 | + |
|
| 1339 | + //if ( ! post_type_exists('gd_place') )
|
|
| 1340 | + {
|
|
| 1341 | + |
|
| 1342 | + $labels = array( |
|
| 1343 | + 'name' => __('Places', 'geodirectory'),
|
|
| 1344 | + 'singular_name' => __('Place', 'geodirectory'),
|
|
| 1345 | + 'add_new' => __('Add New', 'geodirectory'),
|
|
| 1346 | + 'add_new_item' => __('Add New Place', 'geodirectory'),
|
|
| 1347 | + 'edit_item' => __('Edit Place', 'geodirectory'),
|
|
| 1348 | + 'new_item' => __('New Place', 'geodirectory'),
|
|
| 1349 | + 'view_item' => __('View Place', 'geodirectory'),
|
|
| 1350 | + 'search_items' => __('Search Places', 'geodirectory'),
|
|
| 1351 | + 'not_found' => __('No Place Found', 'geodirectory'),
|
|
| 1352 | + 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
|
|
| 1353 | + |
|
| 1354 | + $place_default = array( |
|
| 1355 | + 'labels' => $labels, |
|
| 1356 | + 'can_export' => true, |
|
| 1357 | + 'capability_type' => 'post', |
|
| 1358 | + 'description' => 'Place post type.', |
|
| 1359 | + 'has_archive' => $listing_slug, |
|
| 1360 | + 'hierarchical' => false, |
|
| 1361 | + 'map_meta_cap' => true, |
|
| 1362 | + 'menu_icon' => $menu_icon, |
|
| 1363 | + 'public' => true, |
|
| 1364 | + 'query_var' => true, |
|
| 1365 | + 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1366 | + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
|
| 1367 | + 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
|
| 1368 | + |
|
| 1369 | + //Update custom post types |
|
| 1370 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 1371 | + $geodir_post_types['gd_place'] = $place_default; |
|
| 1372 | + update_option('geodir_post_types', $geodir_post_types);
|
|
| 1373 | + |
|
| 1374 | + // Update post types and delete tmp options |
|
| 1375 | + flush_rewrite_rules(); |
|
| 1376 | + } |
|
| 1377 | + |
|
| 1378 | + |
|
| 1379 | + geodir_register_taxonomies(); |
|
| 1380 | + geodir_register_post_types(); |
|
| 1381 | + |
|
| 1382 | + //die; |
|
| 1383 | 1383 | |
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | 1386 | $gd_wpml_get_languages = ""; |
| 1387 | 1387 | function gd_wpml_get_lang_from_url($url) {
|
| 1388 | - global $sitepress, $gd_wpml_get_languages; |
|
| 1388 | + global $sitepress, $gd_wpml_get_languages; |
|
| 1389 | 1389 | |
| 1390 | - if (geodir_is_wpml()) {
|
|
| 1391 | - return $sitepress->get_language_from_url($url); |
|
| 1392 | - } |
|
| 1390 | + if (geodir_is_wpml()) {
|
|
| 1391 | + return $sitepress->get_language_from_url($url); |
|
| 1392 | + } |
|
| 1393 | 1393 | |
| 1394 | - if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {
|
|
| 1395 | - return $_REQUEST['lang']; |
|
| 1396 | - } |
|
| 1394 | + if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {
|
|
| 1395 | + return $_REQUEST['lang']; |
|
| 1396 | + } |
|
| 1397 | 1397 | |
| 1398 | - $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1398 | + $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1399 | 1399 | |
| 1400 | - // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
|
| 1401 | - $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1400 | + // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
|
| 1401 | + $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1402 | 1402 | |
| 1403 | - $url = str_replace($site_url,"",$url); |
|
| 1403 | + $url = str_replace($site_url,"",$url); |
|
| 1404 | 1404 | |
| 1405 | - $segments = explode('/', trim($url, '/'));
|
|
| 1405 | + $segments = explode('/', trim($url, '/'));
|
|
| 1406 | 1406 | |
| 1407 | - if ($gd_wpml_get_languages) {
|
|
| 1408 | - $langs = $gd_wpml_get_languages; |
|
| 1409 | - } else {
|
|
| 1410 | - $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
| 1411 | - } |
|
| 1407 | + if ($gd_wpml_get_languages) {
|
|
| 1408 | + $langs = $gd_wpml_get_languages; |
|
| 1409 | + } else {
|
|
| 1410 | + $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
| 1411 | + } |
|
| 1412 | 1412 | |
| 1413 | - if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
|
|
| 1414 | - return $segments[0]; |
|
| 1415 | - } |
|
| 1413 | + if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
|
|
| 1414 | + return $segments[0]; |
|
| 1415 | + } |
|
| 1416 | 1416 | |
| 1417 | - return false; |
|
| 1417 | + return false; |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | function gd_wpml_slug_translation_turned_on($post_type) {
|
| 1421 | 1421 | |
| 1422 | - global $sitepress; |
|
| 1423 | - $settings = $sitepress->get_settings(); |
|
| 1424 | - return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
| 1425 | - && $settings['posts_slug_translation']['types'][$post_type] |
|
| 1426 | - && isset($settings['posts_slug_translation']['on']) |
|
| 1427 | - && $settings['posts_slug_translation']['on']; |
|
| 1422 | + global $sitepress; |
|
| 1423 | + $settings = $sitepress->get_settings(); |
|
| 1424 | + return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
| 1425 | + && $settings['posts_slug_translation']['types'][$post_type] |
|
| 1426 | + && isset($settings['posts_slug_translation']['on']) |
|
| 1427 | + && $settings['posts_slug_translation']['on']; |
|
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | 1430 | |
@@ -1451,162 +1451,162 @@ discard block |
||
| 1451 | 1451 | */ |
| 1452 | 1452 | function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample) |
| 1453 | 1453 | {
|
| 1454 | - //echo $post_link."<br />".$sample ; |
|
| 1454 | + //echo $post_link."<br />".$sample ; |
|
| 1455 | 1455 | |
| 1456 | 1456 | |
| 1457 | - global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
|
| 1458 | - if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
|
|
| 1459 | - if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
|
|
| 1460 | - } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
|
|
| 1461 | - return $post_link; |
|
| 1462 | - } else {
|
|
| 1463 | - $orig_post = $post; |
|
| 1464 | - $post = $post_obj; |
|
| 1465 | - } |
|
| 1457 | + global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
|
| 1458 | + if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
|
|
| 1459 | + if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
|
|
| 1460 | + } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
|
|
| 1461 | + return $post_link; |
|
| 1462 | + } else {
|
|
| 1463 | + $orig_post = $post; |
|
| 1464 | + $post = $post_obj; |
|
| 1465 | + } |
|
| 1466 | 1466 | |
| 1467 | 1467 | |
| 1468 | 1468 | |
| 1469 | - if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit;
|
|
| 1469 | + if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit;
|
|
| 1470 | 1470 | |
| 1471 | 1471 | |
| 1472 | - // if we dont have a GD post then try to grab it |
|
| 1473 | - if(!isset($post->default_category)){
|
|
| 1474 | - $gd_post = geodir_get_post_info($post->ID); |
|
| 1475 | - if(!empty($gd_post)){
|
|
| 1476 | - $post = $gd_post; |
|
| 1477 | - } |
|
| 1478 | - } |
|
| 1472 | + // if we dont have a GD post then try to grab it |
|
| 1473 | + if(!isset($post->default_category)){
|
|
| 1474 | + $gd_post = geodir_get_post_info($post->ID); |
|
| 1475 | + if(!empty($gd_post)){
|
|
| 1476 | + $post = $gd_post; |
|
| 1477 | + } |
|
| 1478 | + } |
|
| 1479 | 1479 | |
| 1480 | 1480 | |
| 1481 | - $post_types = get_option('geodir_post_types');
|
|
| 1482 | - $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
| 1481 | + $post_types = get_option('geodir_post_types');
|
|
| 1482 | + $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
| 1483 | 1483 | |
| 1484 | - // Alter the CPT slug if WPML is set to do so |
|
| 1485 | - if(geodir_wpml_is_post_type_translated($post->post_type)){
|
|
| 1486 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1484 | + // Alter the CPT slug if WPML is set to do so |
|
| 1485 | + if(geodir_wpml_is_post_type_translated($post->post_type)){
|
|
| 1486 | + if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1487 | 1487 | |
| 1488 | - $org_slug = $slug; |
|
| 1489 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1490 | - $slug, |
|
| 1491 | - 'WordPress', |
|
| 1492 | - 'URL slug: ' . $slug, |
|
| 1493 | - $language_code); |
|
| 1488 | + $org_slug = $slug; |
|
| 1489 | + $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1490 | + $slug, |
|
| 1491 | + 'WordPress', |
|
| 1492 | + 'URL slug: ' . $slug, |
|
| 1493 | + $language_code); |
|
| 1494 | 1494 | |
| 1495 | - if(!$slug){$slug = $org_slug;}
|
|
| 1495 | + if(!$slug){$slug = $org_slug;}
|
|
| 1496 | 1496 | |
| 1497 | - } |
|
| 1498 | - } |
|
| 1497 | + } |
|
| 1498 | + } |
|
| 1499 | 1499 | |
| 1500 | - if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1501 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 1502 | - } |
|
| 1500 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1501 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 1502 | + } |
|
| 1503 | 1503 | |
| 1504 | - // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
| 1505 | - $site_url = trailingslashit(get_bloginfo('url'));
|
|
| 1504 | + // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
| 1505 | + $site_url = trailingslashit(get_bloginfo('url'));
|
|
| 1506 | 1506 | |
| 1507 | - if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1508 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 1509 | - } |
|
| 1510 | - |
|
| 1511 | - $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
| 1512 | - if ($fix_url) {
|
|
| 1513 | - $post_link = str_replace($site_url, '', $post_link); |
|
| 1514 | - } |
|
| 1515 | - |
|
| 1516 | - $post_link = trailingslashit( |
|
| 1517 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1518 | - ); |
|
| 1519 | - |
|
| 1520 | - if ($fix_url) {
|
|
| 1521 | - $post_link = $site_url . $post_link; |
|
| 1522 | - } |
|
| 1523 | - |
|
| 1524 | - if (isset($comment_post_cache[$post->ID])) {
|
|
| 1525 | - $post = $comment_post_cache[$post->ID]; |
|
| 1526 | - } |
|
| 1527 | - if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
|
|
| 1528 | - $post_id = $post->ID; |
|
| 1529 | - if (isset($orig_post)) {
|
|
| 1530 | - $post = $orig_post; |
|
| 1531 | - } |
|
| 1532 | - return $gd_permalink_cache[$post_id]; |
|
| 1533 | - } |
|
| 1507 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1508 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 1509 | + } |
|
| 1534 | 1510 | |
| 1535 | - if (!isset($post->post_locations)) {
|
|
| 1536 | - $post_type = $post->post_type; |
|
| 1537 | - $ID = $post->ID; |
|
| 1538 | - $post2 = $wpdb->get_row( |
|
| 1539 | - $wpdb->prepare( |
|
| 1540 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1541 | - array($post->ID) |
|
| 1542 | - ) |
|
| 1543 | - ); |
|
| 1511 | + $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
| 1512 | + if ($fix_url) {
|
|
| 1513 | + $post_link = str_replace($site_url, '', $post_link); |
|
| 1514 | + } |
|
| 1544 | 1515 | |
| 1545 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1516 | + $post_link = trailingslashit( |
|
| 1517 | + preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1518 | + ); |
|
| 1546 | 1519 | |
| 1547 | - $comment_post_cache[$post->ID] = $post; |
|
| 1548 | - } |
|
| 1520 | + if ($fix_url) {
|
|
| 1521 | + $post_link = $site_url . $post_link; |
|
| 1522 | + } |
|
| 1549 | 1523 | |
| 1524 | + if (isset($comment_post_cache[$post->ID])) {
|
|
| 1525 | + $post = $comment_post_cache[$post->ID]; |
|
| 1526 | + } |
|
| 1527 | + if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
|
|
| 1528 | + $post_id = $post->ID; |
|
| 1529 | + if (isset($orig_post)) {
|
|
| 1530 | + $post = $orig_post; |
|
| 1531 | + } |
|
| 1532 | + return $gd_permalink_cache[$post_id]; |
|
| 1533 | + } |
|
| 1550 | 1534 | |
| 1535 | + if (!isset($post->post_locations)) {
|
|
| 1536 | + $post_type = $post->post_type; |
|
| 1537 | + $ID = $post->ID; |
|
| 1538 | + $post2 = $wpdb->get_row( |
|
| 1539 | + $wpdb->prepare( |
|
| 1540 | + "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1541 | + array($post->ID) |
|
| 1542 | + ) |
|
| 1543 | + ); |
|
| 1551 | 1544 | |
| 1552 | - if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
|
| 1545 | + $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1553 | 1546 | |
| 1554 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1555 | - $location_request = ''; |
|
| 1547 | + $comment_post_cache[$post->ID] = $post; |
|
| 1548 | + } |
|
| 1556 | 1549 | |
| 1557 | 1550 | |
| 1558 | - if (!empty($post->post_locations)) {
|
|
| 1559 | - $geodir_arr_locations = explode(',', $post->post_locations);
|
|
| 1560 | - if (count($geodir_arr_locations) == 3) {
|
|
| 1561 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1562 | - $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1563 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1564 | - $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1565 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1566 | - $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1567 | 1551 | |
| 1568 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1569 | - 'region_slug' => $post->region_slug, |
|
| 1570 | - 'city_slug' => $post->city_slug |
|
| 1571 | - ); |
|
| 1552 | + if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
|
| 1572 | 1553 | |
| 1573 | - } else |
|
| 1574 | - $post_location = geodir_get_location(); |
|
| 1554 | + if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1555 | + $location_request = ''; |
|
| 1575 | 1556 | |
| 1576 | 1557 | |
| 1577 | - } else {
|
|
| 1558 | + if (!empty($post->post_locations)) {
|
|
| 1559 | + $geodir_arr_locations = explode(',', $post->post_locations);
|
|
| 1560 | + if (count($geodir_arr_locations) == 3) {
|
|
| 1561 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1562 | + $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1563 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1564 | + $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1565 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1566 | + $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1578 | 1567 | |
| 1579 | - $post_location_sql = $wpdb->get_results( |
|
| 1580 | - $wpdb->prepare( |
|
| 1581 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1582 | - array($post->ID) |
|
| 1583 | - ) |
|
| 1584 | - ); |
|
| 1585 | - |
|
| 1586 | - if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
|
|
| 1587 | - |
|
| 1588 | - $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
|
|
| 1589 | - if (count($geodir_arr_locations) == 3) {
|
|
| 1590 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1591 | - $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1592 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1593 | - $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1594 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1595 | - $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1596 | - |
|
| 1597 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1598 | - 'region_slug' => $post->region_slug, |
|
| 1599 | - 'city_slug' => $post->city_slug |
|
| 1600 | - ); |
|
| 1568 | + $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1569 | + 'region_slug' => $post->region_slug, |
|
| 1570 | + 'city_slug' => $post->city_slug |
|
| 1571 | + ); |
|
| 1601 | 1572 | |
| 1602 | - } |
|
| 1603 | - } else |
|
| 1604 | - $post_location = geodir_get_location(); |
|
| 1605 | - } |
|
| 1573 | + } else |
|
| 1574 | + $post_location = geodir_get_location(); |
|
| 1575 | + |
|
| 1576 | + |
|
| 1577 | + } else {
|
|
| 1578 | + |
|
| 1579 | + $post_location_sql = $wpdb->get_results( |
|
| 1580 | + $wpdb->prepare( |
|
| 1581 | + "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1582 | + array($post->ID) |
|
| 1583 | + ) |
|
| 1584 | + ); |
|
| 1585 | + |
|
| 1586 | + if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
|
|
| 1587 | + |
|
| 1588 | + $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
|
|
| 1589 | + if (count($geodir_arr_locations) == 3) {
|
|
| 1590 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1591 | + $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1592 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1593 | + $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1594 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1595 | + $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1596 | + |
|
| 1597 | + $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1598 | + 'region_slug' => $post->region_slug, |
|
| 1599 | + 'city_slug' => $post->city_slug |
|
| 1600 | + ); |
|
| 1601 | + |
|
| 1602 | + } |
|
| 1603 | + } else |
|
| 1604 | + $post_location = geodir_get_location(); |
|
| 1605 | + } |
|
| 1606 | 1606 | |
| 1607 | 1607 | |
| 1608 | - if (!empty($post_location)) {
|
|
| 1609 | - $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
| 1608 | + if (!empty($post_location)) {
|
|
| 1609 | + $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
| 1610 | 1610 | $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
| 1611 | 1611 | $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
| 1612 | 1612 | |
@@ -1624,88 +1624,88 @@ discard block |
||
| 1624 | 1624 | $location_slug[] = $city_slug; |
| 1625 | 1625 | |
| 1626 | 1626 | $location_request .= implode('/', $location_slug) . '/';
|
| 1627 | - } |
|
| 1628 | - } |
|
| 1627 | + } |
|
| 1628 | + } |
|
| 1629 | 1629 | |
| 1630 | - if (get_option('geodir_add_categories_url')) {
|
|
| 1630 | + if (get_option('geodir_add_categories_url')) {
|
|
| 1631 | 1631 | |
| 1632 | - $term_request = ''; |
|
| 1633 | - $taxonomies = geodir_get_taxonomies($post->post_type); |
|
| 1634 | - $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : ''; |
|
| 1632 | + $term_request = ''; |
|
| 1633 | + $taxonomies = geodir_get_taxonomies($post->post_type); |
|
| 1634 | + $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : ''; |
|
| 1635 | 1635 | |
| 1636 | - if (!empty($post->default_category)) {
|
|
| 1637 | - $post_terms = $post->default_category; |
|
| 1638 | - } else {
|
|
| 1639 | - $post_terms = ''; |
|
| 1640 | - |
|
| 1641 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
|
|
| 1642 | - $post_terms = absint($_POST['post_default_category']); |
|
| 1643 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1644 | - $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
|
|
| 1645 | - $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
|
| 1646 | - }elseif (isset($post->{$taxonomies})) {
|
|
| 1647 | - $post_terms = explode(",", trim($post->{$taxonomies}, ","));
|
|
| 1648 | - $post_terms = $post_terms[0]; |
|
| 1649 | - } |
|
| 1636 | + if (!empty($post->default_category)) {
|
|
| 1637 | + $post_terms = $post->default_category; |
|
| 1638 | + } else {
|
|
| 1639 | + $post_terms = ''; |
|
| 1640 | + |
|
| 1641 | + if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
|
|
| 1642 | + $post_terms = absint($_POST['post_default_category']); |
|
| 1643 | + }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1644 | + $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
|
|
| 1645 | + $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
|
| 1646 | + }elseif (isset($post->{$taxonomies})) {
|
|
| 1647 | + $post_terms = explode(",", trim($post->{$taxonomies}, ","));
|
|
| 1648 | + $post_terms = $post_terms[0]; |
|
| 1649 | + } |
|
| 1650 | 1650 | |
| 1651 | - if (!$post_terms) |
|
| 1652 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1651 | + if (!$post_terms) |
|
| 1652 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1653 | 1653 | |
| 1654 | - if (!$post_terms) {
|
|
| 1655 | - $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
| 1654 | + if (!$post_terms) {
|
|
| 1655 | + $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
| 1656 | 1656 | |
| 1657 | - if ($post_terms) {
|
|
| 1658 | - $post_terms = explode(",", trim($post_terms, ","));
|
|
| 1659 | - $post_terms = $post_terms[0]; |
|
| 1660 | - } |
|
| 1661 | - } |
|
| 1662 | - } |
|
| 1657 | + if ($post_terms) {
|
|
| 1658 | + $post_terms = explode(",", trim($post_terms, ","));
|
|
| 1659 | + $post_terms = $post_terms[0]; |
|
| 1660 | + } |
|
| 1661 | + } |
|
| 1662 | + } |
|
| 1663 | 1663 | |
| 1664 | - $term = get_term_by('id', $post_terms, $taxonomies);
|
|
| 1664 | + $term = get_term_by('id', $post_terms, $taxonomies);
|
|
| 1665 | 1665 | |
| 1666 | - if (!empty($term)) |
|
| 1667 | - $term_request = $term->slug; |
|
| 1668 | - //$term_request = $term->slug.'/'; |
|
| 1669 | - } |
|
| 1666 | + if (!empty($term)) |
|
| 1667 | + $term_request = $term->slug; |
|
| 1668 | + //$term_request = $term->slug.'/'; |
|
| 1669 | + } |
|
| 1670 | 1670 | |
| 1671 | - $request_term = ''; |
|
| 1672 | - $listingurl_separator = ''; |
|
| 1673 | - //$detailurl_separator = get_option('geodir_detailurl_separator');
|
|
| 1674 | - $detailurl_separator = ''; |
|
| 1675 | - if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
|
|
| 1676 | - $request_term = $location_request; |
|
| 1677 | - //$listingurl_separator = get_option('geodir_listingurl_separator');
|
|
| 1678 | - //$request_term .= $listingurl_separator.'/'.$term_request; |
|
| 1679 | - $request_term .= $term_request; |
|
| 1671 | + $request_term = ''; |
|
| 1672 | + $listingurl_separator = ''; |
|
| 1673 | + //$detailurl_separator = get_option('geodir_detailurl_separator');
|
|
| 1674 | + $detailurl_separator = ''; |
|
| 1675 | + if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
|
|
| 1676 | + $request_term = $location_request; |
|
| 1677 | + //$listingurl_separator = get_option('geodir_listingurl_separator');
|
|
| 1678 | + //$request_term .= $listingurl_separator.'/'.$term_request; |
|
| 1679 | + $request_term .= $term_request; |
|
| 1680 | 1680 | |
| 1681 | - } else {
|
|
| 1682 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
| 1681 | + } else {
|
|
| 1682 | + if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
| 1683 | 1683 | |
| 1684 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
| 1685 | - } |
|
| 1686 | - $request_term = trim($request_term, '/'); |
|
| 1684 | + if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
| 1685 | + } |
|
| 1686 | + $request_term = trim($request_term, '/'); |
|
| 1687 | 1687 | |
| 1688 | - // Fix with WPML the location terms added twice when CPT slug is translated. |
|
| 1689 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
|
|
| 1690 | - $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
|
|
| 1691 | - } |
|
| 1688 | + // Fix with WPML the location terms added twice when CPT slug is translated. |
|
| 1689 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
|
|
| 1690 | + $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
|
|
| 1691 | + } |
|
| 1692 | 1692 | |
| 1693 | - if (!empty($request_term)) |
|
| 1694 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1695 | - else |
|
| 1696 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1697 | - //echo $post_link ; |
|
| 1698 | - } |
|
| 1699 | - // temp cache the permalink |
|
| 1700 | - if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
|
|
| 1701 | - $gd_permalink_cache[$post->ID] = $post_link; |
|
| 1702 | - } |
|
| 1703 | - } |
|
| 1704 | - if (isset($orig_post)) {
|
|
| 1705 | - $post = $orig_post; |
|
| 1706 | - } |
|
| 1707 | - |
|
| 1708 | - return $post_link; |
|
| 1693 | + if (!empty($request_term)) |
|
| 1694 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1695 | + else |
|
| 1696 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1697 | + //echo $post_link ; |
|
| 1698 | + } |
|
| 1699 | + // temp cache the permalink |
|
| 1700 | + if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
|
|
| 1701 | + $gd_permalink_cache[$post->ID] = $post_link; |
|
| 1702 | + } |
|
| 1703 | + } |
|
| 1704 | + if (isset($orig_post)) {
|
|
| 1705 | + $post = $orig_post; |
|
| 1706 | + } |
|
| 1707 | + |
|
| 1708 | + return $post_link; |
|
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | 1711 | /** |
@@ -1721,117 +1721,117 @@ discard block |
||
| 1721 | 1721 | * @return string The term link. |
| 1722 | 1722 | */ |
| 1723 | 1723 | function geodir_term_link($termlink, $term, $taxonomy) {
|
| 1724 | - $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1724 | + $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1725 | 1725 | |
| 1726 | - if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
|
|
| 1727 | - global $geodir_add_location_url, $gd_session; |
|
| 1728 | - $include_location = false; |
|
| 1729 | - $request_term = array(); |
|
| 1730 | - $add_location_url = get_option('geodir_add_location_url');
|
|
| 1731 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
|
| 1726 | + if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
|
|
| 1727 | + global $geodir_add_location_url, $gd_session; |
|
| 1728 | + $include_location = false; |
|
| 1729 | + $request_term = array(); |
|
| 1730 | + $add_location_url = get_option('geodir_add_location_url');
|
|
| 1731 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
|
| 1732 | 1732 | |
| 1733 | - $listing_slug = geodir_get_listing_slug($taxonomy); |
|
| 1733 | + $listing_slug = geodir_get_listing_slug($taxonomy); |
|
| 1734 | 1734 | |
| 1735 | - if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
|
|
| 1736 | - if ($geodir_add_location_url && $add_location_url) {
|
|
| 1737 | - $include_location = true; |
|
| 1738 | - } |
|
| 1739 | - } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
|
|
| 1740 | - $include_location = true; |
|
| 1741 | - } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
|
|
| 1742 | - $include_location = true; |
|
| 1743 | - } |
|
| 1744 | - |
|
| 1745 | - if ($include_location) {
|
|
| 1746 | - global $post; |
|
| 1747 | - $location_terms = array(); |
|
| 1735 | + if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
|
|
| 1736 | + if ($geodir_add_location_url && $add_location_url) {
|
|
| 1737 | + $include_location = true; |
|
| 1738 | + } |
|
| 1739 | + } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
|
|
| 1740 | + $include_location = true; |
|
| 1741 | + } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
|
|
| 1742 | + $include_location = true; |
|
| 1743 | + } |
|
| 1744 | + |
|
| 1745 | + if ($include_location) {
|
|
| 1746 | + global $post; |
|
| 1747 | + $location_terms = array(); |
|
| 1748 | 1748 | |
| 1749 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 1749 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 1750 | 1750 | |
| 1751 | - if (geodir_is_page('detail')) {
|
|
| 1752 | - if (!isset($post->country_slug) && !empty($post->post_locations)) {
|
|
| 1753 | - $post_locations = explode(',', $post->post_locations);
|
|
| 1754 | - |
|
| 1755 | - if (count($post_locations) == 3) {
|
|
| 1756 | - $post->city_slug = str_replace('[', '', $post_locations[0]);
|
|
| 1757 | - $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1758 | - $post->region_slug = str_replace('[', '', $post_locations[1]);
|
|
| 1759 | - $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1760 | - $post->country_slug = str_replace('[', '', $post_locations[2]);
|
|
| 1761 | - $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1762 | - } |
|
| 1763 | - } |
|
| 1751 | + if (geodir_is_page('detail')) {
|
|
| 1752 | + if (!isset($post->country_slug) && !empty($post->post_locations)) {
|
|
| 1753 | + $post_locations = explode(',', $post->post_locations);
|
|
| 1754 | + |
|
| 1755 | + if (count($post_locations) == 3) {
|
|
| 1756 | + $post->city_slug = str_replace('[', '', $post_locations[0]);
|
|
| 1757 | + $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1758 | + $post->region_slug = str_replace('[', '', $post_locations[1]);
|
|
| 1759 | + $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1760 | + $post->country_slug = str_replace('[', '', $post_locations[2]);
|
|
| 1761 | + $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1762 | + } |
|
| 1763 | + } |
|
| 1764 | 1764 | |
| 1765 | - if (isset($post->country_slug)) {
|
|
| 1766 | - $location_terms = array( |
|
| 1767 | - 'gd_country' => $post->country_slug, |
|
| 1768 | - 'gd_region' => $post->region_slug, |
|
| 1769 | - 'gd_city' => $post->city_slug |
|
| 1770 | - ); |
|
| 1765 | + if (isset($post->country_slug)) {
|
|
| 1766 | + $location_terms = array( |
|
| 1767 | + 'gd_country' => $post->country_slug, |
|
| 1768 | + 'gd_region' => $post->region_slug, |
|
| 1769 | + 'gd_city' => $post->city_slug |
|
| 1770 | + ); |
|
| 1771 | 1771 | |
| 1772 | - if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
|
|
| 1773 | - $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
| 1774 | - } |
|
| 1775 | - } |
|
| 1776 | - } |
|
| 1772 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
|
|
| 1773 | + $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
| 1774 | + } |
|
| 1775 | + } |
|
| 1776 | + } |
|
| 1777 | 1777 | |
| 1778 | - if (empty($location_terms)) {
|
|
| 1779 | - $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1780 | - } |
|
| 1778 | + if (empty($location_terms)) {
|
|
| 1779 | + $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1780 | + } |
|
| 1781 | 1781 | |
| 1782 | - $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 1783 | - $location_terms = geodir_remove_location_terms($location_terms); |
|
| 1782 | + $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 1783 | + $location_terms = geodir_remove_location_terms($location_terms); |
|
| 1784 | 1784 | |
| 1785 | - if (!empty($location_terms)) {
|
|
| 1786 | - $url_separator = ''; |
|
| 1785 | + if (!empty($location_terms)) {
|
|
| 1786 | + $url_separator = ''; |
|
| 1787 | 1787 | |
| 1788 | - if (get_option('permalink_structure') != '') {
|
|
| 1789 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1790 | - $request_term = implode("/", $location_terms);
|
|
| 1791 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1788 | + if (get_option('permalink_structure') != '') {
|
|
| 1789 | + $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1790 | + $request_term = implode("/", $location_terms);
|
|
| 1791 | + $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1792 | 1792 | |
| 1793 | - $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
|
| 1794 | - } else {
|
|
| 1795 | - $termlink = geodir_getlink($termlink, $request_term); |
|
| 1796 | - } |
|
| 1797 | - } |
|
| 1798 | - } |
|
| 1793 | + $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
|
| 1794 | + } else {
|
|
| 1795 | + $termlink = geodir_getlink($termlink, $request_term); |
|
| 1796 | + } |
|
| 1797 | + } |
|
| 1798 | + } |
|
| 1799 | 1799 | |
| 1800 | - // Alter the CPT slug is WPML is set to do so |
|
| 1801 | - /* we can replace this with the below function |
|
| 1800 | + // Alter the CPT slug is WPML is set to do so |
|
| 1801 | + /* we can replace this with the below function |
|
| 1802 | 1802 | if(geodir_is_wpml()){
|
| 1803 | 1803 | global $sitepress; |
| 1804 | 1804 | $post_type = str_replace("category","",$taxonomy);
|
| 1805 | 1805 | $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type); |
| 1806 | 1806 | }*/ |
| 1807 | 1807 | |
| 1808 | - // Alter the CPT slug if WPML is set to do so |
|
| 1809 | - if (geodir_is_wpml()) {
|
|
| 1810 | - $post_types = get_option('geodir_post_types');
|
|
| 1811 | - $post_type = str_replace("category","",$taxonomy);
|
|
| 1812 | - $post_type = str_replace("_tags","",$post_type);
|
|
| 1813 | - $slug = $post_types[$post_type]['rewrite']['slug']; |
|
| 1814 | - if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
|
|
| 1815 | - global $sitepress; |
|
| 1816 | - $default_lang = $sitepress->get_default_language(); |
|
| 1817 | - $language_code = gd_wpml_get_lang_from_url($termlink); |
|
| 1818 | - if (!$language_code ) {
|
|
| 1819 | - $language_code = $default_lang; |
|
| 1820 | - } |
|
| 1808 | + // Alter the CPT slug if WPML is set to do so |
|
| 1809 | + if (geodir_is_wpml()) {
|
|
| 1810 | + $post_types = get_option('geodir_post_types');
|
|
| 1811 | + $post_type = str_replace("category","",$taxonomy);
|
|
| 1812 | + $post_type = str_replace("_tags","",$post_type);
|
|
| 1813 | + $slug = $post_types[$post_type]['rewrite']['slug']; |
|
| 1814 | + if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
|
|
| 1815 | + global $sitepress; |
|
| 1816 | + $default_lang = $sitepress->get_default_language(); |
|
| 1817 | + $language_code = gd_wpml_get_lang_from_url($termlink); |
|
| 1818 | + if (!$language_code ) {
|
|
| 1819 | + $language_code = $default_lang; |
|
| 1820 | + } |
|
| 1821 | 1821 | |
| 1822 | - $org_slug = $slug; |
|
| 1823 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1822 | + $org_slug = $slug; |
|
| 1823 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1824 | 1824 | |
| 1825 | - if (!$slug) {
|
|
| 1826 | - $slug = $org_slug; |
|
| 1827 | - } |
|
| 1825 | + if (!$slug) {
|
|
| 1826 | + $slug = $org_slug; |
|
| 1827 | + } |
|
| 1828 | 1828 | |
| 1829 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1830 | - } |
|
| 1831 | - } |
|
| 1832 | - } |
|
| 1829 | + $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1830 | + } |
|
| 1831 | + } |
|
| 1832 | + } |
|
| 1833 | 1833 | |
| 1834 | - return $termlink; |
|
| 1834 | + return $termlink; |
|
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | 1837 | /** |
@@ -1857,14 +1857,14 @@ discard block |
||
| 1857 | 1857 | if (in_array($post_type, geodir_get_posttypes())) {
|
| 1858 | 1858 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
|
| 1859 | 1859 | if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
| 1860 | - $location_terms = array( |
|
| 1861 | - 'gd_country' => $post->country_slug, |
|
| 1862 | - 'gd_region' => $post->region_slug, |
|
| 1863 | - 'gd_city' => $post->city_slug |
|
| 1864 | - ); |
|
| 1865 | - } else {
|
|
| 1866 | - $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1867 | - } |
|
| 1860 | + $location_terms = array( |
|
| 1861 | + 'gd_country' => $post->country_slug, |
|
| 1862 | + 'gd_region' => $post->region_slug, |
|
| 1863 | + 'gd_city' => $post->city_slug |
|
| 1864 | + ); |
|
| 1865 | + } else {
|
|
| 1866 | + $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1867 | + } |
|
| 1868 | 1868 | |
| 1869 | 1869 | $location_terms = geodir_remove_location_terms($location_terms); |
| 1870 | 1870 | |
@@ -1896,17 +1896,17 @@ discard block |
||
| 1896 | 1896 | * @return void|string Label. |
| 1897 | 1897 | */ |
| 1898 | 1898 | function get_post_type_singular_label($post_type, $echo = false, $translate = false) {
|
| 1899 | - $obj_post_type = get_post_type_object($post_type); |
|
| 1900 | - if (!is_object($obj_post_type)) {
|
|
| 1901 | - return; |
|
| 1902 | - } |
|
| 1899 | + $obj_post_type = get_post_type_object($post_type); |
|
| 1900 | + if (!is_object($obj_post_type)) {
|
|
| 1901 | + return; |
|
| 1902 | + } |
|
| 1903 | 1903 | |
| 1904 | - $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
| 1904 | + $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
| 1905 | 1905 | |
| 1906 | - if ($echo) |
|
| 1907 | - echo $label; |
|
| 1908 | - else |
|
| 1909 | - return $label; |
|
| 1906 | + if ($echo) |
|
| 1907 | + echo $label; |
|
| 1908 | + else |
|
| 1909 | + return $label; |
|
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | 1912 | /** |
@@ -1921,19 +1921,19 @@ discard block |
||
| 1921 | 1921 | * @return void|string Label. |
| 1922 | 1922 | */ |
| 1923 | 1923 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
|
| 1924 | - $all_postypes = geodir_get_posttypes(); |
|
| 1924 | + $all_postypes = geodir_get_posttypes(); |
|
| 1925 | 1925 | |
| 1926 | - if (!in_array($post_type, $all_postypes)) |
|
| 1927 | - return false; |
|
| 1926 | + if (!in_array($post_type, $all_postypes)) |
|
| 1927 | + return false; |
|
| 1928 | 1928 | |
| 1929 | - $obj_post_type = get_post_type_object($post_type); |
|
| 1929 | + $obj_post_type = get_post_type_object($post_type); |
|
| 1930 | 1930 | |
| 1931 | - $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
| 1931 | + $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
| 1932 | 1932 | |
| 1933 | - if ($echo) |
|
| 1934 | - echo $label; |
|
| 1935 | - else |
|
| 1936 | - return $label; |
|
| 1933 | + if ($echo) |
|
| 1934 | + echo $label; |
|
| 1935 | + else |
|
| 1936 | + return $label; |
|
| 1937 | 1937 | } |
| 1938 | 1938 | |
| 1939 | 1939 | /** |
@@ -1951,51 +1951,51 @@ discard block |
||
| 1951 | 1951 | */ |
| 1952 | 1952 | function geodir_term_exists($term, $taxonomy = '', $parent = 0) |
| 1953 | 1953 | {
|
| 1954 | - global $wpdb; |
|
| 1955 | - |
|
| 1956 | - $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
| 1957 | - $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
| 1958 | - |
|
| 1959 | - if (is_int($term)) {
|
|
| 1960 | - if (0 == $term) |
|
| 1961 | - return 0; |
|
| 1962 | - $where = 't.term_id = %d'; |
|
| 1963 | - if (!empty($taxonomy)) |
|
| 1964 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1965 | - else |
|
| 1966 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1967 | - } |
|
| 1954 | + global $wpdb; |
|
| 1955 | + |
|
| 1956 | + $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
| 1957 | + $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
| 1958 | + |
|
| 1959 | + if (is_int($term)) {
|
|
| 1960 | + if (0 == $term) |
|
| 1961 | + return 0; |
|
| 1962 | + $where = 't.term_id = %d'; |
|
| 1963 | + if (!empty($taxonomy)) |
|
| 1964 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1965 | + else |
|
| 1966 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1967 | + } |
|
| 1968 | 1968 | |
| 1969 | - $term = trim(wp_unslash($term)); |
|
| 1969 | + $term = trim(wp_unslash($term)); |
|
| 1970 | 1970 | |
| 1971 | - if ('' === $slug = sanitize_title($term))
|
|
| 1972 | - return 0; |
|
| 1971 | + if ('' === $slug = sanitize_title($term))
|
|
| 1972 | + return 0; |
|
| 1973 | 1973 | |
| 1974 | - $where = 't.slug = %s'; |
|
| 1974 | + $where = 't.slug = %s'; |
|
| 1975 | 1975 | |
| 1976 | - $where_fields = array($slug); |
|
| 1977 | - if (!empty($taxonomy)) {
|
|
| 1978 | - $parent = (int)$parent; |
|
| 1979 | - if ($parent > 0) {
|
|
| 1980 | - $where_fields[] = $parent; |
|
| 1981 | - $else_where_fields[] = $parent; |
|
| 1982 | - $where .= ' AND tt.parent = %d'; |
|
| 1976 | + $where_fields = array($slug); |
|
| 1977 | + if (!empty($taxonomy)) {
|
|
| 1978 | + $parent = (int)$parent; |
|
| 1979 | + if ($parent > 0) {
|
|
| 1980 | + $where_fields[] = $parent; |
|
| 1981 | + $else_where_fields[] = $parent; |
|
| 1982 | + $where .= ' AND tt.parent = %d'; |
|
| 1983 | 1983 | |
| 1984 | - } |
|
| 1984 | + } |
|
| 1985 | 1985 | |
| 1986 | - $where_fields[] = $taxonomy; |
|
| 1986 | + $where_fields[] = $taxonomy; |
|
| 1987 | 1987 | |
| 1988 | 1988 | |
| 1989 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
|
|
| 1990 | - return $result; |
|
| 1989 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
|
|
| 1990 | + return $result; |
|
| 1991 | 1991 | |
| 1992 | - return false; |
|
| 1993 | - } |
|
| 1992 | + return false; |
|
| 1993 | + } |
|
| 1994 | 1994 | |
| 1995 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
|
|
| 1996 | - return $result; |
|
| 1995 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
|
|
| 1996 | + return $result; |
|
| 1997 | 1997 | |
| 1998 | - return false; |
|
| 1998 | + return false; |
|
| 1999 | 1999 | } |
| 2000 | 2000 | |
| 2001 | 2001 | /** |
@@ -2007,7 +2007,7 @@ discard block |
||
| 2007 | 2007 | function geodir_get_term_icon_rebuild() |
| 2008 | 2008 | {
|
| 2009 | 2009 | |
| 2010 | - update_option('gd_term_icons', '');
|
|
| 2010 | + update_option('gd_term_icons', '');
|
|
| 2011 | 2011 | |
| 2012 | 2012 | } |
| 2013 | 2013 | |
@@ -2025,61 +2025,61 @@ discard block |
||
| 2025 | 2025 | */ |
| 2026 | 2026 | function geodir_get_term_icon($term_id = false, $rebuild = false) |
| 2027 | 2027 | {
|
| 2028 | - global $wpdb; |
|
| 2029 | - if (!$rebuild) {
|
|
| 2030 | - $terms_icons = get_option('gd_term_icons');
|
|
| 2031 | - } else {
|
|
| 2032 | - $terms_icons = array(); |
|
| 2033 | - } |
|
| 2034 | - |
|
| 2035 | - if (empty($terms_icons)) {
|
|
| 2036 | - $terms_icons = array(); |
|
| 2037 | - $default_icon_url = get_option('geodir_default_marker_icon');
|
|
| 2038 | - $taxonomy = geodir_get_taxonomies(); |
|
| 2039 | - $post_types = geodir_get_posttypes(); |
|
| 2040 | - $tax_arr = array(); |
|
| 2041 | - foreach ($post_types as $post_type) {
|
|
| 2042 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
| 2043 | - } |
|
| 2044 | - $tax_c = implode(',', $tax_arr);
|
|
| 2045 | - $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
|
| 2046 | - //$terms = get_terms( $taxonomy ); |
|
| 2047 | - |
|
| 2048 | - if($terms) {
|
|
| 2049 | - foreach ($terms as $term) {
|
|
| 2050 | - $post_type = str_replace("category", "", $term->taxonomy);
|
|
| 2051 | - $a_terms[$post_type][] = $term; |
|
| 2028 | + global $wpdb; |
|
| 2029 | + if (!$rebuild) {
|
|
| 2030 | + $terms_icons = get_option('gd_term_icons');
|
|
| 2031 | + } else {
|
|
| 2032 | + $terms_icons = array(); |
|
| 2033 | + } |
|
| 2052 | 2034 | |
| 2053 | - } |
|
| 2054 | - } |
|
| 2035 | + if (empty($terms_icons)) {
|
|
| 2036 | + $terms_icons = array(); |
|
| 2037 | + $default_icon_url = get_option('geodir_default_marker_icon');
|
|
| 2038 | + $taxonomy = geodir_get_taxonomies(); |
|
| 2039 | + $post_types = geodir_get_posttypes(); |
|
| 2040 | + $tax_arr = array(); |
|
| 2041 | + foreach ($post_types as $post_type) {
|
|
| 2042 | + $tax_arr[] = "'" . $post_type . "category'"; |
|
| 2043 | + } |
|
| 2044 | + $tax_c = implode(',', $tax_arr);
|
|
| 2045 | + $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
|
| 2046 | + //$terms = get_terms( $taxonomy ); |
|
| 2055 | 2047 | |
| 2056 | - if($a_terms) {
|
|
| 2057 | - foreach ($a_terms as $pt => $t2) {
|
|
| 2048 | + if($terms) {
|
|
| 2049 | + foreach ($terms as $term) {
|
|
| 2050 | + $post_type = str_replace("category", "", $term->taxonomy);
|
|
| 2051 | + $a_terms[$post_type][] = $term; |
|
| 2058 | 2052 | |
| 2059 | - foreach ($t2 as $term) {
|
|
| 2060 | - $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
| 2061 | - if ($term_icon) {
|
|
| 2062 | - $term_icon_url = $term_icon["src"]; |
|
| 2063 | - } else {
|
|
| 2064 | - $term_icon_url = $default_icon_url; |
|
| 2065 | - } |
|
| 2066 | - $terms_icons[$term->term_id] = $term_icon_url; |
|
| 2067 | - } |
|
| 2068 | - } |
|
| 2069 | - } |
|
| 2053 | + } |
|
| 2054 | + } |
|
| 2055 | + |
|
| 2056 | + if($a_terms) {
|
|
| 2057 | + foreach ($a_terms as $pt => $t2) {
|
|
| 2070 | 2058 | |
| 2071 | - update_option('gd_term_icons', $terms_icons);
|
|
| 2072 | - } |
|
| 2059 | + foreach ($t2 as $term) {
|
|
| 2060 | + $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
| 2061 | + if ($term_icon) {
|
|
| 2062 | + $term_icon_url = $term_icon["src"]; |
|
| 2063 | + } else {
|
|
| 2064 | + $term_icon_url = $default_icon_url; |
|
| 2065 | + } |
|
| 2066 | + $terms_icons[$term->term_id] = $term_icon_url; |
|
| 2067 | + } |
|
| 2068 | + } |
|
| 2069 | + } |
|
| 2073 | 2070 | |
| 2074 | - if ($term_id && isset($terms_icons[$term_id])) {
|
|
| 2075 | - return $terms_icons[$term_id]; |
|
| 2076 | - } elseif ($term_id && !isset($terms_icons[$term_id])) {
|
|
| 2077 | - return get_option('geodir_default_marker_icon');
|
|
| 2078 | - } |
|
| 2071 | + update_option('gd_term_icons', $terms_icons);
|
|
| 2072 | + } |
|
| 2073 | + |
|
| 2074 | + if ($term_id && isset($terms_icons[$term_id])) {
|
|
| 2075 | + return $terms_icons[$term_id]; |
|
| 2076 | + } elseif ($term_id && !isset($terms_icons[$term_id])) {
|
|
| 2077 | + return get_option('geodir_default_marker_icon');
|
|
| 2078 | + } |
|
| 2079 | 2079 | |
| 2080 | - if (is_ssl()) {
|
|
| 2081 | - $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2082 | - } |
|
| 2080 | + if (is_ssl()) {
|
|
| 2081 | + $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2082 | + } |
|
| 2083 | 2083 | |
| 2084 | - return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
|
| 2084 | + return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
|
| 2085 | 2085 | } |
| 2086 | 2086 | \ No newline at end of file |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | * @since 1.0.0 |
| 61 | 61 | * @param string $menu_class The menu HTML class. |
| 62 | 62 | */ |
| 63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
|
|
| 64 | 64 | /** |
| 65 | 65 | * Filter the menu a class. |
| 66 | 66 | * |
| 67 | 67 | * @since 1.0.0 |
| 68 | 68 | */ |
| 69 | 69 | $a_class = apply_filters('geodir_menu_a_class', '');
|
| 70 | - $items .= '<li class="' . $li_class . '"> |
|
| 71 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
|
| 72 | - ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
|
| 70 | + $items .= '<li class="'.$li_class.'"> |
|
| 71 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'"> |
|
| 72 | + ' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').' |
|
| 73 | 73 | </a> |
| 74 | 74 | </li>'; |
| 75 | 75 | } |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | * @since 1.0.0 |
| 89 | 89 | * @param string $menu_class The menu HTML class. |
| 90 | 90 | */ |
| 91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
|
|
| 91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class);
|
|
| 92 | 92 | /** |
| 93 | 93 | * Filter the sub menu li class. |
| 94 | 94 | * |
| 95 | 95 | * @since 1.0.0 |
| 96 | 96 | * @param string $menu_class The menu HTML class. |
| 97 | 97 | */ |
| 98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
|
|
| 99 | 99 | /** |
| 100 | 100 | * Filter the sub menu ul class. |
| 101 | 101 | * |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | * @since 1.0.0 |
| 115 | 115 | */ |
| 116 | 116 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
| 117 | - $items .= '<li class="' . $li_class . '"> |
|
| 118 | - <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
|
|
| 119 | - <ul class="' . $sub_ul_class . '">'; |
|
| 117 | + $items .= '<li class="'.$li_class.'"> |
|
| 118 | + <a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a>
|
|
| 119 | + <ul class="' . $sub_ul_class.'">'; |
|
| 120 | 120 | $post_types = geodir_get_posttypes('object');
|
| 121 | 121 | |
| 122 | 122 | $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
|
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
| 134 | 134 | $menu_class = 'current-menu-item'; |
| 135 | 135 | |
| 136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
| 137 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
|
| 138 | - ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
|
| 136 | + $items .= '<li class="'.$sub_li_class.'"> |
|
| 137 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'"> |
|
| 138 | + ' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').' |
|
| 139 | 139 | </a> |
| 140 | 140 | </li>'; |
| 141 | 141 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @since 1.5.9 |
| 153 | 153 | */ |
| 154 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 154 | + $items .= apply_filters('geodir_menu_after_sub_ul', '');
|
|
| 155 | 155 | $items .= '</li>'; |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @since 1.0.0 |
| 185 | 185 | * @param string $menu_class The menu HTML class. |
| 186 | 186 | */ |
| 187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
|
|
| 188 | 188 | /** |
| 189 | 189 | * Filter the menu a class. |
| 190 | 190 | * |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | $a_class = apply_filters('geodir_menu_a_class', '');
|
| 194 | 194 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
| 195 | - $items .= '<li class="' . $li_class . '"> |
|
| 196 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
|
| 197 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
|
| 195 | + $items .= '<li class="'.$li_class.'"> |
|
| 196 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'"> |
|
| 197 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
|
|
| 198 | 198 | </a> |
| 199 | 199 | </li>'; |
| 200 | 200 | } |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | * @since 1.0.0 |
| 219 | 219 | * @param string $menu_class The menu HTML class. |
| 220 | 220 | */ |
| 221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
|
|
| 221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class);
|
|
| 222 | 222 | /** |
| 223 | 223 | * Filter the sub menu li class. |
| 224 | 224 | * |
| 225 | 225 | * @since 1.0.0 |
| 226 | 226 | * @param string $menu_class The menu HTML class. |
| 227 | 227 | */ |
| 228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
|
|
| 229 | 229 | /** |
| 230 | 230 | * Filter the sub menu ul class. |
| 231 | 231 | * |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | * @since 1.0.0 |
| 245 | 245 | */ |
| 246 | 246 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
| 247 | - $items .= '<li class="' . $li_class . '"> |
|
| 248 | - <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
|
|
| 249 | - <ul class="' . $sub_ul_class . '">'; |
|
| 247 | + $items .= '<li class="'.$li_class.'"> |
|
| 248 | + <a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a>
|
|
| 249 | + <ul class="' . $sub_ul_class.'">'; |
|
| 250 | 250 | |
| 251 | 251 | $post_types = geodir_get_posttypes('object');
|
| 252 | 252 | |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | * @since 1.0.0 |
| 270 | 270 | * @param string $menu_class The menu HTML class. |
| 271 | 271 | */ |
| 272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
|
|
| 273 | 273 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
| 274 | - $items .= '<li class="' . $sub_li_class . '"> |
|
| 275 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
|
| 276 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
|
| 274 | + $items .= '<li class="'.$sub_li_class.'"> |
|
| 275 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'"> |
|
| 276 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
|
|
| 277 | 277 | </a> |
| 278 | 278 | </li>'; |
| 279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | $items .= ' </ul> '; |
| 288 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 288 | + $items .= apply_filters('geodir_menu_after_sub_ul', '');
|
|
| 289 | 289 | $items .= '</li>'; |
| 290 | 290 | |
| 291 | 291 | } |
@@ -313,14 +313,14 @@ discard block |
||
| 313 | 313 | $geodir_theme_location = get_option('geodir_theme_location_nav');
|
| 314 | 314 | $geodir_theme_location_nav = array(); |
| 315 | 315 | if (empty($locations) && empty($geodir_theme_location)) {
|
| 316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
|
|
| 317 | 317 | $geodir_theme_location_nav[] = $args['theme_location']; |
| 318 | 318 | update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
|
| 319 | 319 | } |
| 320 | 320 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
| 321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
|
| 322 | 322 | else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
| 323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
|
|
| 324 | 324 | |
| 325 | 325 | return $menu; |
| 326 | 326 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
|
| 350 | 350 | |
| 351 | - $items = $items . geodir_add_nav_menu_items(); |
|
| 351 | + $items = $items.geodir_add_nav_menu_items(); |
|
| 352 | 352 | return $items; |
| 353 | 353 | |
| 354 | 354 | } else {
|
@@ -373,12 +373,12 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | $taxonomies = geodir_get_taxonomies(); |
| 375 | 375 | $taxonomies = implode("','", $taxonomies);
|
| 376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 376 | + $taxonomies = "'".$taxonomies."'"; |
|
| 377 | 377 | |
| 378 | 378 | $pn_categories = $wpdb->get_results( |
| 379 | 379 | $wpdb->prepare( |
| 380 | 380 | "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
| 381 | - array($wpdb->terms . term_id) |
|
| 381 | + array($wpdb->terms.term_id) |
|
| 382 | 382 | ) |
| 383 | 383 | ); |
| 384 | 384 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
| 410 | 410 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
| 411 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 411 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
| 412 | 412 | elseif (isset($_REQUEST['listing_type'])) |
| 413 | 413 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
| 414 | 414 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
| 435 | 435 | $geodir_post_type = ''; |
| 436 | 436 | |
| 437 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 437 | + if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) {
|
|
| 438 | 438 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
| 439 | 439 | } |
| 440 | 440 | |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | * |
| 445 | 445 | * @since 1.6.9 |
| 446 | 446 | */ |
| 447 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 447 | + return apply_filters('geodir_get_current_posttype', $geodir_post_type);
|
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -458,18 +458,18 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | function geodir_get_default_posttype() |
| 460 | 460 | {
|
| 461 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 461 | + $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object'));
|
|
| 462 | 462 | |
| 463 | 463 | $stype = false; |
| 464 | - foreach ( $post_types as $post_type => $info ) {
|
|
| 464 | + foreach ($post_types as $post_type => $info) {
|
|
| 465 | 465 | global $wpdb; |
| 466 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 467 | - if ( $has_posts ) {
|
|
| 466 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 467 | + if ($has_posts) {
|
|
| 468 | 468 | $stype = $post_type; break; |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - if(!$stype){
|
|
| 472 | + if (!$stype) {
|
|
| 473 | 473 | $stype = 'gd_place'; |
| 474 | 474 | } |
| 475 | 475 | |
@@ -494,14 +494,14 @@ discard block |
||
| 494 | 494 | switch ($output): |
| 495 | 495 | case 'object': |
| 496 | 496 | case 'Object': |
| 497 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 497 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
| 498 | 498 | break; |
| 499 | 499 | case 'array': |
| 500 | 500 | case 'Array': |
| 501 | - $post_types = (array)$post_types; |
|
| 501 | + $post_types = (array) $post_types; |
|
| 502 | 502 | break; |
| 503 | 503 | case 'options': |
| 504 | - $post_types = (array)$post_types; |
|
| 504 | + $post_types = (array) $post_types; |
|
| 505 | 505 | |
| 506 | 506 | $options = array(); |
| 507 | 507 | if (!empty($post_types)) {
|
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $gd_taxonomies[] = $taxonomy; |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
|
|
| 572 | + if ($tages_taxonomies === false && substr($taxonomy, -5) == '_tags') {
|
|
| 573 | 573 | if (array_search($taxonomy, $gd_taxonomies) !== false) {
|
| 574 | 574 | unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
| 575 | 575 | } |
@@ -615,15 +615,15 @@ discard block |
||
| 615 | 615 | |
| 616 | 616 | $categories = get_terms($taxonomies); |
| 617 | 617 | |
| 618 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 618 | + $html .= '<option value="0">'.__('All', 'geodirectory').'</option>';
|
|
| 619 | 619 | |
| 620 | 620 | foreach ($categories as $category_obj) {
|
| 621 | 621 | $select_opt = ''; |
| 622 | 622 | if ($selected == $category_obj->term_id) {
|
| 623 | 623 | $select_opt = 'selected="selected"'; |
| 624 | 624 | } |
| 625 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 626 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
| 625 | + $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">' |
|
| 626 | + . geodir_utf8_ucfirst($category_obj->name).'</option>'; |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | if ($echo) |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | } elseif (isset($wp_query->tax_query->queries)) {
|
| 692 | 692 | $tax_arr = $wp_query->tax_query->queries; |
| 693 | 693 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
| 694 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 694 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
|
|
| 695 | 695 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
| 696 | 696 | } |
| 697 | 697 | |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | |
| 746 | 746 | if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
| 747 | 747 | if ($cat_parent == 0) {
|
| 748 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 748 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display; |
|
| 749 | 749 | $main_list_class = 'class="main_list_selecter"'; |
| 750 | 750 | } else {
|
| 751 | 751 | //$display = 'display:none'; |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
| 757 | 757 | $p = 0; |
| 758 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 758 | + $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | foreach ($cat_terms as $cat_term) {
|
@@ -770,12 +770,12 @@ discard block |
||
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | if ($cat_display == 'radio') |
| 773 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 773 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
| 774 | 774 | elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
| 775 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 775 | + $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
| 776 | 776 | |
| 777 | 777 | else {
|
| 778 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 778 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | // Call recurson to print sub cats |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | $cat_exclude = serialize($exclude_cats); |
| 815 | 815 | |
| 816 | 816 | if (isset($_REQUEST['backandedit'])) {
|
| 817 | - $post = (object)$gd_session->get('listing');
|
|
| 817 | + $post = (object) $gd_session->get('listing');
|
|
| 818 | 818 | |
| 819 | 819 | if (!is_array($post->post_category[$cat_taxonomy])) |
| 820 | 820 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | |
| 847 | 847 | if (!empty($post_category)) {
|
| 848 | 848 | $cat1 = array_filter(explode(',', $post_category));
|
| 849 | - $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 849 | + $post_category = ','.implode(',', $cat1).',';
|
|
| 850 | 850 | |
| 851 | 851 | } |
| 852 | 852 | |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | foreach ($post_category_upd as $cat) {
|
| 858 | 858 | |
| 859 | 859 | if (!in_array($cat, $exclude_cats) && $cat != '') {
|
| 860 | - $post_category_change .= ',' . $cat; |
|
| 860 | + $post_category_change .= ','.$cat; |
|
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | 863 | $post_category = $post_category_change; |
@@ -869,11 +869,11 @@ discard block |
||
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 872 | + echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']" />'; |
|
| 873 | 873 | |
| 874 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 874 | + echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']" />'; |
|
| 875 | 875 | |
| 876 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 876 | + echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']" />'; |
|
| 877 | 877 | |
| 878 | 878 | |
| 879 | 879 | ?> |
@@ -892,14 +892,14 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | function show_subcatlist(main_cat, catObj) {
|
| 894 | 894 | if (main_cat != '') {
|
| 895 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
| 896 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
| 897 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
| 895 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
| 896 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
| 897 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
| 898 | 898 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
|
| 899 | - <?php if ((int)$cat_limit > 0) { ?>
|
|
| 899 | + <?php if ((int) $cat_limit > 0) { ?>
|
|
| 900 | 900 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
|
| 901 | 901 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
|
| 902 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
|
|
| 902 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
|
|
| 903 | 903 | return false; |
| 904 | 904 | } |
| 905 | 905 | <?php } ?> |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | function update_listing_cat(el) {
|
| 941 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
| 941 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
| 942 | 942 | var cat_ids = ''; |
| 943 | 943 | var main_cat = ''; |
| 944 | 944 | var sub_cat = ''; |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | <div class="main_cat_list" style=" <?php if (isset($style)) {
|
| 1020 | 1020 | echo $style; |
| 1021 | 1021 | }?> "> |
| 1022 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
| 1022 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
| 1023 | 1023 | ?> |
| 1024 | 1024 | </div> |
| 1025 | 1025 | <?php |
@@ -1046,9 +1046,9 @@ discard block |
||
| 1046 | 1046 | if ($exclude != '') {
|
| 1047 | 1047 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
| 1048 | 1048 | |
| 1049 | - if(is_array( $exclude_cats)){
|
|
| 1050 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1051 | - }else{
|
|
| 1049 | + if (is_array($exclude_cats)) {
|
|
| 1050 | + $exclude_cats = array_map('intval', $exclude_cats);
|
|
| 1051 | + } else {
|
|
| 1052 | 1052 | $exclude_cats = intval($exclude_cats); |
| 1053 | 1053 | } |
| 1054 | 1054 | |
@@ -1062,25 +1062,25 @@ discard block |
||
| 1062 | 1062 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
| 1063 | 1063 | |
| 1064 | 1064 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
| 1065 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
| 1065 | + <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>" |
|
| 1066 | 1066 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
|
| 1067 | 1067 | <?php /* ?> |
| 1068 | 1068 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" />
|
| 1069 | 1069 | <?php */ ?> |
| 1070 | 1070 | |
| 1071 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
| 1071 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
| 1072 | 1072 | onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
|
| 1073 | 1073 | checked="checked" disabled="disabled"/> |
| 1074 | 1074 | <span> |
| 1075 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
|
|
| 1075 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
|
|
| 1076 | 1076 | </span> |
| 1077 | 1077 | <br/> |
| 1078 | 1078 | |
| 1079 | 1079 | <div class="post_default_category"> |
| 1080 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
| 1081 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
| 1080 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
| 1081 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
| 1082 | 1082 | <span> |
| 1083 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
|
|
| 1083 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
|
|
| 1084 | 1084 | </span> |
| 1085 | 1085 | </div> |
| 1086 | 1086 | |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | $post_cat_str = $post_categories[$request_taxonomy]; |
| 1114 | 1114 | $post_cat_array = explode("#", $post_cat_str);
|
| 1115 | 1115 | if (is_array($post_cat_array)) {
|
| 1116 | - $post_cat_array = array_unique( $post_cat_array ); |
|
| 1116 | + $post_cat_array = array_unique($post_cat_array); |
|
| 1117 | 1117 | |
| 1118 | 1118 | foreach ($post_cat_array as $post_cat_html) {
|
| 1119 | 1119 | |
@@ -1128,7 +1128,7 @@ discard block |
||
| 1128 | 1128 | } |
| 1129 | 1129 | $post_sub_catid = ''; |
| 1130 | 1130 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
| 1131 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1131 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
| 1152 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1152 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1181,9 +1181,9 @@ discard block |
||
| 1181 | 1181 | if (!$selected) |
| 1182 | 1182 | $option_slected = ' selected="selected" '; |
| 1183 | 1183 | |
| 1184 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1184 | + echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >'; |
|
| 1185 | 1185 | |
| 1186 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1186 | + echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>';
|
|
| 1187 | 1187 | |
| 1188 | 1188 | foreach ($cat_terms as $cat_term) {
|
| 1189 | 1189 | $option_selected = ''; |
@@ -1191,10 +1191,10 @@ discard block |
||
| 1191 | 1191 | $option_selected = ' selected="selected" '; |
| 1192 | 1192 | |
| 1193 | 1193 | // Count child terms |
| 1194 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1195 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1194 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
|
|
| 1195 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
| 1196 | 1196 | |
| 1197 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 1197 | + echo '<option '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
| 1198 | 1198 | } |
| 1199 | 1199 | echo '</select>'; |
| 1200 | 1200 | } |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | 2 => __('Custom field updated.', 'geodirectory'),
|
| 1226 | 1226 | 3 => __('Custom field deleted.', 'geodirectory'),
|
| 1227 | 1227 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
| 1228 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
|
|
| 1228 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
|
|
| 1229 | 1229 | 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
| 1230 | 1230 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
| 1231 | 1231 | 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | |
| 1252 | 1252 | global $wpdb; |
| 1253 | 1253 | |
| 1254 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1254 | + $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico'; |
|
| 1255 | 1255 | |
| 1256 | 1256 | if (!$listing_slug = get_option('geodir_listing_prefix'))
|
| 1257 | 1257 | $listing_slug = 'places'; |
@@ -1264,11 +1264,11 @@ discard block |
||
| 1264 | 1264 | |
| 1265 | 1265 | $gd_placetags = array(); |
| 1266 | 1266 | $gd_placetags['object_type'] = 'gd_place'; |
| 1267 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1267 | + $gd_placetags['listing_slug'] = $listing_slug.'/tags'; |
|
| 1268 | 1268 | $gd_placetags['args'] = array( |
| 1269 | 1269 | 'public' => true, |
| 1270 | 1270 | 'hierarchical' => false, |
| 1271 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1271 | + 'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1272 | 1272 | 'query_var' => true, |
| 1273 | 1273 | |
| 1274 | 1274 | 'labels' => array( |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | 'menu_icon' => $menu_icon, |
| 1363 | 1363 | 'public' => true, |
| 1364 | 1364 | 'query_var' => true, |
| 1365 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1365 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1366 | 1366 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
| 1367 | 1367 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
| 1368 | 1368 | |
@@ -1395,12 +1395,12 @@ discard block |
||
| 1395 | 1395 | return $_REQUEST['lang']; |
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | - $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1398 | + $url = str_replace(array("http://", "https://"), "", $url);
|
|
| 1399 | 1399 | |
| 1400 | 1400 | // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
| 1401 | - $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1401 | + $site_url = str_replace(array("http://", "https://"), "", site_url());
|
|
| 1402 | 1402 | |
| 1403 | - $url = str_replace($site_url,"",$url); |
|
| 1403 | + $url = str_replace($site_url, "", $url); |
|
| 1404 | 1404 | |
| 1405 | 1405 | $segments = explode('/', trim($url, '/'));
|
| 1406 | 1406 | |
@@ -1456,7 +1456,7 @@ discard block |
||
| 1456 | 1456 | |
| 1457 | 1457 | global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
| 1458 | 1458 | if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
|
| 1459 | - if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
|
|
| 1459 | + if ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending') {return $post_link; }
|
|
| 1460 | 1460 | } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
|
| 1461 | 1461 | return $post_link; |
| 1462 | 1462 | } else {
|
@@ -1470,9 +1470,9 @@ discard block |
||
| 1470 | 1470 | |
| 1471 | 1471 | |
| 1472 | 1472 | // if we dont have a GD post then try to grab it |
| 1473 | - if(!isset($post->default_category)){
|
|
| 1473 | + if (!isset($post->default_category)) {
|
|
| 1474 | 1474 | $gd_post = geodir_get_post_info($post->ID); |
| 1475 | - if(!empty($gd_post)){
|
|
| 1475 | + if (!empty($gd_post)) {
|
|
| 1476 | 1476 | $post = $gd_post; |
| 1477 | 1477 | } |
| 1478 | 1478 | } |
@@ -1482,17 +1482,17 @@ discard block |
||
| 1482 | 1482 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
| 1483 | 1483 | |
| 1484 | 1484 | // Alter the CPT slug if WPML is set to do so |
| 1485 | - if(geodir_wpml_is_post_type_translated($post->post_type)){
|
|
| 1486 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1485 | + if (geodir_wpml_is_post_type_translated($post->post_type)) {
|
|
| 1486 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1487 | 1487 | |
| 1488 | 1488 | $org_slug = $slug; |
| 1489 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1489 | + $slug = apply_filters('wpml_translate_single_string',
|
|
| 1490 | 1490 | $slug, |
| 1491 | 1491 | 'WordPress', |
| 1492 | - 'URL slug: ' . $slug, |
|
| 1492 | + 'URL slug: '.$slug, |
|
| 1493 | 1493 | $language_code); |
| 1494 | 1494 | |
| 1495 | - if(!$slug){$slug = $org_slug;}
|
|
| 1495 | + if (!$slug) {$slug = $org_slug; }
|
|
| 1496 | 1496 | |
| 1497 | 1497 | } |
| 1498 | 1498 | } |
@@ -1514,11 +1514,11 @@ discard block |
||
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | 1516 | $post_link = trailingslashit( |
| 1517 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1517 | + preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1)
|
|
| 1518 | 1518 | ); |
| 1519 | 1519 | |
| 1520 | 1520 | if ($fix_url) {
|
| 1521 | - $post_link = $site_url . $post_link; |
|
| 1521 | + $post_link = $site_url.$post_link; |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | if (isset($comment_post_cache[$post->ID])) {
|
@@ -1537,12 +1537,12 @@ discard block |
||
| 1537 | 1537 | $ID = $post->ID; |
| 1538 | 1538 | $post2 = $wpdb->get_row( |
| 1539 | 1539 | $wpdb->prepare( |
| 1540 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1540 | + "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
| 1541 | 1541 | array($post->ID) |
| 1542 | 1542 | ) |
| 1543 | 1543 | ); |
| 1544 | 1544 | |
| 1545 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1545 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
| 1546 | 1546 | |
| 1547 | 1547 | $comment_post_cache[$post->ID] = $post; |
| 1548 | 1548 | } |
@@ -1551,7 +1551,7 @@ discard block |
||
| 1551 | 1551 | |
| 1552 | 1552 | if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
| 1553 | 1553 | |
| 1554 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1554 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
|
|
| 1555 | 1555 | $location_request = ''; |
| 1556 | 1556 | |
| 1557 | 1557 | |
@@ -1565,7 +1565,7 @@ discard block |
||
| 1565 | 1565 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
| 1566 | 1566 | $post->country_slug = str_replace(']', '', $post->country_slug);
|
| 1567 | 1567 | |
| 1568 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1568 | + $post_location = (object) array('country_slug' => $post->country_slug,
|
|
| 1569 | 1569 | 'region_slug' => $post->region_slug, |
| 1570 | 1570 | 'city_slug' => $post->city_slug |
| 1571 | 1571 | ); |
@@ -1578,7 +1578,7 @@ discard block |
||
| 1578 | 1578 | |
| 1579 | 1579 | $post_location_sql = $wpdb->get_results( |
| 1580 | 1580 | $wpdb->prepare( |
| 1581 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1581 | + "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
| 1582 | 1582 | array($post->ID) |
| 1583 | 1583 | ) |
| 1584 | 1584 | ); |
@@ -1594,7 +1594,7 @@ discard block |
||
| 1594 | 1594 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
| 1595 | 1595 | $post->country_slug = str_replace(']', '', $post->country_slug);
|
| 1596 | 1596 | |
| 1597 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1597 | + $post_location = (object) array('country_slug' => $post->country_slug,
|
|
| 1598 | 1598 | 'region_slug' => $post->region_slug, |
| 1599 | 1599 | 'city_slug' => $post->city_slug |
| 1600 | 1600 | ); |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | } |
| 1624 | 1624 | $location_slug[] = $city_slug; |
| 1625 | 1625 | |
| 1626 | - $location_request .= implode('/', $location_slug) . '/';
|
|
| 1626 | + $location_request .= implode('/', $location_slug).'/';
|
|
| 1627 | 1627 | } |
| 1628 | 1628 | } |
| 1629 | 1629 | |
@@ -1638,9 +1638,9 @@ discard block |
||
| 1638 | 1638 | } else {
|
| 1639 | 1639 | $post_terms = ''; |
| 1640 | 1640 | |
| 1641 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
|
|
| 1641 | + if (isset($_POST['post_default_category']) && $_POST['post_default_category']) {
|
|
| 1642 | 1642 | $post_terms = absint($_POST['post_default_category']); |
| 1643 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1643 | + }elseif (isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1644 | 1644 | $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
|
| 1645 | 1645 | $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
| 1646 | 1646 | }elseif (isset($post->{$taxonomies})) {
|
@@ -1686,14 +1686,14 @@ discard block |
||
| 1686 | 1686 | $request_term = trim($request_term, '/'); |
| 1687 | 1687 | |
| 1688 | 1688 | // Fix with WPML the location terms added twice when CPT slug is translated. |
| 1689 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
|
|
| 1689 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/'.$request_term.$detailurl_separator) !== false) {
|
|
| 1690 | 1690 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
|
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | 1693 | if (!empty($request_term)) |
| 1694 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1694 | + $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
|
|
| 1695 | 1695 | else |
| 1696 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1696 | + $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
|
|
| 1697 | 1697 | //echo $post_link ; |
| 1698 | 1698 | } |
| 1699 | 1699 | // temp cache the permalink |
@@ -1786,9 +1786,9 @@ discard block |
||
| 1786 | 1786 | $url_separator = ''; |
| 1787 | 1787 | |
| 1788 | 1788 | if (get_option('permalink_structure') != '') {
|
| 1789 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1789 | + $old_listing_slug = '/'.$listing_slug.'/'; |
|
| 1790 | 1790 | $request_term = implode("/", $location_terms);
|
| 1791 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1791 | + $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/'; |
|
| 1792 | 1792 | |
| 1793 | 1793 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
| 1794 | 1794 | } else {
|
@@ -1808,25 +1808,25 @@ discard block |
||
| 1808 | 1808 | // Alter the CPT slug if WPML is set to do so |
| 1809 | 1809 | if (geodir_is_wpml()) {
|
| 1810 | 1810 | $post_types = get_option('geodir_post_types');
|
| 1811 | - $post_type = str_replace("category","",$taxonomy);
|
|
| 1812 | - $post_type = str_replace("_tags","",$post_type);
|
|
| 1811 | + $post_type = str_replace("category", "", $taxonomy);
|
|
| 1812 | + $post_type = str_replace("_tags", "", $post_type);
|
|
| 1813 | 1813 | $slug = $post_types[$post_type]['rewrite']['slug']; |
| 1814 | 1814 | if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
|
| 1815 | 1815 | global $sitepress; |
| 1816 | 1816 | $default_lang = $sitepress->get_default_language(); |
| 1817 | 1817 | $language_code = gd_wpml_get_lang_from_url($termlink); |
| 1818 | - if (!$language_code ) {
|
|
| 1819 | - $language_code = $default_lang; |
|
| 1818 | + if (!$language_code) {
|
|
| 1819 | + $language_code = $default_lang; |
|
| 1820 | 1820 | } |
| 1821 | 1821 | |
| 1822 | 1822 | $org_slug = $slug; |
| 1823 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1823 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code);
|
|
| 1824 | 1824 | |
| 1825 | 1825 | if (!$slug) {
|
| 1826 | 1826 | $slug = $org_slug; |
| 1827 | 1827 | } |
| 1828 | 1828 | |
| 1829 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1829 | + $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1));
|
|
| 1830 | 1830 | } |
| 1831 | 1831 | } |
| 1832 | 1832 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | |
| 1857 | 1857 | if (in_array($post_type, geodir_get_posttypes())) {
|
| 1858 | 1858 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
|
| 1859 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
|
| 1859 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
|
| 1860 | 1860 | $location_terms = array( |
| 1861 | 1861 | 'gd_country' => $post->country_slug, |
| 1862 | 1862 | 'gd_region' => $post->region_slug, |
@@ -1873,7 +1873,7 @@ discard block |
||
| 1873 | 1873 | $location_terms = implode("/", $location_terms);
|
| 1874 | 1874 | $location_terms = rtrim($location_terms, '/'); |
| 1875 | 1875 | |
| 1876 | - $link .= urldecode($location_terms) . '/'; |
|
| 1876 | + $link .= urldecode($location_terms).'/'; |
|
| 1877 | 1877 | } else {
|
| 1878 | 1878 | $link = geodir_getlink($link, $location_terms); |
| 1879 | 1879 | } |
@@ -1961,9 +1961,9 @@ discard block |
||
| 1961 | 1961 | return 0; |
| 1962 | 1962 | $where = 't.term_id = %d'; |
| 1963 | 1963 | if (!empty($taxonomy)) |
| 1964 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1964 | + return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1965 | 1965 | else |
| 1966 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1966 | + return $wpdb->get_var($wpdb->prepare($select.$where, $term)); |
|
| 1967 | 1967 | } |
| 1968 | 1968 | |
| 1969 | 1969 | $term = trim(wp_unslash($term)); |
@@ -1975,7 +1975,7 @@ discard block |
||
| 1975 | 1975 | |
| 1976 | 1976 | $where_fields = array($slug); |
| 1977 | 1977 | if (!empty($taxonomy)) {
|
| 1978 | - $parent = (int)$parent; |
|
| 1978 | + $parent = (int) $parent; |
|
| 1979 | 1979 | if ($parent > 0) {
|
| 1980 | 1980 | $where_fields[] = $parent; |
| 1981 | 1981 | $else_where_fields[] = $parent; |
@@ -2039,13 +2039,13 @@ discard block |
||
| 2039 | 2039 | $post_types = geodir_get_posttypes(); |
| 2040 | 2040 | $tax_arr = array(); |
| 2041 | 2041 | foreach ($post_types as $post_type) {
|
| 2042 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
| 2042 | + $tax_arr[] = "'".$post_type."category'"; |
|
| 2043 | 2043 | } |
| 2044 | 2044 | $tax_c = implode(',', $tax_arr);
|
| 2045 | 2045 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
| 2046 | 2046 | //$terms = get_terms( $taxonomy ); |
| 2047 | 2047 | |
| 2048 | - if($terms) {
|
|
| 2048 | + if ($terms) {
|
|
| 2049 | 2049 | foreach ($terms as $term) {
|
| 2050 | 2050 | $post_type = str_replace("category", "", $term->taxonomy);
|
| 2051 | 2051 | $a_terms[$post_type][] = $term; |
@@ -2053,7 +2053,7 @@ discard block |
||
| 2053 | 2053 | } |
| 2054 | 2054 | } |
| 2055 | 2055 | |
| 2056 | - if($a_terms) {
|
|
| 2056 | + if ($a_terms) {
|
|
| 2057 | 2057 | foreach ($a_terms as $pt => $t2) {
|
| 2058 | 2058 | |
| 2059 | 2059 | foreach ($t2 as $term) {
|
@@ -2078,7 +2078,7 @@ discard block |
||
| 2078 | 2078 | } |
| 2079 | 2079 | |
| 2080 | 2080 | if (is_ssl()) {
|
| 2081 | - $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2081 | + $terms_icons = str_replace("http:", "https:", $terms_icons);
|
|
| 2082 | 2082 | } |
| 2083 | 2083 | |
| 2084 | 2084 | return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | * |
| 82 | 82 | * @param string $map_json The map marker json. |
| 83 | 83 | * @since 1.6.22 |
| 84 | - * @return mixed |
|
| 84 | + * @return string |
|
| 85 | 85 | */ |
| 86 | 86 | function geodir_save_map_cache($map_json){
|
| 87 | 87 | |
@@ -247,11 +247,13 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - if (!empty($field_default_cat)) |
|
| 251 | - $field_default_cat = ''; |
|
| 250 | + if (!empty($field_default_cat)) { |
|
| 251 | + $field_default_cat = ''; |
|
| 252 | + } |
|
| 252 | 253 | |
| 253 | - if (!empty($cat_find_array)) |
|
| 254 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 254 | + if (!empty($cat_find_array)) { |
|
| 255 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
| 256 | + } |
|
| 255 | 257 | |
| 256 | 258 | $main_query_array = $map_cat_ids_array; |
| 257 | 259 | |
@@ -283,8 +285,9 @@ discard block |
||
| 283 | 285 | $gd_posttype = " AND p.post_type = %s"; |
| 284 | 286 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 285 | 287 | |
| 286 | - } else |
|
| 287 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 288 | + } else { |
|
| 289 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
| 290 | + } |
|
| 288 | 291 | |
| 289 | 292 | $join = ", " . $table . " AS pd "; |
| 290 | 293 | |
@@ -606,8 +609,7 @@ discard block |
||
| 606 | 609 | |
| 607 | 610 | if (!empty($cat_content_info)) {
|
| 608 | 611 | $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
| 609 | - } |
|
| 610 | - else {
|
|
| 612 | + } else {
|
|
| 611 | 613 | $map_json = '[{"totalcount":"0"}]';
|
| 612 | 614 | } |
| 613 | 615 | |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | // Enable map cache if set |
| 10 | 10 | if(get_option('geodir_enable_map_cache')){
|
| 11 | - add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | - add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 11 | + add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | + add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
@@ -23,56 +23,56 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function geodir_get_map_cache($cache){
|
| 25 | 25 | |
| 26 | - // if a search is going on then dont even try to check for cache. |
|
| 27 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 28 | - return $cache; |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - $url_params = array(); |
|
| 32 | - $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; |
|
| 33 | - $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : ''; |
|
| 34 | - $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : ''; |
|
| 35 | - $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : ''; |
|
| 36 | - $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : ''; |
|
| 37 | - $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : ''; |
|
| 38 | - $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : ''; |
|
| 39 | - $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : ''; |
|
| 40 | - $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : ''; |
|
| 41 | - $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : ''; |
|
| 42 | - $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : ''; |
|
| 43 | - $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
|
| 44 | - $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
|
| 45 | - |
|
| 46 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 47 | - |
|
| 48 | - $blog_id = get_current_blog_id(); |
|
| 49 | - if($blog_id>1){
|
|
| 50 | - $file_name = $blog_id."_".$file_name; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
|
| 54 | - $file = $file_path . $file_name . ".json"; |
|
| 55 | - |
|
| 56 | - if(file_exists($file)){
|
|
| 57 | - // do the cache delete stuff |
|
| 58 | - $cache_time = get_option('geodir_map_cache');
|
|
| 59 | - if(!$cache_time){
|
|
| 60 | - $cache_time = time(); |
|
| 61 | - update_option('geodir_map_cache', $cache_time);
|
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 65 | - geodir_delete_map_cache(); |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - if(file_exists($file) && is_readable($file)){
|
|
| 69 | - ob_start(); |
|
| 70 | - readfile($file); // readfile is quicker then file get contents |
|
| 71 | - return ob_get_clean(); |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - return $cache; |
|
| 26 | + // if a search is going on then dont even try to check for cache. |
|
| 27 | + if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 28 | + return $cache; |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + $url_params = array(); |
|
| 32 | + $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; |
|
| 33 | + $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : ''; |
|
| 34 | + $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : ''; |
|
| 35 | + $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : ''; |
|
| 36 | + $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : ''; |
|
| 37 | + $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : ''; |
|
| 38 | + $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : ''; |
|
| 39 | + $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : ''; |
|
| 40 | + $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : ''; |
|
| 41 | + $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : ''; |
|
| 42 | + $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : ''; |
|
| 43 | + $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
|
| 44 | + $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
|
| 45 | + |
|
| 46 | + $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 47 | + |
|
| 48 | + $blog_id = get_current_blog_id(); |
|
| 49 | + if($blog_id>1){
|
|
| 50 | + $file_name = $blog_id."_".$file_name; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
|
| 54 | + $file = $file_path . $file_name . ".json"; |
|
| 55 | + |
|
| 56 | + if(file_exists($file)){
|
|
| 57 | + // do the cache delete stuff |
|
| 58 | + $cache_time = get_option('geodir_map_cache');
|
|
| 59 | + if(!$cache_time){
|
|
| 60 | + $cache_time = time(); |
|
| 61 | + update_option('geodir_map_cache', $cache_time);
|
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 65 | + geodir_delete_map_cache(); |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + if(file_exists($file) && is_readable($file)){
|
|
| 69 | + ob_start(); |
|
| 70 | + readfile($file); // readfile is quicker then file get contents |
|
| 71 | + return ob_get_clean(); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + return $cache; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
@@ -85,109 +85,109 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function geodir_save_map_cache($map_json){
|
| 87 | 87 | |
| 88 | - // if a search is going on then dont even try to check for cache. |
|
| 89 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 90 | - return $map_json; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - $url_params = array(); |
|
| 94 | - $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; |
|
| 95 | - $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : ''; |
|
| 96 | - $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : ''; |
|
| 97 | - $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : ''; |
|
| 98 | - $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : ''; |
|
| 99 | - $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : ''; |
|
| 100 | - $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : ''; |
|
| 101 | - $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : ''; |
|
| 102 | - $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : ''; |
|
| 103 | - $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : ''; |
|
| 104 | - $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : ''; |
|
| 105 | - $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
|
| 106 | - $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
|
| 107 | - |
|
| 108 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 109 | - |
|
| 110 | - $blog_id = get_current_blog_id(); |
|
| 111 | - if($blog_id>1){
|
|
| 112 | - $file_name = $blog_id."_".$file_name; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
|
| 116 | - |
|
| 117 | - |
|
| 118 | - global $wp_filesystem; |
|
| 119 | - if (empty($wp_filesystem)) {
|
|
| 120 | - require_once (ABSPATH . '/wp-admin/includes/file.php'); |
|
| 121 | - WP_Filesystem(); |
|
| 122 | - } |
|
| 123 | - $wp_filesystem->put_contents( |
|
| 124 | - $file_path.$file_name.".json", |
|
| 125 | - $map_json, |
|
| 126 | - FS_CHMOD_FILE // predefined mode settings for WP files |
|
| 127 | - ); |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - return $map_json; |
|
| 88 | + // if a search is going on then dont even try to check for cache. |
|
| 89 | + if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 90 | + return $map_json; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + $url_params = array(); |
|
| 94 | + $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; |
|
| 95 | + $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : ''; |
|
| 96 | + $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : ''; |
|
| 97 | + $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : ''; |
|
| 98 | + $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : ''; |
|
| 99 | + $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : ''; |
|
| 100 | + $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : ''; |
|
| 101 | + $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : ''; |
|
| 102 | + $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : ''; |
|
| 103 | + $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : ''; |
|
| 104 | + $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : ''; |
|
| 105 | + $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
|
| 106 | + $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
|
| 107 | + |
|
| 108 | + $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 109 | + |
|
| 110 | + $blog_id = get_current_blog_id(); |
|
| 111 | + if($blog_id>1){
|
|
| 112 | + $file_name = $blog_id."_".$file_name; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
|
| 116 | + |
|
| 117 | + |
|
| 118 | + global $wp_filesystem; |
|
| 119 | + if (empty($wp_filesystem)) {
|
|
| 120 | + require_once (ABSPATH . '/wp-admin/includes/file.php'); |
|
| 121 | + WP_Filesystem(); |
|
| 122 | + } |
|
| 123 | + $wp_filesystem->put_contents( |
|
| 124 | + $file_path.$file_name.".json", |
|
| 125 | + $map_json, |
|
| 126 | + FS_CHMOD_FILE // predefined mode settings for WP files |
|
| 127 | + ); |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + return $map_json; |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
|
| 136 | - global $gd_session; |
|
| 137 | - $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
| 138 | - $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
|
| 139 | - $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 140 | - $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
| 141 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 142 | - echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
| 143 | - die; |
|
| 136 | + global $gd_session; |
|
| 137 | + $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
| 138 | + $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
|
| 139 | + $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 140 | + $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
| 141 | + $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 142 | + echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
| 143 | + die; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // Send the content-type header with correct encoding |
| 147 | 147 | header("Content-type: text/javascript; charset=utf-8");
|
| 148 | 148 | |
| 149 | 149 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
|
| 150 | - echo get_markers(); |
|
| 151 | - exit; |
|
| 150 | + echo get_markers(); |
|
| 151 | + exit; |
|
| 152 | 152 | } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
|
| 153 | - /** |
|
| 154 | - * @global object $wpdb WordPress Database object. |
|
| 155 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 156 | - * @global object $gd_session GeoDirectory Session object. |
|
| 157 | - */ |
|
| 158 | - global $wpdb, $plugin_prefix, $gd_session; |
|
| 159 | - |
|
| 160 | - if ($_REQUEST['m_id'] != '') {
|
|
| 161 | - $pid = (int)$_REQUEST['m_id']; |
|
| 162 | - } else {
|
|
| 163 | - echo __('No marker data found', 'geodirectory');
|
|
| 164 | - exit; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 168 | - $post = (object)$gd_ses_listing; |
|
| 169 | - echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
| 170 | - } else {
|
|
| 171 | - $geodir_post_type = get_post_type($pid); |
|
| 172 | - |
|
| 173 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 174 | - |
|
| 175 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 176 | - |
|
| 177 | - $postinfo = $wpdb->get_results($sql); |
|
| 178 | - |
|
| 179 | - $data_arr = array(); |
|
| 180 | - |
|
| 181 | - if ($postinfo) {
|
|
| 182 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 183 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 184 | - |
|
| 185 | - foreach ($postinfo as $postinfo_obj) {
|
|
| 186 | - echo geodir_get_infowindow_html($postinfo_obj); |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - exit; |
|
| 153 | + /** |
|
| 154 | + * @global object $wpdb WordPress Database object. |
|
| 155 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 156 | + * @global object $gd_session GeoDirectory Session object. |
|
| 157 | + */ |
|
| 158 | + global $wpdb, $plugin_prefix, $gd_session; |
|
| 159 | + |
|
| 160 | + if ($_REQUEST['m_id'] != '') {
|
|
| 161 | + $pid = (int)$_REQUEST['m_id']; |
|
| 162 | + } else {
|
|
| 163 | + echo __('No marker data found', 'geodirectory');
|
|
| 164 | + exit; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 168 | + $post = (object)$gd_ses_listing; |
|
| 169 | + echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
| 170 | + } else {
|
|
| 171 | + $geodir_post_type = get_post_type($pid); |
|
| 172 | + |
|
| 173 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 174 | + |
|
| 175 | + $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 176 | + |
|
| 177 | + $postinfo = $wpdb->get_results($sql); |
|
| 178 | + |
|
| 179 | + $data_arr = array(); |
|
| 180 | + |
|
| 181 | + if ($postinfo) {
|
|
| 182 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 183 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 184 | + |
|
| 185 | + foreach ($postinfo as $postinfo_obj) {
|
|
| 186 | + echo geodir_get_infowindow_html($postinfo_obj); |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + exit; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -206,93 +206,93 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | function get_markers() {
|
| 208 | 208 | |
| 209 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 209 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 210 | 210 | |
| 211 | 211 | |
| 212 | - /** |
|
| 213 | - * Filter to allow for any map caching to be output before queries. |
|
| 214 | - * |
|
| 215 | - * @since 1.6.22 |
|
| 216 | - */ |
|
| 217 | - $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 218 | - if($map_cache){
|
|
| 219 | - return $map_cache; |
|
| 220 | - wp_die(); |
|
| 221 | - } |
|
| 212 | + /** |
|
| 213 | + * Filter to allow for any map caching to be output before queries. |
|
| 214 | + * |
|
| 215 | + * @since 1.6.22 |
|
| 216 | + */ |
|
| 217 | + $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 218 | + if($map_cache){
|
|
| 219 | + return $map_cache; |
|
| 220 | + wp_die(); |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | |
| 225 | - $search = ''; |
|
| 225 | + $search = ''; |
|
| 226 | 226 | |
| 227 | - $srcharr = array("'", "/", "-", '"', '\\', ''');
|
|
| 228 | - $replarr = array("′", "⁄", "–", "“", '', "′");
|
|
| 227 | + $srcharr = array("'", "/", "-", '"', '\\', ''');
|
|
| 228 | + $replarr = array("′", "⁄", "–", "“", '', "′");
|
|
| 229 | 229 | |
| 230 | - $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
| 230 | + $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
| 231 | 231 | |
| 232 | - $map_cat_ids_array = array('0');
|
|
| 233 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 232 | + $map_cat_ids_array = array('0');
|
|
| 233 | + $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 234 | 234 | |
| 235 | 235 | |
| 236 | - $field_default_cat = ''; |
|
| 237 | - if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
|
|
| 238 | - $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
| 236 | + $field_default_cat = ''; |
|
| 237 | + if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
|
|
| 238 | + $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
| 239 | 239 | |
| 240 | - if (!empty($map_cat_arr)) {
|
|
| 241 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 240 | + if (!empty($map_cat_arr)) {
|
|
| 241 | + $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 242 | 242 | |
| 243 | - $map_cat_ids_array = explode(',', $map_cat_arr);
|
|
| 244 | - $cat_find_array = array(); |
|
| 245 | - foreach ($map_cat_ids_array as $cat_id) {
|
|
| 246 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 247 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 248 | - $main_query_array[] = $cat_id; |
|
| 249 | - } |
|
| 243 | + $map_cat_ids_array = explode(',', $map_cat_arr);
|
|
| 244 | + $cat_find_array = array(); |
|
| 245 | + foreach ($map_cat_ids_array as $cat_id) {
|
|
| 246 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 247 | + $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 248 | + $main_query_array[] = $cat_id; |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | - } |
|
| 252 | - } |
|
| 251 | + } |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | - if (!empty($field_default_cat)) |
|
| 255 | - $field_default_cat = ''; |
|
| 254 | + if (!empty($field_default_cat)) |
|
| 255 | + $field_default_cat = ''; |
|
| 256 | 256 | |
| 257 | - if (!empty($cat_find_array)) |
|
| 258 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 257 | + if (!empty($cat_find_array)) |
|
| 258 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 259 | 259 | |
| 260 | - $main_query_array = $map_cat_ids_array; |
|
| 260 | + $main_query_array = $map_cat_ids_array; |
|
| 261 | 261 | |
| 262 | - if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
|
| 263 | - $search .= " AND p.post_title LIKE %s"; |
|
| 264 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - /** |
|
| 268 | - * Filter the marker query search SQL, values are replaces with %s or %d. |
|
| 269 | - * |
|
| 270 | - * @since 1.5.3 |
|
| 271 | - * |
|
| 272 | - * @param string $search The SQL query for search/where. |
|
| 273 | - */ |
|
| 274 | - $search = apply_filters('geodir_marker_search', $search);
|
|
| 275 | - /** |
|
| 276 | - * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
| 277 | - * |
|
| 278 | - * @since 1.5.3 |
|
| 279 | - * |
|
| 280 | - * @param array $main_query_array The SQL query values for search/where. |
|
| 281 | - */ |
|
| 282 | - $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
|
|
| 283 | - |
|
| 284 | - $gd_posttype = ''; |
|
| 285 | - if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
|
| 286 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 287 | - $gd_posttype = " AND p.post_type = %s"; |
|
| 288 | - $main_query_array[] = $_REQUEST['gd_posttype']; |
|
| 289 | - |
|
| 290 | - } else |
|
| 291 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 292 | - |
|
| 293 | - $join = ", " . $table . " AS pd "; |
|
| 294 | - |
|
| 295 | - /** |
|
| 262 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
|
| 263 | + $search .= " AND p.post_title LIKE %s"; |
|
| 264 | + $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + /** |
|
| 268 | + * Filter the marker query search SQL, values are replaces with %s or %d. |
|
| 269 | + * |
|
| 270 | + * @since 1.5.3 |
|
| 271 | + * |
|
| 272 | + * @param string $search The SQL query for search/where. |
|
| 273 | + */ |
|
| 274 | + $search = apply_filters('geodir_marker_search', $search);
|
|
| 275 | + /** |
|
| 276 | + * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
| 277 | + * |
|
| 278 | + * @since 1.5.3 |
|
| 279 | + * |
|
| 280 | + * @param array $main_query_array The SQL query values for search/where. |
|
| 281 | + */ |
|
| 282 | + $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
|
|
| 283 | + |
|
| 284 | + $gd_posttype = ''; |
|
| 285 | + if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
|
| 286 | + $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 287 | + $gd_posttype = " AND p.post_type = %s"; |
|
| 288 | + $main_query_array[] = $_REQUEST['gd_posttype']; |
|
| 289 | + |
|
| 290 | + } else |
|
| 291 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
| 292 | + |
|
| 293 | + $join = ", " . $table . " AS pd "; |
|
| 294 | + |
|
| 295 | + /** |
|
| 296 | 296 | * Filter the SQL JOIN clause for the markers data |
| 297 | 297 | * |
| 298 | 298 | * @since 1.0.0 |
@@ -309,16 +309,16 @@ discard block |
||
| 309 | 309 | * @param string $search Row of searched fields to use in WHERE clause. |
| 310 | 310 | */ |
| 311 | 311 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 312 | - $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
|
| 313 | - $cat_type = $post_type . 'category'; |
|
| 314 | - if ($post_type == 'gd_event') {
|
|
| 315 | - $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
| 316 | - } else {
|
|
| 317 | - $event_select = ""; |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 321 | - /** |
|
| 312 | + $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
|
| 313 | + $cat_type = $post_type . 'category'; |
|
| 314 | + if ($post_type == 'gd_event') {
|
|
| 315 | + $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
| 316 | + } else {
|
|
| 317 | + $event_select = ""; |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 321 | + /** |
|
| 322 | 322 | * Filter the SQL SELECT clause to retrive fields data |
| 323 | 323 | * |
| 324 | 324 | * @since 1.0.0 |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 339 | 339 | |
| 340 | - $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);
|
|
| 340 | + $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);
|
|
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | 343 | * Filter the SQL query to retrive markers data |
@@ -353,276 +353,276 @@ discard block |
||
| 353 | 353 | // print_r($gd_session); |
| 354 | 354 | // print_r($_SESSION); |
| 355 | 355 | |
| 356 | - $catinfo = $wpdb->get_results($catsql); |
|
| 356 | + $catinfo = $wpdb->get_results($catsql); |
|
| 357 | 357 | |
| 358 | - $cat_content_info = array(); |
|
| 359 | - $content_data = array(); |
|
| 360 | - $post_ids = array(); |
|
| 361 | - |
|
| 362 | - /** |
|
| 363 | - * Called before marker data is processed into JSON. |
|
| 364 | - * |
|
| 365 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 366 | - * |
|
| 367 | - * @since 1.5.3 |
|
| 368 | - * @param object $catinfo The posts object containing all marker data. |
|
| 369 | - * @see 'geodir_after_marker_post_process' |
|
| 370 | - */ |
|
| 371 | - $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
|
|
| 372 | - |
|
| 373 | - /** |
|
| 374 | - * Called before marker data is processed into JSON. |
|
| 375 | - * |
|
| 376 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 377 | - * |
|
| 378 | - * @since 1.4.9 |
|
| 379 | - * @param object $catinfo The posts object containing all marker data. |
|
| 380 | - * @see 'geodir_after_marker_post_process' |
|
| 381 | - */ |
|
| 382 | - do_action('geodir_before_marker_post_process_action', $catinfo);
|
|
| 383 | - |
|
| 384 | - // Sort any posts into a ajax array |
|
| 385 | - if (!empty($catinfo)) {
|
|
| 386 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
| 387 | - global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
|
| 388 | - |
|
| 389 | - $today = strtotime(date_i18n('Y-m-d'));
|
|
| 390 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 358 | + $cat_content_info = array(); |
|
| 359 | + $content_data = array(); |
|
| 360 | + $post_ids = array(); |
|
| 361 | + |
|
| 362 | + /** |
|
| 363 | + * Called before marker data is processed into JSON. |
|
| 364 | + * |
|
| 365 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 366 | + * |
|
| 367 | + * @since 1.5.3 |
|
| 368 | + * @param object $catinfo The posts object containing all marker data. |
|
| 369 | + * @see 'geodir_after_marker_post_process' |
|
| 370 | + */ |
|
| 371 | + $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
|
|
| 372 | + |
|
| 373 | + /** |
|
| 374 | + * Called before marker data is processed into JSON. |
|
| 375 | + * |
|
| 376 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 377 | + * |
|
| 378 | + * @since 1.4.9 |
|
| 379 | + * @param object $catinfo The posts object containing all marker data. |
|
| 380 | + * @see 'geodir_after_marker_post_process' |
|
| 381 | + */ |
|
| 382 | + do_action('geodir_before_marker_post_process_action', $catinfo);
|
|
| 383 | + |
|
| 384 | + // Sort any posts into a ajax array |
|
| 385 | + if (!empty($catinfo)) {
|
|
| 386 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
| 387 | + global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
|
| 388 | + |
|
| 389 | + $today = strtotime(date_i18n('Y-m-d'));
|
|
| 390 | + $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 391 | 391 | |
| 392 | - foreach ($catinfo as $catinfo_obj) {
|
|
| 393 | - $post_title = $catinfo_obj->post_title; |
|
| 392 | + foreach ($catinfo as $catinfo_obj) {
|
|
| 393 | + $post_title = $catinfo_obj->post_title; |
|
| 394 | 394 | |
| 395 | - if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
|
|
| 396 | - $event_dates = ''; |
|
| 397 | - $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
| 395 | + if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
|
|
| 396 | + $event_dates = ''; |
|
| 397 | + $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
| 398 | 398 | |
| 399 | - $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
| 399 | + $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
| 400 | 400 | |
| 401 | - if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
|
|
| 402 | - $starttimes = ''; |
|
| 403 | - $endtimes = ''; |
|
| 404 | - $astarttimes = array(); |
|
| 405 | - $aendtimes = array(); |
|
| 406 | - if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 407 | - $recurring_data['repeat_type'] = 'custom'; |
|
| 408 | - } |
|
| 409 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 410 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 401 | + if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
|
|
| 402 | + $starttimes = ''; |
|
| 403 | + $endtimes = ''; |
|
| 404 | + $astarttimes = array(); |
|
| 405 | + $aendtimes = array(); |
|
| 406 | + if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 407 | + $recurring_data['repeat_type'] = 'custom'; |
|
| 408 | + } |
|
| 409 | + $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 410 | + $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 411 | 411 | |
| 412 | - $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 412 | + $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 413 | 413 | |
| 414 | - if ( !empty( $recurring_dates ) ) {
|
|
| 415 | - if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 416 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 417 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 418 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 419 | - } else {
|
|
| 420 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 421 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 422 | - } |
|
| 423 | - } |
|
| 414 | + if ( !empty( $recurring_dates ) ) {
|
|
| 415 | + if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 416 | + if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 417 | + $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 418 | + $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 419 | + } else {
|
|
| 420 | + $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 421 | + $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 422 | + } |
|
| 423 | + } |
|
| 424 | 424 | |
| 425 | - $e = 0; |
|
| 426 | - foreach( $recurring_dates as $key => $date ) {
|
|
| 427 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 428 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 429 | - $starttimes = $astarttimes[$key]; |
|
| 430 | - $endtimes = $aendtimes[$key]; |
|
| 431 | - } else {
|
|
| 432 | - $starttimes = ''; |
|
| 433 | - $endtimes = ''; |
|
| 434 | - } |
|
| 435 | - } |
|
| 425 | + $e = 0; |
|
| 426 | + foreach( $recurring_dates as $key => $date ) {
|
|
| 427 | + if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 428 | + if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 429 | + $starttimes = $astarttimes[$key]; |
|
| 430 | + $endtimes = $aendtimes[$key]; |
|
| 431 | + } else {
|
|
| 432 | + $starttimes = ''; |
|
| 433 | + $endtimes = ''; |
|
| 434 | + } |
|
| 435 | + } |
|
| 436 | 436 | |
| 437 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 438 | - $duration--; |
|
| 439 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 437 | + $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 438 | + $duration--; |
|
| 439 | + $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 440 | 440 | |
| 441 | - // Hide past dates |
|
| 442 | - if ( strtotime( $enddate ) < $today ) {
|
|
| 443 | - continue; |
|
| 444 | - } |
|
| 441 | + // Hide past dates |
|
| 442 | + if ( strtotime( $enddate ) < $today ) {
|
|
| 443 | + continue; |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 447 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 446 | + $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 447 | + $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 448 | 448 | |
| 449 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 450 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 449 | + $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 450 | + $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 451 | 451 | |
| 452 | - $same_day = false; |
|
| 453 | - $full_day = false; |
|
| 454 | - $same_datetime = false; |
|
| 452 | + $same_day = false; |
|
| 453 | + $full_day = false; |
|
| 454 | + $same_datetime = false; |
|
| 455 | 455 | |
| 456 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 457 | - $full_day = true; |
|
| 458 | - } |
|
| 456 | + if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 457 | + $full_day = true; |
|
| 458 | + } |
|
| 459 | 459 | |
| 460 | - if ( $start_date == $end_date && $full_day ) {
|
|
| 461 | - $same_datetime = true; |
|
| 462 | - } |
|
| 463 | - |
|
| 464 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 465 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 466 | - if ( $full_day ) {
|
|
| 467 | - $start_date = $title_date; |
|
| 468 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 469 | - } |
|
| 460 | + if ( $start_date == $end_date && $full_day ) {
|
|
| 461 | + $same_datetime = true; |
|
| 462 | + } |
|
| 463 | + |
|
| 464 | + $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 465 | + $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 466 | + if ( $full_day ) {
|
|
| 467 | + $start_date = $title_date; |
|
| 468 | + $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 469 | + } |
|
| 470 | 470 | |
| 471 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 472 | - $same_day = true; |
|
| 471 | + if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 472 | + $same_day = true; |
|
| 473 | 473 | |
| 474 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 475 | - } |
|
| 474 | + $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 475 | + } |
|
| 476 | 476 | |
| 477 | - $event_dates .= ' :: ' . $start_date; |
|
| 477 | + $event_dates .= ' :: ' . $start_date; |
|
| 478 | 478 | |
| 479 | - if ( !$same_day && !$same_datetime ) {
|
|
| 480 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 481 | - } |
|
| 479 | + if ( !$same_day && !$same_datetime ) {
|
|
| 480 | + $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 481 | + } |
|
| 482 | 482 | |
| 483 | - $e++; |
|
| 483 | + $e++; |
|
| 484 | 484 | |
| 485 | - if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
|
|
| 486 | - break; |
|
| 487 | - } |
|
| 488 | - } |
|
| 489 | - } |
|
| 490 | - } else {
|
|
| 491 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 492 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 493 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 494 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 495 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 485 | + if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
|
|
| 486 | + break; |
|
| 487 | + } |
|
| 488 | + } |
|
| 489 | + } |
|
| 490 | + } else {
|
|
| 491 | + $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 492 | + $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 493 | + $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 494 | + $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 495 | + $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 496 | 496 | |
| 497 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 498 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 499 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 497 | + $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 498 | + $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 499 | + $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 500 | 500 | |
| 501 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 502 | - $start_date = $event_recurring_dates[0]; |
|
| 503 | - } |
|
| 501 | + if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 502 | + $start_date = $event_recurring_dates[0]; |
|
| 503 | + } |
|
| 504 | 504 | |
| 505 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 506 | - $end_date = $start_date; |
|
| 507 | - } |
|
| 505 | + if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 506 | + $end_date = $start_date; |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | - if ($end_date != '' && strtotime($end_date) >= $today) {
|
|
| 510 | - if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 511 | - $starttime = $starttimes[0]; |
|
| 512 | - $endtime = $endtimes[0]; |
|
| 513 | - } |
|
| 509 | + if ($end_date != '' && strtotime($end_date) >= $today) {
|
|
| 510 | + if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 511 | + $starttime = $starttimes[0]; |
|
| 512 | + $endtime = $endtimes[0]; |
|
| 513 | + } |
|
| 514 | 514 | |
| 515 | - $same_day = false; |
|
| 516 | - $one_day = false; |
|
| 517 | - if ( $start_date == $end_date && $all_day ) {
|
|
| 518 | - $one_day = true; |
|
| 519 | - } |
|
| 520 | - |
|
| 521 | - if ( $all_day ) {
|
|
| 522 | - $start_datetime = strtotime( $start_date ); |
|
| 523 | - $end_datetime = strtotime( $end_date ); |
|
| 515 | + $same_day = false; |
|
| 516 | + $one_day = false; |
|
| 517 | + if ( $start_date == $end_date && $all_day ) {
|
|
| 518 | + $one_day = true; |
|
| 519 | + } |
|
| 520 | + |
|
| 521 | + if ( $all_day ) {
|
|
| 522 | + $start_datetime = strtotime( $start_date ); |
|
| 523 | + $end_datetime = strtotime( $end_date ); |
|
| 524 | 524 | |
| 525 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 526 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 527 | - if ( $start_date == $end_date ) {
|
|
| 528 | - $one_day = true; |
|
| 529 | - } |
|
| 530 | - } else {
|
|
| 531 | - if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 532 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 533 | - $one_day = false; |
|
| 534 | - } |
|
| 535 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 536 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 525 | + $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 526 | + $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 527 | + if ( $start_date == $end_date ) {
|
|
| 528 | + $one_day = true; |
|
| 529 | + } |
|
| 530 | + } else {
|
|
| 531 | + if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 532 | + $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 533 | + $one_day = false; |
|
| 534 | + } |
|
| 535 | + $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 536 | + $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 537 | 537 | |
| 538 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 539 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 540 | - } |
|
| 538 | + $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 539 | + $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 540 | + } |
|
| 541 | 541 | |
| 542 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 543 | - $same_day = true; |
|
| 542 | + if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 543 | + $same_day = true; |
|
| 544 | 544 | |
| 545 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 546 | - } |
|
| 545 | + $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 546 | + } |
|
| 547 | 547 | |
| 548 | - $event_dates .= ' :: ' . $start_date; |
|
| 548 | + $event_dates .= ' :: ' . $start_date; |
|
| 549 | 549 | |
| 550 | - if ( !$same_day && !$one_day ) {
|
|
| 551 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 552 | - } |
|
| 553 | - } |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - if (empty($event_dates)) {
|
|
| 557 | - continue; |
|
| 558 | - } |
|
| 550 | + if ( !$same_day && !$one_day ) {
|
|
| 551 | + $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 552 | + } |
|
| 553 | + } |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + if (empty($event_dates)) {
|
|
| 557 | + continue; |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | - $post_title .= $event_dates; |
|
| 561 | - } |
|
| 560 | + $post_title .= $event_dates; |
|
| 561 | + } |
|
| 562 | 562 | |
| 563 | - $map_cat_ids_array; |
|
| 564 | - $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
| 563 | + $map_cat_ids_array; |
|
| 564 | + $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
| 565 | 565 | |
| 566 | - // if single cat lets just show that icon |
|
| 567 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 568 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
| 569 | - } |
|
| 566 | + // if single cat lets just show that icon |
|
| 567 | + if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 568 | + $default_cat = (int)$map_cat_ids_array[0]; |
|
| 569 | + } |
|
| 570 | 570 | |
| 571 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
| 572 | - $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
| 573 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
| 571 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
| 572 | + $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
| 573 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
| 574 | 574 | |
| 575 | - if ($icon != '') {
|
|
| 576 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 575 | + if ($icon != '') {
|
|
| 576 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 577 | 577 | |
| 578 | - if (isset($gd_marker_sizes[$icon])) {
|
|
| 579 | - $icon_size = $gd_marker_sizes[$icon]; |
|
| 580 | - } else {
|
|
| 581 | - $icon_size = geodir_get_marker_size($icon); |
|
| 582 | - $gd_marker_sizes[$icon] = $icon_size; |
|
| 583 | - } |
|
| 584 | - } else {
|
|
| 585 | - $icon_size = array('w' => 36, 'h' => 45);
|
|
| 586 | - } |
|
| 587 | - |
|
| 588 | - $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 . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 589 | - $post_ids[] = $catinfo_obj->post_id; |
|
| 590 | - } |
|
| 591 | - } |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * Called after marker data is processed into JSON. |
|
| 595 | - * |
|
| 596 | - * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 597 | - * |
|
| 598 | - * @since 1.4.9 |
|
| 599 | - * @param array $content_data The array containing all markers in JSON format. |
|
| 600 | - * @param object $catinfo The posts object containing all marker data. |
|
| 601 | - * @see 'geodir_before_marker_post_process' |
|
| 602 | - */ |
|
| 603 | - do_action('geodir_after_marker_post_process', $content_data, $catinfo);
|
|
| 604 | - |
|
| 605 | - if (!empty($content_data)) {
|
|
| 606 | - $cat_content_info[] = implode(',', $content_data);
|
|
| 607 | - } |
|
| 608 | - |
|
| 609 | - $totalcount = count(array_unique($post_ids)); |
|
| 610 | - |
|
| 611 | - if (!empty($cat_content_info)) {
|
|
| 612 | - $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 613 | - } |
|
| 614 | - else {
|
|
| 615 | - $map_json = '[{"totalcount":"0"}]';
|
|
| 616 | - } |
|
| 617 | - |
|
| 618 | - |
|
| 619 | - /** |
|
| 620 | - * Filter the marker json return. |
|
| 621 | - * |
|
| 622 | - * @since 1.6.22 |
|
| 623 | - * @param string $map_json The JSON string of the map markers results. |
|
| 624 | - */ |
|
| 625 | - return apply_filters('geodir_markers_json',$map_json);
|
|
| 578 | + if (isset($gd_marker_sizes[$icon])) {
|
|
| 579 | + $icon_size = $gd_marker_sizes[$icon]; |
|
| 580 | + } else {
|
|
| 581 | + $icon_size = geodir_get_marker_size($icon); |
|
| 582 | + $gd_marker_sizes[$icon] = $icon_size; |
|
| 583 | + } |
|
| 584 | + } else {
|
|
| 585 | + $icon_size = array('w' => 36, 'h' => 45);
|
|
| 586 | + } |
|
| 587 | + |
|
| 588 | + $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 . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 589 | + $post_ids[] = $catinfo_obj->post_id; |
|
| 590 | + } |
|
| 591 | + } |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * Called after marker data is processed into JSON. |
|
| 595 | + * |
|
| 596 | + * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 597 | + * |
|
| 598 | + * @since 1.4.9 |
|
| 599 | + * @param array $content_data The array containing all markers in JSON format. |
|
| 600 | + * @param object $catinfo The posts object containing all marker data. |
|
| 601 | + * @see 'geodir_before_marker_post_process' |
|
| 602 | + */ |
|
| 603 | + do_action('geodir_after_marker_post_process', $content_data, $catinfo);
|
|
| 604 | + |
|
| 605 | + if (!empty($content_data)) {
|
|
| 606 | + $cat_content_info[] = implode(',', $content_data);
|
|
| 607 | + } |
|
| 608 | + |
|
| 609 | + $totalcount = count(array_unique($post_ids)); |
|
| 610 | + |
|
| 611 | + if (!empty($cat_content_info)) {
|
|
| 612 | + $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 613 | + } |
|
| 614 | + else {
|
|
| 615 | + $map_json = '[{"totalcount":"0"}]';
|
|
| 616 | + } |
|
| 617 | + |
|
| 618 | + |
|
| 619 | + /** |
|
| 620 | + * Filter the marker json return. |
|
| 621 | + * |
|
| 622 | + * @since 1.6.22 |
|
| 623 | + * @param string $map_json The JSON string of the map markers results. |
|
| 624 | + */ |
|
| 625 | + return apply_filters('geodir_markers_json',$map_json);
|
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Enable map cache if set |
| 10 | -if(get_option('geodir_enable_map_cache')){
|
|
| 11 | - add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | - add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 10 | +if (get_option('geodir_enable_map_cache')) {
|
|
| 11 | + add_filter('geodir_get_markers_cache', 'geodir_get_map_cache');
|
|
| 12 | + add_filter('geodir_markers_json', 'geodir_save_map_cache', 10);
|
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * @since 1.6.22 |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | -function geodir_get_map_cache($cache){
|
|
| 24 | +function geodir_get_map_cache($cache) {
|
|
| 25 | 25 | |
| 26 | 26 | // if a search is going on then dont even try to check for cache. |
| 27 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 27 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 28 | 28 | return $cache; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -43,29 +43,29 @@ discard block |
||
| 43 | 43 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 44 | 44 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 45 | 45 | |
| 46 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 46 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 47 | 47 | |
| 48 | 48 | $blog_id = get_current_blog_id(); |
| 49 | - if($blog_id>1){
|
|
| 49 | + if ($blog_id > 1) {
|
|
| 50 | 50 | $file_name = $blog_id."_".$file_name; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
| 54 | - $file = $file_path . $file_name . ".json"; |
|
| 54 | + $file = $file_path.$file_name.".json"; |
|
| 55 | 55 | |
| 56 | - if(file_exists($file)){
|
|
| 56 | + if (file_exists($file)) {
|
|
| 57 | 57 | // do the cache delete stuff |
| 58 | 58 | $cache_time = get_option('geodir_map_cache');
|
| 59 | - if(!$cache_time){
|
|
| 59 | + if (!$cache_time) {
|
|
| 60 | 60 | $cache_time = time(); |
| 61 | 61 | update_option('geodir_map_cache', $cache_time);
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 64 | + if ((time() - $cache_time) > 86400) { // delete the cache every 24 hours
|
|
| 65 | 65 | geodir_delete_map_cache(); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if(file_exists($file) && is_readable($file)){
|
|
| 68 | + if (file_exists($file) && is_readable($file)) {
|
|
| 69 | 69 | ob_start(); |
| 70 | 70 | readfile($file); // readfile is quicker then file get contents |
| 71 | 71 | return ob_get_clean(); |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | * @since 1.6.22 |
| 84 | 84 | * @return mixed |
| 85 | 85 | */ |
| 86 | -function geodir_save_map_cache($map_json){
|
|
| 86 | +function geodir_save_map_cache($map_json) {
|
|
| 87 | 87 | |
| 88 | 88 | // if a search is going on then dont even try to check for cache. |
| 89 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 89 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 90 | 90 | return $map_json; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 106 | 106 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 107 | 107 | |
| 108 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 108 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 109 | 109 | |
| 110 | 110 | $blog_id = get_current_blog_id(); |
| 111 | - if($blog_id>1){
|
|
| 111 | + if ($blog_id > 1) {
|
|
| 112 | 112 | $file_name = $blog_id."_".$file_name; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | global $wp_filesystem; |
| 119 | 119 | if (empty($wp_filesystem)) {
|
| 120 | - require_once (ABSPATH . '/wp-admin/includes/file.php'); |
|
| 120 | + require_once (ABSPATH.'/wp-admin/includes/file.php'); |
|
| 121 | 121 | WP_Filesystem(); |
| 122 | 122 | } |
| 123 | 123 | $wp_filesystem->put_contents( |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
| 139 | 139 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
| 140 | 140 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
| 141 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 141 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
| 142 | 142 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
| 143 | 143 | die; |
| 144 | 144 | } |
@@ -158,21 +158,21 @@ discard block |
||
| 158 | 158 | global $wpdb, $plugin_prefix, $gd_session; |
| 159 | 159 | |
| 160 | 160 | if ($_REQUEST['m_id'] != '') {
|
| 161 | - $pid = (int)$_REQUEST['m_id']; |
|
| 161 | + $pid = (int) $_REQUEST['m_id']; |
|
| 162 | 162 | } else {
|
| 163 | 163 | echo __('No marker data found', 'geodirectory');
|
| 164 | 164 | exit; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
| 168 | - $post = (object)$gd_ses_listing; |
|
| 168 | + $post = (object) $gd_ses_listing; |
|
| 169 | 169 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
| 170 | 170 | } else {
|
| 171 | 171 | $geodir_post_type = get_post_type($pid); |
| 172 | 172 | |
| 173 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 173 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 174 | 174 | |
| 175 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 175 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
|
|
| 176 | 176 | |
| 177 | 177 | $postinfo = $wpdb->get_results($sql); |
| 178 | 178 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | function get_markers() {
|
| 208 | 208 | |
| 209 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 209 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session; |
|
| 210 | 210 | |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | * |
| 215 | 215 | * @since 1.6.22 |
| 216 | 216 | */ |
| 217 | - $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 218 | - if($map_cache){
|
|
| 217 | + $map_cache = apply_filters('geodir_get_markers_cache', '');
|
|
| 218 | + if ($map_cache) {
|
|
| 219 | 219 | return $map_cache; |
| 220 | 220 | wp_die(); |
| 221 | 221 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
| 231 | 231 | |
| 232 | 232 | $map_cat_ids_array = array('0');
|
| 233 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 233 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
|
|
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | $field_default_cat = ''; |
@@ -238,13 +238,13 @@ discard block |
||
| 238 | 238 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
| 239 | 239 | |
| 240 | 240 | if (!empty($map_cat_arr)) {
|
| 241 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 241 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
|
|
| 242 | 242 | |
| 243 | 243 | $map_cat_ids_array = explode(',', $map_cat_arr);
|
| 244 | 244 | $cat_find_array = array(); |
| 245 | 245 | foreach ($map_cat_ids_array as $cat_id) {
|
| 246 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 247 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 246 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
| 247 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
| 248 | 248 | $main_query_array[] = $cat_id; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | $field_default_cat = ''; |
| 256 | 256 | |
| 257 | 257 | if (!empty($cat_find_array)) |
| 258 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 258 | + $search .= "AND (".implode(' OR ', $cat_find_array).")";
|
|
| 259 | 259 | |
| 260 | 260 | $main_query_array = $map_cat_ids_array; |
| 261 | 261 | |
| 262 | 262 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
| 263 | 263 | $search .= " AND p.post_title LIKE %s"; |
| 264 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 264 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -283,14 +283,14 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $gd_posttype = ''; |
| 285 | 285 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
| 286 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 286 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
| 287 | 287 | $gd_posttype = " AND p.post_type = %s"; |
| 288 | 288 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 289 | 289 | |
| 290 | 290 | } else |
| 291 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 291 | + $table = $plugin_prefix.'gd_place_detail'; |
|
| 292 | 292 | |
| 293 | - $join = ", " . $table . " AS pd "; |
|
| 293 | + $join = ", ".$table." AS pd "; |
|
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | 296 | * Filter the SQL JOIN clause for the markers data |
@@ -310,14 +310,14 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 312 | 312 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
| 313 | - $cat_type = $post_type . 'category'; |
|
| 313 | + $cat_type = $post_type.'category'; |
|
| 314 | 314 | if ($post_type == 'gd_event') {
|
| 315 | 315 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
| 316 | 316 | } else {
|
| 317 | 317 | $event_select = ""; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 320 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
| 321 | 321 | /** |
| 322 | 322 | * Filter the SQL SELECT clause to retrive fields data |
| 323 | 323 | * |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 339 | 339 | |
| 340 | - $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);
|
|
| 340 | + $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);
|
|
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | 343 | * Filter the SQL query to retrive markers data |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
| 388 | 388 | |
| 389 | 389 | $today = strtotime(date_i18n('Y-m-d'));
|
| 390 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 390 | + $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 391 | 391 | |
| 392 | 392 | foreach ($catinfo as $catinfo_obj) {
|
| 393 | 393 | $post_title = $catinfo_obj->post_title; |
@@ -403,29 +403,29 @@ discard block |
||
| 403 | 403 | $endtimes = ''; |
| 404 | 404 | $astarttimes = array(); |
| 405 | 405 | $aendtimes = array(); |
| 406 | - if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 406 | + if (!isset($recurring_data['repeat_type'])) {
|
|
| 407 | 407 | $recurring_data['repeat_type'] = 'custom'; |
| 408 | 408 | } |
| 409 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 410 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 409 | + $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
|
|
| 410 | + $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false; |
|
| 411 | 411 | |
| 412 | 412 | $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
| 413 | 413 | |
| 414 | - if ( !empty( $recurring_dates ) ) {
|
|
| 415 | - if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 416 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 417 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 418 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 414 | + if (!empty($recurring_dates)) {
|
|
| 415 | + if (empty($recurring_data['all_day'])) {
|
|
| 416 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 417 | + $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 418 | + $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 419 | 419 | } else {
|
| 420 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 421 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 420 | + $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 421 | + $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | $e = 0; |
| 426 | - foreach( $recurring_dates as $key => $date ) {
|
|
| 427 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 428 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 426 | + foreach ($recurring_dates as $key => $date) {
|
|
| 427 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 428 | + if (!empty($astarttimes) && isset($astarttimes[$key])) {
|
|
| 429 | 429 | $starttimes = $astarttimes[$key]; |
| 430 | 430 | $endtimes = $aendtimes[$key]; |
| 431 | 431 | } else {
|
@@ -434,50 +434,50 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 437 | + $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1; |
|
| 438 | 438 | $duration--; |
| 439 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 439 | + $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day'));
|
|
| 440 | 440 | |
| 441 | 441 | // Hide past dates |
| 442 | - if ( strtotime( $enddate ) < $today ) {
|
|
| 442 | + if (strtotime($enddate) < $today) {
|
|
| 443 | 443 | continue; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 447 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 446 | + $sdate = strtotime($date.' '.$starttimes); |
|
| 447 | + $edate = strtotime($enddate.' '.$endtimes); |
|
| 448 | 448 | |
| 449 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 450 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 449 | + $start_date = date_i18n($geodir_date_time_format, $sdate); |
|
| 450 | + $end_date = date_i18n($geodir_date_time_format, $edate); |
|
| 451 | 451 | |
| 452 | 452 | $same_day = false; |
| 453 | 453 | $full_day = false; |
| 454 | 454 | $same_datetime = false; |
| 455 | 455 | |
| 456 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 456 | + if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) {
|
|
| 457 | 457 | $full_day = true; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if ( $start_date == $end_date && $full_day ) {
|
|
| 460 | + if ($start_date == $end_date && $full_day) {
|
|
| 461 | 461 | $same_datetime = true; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 465 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 466 | - if ( $full_day ) {
|
|
| 464 | + $link_date = date_i18n('Y-m-d', $sdate);
|
|
| 465 | + $title_date = date_i18n($geodir_date_format, $sdate); |
|
| 466 | + if ($full_day) {
|
|
| 467 | 467 | $start_date = $title_date; |
| 468 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 468 | + $end_date = date_i18n($geodir_date_format, $edate); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 471 | + if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) {
|
|
| 472 | 472 | $same_day = true; |
| 473 | 473 | |
| 474 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 474 | + $start_date .= ' - '.date_i18n($geodir_time_format, $edate); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - $event_dates .= ' :: ' . $start_date; |
|
| 477 | + $event_dates .= ' :: '.$start_date; |
|
| 478 | 478 | |
| 479 | - if ( !$same_day && !$same_datetime ) {
|
|
| 480 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 479 | + if (!$same_day && !$same_datetime) {
|
|
| 480 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | $e++; |
@@ -488,67 +488,67 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | } else {
|
| 491 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 492 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 493 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 494 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 495 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 491 | + $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : ''; |
|
| 492 | + $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date; |
|
| 493 | + $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false; |
|
| 494 | + $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 495 | + $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 496 | 496 | |
| 497 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 498 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 499 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 497 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 498 | + $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 499 | + $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 500 | 500 | |
| 501 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 501 | + if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) {
|
|
| 502 | 502 | $start_date = $event_recurring_dates[0]; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 505 | + if (strtotime($end_date) < strtotime($start_date)) {
|
|
| 506 | 506 | $end_date = $start_date; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | if ($end_date != '' && strtotime($end_date) >= $today) {
|
| 510 | - if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 510 | + if ($starttime == '' && !empty($starttimes)) {
|
|
| 511 | 511 | $starttime = $starttimes[0]; |
| 512 | 512 | $endtime = $endtimes[0]; |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | $same_day = false; |
| 516 | 516 | $one_day = false; |
| 517 | - if ( $start_date == $end_date && $all_day ) {
|
|
| 517 | + if ($start_date == $end_date && $all_day) {
|
|
| 518 | 518 | $one_day = true; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - if ( $all_day ) {
|
|
| 522 | - $start_datetime = strtotime( $start_date ); |
|
| 523 | - $end_datetime = strtotime( $end_date ); |
|
| 521 | + if ($all_day) {
|
|
| 522 | + $start_datetime = strtotime($start_date); |
|
| 523 | + $end_datetime = strtotime($end_date); |
|
| 524 | 524 | |
| 525 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 526 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 527 | - if ( $start_date == $end_date ) {
|
|
| 525 | + $start_date = date_i18n($geodir_date_format, $start_datetime); |
|
| 526 | + $end_date = date_i18n($geodir_date_format, $end_datetime); |
|
| 527 | + if ($start_date == $end_date) {
|
|
| 528 | 528 | $one_day = true; |
| 529 | 529 | } |
| 530 | 530 | } else {
|
| 531 | - if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 532 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 531 | + if ($start_date == $end_date && $starttime == $endtime) {
|
|
| 532 | + $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day'));
|
|
| 533 | 533 | $one_day = false; |
| 534 | 534 | } |
| 535 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 536 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 535 | + $start_datetime = strtotime($start_date.' '.$starttime); |
|
| 536 | + $end_datetime = strtotime($end_date.' '.$endtime); |
|
| 537 | 537 | |
| 538 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 539 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 538 | + $start_date = date_i18n($geodir_date_time_format, $start_datetime); |
|
| 539 | + $end_date = date_i18n($geodir_date_time_format, $end_datetime); |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 542 | + if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) {
|
|
| 543 | 543 | $same_day = true; |
| 544 | 544 | |
| 545 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 545 | + $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - $event_dates .= ' :: ' . $start_date; |
|
| 548 | + $event_dates .= ' :: '.$start_date; |
|
| 549 | 549 | |
| 550 | - if ( !$same_day && !$one_day ) {
|
|
| 551 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 550 | + if (!$same_day && !$one_day) {
|
|
| 551 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | 554 | } |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
| 565 | 565 | |
| 566 | 566 | // if single cat lets just show that icon |
| 567 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 568 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
| 567 | + if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) {
|
|
| 568 | + $default_cat = (int) $map_cat_ids_array[0]; |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | $icon_size = array('w' => 36, 'h' => 45);
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - $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 . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 588 | + $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.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
|
|
| 589 | 589 | $post_ids[] = $catinfo_obj->post_id; |
| 590 | 590 | } |
| 591 | 591 | } |
@@ -609,10 +609,10 @@ discard block |
||
| 609 | 609 | $totalcount = count(array_unique($post_ids)); |
| 610 | 610 | |
| 611 | 611 | if (!empty($cat_content_info)) {
|
| 612 | - $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 612 | + $map_json = '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
|
|
| 613 | 613 | } |
| 614 | 614 | else {
|
| 615 | - $map_json = '[{"totalcount":"0"}]';
|
|
| 615 | + $map_json = '[{"totalcount":"0"}]';
|
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | * @since 1.6.22 |
| 623 | 623 | * @param string $map_json The JSON string of the map markers results. |
| 624 | 624 | */ |
| 625 | - return apply_filters('geodir_markers_json',$map_json);
|
|
| 625 | + return apply_filters('geodir_markers_json', $map_json);
|
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function geodir_session_start() |
| 18 | 18 | {
|
| 19 | - if (!session_id()) session_start(); |
|
| 19 | + if (!session_id()) { |
|
| 20 | + session_start(); |
|
| 21 | + } |
|
| 20 | 22 | global $geodir_add_location_url; |
| 21 | 23 | |
| 22 | 24 | $geodir_add_location_url = NULL; |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | |
| 87 | 89 | if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
| 88 | 90 | |
| 89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
| 91 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') { |
|
| 92 | + $_REQUEST['scat'] = ''; |
|
| 93 | + } |
|
| 90 | 94 | //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
| 91 | 95 | |
| 92 | 96 | if (isset($_REQUEST['sdist'])) {
|
@@ -198,8 +202,9 @@ discard block |
||
| 198 | 202 | add_filter('posts_fields', 'geodir_posts_fields', 1);
|
| 199 | 203 | add_filter('posts_join', 'geodir_posts_join', 1);
|
| 200 | 204 | geodir_post_where(); |
| 201 | - if (!is_admin()) |
|
| 202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 205 | + if (!is_admin()) { |
|
| 206 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
| 207 | + } |
|
| 203 | 208 | |
| 204 | 209 | // advanced filter for popular post view widget |
| 205 | 210 | global $wp_query; |
@@ -349,8 +354,9 @@ discard block |
||
| 349 | 354 | $sort_by = ''; |
| 350 | 355 | $orderby = ' '; |
| 351 | 356 | |
| 352 | - if (get_query_var('order_by'))
|
|
| 353 | - $sort_by = get_query_var('order_by');
|
|
| 357 | + if (get_query_var('order_by')) { |
|
| 358 | + $sort_by = get_query_var('order_by'); |
|
| 359 | + } |
|
| 354 | 360 | |
| 355 | 361 | /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
|
| 356 | 362 | $current_term = $wp_query->get_queried_object(); |
@@ -370,14 +376,16 @@ discard block |
||
| 370 | 376 | $orderby .= " distance,"; |
| 371 | 377 | } |
| 372 | 378 | |
| 373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
| 374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 379 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) { |
|
| 380 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 381 | + } |
|
| 375 | 382 | |
| 376 | 383 | |
| 377 | 384 | if ($sort_by == '') {
|
| 378 | 385 | $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
| 379 | - if (!empty($default_sort)) |
|
| 380 | - $sort_by = $default_sort; |
|
| 386 | + if (!empty($default_sort)) { |
|
| 387 | + $sort_by = $default_sort; |
|
| 388 | + } |
|
| 381 | 389 | } |
| 382 | 390 | |
| 383 | 391 | /* |
@@ -562,7 +570,7 @@ discard block |
||
| 562 | 570 | $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )) / ( $avg_num_votes + " . $table . ".rating_count ) $order , ";
|
| 563 | 571 | |
| 564 | 572 | //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ) / ( " . $table . ".rating_count + " . $table . ".rating_count ) $order , "; // seems to work mostly with no extra overheads
|
| 565 | - }else{
|
|
| 573 | + } else{
|
|
| 566 | 574 | $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
| 567 | 575 | } |
| 568 | 576 | |
@@ -607,8 +615,9 @@ discard block |
||
| 607 | 615 | |
| 608 | 616 | add_filter('posts_where', 'searching_filter_where', 1);
|
| 609 | 617 | |
| 610 | - if ($snear != '') |
|
| 611 | - add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 618 | + if ($snear != '') { |
|
| 619 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
| 620 | + } |
|
| 612 | 621 | |
| 613 | 622 | add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
| 614 | 623 | |
@@ -762,10 +771,11 @@ discard block |
||
| 762 | 771 | |
| 763 | 772 | $where = ''; |
| 764 | 773 | $better_search_terms = ''; |
| 765 | - if (isset($_REQUEST['stype'])) |
|
| 766 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 767 | - else |
|
| 768 | - $post_types = 'gd_place'; |
|
| 774 | + if (isset($_REQUEST['stype'])) { |
|
| 775 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 776 | + } else { |
|
| 777 | + $post_types = 'gd_place'; |
|
| 778 | + } |
|
| 769 | 779 | |
| 770 | 780 | if ($s != '') {
|
| 771 | 781 | $keywords = explode(" ", $s);
|
@@ -802,7 +812,7 @@ discard block |
||
| 802 | 812 | if($taxonomies) {
|
| 803 | 813 | $taxonomies = implode("','", $taxonomies);
|
| 804 | 814 | $taxonomies = "'" . $taxonomies . "'"; |
| 805 | - }else{$taxonomies='';}
|
|
| 815 | + } else{$taxonomies='';}
|
|
| 806 | 816 | |
| 807 | 817 | $content_where = $terms_where = ''; |
| 808 | 818 | if ($s != '') {
|
@@ -940,8 +950,9 @@ discard block |
||
| 940 | 950 | $user_fav_posts = geodir_get_user_favourites($user_id); |
| 941 | 951 | $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
|
| 942 | 952 | $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
|
| 943 | - } else |
|
| 944 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 953 | + } else { |
|
| 954 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 955 | + } |
|
| 945 | 956 | |
| 946 | 957 | if ($user_id == (int)get_current_user_id()) {
|
| 947 | 958 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function geodir_session_start() |
| 18 | 18 | {
|
| 19 | - if (!session_id()) session_start(); |
|
| 20 | - global $geodir_add_location_url; |
|
| 19 | + if (!session_id()) session_start(); |
|
| 20 | + global $geodir_add_location_url; |
|
| 21 | 21 | |
| 22 | - $geodir_add_location_url = NULL; |
|
| 22 | + $geodir_add_location_url = NULL; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function geodir_modified_query($query) |
| 35 | 35 | {
|
| 36 | - if ($query->is_main_query() && ( |
|
| 37 | - (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
|
|
| 38 | - || geodir_is_page('listing')
|
|
| 39 | - || geodir_is_page('author')
|
|
| 40 | - || geodir_is_page('search')
|
|
| 41 | - || geodir_is_page('detail'))
|
|
| 42 | - ) {
|
|
| 43 | - |
|
| 44 | - $query->set('is_geodir_loop', true);
|
|
| 45 | - } |
|
| 36 | + if ($query->is_main_query() && ( |
|
| 37 | + (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
|
|
| 38 | + || geodir_is_page('listing')
|
|
| 39 | + || geodir_is_page('author')
|
|
| 40 | + || geodir_is_page('search')
|
|
| 41 | + || geodir_is_page('detail'))
|
|
| 42 | + ) {
|
|
| 43 | + |
|
| 44 | + $query->set('is_geodir_loop', true);
|
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $query; |
|
| 47 | + return $query; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -67,81 +67,81 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function set_listing_request($query ) |
| 69 | 69 | {
|
| 70 | - global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
| 70 | + global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | - // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
| 74 | - if (!geodir_is_geodir_page()) {
|
|
| 75 | - return; |
|
| 76 | - } |
|
| 73 | + // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
| 74 | + if (!geodir_is_geodir_page()) {
|
|
| 75 | + return; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /* remove all pre filters */ |
|
| 79 | - remove_all_filters('query');
|
|
| 80 | - remove_all_filters('posts_search');
|
|
| 81 | - remove_all_filters('posts_fields');
|
|
| 82 | - remove_all_filters('posts_join');
|
|
| 83 | - remove_all_filters('posts_orderby');
|
|
| 84 | - remove_all_filters('posts_where');
|
|
| 78 | + /* remove all pre filters */ |
|
| 79 | + remove_all_filters('query');
|
|
| 80 | + remove_all_filters('posts_search');
|
|
| 81 | + remove_all_filters('posts_fields');
|
|
| 82 | + remove_all_filters('posts_join');
|
|
| 83 | + remove_all_filters('posts_orderby');
|
|
| 84 | + remove_all_filters('posts_where');
|
|
| 85 | 85 | |
| 86 | 86 | |
| 87 | - if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
| 87 | + if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
| 88 | 88 | |
| 89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
| 90 | - //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
| 89 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
| 90 | + //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
| 91 | 91 | |
| 92 | - if (isset($_REQUEST['sdist'])) {
|
|
| 93 | - ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
| 94 | - } elseif (get_option('geodir_search_dist') != '') {
|
|
| 95 | - $dist = get_option('geodir_search_dist');
|
|
| 92 | + if (isset($_REQUEST['sdist'])) {
|
|
| 93 | + ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
| 94 | + } elseif (get_option('geodir_search_dist') != '') {
|
|
| 95 | + $dist = get_option('geodir_search_dist');
|
|
| 96 | 96 | |
| 97 | - } else {
|
|
| 98 | - $dist = 25000; |
|
| 99 | - } // Distance |
|
| 97 | + } else {
|
|
| 98 | + $dist = 25000; |
|
| 99 | + } // Distance |
|
| 100 | 100 | |
| 101 | - if (isset($_REQUEST['sgeo_lat'])) {
|
|
| 102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | - } else {
|
|
| 104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
| 105 | - } // Latitude |
|
| 101 | + if (isset($_REQUEST['sgeo_lat'])) {
|
|
| 102 | + $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | + } else {
|
|
| 104 | + $mylat = (float)geodir_get_current_city_lat(); |
|
| 105 | + } // Latitude |
|
| 106 | 106 | |
| 107 | - if (isset($_REQUEST['sgeo_lon'])) {
|
|
| 108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | - } else {
|
|
| 110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
| 111 | - } // Distance |
|
| 107 | + if (isset($_REQUEST['sgeo_lon'])) {
|
|
| 108 | + $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | + } else {
|
|
| 110 | + $mylon = (float)geodir_get_current_city_lng(); |
|
| 111 | + } // Distance |
|
| 112 | 112 | |
| 113 | - if (isset($_REQUEST['snear'])) {
|
|
| 114 | - $snear = trim(esc_attr($_REQUEST['snear'])); |
|
| 115 | - } |
|
| 113 | + if (isset($_REQUEST['snear'])) {
|
|
| 114 | + $snear = trim(esc_attr($_REQUEST['snear'])); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - if (isset($_REQUEST['s'])) {
|
|
| 118 | - $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
| 119 | - } |
|
| 117 | + if (isset($_REQUEST['s'])) {
|
|
| 118 | + $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - if ($snear == 'NEAR ME') {
|
|
| 122 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
| 123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 124 | - $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude])); |
|
| 125 | - $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude])); |
|
| 126 | - } |
|
| 121 | + if ($snear == 'NEAR ME') {
|
|
| 122 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
| 123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 124 | + $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude])); |
|
| 125 | + $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude])); |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | 128 | |
| 129 | - if (strstr($s, ',')) {
|
|
| 130 | - $s_AA = str_replace(" ", "", $s);
|
|
| 131 | - $s_A = explode(",", $s_AA);
|
|
| 132 | - $s_A = implode('","', $s_A);
|
|
| 133 | - $s_A = '"' . $s_A . '"'; |
|
| 134 | - } else {
|
|
| 135 | - $s_A = '"' . $s . '"'; |
|
| 136 | - } |
|
| 129 | + if (strstr($s, ',')) {
|
|
| 130 | + $s_AA = str_replace(" ", "", $s);
|
|
| 131 | + $s_A = explode(",", $s_AA);
|
|
| 132 | + $s_A = implode('","', $s_A);
|
|
| 133 | + $s_A = '"' . $s_A . '"'; |
|
| 134 | + } else {
|
|
| 135 | + $s_A = '"' . $s . '"'; |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - if (strstr($s, ' ')) {
|
|
| 139 | - $s_SA = explode(" ", $s);
|
|
| 140 | - } else {
|
|
| 141 | - $s_SA = ''; |
|
| 142 | - } |
|
| 138 | + if (strstr($s, ' ')) {
|
|
| 139 | + $s_SA = explode(" ", $s);
|
|
| 140 | + } else {
|
|
| 141 | + $s_SA = ''; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - endif; |
|
| 144 | + endif; |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | |
@@ -162,56 +162,56 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | function geodir_listing_loop_filter($query) |
| 164 | 164 | {
|
| 165 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
| 165 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
| 166 | 166 | |
| 167 | - // fix wp_reset_query for popular post view widget |
|
| 168 | - if (!geodir_is_geodir_page()) {
|
|
| 169 | - return; |
|
| 170 | - } |
|
| 167 | + // fix wp_reset_query for popular post view widget |
|
| 168 | + if (!geodir_is_geodir_page()) {
|
|
| 169 | + return; |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - $geodir_post_type = geodir_get_current_posttype(); |
|
| 173 | - |
|
| 174 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
|
|
| 175 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
| 176 | - |
|
| 177 | - if (isset($wp_query->query[$taxonomies[0]])) {
|
|
| 178 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
|
|
| 179 | - $request_term = end($request_term); |
|
| 180 | - if (!term_exists($request_term)) {
|
|
| 181 | - $args = array('number' => '1',);
|
|
| 182 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
| 183 | - foreach ($terms_arr as $location_term) {
|
|
| 184 | - $term_arr = $location_term; |
|
| 185 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
|
|
| 186 | - } |
|
| 187 | - $wp_query->queried_object_id = 1; |
|
| 188 | - $wp_query->queried_object = $term_arr; |
|
| 189 | - //print_r($wp_query) ; |
|
| 190 | - } |
|
| 191 | - } |
|
| 172 | + $geodir_post_type = geodir_get_current_posttype(); |
|
| 173 | + |
|
| 174 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
|
|
| 175 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
| 176 | + |
|
| 177 | + if (isset($wp_query->query[$taxonomies[0]])) {
|
|
| 178 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
|
|
| 179 | + $request_term = end($request_term); |
|
| 180 | + if (!term_exists($request_term)) {
|
|
| 181 | + $args = array('number' => '1',);
|
|
| 182 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
| 183 | + foreach ($terms_arr as $location_term) {
|
|
| 184 | + $term_arr = $location_term; |
|
| 185 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
|
|
| 186 | + } |
|
| 187 | + $wp_query->queried_object_id = 1; |
|
| 188 | + $wp_query->queried_object = $term_arr; |
|
| 189 | + //print_r($wp_query) ; |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - } |
|
| 194 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
|
| 195 | - |
|
| 196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 197 | - |
|
| 198 | - add_filter('posts_fields', 'geodir_posts_fields', 1);
|
|
| 199 | - add_filter('posts_join', 'geodir_posts_join', 1);
|
|
| 200 | - geodir_post_where(); |
|
| 201 | - if (!is_admin()) |
|
| 202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 203 | - |
|
| 204 | - // advanced filter for popular post view widget |
|
| 205 | - global $wp_query; |
|
| 206 | - if (!is_admin()) {
|
|
| 207 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 208 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000);
|
|
| 209 | - } |
|
| 210 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000);
|
|
| 211 | - } |
|
| 193 | + } |
|
| 194 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
|
| 212 | 195 | |
| 213 | - } |
|
| 214 | - return $query; |
|
| 196 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 197 | + |
|
| 198 | + add_filter('posts_fields', 'geodir_posts_fields', 1);
|
|
| 199 | + add_filter('posts_join', 'geodir_posts_join', 1);
|
|
| 200 | + geodir_post_where(); |
|
| 201 | + if (!is_admin()) |
|
| 202 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 203 | + |
|
| 204 | + // advanced filter for popular post view widget |
|
| 205 | + global $wp_query; |
|
| 206 | + if (!is_admin()) {
|
|
| 207 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 208 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000);
|
|
| 209 | + } |
|
| 210 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000);
|
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + } |
|
| 214 | + return $query; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
@@ -230,67 +230,67 @@ discard block |
||
| 230 | 230 | * @return string Modified fields query string. |
| 231 | 231 | */ |
| 232 | 232 | function geodir_posts_fields($fields) {
|
| 233 | - global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
| 233 | + global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
| 234 | 234 | |
| 235 | - // Filter-Location-Manager to add location table. |
|
| 236 | - $fields .= ", " . $table . ".* "; |
|
| 235 | + // Filter-Location-Manager to add location table. |
|
| 236 | + $fields .= ", " . $table . ".* "; |
|
| 237 | 237 | |
| 238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) {
|
| 239 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 239 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 240 | 240 | |
| 241 | 241 | if ($gd_session->get('all_near_me')) {
|
| 242 | - $mylat = $gd_session->get('user_lat');
|
|
| 243 | - $mylon = $gd_session->get('user_lon');
|
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | - } |
|
| 248 | - |
|
| 249 | - global $s; |
|
| 250 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 251 | - $keywords = explode(" ", $s);
|
|
| 252 | - |
|
| 253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | - foreach($keywords as $kkey=>$kword){
|
|
| 255 | - if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 256 | - unset($keywords[$kkey]); |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - } |
|
| 242 | + $mylat = $gd_session->get('user_lat');
|
|
| 243 | + $mylon = $gd_session->get('user_lon');
|
|
| 244 | + } |
|
| 260 | 245 | |
| 246 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | + } |
|
| 261 | 248 | |
| 262 | - if (count($keywords) > 1) {
|
|
| 263 | - $parts = array( |
|
| 264 | - 'AND' => 'gd_alltitlematch_part', |
|
| 265 | - 'OR' => 'gd_titlematch_part' |
|
| 266 | - ); |
|
| 267 | - $gd_titlematch_part = ""; |
|
| 268 | - foreach ($parts as $key => $part) {
|
|
| 269 | - $gd_titlematch_part .= " CASE WHEN "; |
|
| 270 | - $count = 0; |
|
| 271 | - foreach ($keywords as $keyword) {
|
|
| 272 | - $keyword = trim($keyword); |
|
| 273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 249 | + global $s; |
|
| 250 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 251 | + $keywords = explode(" ", $s);
|
|
| 252 | + |
|
| 253 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | + foreach($keywords as $kkey=>$kword){
|
|
| 255 | + if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 256 | + unset($keywords[$kkey]); |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + |
|
| 262 | + if (count($keywords) > 1) {
|
|
| 263 | + $parts = array( |
|
| 264 | + 'AND' => 'gd_alltitlematch_part', |
|
| 265 | + 'OR' => 'gd_titlematch_part' |
|
| 266 | + ); |
|
| 267 | + $gd_titlematch_part = ""; |
|
| 268 | + foreach ($parts as $key => $part) {
|
|
| 269 | + $gd_titlematch_part .= " CASE WHEN "; |
|
| 270 | + $count = 0; |
|
| 271 | + foreach ($keywords as $keyword) {
|
|
| 272 | + $keyword = trim($keyword); |
|
| 273 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 274 | 274 | $count++; |
| 275 | - if ($count < count($keywords)) {
|
|
| 276 | - // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
| 275 | + if ($count < count($keywords)) {
|
|
| 276 | + // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
| 277 | 277 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
| 278 | - } else {
|
|
| 279 | - //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
| 278 | + } else {
|
|
| 279 | + //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
| 280 | 280 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
| 281 | - } |
|
| 282 | - } |
|
| 283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 284 | - } |
|
| 285 | - } else {
|
|
| 286 | - $gd_titlematch_part = ""; |
|
| 287 | - } |
|
| 288 | - $s = stripslashes_deep( $s ); |
|
| 289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 284 | + } |
|
| 285 | + } else {
|
|
| 286 | + $gd_titlematch_part = ""; |
|
| 287 | + } |
|
| 288 | + $s = stripslashes_deep( $s ); |
|
| 289 | + $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 290 | 290 | $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
|
| 291 | - } |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - return $fields; |
|
| 293 | + return $fields; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
@@ -307,26 +307,26 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | function geodir_posts_join($join) |
| 309 | 309 | {
|
| 310 | - global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
| 310 | + global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
| 311 | 311 | |
| 312 | - ########### WPML ########### |
|
| 312 | + ########### WPML ########### |
|
| 313 | 313 | |
| 314 | - if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) {
|
|
| 315 | - global $sitepress; |
|
| 316 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 317 | - $default_lang_code = $sitepress->get_default_language(); |
|
| 318 | - if ($lang_code) {
|
|
| 319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 320 | - } |
|
| 314 | + if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) {
|
|
| 315 | + global $sitepress; |
|
| 316 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 317 | + $default_lang_code = $sitepress->get_default_language(); |
|
| 318 | + if ($lang_code) {
|
|
| 319 | + $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 320 | + } |
|
| 321 | 321 | |
| 322 | - } |
|
| 323 | - ########### WPML ########### |
|
| 322 | + } |
|
| 323 | + ########### WPML ########### |
|
| 324 | 324 | |
| 325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 326 | - //===old code start |
|
| 327 | - //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
|
| 325 | + $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 326 | + //===old code start |
|
| 327 | + //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
|
| 328 | 328 | |
| 329 | - return $join; |
|
| 329 | + return $join; |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | |
@@ -344,15 +344,15 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | function geodir_posts_orderby($orderby) |
| 346 | 346 | {
|
| 347 | - global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
| 347 | + global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
| 348 | 348 | |
| 349 | - $sort_by = ''; |
|
| 350 | - $orderby = ' '; |
|
| 349 | + $sort_by = ''; |
|
| 350 | + $orderby = ' '; |
|
| 351 | 351 | |
| 352 | - if (get_query_var('order_by'))
|
|
| 353 | - $sort_by = get_query_var('order_by');
|
|
| 352 | + if (get_query_var('order_by'))
|
|
| 353 | + $sort_by = get_query_var('order_by');
|
|
| 354 | 354 | |
| 355 | - /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
|
|
| 355 | + /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
|
|
| 356 | 356 | $current_term = $wp_query->get_queried_object(); |
| 357 | 357 | } |
| 358 | 358 | |
@@ -366,133 +366,133 @@ discard block |
||
| 366 | 366 | }*/ |
| 367 | 367 | |
| 368 | 368 | |
| 369 | - if ($snear != '') {
|
|
| 370 | - $orderby .= " distance,"; |
|
| 371 | - } |
|
| 369 | + if ($snear != '') {
|
|
| 370 | + $orderby .= " distance,"; |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
| 374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 373 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
| 374 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 375 | 375 | |
| 376 | 376 | |
| 377 | - if ($sort_by == '') {
|
|
| 378 | - $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
| 379 | - if (!empty($default_sort)) |
|
| 380 | - $sort_by = $default_sort; |
|
| 381 | - } |
|
| 377 | + if ($sort_by == '') {
|
|
| 378 | + $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
| 379 | + if (!empty($default_sort)) |
|
| 380 | + $sort_by = $default_sort; |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | - /* |
|
| 383 | + /* |
|
| 384 | 384 | if search by term & no location then order always "relevance" |
| 385 | 385 | if search by location then order always "nearest" |
| 386 | 386 | */ |
| 387 | - if (is_main_query() && geodir_is_page('search')) {
|
|
| 388 | - $search_term = get_query_var('s');
|
|
| 387 | + if (is_main_query() && geodir_is_page('search')) {
|
|
| 388 | + $search_term = get_query_var('s');
|
|
| 389 | 389 | |
| 390 | - if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
|
|
| 391 | - $sort_by = 'az'; |
|
| 392 | - } |
|
| 390 | + if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
|
|
| 391 | + $sort_by = 'az'; |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | - if ($snear != '' && $sort_by!='farthest') {
|
|
| 395 | - $sort_by = 'nearest'; |
|
| 396 | - } |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - switch ($sort_by): |
|
| 400 | - case 'newest': |
|
| 401 | - $orderby = "$wpdb->posts.post_date desc, "; |
|
| 402 | - break; |
|
| 403 | - case 'oldest': |
|
| 404 | - $orderby = "$wpdb->posts.post_date asc, "; |
|
| 405 | - break; |
|
| 406 | - case 'low_review': |
|
| 407 | - case 'rating_count_asc': |
|
| 408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 409 | - break; |
|
| 410 | - case 'high_review': |
|
| 411 | - case 'rating_count_desc': |
|
| 412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 413 | - break; |
|
| 414 | - case 'low_rating': |
|
| 415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 416 | - break; |
|
| 417 | - case 'high_rating': |
|
| 418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 419 | - break; |
|
| 420 | - case 'featured': |
|
| 421 | - $orderby = $table . ".is_featured asc, "; |
|
| 422 | - break; |
|
| 423 | - case 'nearest': |
|
| 424 | - $orderby = " distance asc, "; |
|
| 425 | - break; |
|
| 426 | - case 'farthest': |
|
| 427 | - $orderby = " distance desc, "; |
|
| 428 | - break; |
|
| 429 | - case 'random': |
|
| 430 | - $orderby = " rand(), "; |
|
| 431 | - break; |
|
| 432 | - case 'az': |
|
| 433 | - $orderby = "$wpdb->posts.post_title asc, "; |
|
| 434 | - break; |
|
| 435 | - // sort by rating |
|
| 436 | - case 'overall_rating_desc': |
|
| 437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 438 | - break; |
|
| 439 | - case 'overall_rating_asc': |
|
| 440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
| 441 | - break; |
|
| 442 | - default: |
|
| 443 | - |
|
| 444 | - break; |
|
| 445 | - endswitch; |
|
| 446 | - |
|
| 447 | - if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
|
|
| 448 | - if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
|
|
| 449 | - $orderby = "$wpdb->posts.comment_count DESC, "; |
|
| 450 | - $sort_by = 'comment_count_desc'; |
|
| 451 | - } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
|
|
| 452 | - $orderby = "$wpdb->posts.comment_count ASC, "; |
|
| 453 | - $sort_by = 'comment_count_asc'; |
|
| 454 | - } |
|
| 455 | - } |
|
| 394 | + if ($snear != '' && $sort_by!='farthest') {
|
|
| 395 | + $sort_by = 'nearest'; |
|
| 396 | + } |
|
| 397 | + } |
|
| 456 | 398 | |
| 457 | - global $s; |
|
| 399 | + switch ($sort_by): |
|
| 400 | + case 'newest': |
|
| 401 | + $orderby = "$wpdb->posts.post_date desc, "; |
|
| 402 | + break; |
|
| 403 | + case 'oldest': |
|
| 404 | + $orderby = "$wpdb->posts.post_date asc, "; |
|
| 405 | + break; |
|
| 406 | + case 'low_review': |
|
| 407 | + case 'rating_count_asc': |
|
| 408 | + $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 409 | + break; |
|
| 410 | + case 'high_review': |
|
| 411 | + case 'rating_count_desc': |
|
| 412 | + $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 413 | + break; |
|
| 414 | + case 'low_rating': |
|
| 415 | + $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 416 | + break; |
|
| 417 | + case 'high_rating': |
|
| 418 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 419 | + break; |
|
| 420 | + case 'featured': |
|
| 421 | + $orderby = $table . ".is_featured asc, "; |
|
| 422 | + break; |
|
| 423 | + case 'nearest': |
|
| 424 | + $orderby = " distance asc, "; |
|
| 425 | + break; |
|
| 426 | + case 'farthest': |
|
| 427 | + $orderby = " distance desc, "; |
|
| 428 | + break; |
|
| 429 | + case 'random': |
|
| 430 | + $orderby = " rand(), "; |
|
| 431 | + break; |
|
| 432 | + case 'az': |
|
| 433 | + $orderby = "$wpdb->posts.post_title asc, "; |
|
| 434 | + break; |
|
| 435 | + // sort by rating |
|
| 436 | + case 'overall_rating_desc': |
|
| 437 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 438 | + break; |
|
| 439 | + case 'overall_rating_asc': |
|
| 440 | + $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
| 441 | + break; |
|
| 442 | + default: |
|
| 443 | + |
|
| 444 | + break; |
|
| 445 | + endswitch; |
|
| 446 | + |
|
| 447 | + if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
|
|
| 448 | + if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
|
|
| 449 | + $orderby = "$wpdb->posts.comment_count DESC, "; |
|
| 450 | + $sort_by = 'comment_count_desc'; |
|
| 451 | + } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
|
|
| 452 | + $orderby = "$wpdb->posts.comment_count ASC, "; |
|
| 453 | + $sort_by = 'comment_count_asc'; |
|
| 454 | + } |
|
| 455 | + } |
|
| 458 | 456 | |
| 459 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 460 | - $keywords = explode(" ", $s);
|
|
| 461 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 462 | - foreach($keywords as $kkey=>$kword){
|
|
| 463 | - if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 464 | - unset($keywords[$kkey]); |
|
| 465 | - } |
|
| 466 | - } |
|
| 467 | - } |
|
| 468 | - if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
|
| 469 | - if (count($keywords) > 1) {
|
|
| 470 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 471 | - } else {
|
|
| 472 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 473 | - } |
|
| 474 | - } else {
|
|
| 475 | - if (count($keywords) > 1) {
|
|
| 476 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 477 | - } else {
|
|
| 478 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 479 | - } |
|
| 480 | - } |
|
| 481 | - } |
|
| 457 | + global $s; |
|
| 458 | + |
|
| 459 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 460 | + $keywords = explode(" ", $s);
|
|
| 461 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 462 | + foreach($keywords as $kkey=>$kword){
|
|
| 463 | + if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 464 | + unset($keywords[$kkey]); |
|
| 465 | + } |
|
| 466 | + } |
|
| 467 | + } |
|
| 468 | + if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
|
| 469 | + if (count($keywords) > 1) {
|
|
| 470 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 471 | + } else {
|
|
| 472 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 473 | + } |
|
| 474 | + } else {
|
|
| 475 | + if (count($keywords) > 1) {
|
|
| 476 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 477 | + } else {
|
|
| 478 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 479 | + } |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | 482 | |
| 483 | - /** |
|
| 484 | - * Filter order by SQL. |
|
| 485 | - * |
|
| 486 | - * @since 1.0.0 |
|
| 487 | - * @param string $orderby The orderby query string. |
|
| 488 | - * @param string $sort_by Sortby query string. |
|
| 489 | - * @param string $table Listing table name. |
|
| 490 | - */ |
|
| 491 | - $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
|
| 483 | + /** |
|
| 484 | + * Filter order by SQL. |
|
| 485 | + * |
|
| 486 | + * @since 1.0.0 |
|
| 487 | + * @param string $orderby The orderby query string. |
|
| 488 | + * @param string $sort_by Sortby query string. |
|
| 489 | + * @param string $table Listing table name. |
|
| 490 | + */ |
|
| 491 | + $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
|
| 492 | 492 | |
| 493 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 493 | + $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 494 | 494 | |
| 495 | - return $orderby; |
|
| 495 | + return $orderby; |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | |
@@ -510,78 +510,78 @@ discard block |
||
| 510 | 510 | function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table) |
| 511 | 511 | {
|
| 512 | 512 | |
| 513 | - global $wpdb; |
|
| 513 | + global $wpdb; |
|
| 514 | 514 | |
| 515 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) {
|
|
| 515 | + if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) {
|
|
| 516 | 516 | |
| 517 | - $sort_array = explode('_', $sort_by);
|
|
| 517 | + $sort_array = explode('_', $sort_by);
|
|
| 518 | 518 | |
| 519 | - $sort_by_count = count($sort_array); |
|
| 519 | + $sort_by_count = count($sort_array); |
|
| 520 | 520 | |
| 521 | - $order = $sort_array[$sort_by_count - 1]; |
|
| 521 | + $order = $sort_array[$sort_by_count - 1]; |
|
| 522 | 522 | |
| 523 | - if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
|
| 523 | + if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
|
| 524 | 524 | |
| 525 | - $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 525 | + $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 526 | 526 | |
| 527 | - switch ($sort_by): |
|
| 527 | + switch ($sort_by): |
|
| 528 | 528 | |
| 529 | - case 'post_date': |
|
| 530 | - case 'comment_count': |
|
| 529 | + case 'post_date': |
|
| 530 | + case 'comment_count': |
|
| 531 | 531 | |
| 532 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 533 | - break; |
|
| 532 | + $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 533 | + break; |
|
| 534 | 534 | |
| 535 | - case 'distance': |
|
| 536 | - $orderby = $sort_by . " " . $order . ", "; |
|
| 537 | - break; |
|
| 535 | + case 'distance': |
|
| 536 | + $orderby = $sort_by . " " . $order . ", "; |
|
| 537 | + break; |
|
| 538 | 538 | |
| 539 | 539 | |
| 540 | - // sort by rating |
|
| 541 | - case 'overall_rating': |
|
| 540 | + // sort by rating |
|
| 541 | + case 'overall_rating': |
|
| 542 | 542 | |
| 543 | - $use_bayesian = apply_filters('gd_use_bayesian',true,$table);
|
|
| 544 | - $avg_rating = 0; |
|
| 545 | - if($use_bayesian){
|
|
| 546 | - $avg_num_votes = get_transient( 'gd_avg_num_votes_'.$table ); |
|
| 547 | - if(!$avg_num_votes){
|
|
| 548 | - $avg_num_votes = $wpdb->get_var("SELECT SUM(rating_count) FROM $table");
|
|
| 549 | - if($avg_num_votes){
|
|
| 543 | + $use_bayesian = apply_filters('gd_use_bayesian',true,$table);
|
|
| 544 | + $avg_rating = 0; |
|
| 545 | + if($use_bayesian){
|
|
| 546 | + $avg_num_votes = get_transient( 'gd_avg_num_votes_'.$table ); |
|
| 547 | + if(!$avg_num_votes){
|
|
| 548 | + $avg_num_votes = $wpdb->get_var("SELECT SUM(rating_count) FROM $table");
|
|
| 549 | + if($avg_num_votes){
|
|
| 550 | 550 | |
| 551 | - $avg_rating = get_transient( 'gd_avg_rating_'.$table ); |
|
| 552 | - if(!$avg_rating){
|
|
| 553 | - $avg_rating = $wpdb->get_var("SELECT SUM(overall_rating) FROM $table")/$avg_num_votes;
|
|
| 554 | - } |
|
| 555 | - set_transient( 'gd_avg_num_votes_'.$table, $avg_num_votes, 12 * HOUR_IN_SECONDS ); |
|
| 556 | - set_transient( 'gd_avg_rating_'.$table, $avg_rating , 12 * HOUR_IN_SECONDS ); |
|
| 557 | - } |
|
| 558 | - } |
|
| 551 | + $avg_rating = get_transient( 'gd_avg_rating_'.$table ); |
|
| 552 | + if(!$avg_rating){
|
|
| 553 | + $avg_rating = $wpdb->get_var("SELECT SUM(overall_rating) FROM $table")/$avg_num_votes;
|
|
| 554 | + } |
|
| 555 | + set_transient( 'gd_avg_num_votes_'.$table, $avg_num_votes, 12 * HOUR_IN_SECONDS ); |
|
| 556 | + set_transient( 'gd_avg_rating_'.$table, $avg_rating , 12 * HOUR_IN_SECONDS ); |
|
| 557 | + } |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | - if(!$avg_num_votes){ $avg_num_votes = 0;}
|
|
| 560 | + if(!$avg_num_votes){ $avg_num_votes = 0;}
|
|
| 561 | 561 | |
| 562 | - $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )) / ( $avg_num_votes + " . $table . ".rating_count ) $order , ";
|
|
| 562 | + $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )) / ( $avg_num_votes + " . $table . ".rating_count ) $order , ";
|
|
| 563 | 563 | |
| 564 | - //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ) / ( " . $table . ".rating_count + " . $table . ".rating_count ) $order , "; // seems to work mostly with no extra overheads
|
|
| 565 | - }else{
|
|
| 566 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 567 | - } |
|
| 564 | + //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ) / ( " . $table . ".rating_count + " . $table . ".rating_count ) $order , "; // seems to work mostly with no extra overheads
|
|
| 565 | + }else{
|
|
| 566 | + $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 567 | + } |
|
| 568 | 568 | |
| 569 | - break; |
|
| 569 | + break; |
|
| 570 | 570 | |
| 571 | 571 | |
| 572 | - default: |
|
| 573 | - if (geodir_column_exist($table, $sort_by)) {
|
|
| 572 | + default: |
|
| 573 | + if (geodir_column_exist($table, $sort_by)) {
|
|
| 574 | 574 | $orderby = $table . "." . $sort_by . " " . $order . ", "; |
| 575 | 575 | } |
| 576 | - break; |
|
| 576 | + break; |
|
| 577 | 577 | |
| 578 | - endswitch; |
|
| 578 | + endswitch; |
|
| 579 | 579 | |
| 580 | - } |
|
| 580 | + } |
|
| 581 | 581 | |
| 582 | - } |
|
| 582 | + } |
|
| 583 | 583 | |
| 584 | - return $orderby; |
|
| 584 | + return $orderby; |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -596,34 +596,34 @@ discard block |
||
| 596 | 596 | {
|
| 597 | 597 | |
| 598 | 598 | |
| 599 | - global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
| 599 | + global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
| 600 | 600 | |
| 601 | - if (!is_admin()) {
|
|
| 601 | + if (!is_admin()) {
|
|
| 602 | 602 | |
| 603 | - if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 604 | - add_filter('posts_where', 'geodir_edit_listing_where', 1);
|
|
| 603 | + if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 604 | + add_filter('posts_where', 'geodir_edit_listing_where', 1);
|
|
| 605 | 605 | |
| 606 | - } elseif ((is_search() && $_REQUEST['geodir_search'])) {
|
|
| 606 | + } elseif ((is_search() && $_REQUEST['geodir_search'])) {
|
|
| 607 | 607 | |
| 608 | - add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 608 | + add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 609 | 609 | |
| 610 | - if ($snear != '') |
|
| 611 | - add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 610 | + if ($snear != '') |
|
| 611 | + add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 612 | 612 | |
| 613 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 613 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 614 | 614 | |
| 615 | - } elseif (geodir_is_page('author')) {
|
|
| 615 | + } elseif (geodir_is_page('author')) {
|
|
| 616 | 616 | |
| 617 | - add_filter('posts_where', 'author_filter_where', 1);
|
|
| 617 | + add_filter('posts_where', 'author_filter_where', 1);
|
|
| 618 | 618 | |
| 619 | - } |
|
| 619 | + } |
|
| 620 | 620 | |
| 621 | - //if (!geodir_is_page('detail'))
|
|
| 622 | - add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 621 | + //if (!geodir_is_page('detail'))
|
|
| 622 | + add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 623 | 623 | |
| 624 | - //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
| 624 | + //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
| 625 | 625 | |
| 626 | - } |
|
| 626 | + } |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | /** |
@@ -638,13 +638,13 @@ discard block |
||
| 638 | 638 | */ |
| 639 | 639 | function geodir_preview_post_cap($allcaps, $caps, $args) |
| 640 | 640 | {
|
| 641 | - $user_id = get_current_user_id(); |
|
| 642 | - if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
|
|
| 641 | + $user_id = get_current_user_id(); |
|
| 642 | + if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
|
|
| 643 | 643 | |
| 644 | - $allcaps['edit_posts'] = true; |
|
| 645 | - } |
|
| 646 | - //print_r($allcaps); |
|
| 647 | - return $allcaps; |
|
| 644 | + $allcaps['edit_posts'] = true; |
|
| 645 | + } |
|
| 646 | + //print_r($allcaps); |
|
| 647 | + return $allcaps; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | |
@@ -659,9 +659,9 @@ discard block |
||
| 659 | 659 | */ |
| 660 | 660 | function geodir_edit_listing_where($where) |
| 661 | 661 | {
|
| 662 | - global $wpdb; |
|
| 663 | - $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
|
|
| 664 | - return $where; |
|
| 662 | + global $wpdb; |
|
| 663 | + $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
|
|
| 664 | + return $where; |
|
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | |
@@ -678,29 +678,29 @@ discard block |
||
| 678 | 678 | */ |
| 679 | 679 | function geodir_default_where($where) |
| 680 | 680 | {
|
| 681 | - global $wp_query, $wpdb; |
|
| 682 | - |
|
| 683 | - //print_r($wp_query); |
|
| 684 | - ########### WPML ########### |
|
| 685 | - |
|
| 686 | - if (geodir_is_wpml()) {
|
|
| 687 | - global $sitepress, $table_prefix; |
|
| 688 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 689 | - $default_lang_code = $sitepress->get_default_language(); |
|
| 690 | - $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
| 691 | - //echo '##########'.$q_post_type; |
|
| 692 | - if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) {
|
|
| 693 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 694 | - //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
| 695 | - } |
|
| 681 | + global $wp_query, $wpdb; |
|
| 696 | 682 | |
| 697 | - } |
|
| 698 | - ########### WPML ########### |
|
| 683 | + //print_r($wp_query); |
|
| 684 | + ########### WPML ########### |
|
| 699 | 685 | |
| 686 | + if (geodir_is_wpml()) {
|
|
| 687 | + global $sitepress, $table_prefix; |
|
| 688 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 689 | + $default_lang_code = $sitepress->get_default_language(); |
|
| 690 | + $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
| 691 | + //echo '##########'.$q_post_type; |
|
| 692 | + if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) {
|
|
| 693 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 694 | + //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
| 695 | + } |
|
| 696 | + |
|
| 697 | + } |
|
| 698 | + ########### WPML ########### |
|
| 700 | 699 | |
| 701 | - return $where = str_replace("0 = 1", "1=1", $where);
|
|
| 702 | 700 | |
| 703 | - /* ====== old code start === |
|
| 701 | + return $where = str_replace("0 = 1", "1=1", $where);
|
|
| 702 | + |
|
| 703 | + /* ====== old code start === |
|
| 704 | 704 | $where = str_replace("0 = 1", "1=1", $where);
|
| 705 | 705 | $country = get_query_var('gd_country');
|
| 706 | 706 | $region = get_query_var('gd_region');
|
@@ -741,92 +741,92 @@ discard block |
||
| 741 | 741 | * @return string Modified where query string. |
| 742 | 742 | */ |
| 743 | 743 | function searching_filter_where($where) {
|
| 744 | - global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
| 744 | + global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
| 745 | 745 | |
| 746 | - $search_term = 'OR'; |
|
| 747 | - $search_term = 'AND'; |
|
| 748 | - $geodir_custom_search = ''; |
|
| 749 | - $category_search_range = ''; |
|
| 746 | + $search_term = 'OR'; |
|
| 747 | + $search_term = 'AND'; |
|
| 748 | + $geodir_custom_search = ''; |
|
| 749 | + $category_search_range = ''; |
|
| 750 | 750 | |
| 751 | - if (is_single() && get_query_var('post_type')) {
|
|
| 751 | + if (is_single() && get_query_var('post_type')) {
|
|
| 752 | 752 | return $where; |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | - if (is_tax()) {
|
|
| 755 | + if (is_tax()) {
|
|
| 756 | 756 | return $where; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | $s = trim($s); |
| 760 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 761 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 762 | - |
|
| 763 | - $where = ''; |
|
| 764 | - $better_search_terms = ''; |
|
| 765 | - if (isset($_REQUEST['stype'])) |
|
| 766 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 767 | - else |
|
| 768 | - $post_types = 'gd_place'; |
|
| 769 | - |
|
| 770 | - if ($s != '') {
|
|
| 771 | - $keywords = explode(" ", $s);
|
|
| 772 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 773 | - foreach($keywords as $kkey=>$kword){
|
|
| 774 | - if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 775 | - unset($keywords[$kkey]); |
|
| 776 | - } |
|
| 777 | - } |
|
| 778 | - } |
|
| 760 | + $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 761 | + $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 779 | 762 | |
| 780 | - if (!empty($keywords)) {
|
|
| 781 | - foreach ($keywords as $keyword) {
|
|
| 782 | - $keyword = trim($keyword); |
|
| 783 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 784 | - if ($keyword != '') {
|
|
| 785 | - /** |
|
| 786 | - * Filter the search query keywords SQL. |
|
| 787 | - * |
|
| 788 | - * @since 1.5.9 |
|
| 789 | - * @package GeoDirectory |
|
| 790 | - * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
| 791 | - * @param array $keywords The array of keywords for the query. |
|
| 792 | - * @param string $keyword The single keyword being searched. |
|
| 793 | - */ |
|
| 763 | + $where = ''; |
|
| 764 | + $better_search_terms = ''; |
|
| 765 | + if (isset($_REQUEST['stype'])) |
|
| 766 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 767 | + else |
|
| 768 | + $post_types = 'gd_place'; |
|
| 769 | + |
|
| 770 | + if ($s != '') {
|
|
| 771 | + $keywords = explode(" ", $s);
|
|
| 772 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 773 | + foreach($keywords as $kkey=>$kword){
|
|
| 774 | + if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 775 | + unset($keywords[$kkey]); |
|
| 776 | + } |
|
| 777 | + } |
|
| 778 | + } |
|
| 779 | + |
|
| 780 | + if (!empty($keywords)) {
|
|
| 781 | + foreach ($keywords as $keyword) {
|
|
| 782 | + $keyword = trim($keyword); |
|
| 783 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 784 | + if ($keyword != '') {
|
|
| 785 | + /** |
|
| 786 | + * Filter the search query keywords SQL. |
|
| 787 | + * |
|
| 788 | + * @since 1.5.9 |
|
| 789 | + * @package GeoDirectory |
|
| 790 | + * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
| 791 | + * @param array $keywords The array of keywords for the query. |
|
| 792 | + * @param string $keyword The single keyword being searched. |
|
| 793 | + */ |
|
| 794 | 794 | $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
|
| 795 | - } |
|
| 796 | - } |
|
| 797 | - } |
|
| 798 | - } |
|
| 795 | + } |
|
| 796 | + } |
|
| 797 | + } |
|
| 798 | + } |
|
| 799 | 799 | |
| 800 | - /* get taxonomy */ |
|
| 801 | - $taxonomies = geodir_get_taxonomies($post_types, true); |
|
| 802 | - if($taxonomies) {
|
|
| 803 | - $taxonomies = implode("','", $taxonomies);
|
|
| 804 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 805 | - }else{$taxonomies='';}
|
|
| 800 | + /* get taxonomy */ |
|
| 801 | + $taxonomies = geodir_get_taxonomies($post_types, true); |
|
| 802 | + if($taxonomies) {
|
|
| 803 | + $taxonomies = implode("','", $taxonomies);
|
|
| 804 | + $taxonomies = "'" . $taxonomies . "'"; |
|
| 805 | + }else{$taxonomies='';}
|
|
| 806 | 806 | |
| 807 | - $content_where = $terms_where = ''; |
|
| 807 | + $content_where = $terms_where = ''; |
|
| 808 | 808 | if ($s != '') {
|
| 809 | - /** |
|
| 810 | - * Filter the search query content where values. |
|
| 811 | - * |
|
| 812 | - * @since 1.5.0 |
|
| 813 | - * @package GeoDirectory |
|
| 814 | - * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
|
| 815 | - */ |
|
| 809 | + /** |
|
| 810 | + * Filter the search query content where values. |
|
| 811 | + * |
|
| 812 | + * @since 1.5.0 |
|
| 813 | + * @package GeoDirectory |
|
| 814 | + * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
|
| 815 | + */ |
|
| 816 | 816 | $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
| 817 | - /** |
|
| 818 | - * Filter the search query term values. |
|
| 819 | - * |
|
| 820 | - * @since 1.5.0 |
|
| 821 | - * @package GeoDirectory |
|
| 822 | - * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
|
| 823 | - */ |
|
| 824 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 817 | + /** |
|
| 818 | + * Filter the search query term values. |
|
| 819 | + * |
|
| 820 | + * @since 1.5.0 |
|
| 821 | + * @package GeoDirectory |
|
| 822 | + * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
|
| 823 | + */ |
|
| 824 | + $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | |
| 828 | - // get term sql |
|
| 829 | - $term_sql = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->terms.name, $wpdb->term_taxonomy.taxonomy |
|
| 828 | + // get term sql |
|
| 829 | + $term_sql = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->terms.name, $wpdb->term_taxonomy.taxonomy |
|
| 830 | 830 | FROM $wpdb->term_taxonomy, $wpdb->terms, $wpdb->term_relationships |
| 831 | 831 | WHERE $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id |
| 832 | 832 | AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id |
@@ -834,45 +834,45 @@ discard block |
||
| 834 | 834 | $terms_where |
| 835 | 835 | GROUP BY $wpdb->term_taxonomy.term_id"; |
| 836 | 836 | |
| 837 | - $term_results = $wpdb->get_results($term_sql); |
|
| 838 | - $term_ids = array(); |
|
| 839 | - $terms_sql = ''; |
|
| 840 | - |
|
| 841 | - if(!empty($term_results)){
|
|
| 842 | - foreach($term_results as $term_id){
|
|
| 843 | - $term_ids[] = $term_id; |
|
| 844 | - } |
|
| 845 | - if (!empty($term_ids)) {
|
|
| 846 | - foreach($term_ids as $term){
|
|
| 847 | - if ($term->taxonomy == $post_types.'_tags') {
|
|
| 848 | - $terms_sql .= $wpdb->prepare(" OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name);
|
|
| 849 | - } else {
|
|
| 850 | - $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
| 851 | - } |
|
| 852 | - } |
|
| 853 | - } |
|
| 854 | - } |
|
| 837 | + $term_results = $wpdb->get_results($term_sql); |
|
| 838 | + $term_ids = array(); |
|
| 839 | + $terms_sql = ''; |
|
| 840 | + |
|
| 841 | + if(!empty($term_results)){
|
|
| 842 | + foreach($term_results as $term_id){
|
|
| 843 | + $term_ids[] = $term_id; |
|
| 844 | + } |
|
| 845 | + if (!empty($term_ids)) {
|
|
| 846 | + foreach($term_ids as $term){
|
|
| 847 | + if ($term->taxonomy == $post_types.'_tags') {
|
|
| 848 | + $terms_sql .= $wpdb->prepare(" OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name);
|
|
| 849 | + } else {
|
|
| 850 | + $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
| 851 | + } |
|
| 852 | + } |
|
| 853 | + } |
|
| 854 | + } |
|
| 855 | 855 | |
| 856 | 856 | |
| 857 | - if ($snear != '') {
|
|
| 857 | + if ($snear != '') {
|
|
| 858 | 858 | |
| 859 | 859 | |
| 860 | - if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
|
|
| 861 | - $dist = $gd_session->get('near_me_range');
|
|
| 862 | - } |
|
| 863 | - $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 864 | - $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 865 | - $lat1 = $mylat - ($dist / 69); |
|
| 866 | - $lat2 = $mylat + ($dist / 69); |
|
| 860 | + if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
|
|
| 861 | + $dist = $gd_session->get('near_me_range');
|
|
| 862 | + } |
|
| 863 | + $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 864 | + $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 865 | + $lat1 = $mylat - ($dist / 69); |
|
| 866 | + $lat2 = $mylat + ($dist / 69); |
|
| 867 | 867 | |
| 868 | - $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
| 869 | - $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
| 870 | - $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
| 871 | - $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
| 868 | + $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
| 869 | + $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
| 870 | + $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
| 871 | + $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
| 872 | 872 | |
| 873 | 873 | |
| 874 | 874 | |
| 875 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 875 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 876 | 876 | $content_where |
| 877 | 877 | $terms_sql |
| 878 | 878 | ) |
@@ -881,35 +881,35 @@ discard block |
||
| 881 | 881 | AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
| 882 | 882 | AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
| 883 | 883 | |
| 884 | - if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
|
| 885 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 886 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 887 | - } |
|
| 884 | + if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
|
| 885 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 886 | + $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 887 | + } |
|
| 888 | 888 | |
| 889 | - } else {
|
|
| 889 | + } else {
|
|
| 890 | 890 | |
| 891 | 891 | |
| 892 | 892 | |
| 893 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 893 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 894 | 894 | $content_where |
| 895 | 895 | $terms_sql |
| 896 | 896 | ) |
| 897 | 897 | |
| 898 | 898 | AND $wpdb->posts.post_type in ('$post_types')
|
| 899 | 899 | AND ($wpdb->posts.post_status = 'publish') "; |
| 900 | - } |
|
| 900 | + } |
|
| 901 | 901 | |
| 902 | 902 | ########### WPML ########### |
| 903 | - if ( geodir_wpml_is_post_type_translated( $post_types ) ) {
|
|
| 903 | + if ( geodir_wpml_is_post_type_translated( $post_types ) ) {
|
|
| 904 | 904 | $lang_code = ICL_LANGUAGE_CODE; |
| 905 | 905 | |
| 906 | 906 | if ($lang_code && $post_types) {
|
| 907 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 908 | - } |
|
| 909 | - } |
|
| 910 | - ########### WPML ########### |
|
| 907 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 908 | + } |
|
| 909 | + } |
|
| 910 | + ########### WPML ########### |
|
| 911 | 911 | |
| 912 | - return $where; |
|
| 912 | + return $where; |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | |
@@ -924,45 +924,45 @@ discard block |
||
| 924 | 924 | * @return string Modified where query string. |
| 925 | 925 | */ |
| 926 | 926 | function author_filter_where($where) {
|
| 927 | - global $wpdb, $geodir_post_type, $table, $curr; |
|
| 927 | + global $wpdb, $geodir_post_type, $table, $curr; |
|
| 928 | 928 | |
| 929 | - $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
|
| 930 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 929 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
|
| 930 | + $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 931 | 931 | |
| 932 | - if (isset($_REQUEST['stype'])) {
|
|
| 933 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 934 | - } else {
|
|
| 935 | - $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
|
| 936 | - } |
|
| 932 | + if (isset($_REQUEST['stype'])) {
|
|
| 933 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 934 | + } else {
|
|
| 935 | + $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
|
| 936 | + } |
|
| 937 | 937 | |
| 938 | - if ($user_id > 0) {
|
|
| 939 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 940 | - $user_fav_posts = geodir_get_user_favourites($user_id); |
|
| 941 | - $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
|
|
| 942 | - $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
|
|
| 943 | - } else |
|
| 944 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 945 | - |
|
| 946 | - if ($user_id == (int)get_current_user_id()) {
|
|
| 947 | - $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
|
| 948 | - } else {
|
|
| 949 | - $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
| 950 | - } |
|
| 951 | - } else {
|
|
| 952 | - $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
| 953 | - } |
|
| 938 | + if ($user_id > 0) {
|
|
| 939 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 940 | + $user_fav_posts = geodir_get_user_favourites($user_id); |
|
| 941 | + $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
|
|
| 942 | + $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
|
|
| 943 | + } else |
|
| 944 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 945 | + |
|
| 946 | + if ($user_id == (int)get_current_user_id()) {
|
|
| 947 | + $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
|
| 948 | + } else {
|
|
| 949 | + $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
| 950 | + } |
|
| 951 | + } else {
|
|
| 952 | + $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
| 953 | + } |
|
| 954 | 954 | |
| 955 | - ########### WPML ########### |
|
| 956 | - if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) {
|
|
| 957 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 958 | - if ($lang_code) {
|
|
| 959 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 960 | - } |
|
| 955 | + ########### WPML ########### |
|
| 956 | + if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) {
|
|
| 957 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 958 | + if ($lang_code) {
|
|
| 959 | + $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 960 | + } |
|
| 961 | 961 | |
| 962 | - } |
|
| 963 | - ########### WPML ########### |
|
| 962 | + } |
|
| 963 | + ########### WPML ########### |
|
| 964 | 964 | |
| 965 | - return $where; |
|
| 965 | + return $where; |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | /** |
@@ -977,11 +977,11 @@ discard block |
||
| 977 | 977 | */ |
| 978 | 978 | function geodir_filter_widget_join($join) |
| 979 | 979 | {
|
| 980 | - global $wp_query, $table; |
|
| 981 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 982 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 983 | - } |
|
| 984 | - return $join; |
|
| 980 | + global $wp_query, $table; |
|
| 981 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 982 | + $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 983 | + } |
|
| 984 | + return $join; |
|
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | /** |
@@ -996,43 +996,43 @@ discard block |
||
| 996 | 996 | */ |
| 997 | 997 | function geodir_filter_widget_where($where) |
| 998 | 998 | {
|
| 999 | - global $wp_query, $table; |
|
| 1000 | - if (!empty($wp_query->query['show_featured_only'])) {
|
|
| 1001 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 1002 | - } |
|
| 1003 | - if (!empty($wp_query->query['show_special_only'])) {
|
|
| 1004 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 1005 | - } |
|
| 1006 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 1007 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 1008 | - } |
|
| 1009 | - if (!empty($wp_query->query['with_videos_only'])) {
|
|
| 1010 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 1011 | - } |
|
| 1012 | - return $where; |
|
| 999 | + global $wp_query, $table; |
|
| 1000 | + if (!empty($wp_query->query['show_featured_only'])) {
|
|
| 1001 | + $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 1002 | + } |
|
| 1003 | + if (!empty($wp_query->query['show_special_only'])) {
|
|
| 1004 | + $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 1005 | + } |
|
| 1006 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 1007 | + $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 1008 | + } |
|
| 1009 | + if (!empty($wp_query->query['with_videos_only'])) {
|
|
| 1010 | + $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 1011 | + } |
|
| 1012 | + return $where; |
|
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | |
| 1016 | 1016 | function geodir_related_posts_fields($fields) {
|
| 1017 | - global $wp_query, $wpdb, $table, $post; |
|
| 1017 | + global $wp_query, $wpdb, $table, $post; |
|
| 1018 | 1018 | |
| 1019 | - $fields .= ", " . $table . ".* "; |
|
| 1019 | + $fields .= ", " . $table . ".* "; |
|
| 1020 | 1020 | |
| 1021 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 1021 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 1022 | 1022 | |
| 1023 | - $mylat = $post->post_latitude; |
|
| 1024 | - $mylon = $post->post_longitude; |
|
| 1023 | + $mylat = $post->post_latitude; |
|
| 1024 | + $mylon = $post->post_longitude; |
|
| 1025 | 1025 | |
| 1026 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 1027 | - return $fields; |
|
| 1026 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 1027 | + return $fields; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | function geodir_related_posts_fields_filter($query) {
|
| 1030 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 1031 | - && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
| 1032 | - && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
| 1033 | - ) {
|
|
| 1034 | - add_filter('posts_fields', 'geodir_related_posts_fields', 1);
|
|
| 1035 | - } |
|
| 1030 | + if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 1031 | + && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
| 1032 | + && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
| 1033 | + ) {
|
|
| 1034 | + add_filter('posts_fields', 'geodir_related_posts_fields', 1);
|
|
| 1035 | + } |
|
| 1036 | 1036 | } |
| 1037 | 1037 | add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1);
|
| 1038 | 1038 | |
@@ -1047,30 +1047,30 @@ discard block |
||
| 1047 | 1047 | * @return string|null If field exists in table returns order by clause else returns empty. |
| 1048 | 1048 | */ |
| 1049 | 1049 | function geodir_prepare_custom_sorting( $sorting, $table ) {
|
| 1050 | - $orderby = ''; |
|
| 1050 | + $orderby = ''; |
|
| 1051 | 1051 | |
| 1052 | - if ( empty( $sorting ) || empty( $table ) ) {
|
|
| 1053 | - return $orderby; |
|
| 1054 | - } |
|
| 1052 | + if ( empty( $sorting ) || empty( $table ) ) {
|
|
| 1053 | + return $orderby; |
|
| 1054 | + } |
|
| 1055 | 1055 | |
| 1056 | - if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
|
|
| 1057 | - $sorting_array = explode( '_', $sorting ); |
|
| 1056 | + if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
|
|
| 1057 | + $sorting_array = explode( '_', $sorting ); |
|
| 1058 | 1058 | |
| 1059 | - if ( ( $count = count( $sorting_array ) ) > 1 ) {
|
|
| 1060 | - $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
| 1061 | - array_pop( $sorting_array ); |
|
| 1059 | + if ( ( $count = count( $sorting_array ) ) > 1 ) {
|
|
| 1060 | + $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
| 1061 | + array_pop( $sorting_array ); |
|
| 1062 | 1062 | |
| 1063 | - if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
|
|
| 1064 | - $sort_by = implode( '_', $sorting_array ); |
|
| 1063 | + if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
|
|
| 1064 | + $sort_by = implode( '_', $sorting_array ); |
|
| 1065 | 1065 | |
| 1066 | - if ( geodir_column_exist( $table, $sort_by ) ) {
|
|
| 1067 | - $orderby = $table . "." . $sort_by . " " . $order; |
|
| 1068 | - } |
|
| 1069 | - } |
|
| 1070 | - } |
|
| 1071 | - } |
|
| 1066 | + if ( geodir_column_exist( $table, $sort_by ) ) {
|
|
| 1067 | + $orderby = $table . "." . $sort_by . " " . $order; |
|
| 1068 | + } |
|
| 1069 | + } |
|
| 1070 | + } |
|
| 1071 | + } |
|
| 1072 | 1072 | |
| 1073 | - return $orderby; |
|
| 1073 | + return $orderby; |
|
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | 1076 | /** |
@@ -1090,21 +1090,21 @@ discard block |
||
| 1090 | 1090 | * @return string Modified fields SQL. |
| 1091 | 1091 | */ |
| 1092 | 1092 | function geodir_search_widget_location_filter_fields( $fields, $table, $post_type ) {
|
| 1093 | - global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
|
| 1093 | + global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
|
| 1094 | 1094 | |
| 1095 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) {
|
|
| 1096 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 1095 | + if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) {
|
|
| 1096 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 1097 | 1097 | |
| 1098 | - if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) {
|
|
| 1099 | - $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
| 1100 | - $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
| 1101 | - $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
| 1098 | + if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) {
|
|
| 1099 | + $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
| 1100 | + $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
| 1101 | + $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
| 1102 | 1102 | |
| 1103 | - $fields .= $wpdb->prepare( ", (" . $radius . " * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(" . $table . ".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(" . $table . ".post_latitude) * PI() / 180) * POWER(SIN((%s - " . $table . ".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude );
|
|
| 1104 | - } |
|
| 1105 | - } |
|
| 1103 | + $fields .= $wpdb->prepare( ", (" . $radius . " * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(" . $table . ".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(" . $table . ".post_latitude) * PI() / 180) * POWER(SIN((%s - " . $table . ".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude );
|
|
| 1104 | + } |
|
| 1105 | + } |
|
| 1106 | 1106 | |
| 1107 | - return $fields; |
|
| 1107 | + return $fields; |
|
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | /** |
@@ -1123,17 +1123,17 @@ discard block |
||
| 1123 | 1123 | * @return string Modified fields SQL. |
| 1124 | 1124 | */ |
| 1125 | 1125 | function geodir_search_widget_location_filter_orderby( $orderby, $table, $post_type ) {
|
| 1126 | - global $gd_query_args_widgets, $snear, $gd_session; |
|
| 1126 | + global $gd_query_args_widgets, $snear, $gd_session; |
|
| 1127 | 1127 | |
| 1128 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) {
|
|
| 1129 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 1128 | + if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) {
|
|
| 1129 | + $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 1130 | 1130 | |
| 1131 | - if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) {
|
|
| 1132 | - $orderby = "distance ASC, " . $orderby; |
|
| 1133 | - } |
|
| 1134 | - } |
|
| 1131 | + if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) {
|
|
| 1132 | + $orderby = "distance ASC, " . $orderby; |
|
| 1133 | + } |
|
| 1134 | + } |
|
| 1135 | 1135 | |
| 1136 | - return $orderby; |
|
| 1136 | + return $orderby; |
|
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | /** |
@@ -1144,21 +1144,21 @@ discard block |
||
| 1144 | 1144 | * @return string Filtered url. |
| 1145 | 1145 | */ |
| 1146 | 1146 | function geodir_search_page_base_url() {
|
| 1147 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) {
|
|
| 1148 | - remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
| 1149 | - } |
|
| 1147 | + if ( function_exists( 'geodir_location_geo_home_link' ) ) {
|
|
| 1148 | + remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
| 1149 | + } |
|
| 1150 | 1150 | |
| 1151 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) {
|
|
| 1152 | - $url = icl_get_home_url(); |
|
| 1153 | - } else {
|
|
| 1154 | - $url = get_home_url(); |
|
| 1155 | - } |
|
| 1151 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) {
|
|
| 1152 | + $url = icl_get_home_url(); |
|
| 1153 | + } else {
|
|
| 1154 | + $url = get_home_url(); |
|
| 1155 | + } |
|
| 1156 | 1156 | |
| 1157 | - $url = trailingslashit( $url ); |
|
| 1157 | + $url = trailingslashit( $url ); |
|
| 1158 | 1158 | |
| 1159 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) {
|
|
| 1160 | - add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
| 1161 | - } |
|
| 1159 | + if ( function_exists( 'geodir_location_geo_home_link' ) ) {
|
|
| 1160 | + add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
| 1161 | + } |
|
| 1162 | 1162 | |
| 1163 | - return apply_filters( 'geodir_search_page_base_url', $url ); |
|
| 1163 | + return apply_filters( 'geodir_search_page_base_url', $url ); |
|
| 1164 | 1164 | } |
| 1165 | 1165 | \ No newline at end of file |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @global string $s_A Extra parameters. |
| 66 | 66 | * @global string $s_SA Extra parameters. |
| 67 | 67 | */ |
| 68 | -function set_listing_request($query ) |
|
| 68 | +function set_listing_request($query) |
|
| 69 | 69 | {
|
| 70 | 70 | global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
| 71 | 71 | |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | } // Distance |
| 100 | 100 | |
| 101 | 101 | if (isset($_REQUEST['sgeo_lat'])) {
|
| 102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 102 | + $mylat = (float) esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | 103 | } else {
|
| 104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
| 104 | + $mylat = (float) geodir_get_current_city_lat(); |
|
| 105 | 105 | } // Latitude |
| 106 | 106 | |
| 107 | 107 | if (isset($_REQUEST['sgeo_lon'])) {
|
| 108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 108 | + $mylon = (float) esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | 109 | } else {
|
| 110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
| 110 | + $mylon = (float) geodir_get_current_city_lng(); |
|
| 111 | 111 | } // Distance |
| 112 | 112 | |
| 113 | 113 | if (isset($_REQUEST['snear'])) {
|
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | if ($snear == 'NEAR ME') {
|
| 122 | 122 | $ip = $_SERVER['REMOTE_ADDR']; |
| 123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
|
|
| 124 | 124 | $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude])); |
| 125 | 125 | $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude])); |
| 126 | 126 | } |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | $s_AA = str_replace(" ", "", $s);
|
| 131 | 131 | $s_A = explode(",", $s_AA);
|
| 132 | 132 | $s_A = implode('","', $s_A);
|
| 133 | - $s_A = '"' . $s_A . '"'; |
|
| 133 | + $s_A = '"'.$s_A.'"'; |
|
| 134 | 134 | } else {
|
| 135 | - $s_A = '"' . $s . '"'; |
|
| 135 | + $s_A = '"'.$s.'"'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (strstr($s, ' ')) {
|
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
| 195 | 195 | |
| 196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 196 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 197 | 197 | |
| 198 | 198 | add_filter('posts_fields', 'geodir_posts_fields', 1);
|
| 199 | 199 | add_filter('posts_join', 'geodir_posts_join', 1);
|
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
| 234 | 234 | |
| 235 | 235 | // Filter-Location-Manager to add location table. |
| 236 | - $fields .= ", " . $table . ".* "; |
|
| 236 | + $fields .= ", ".$table.".* "; |
|
| 237 | 237 | |
| 238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) {
|
| 239 | 239 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
@@ -243,16 +243,16 @@ discard block |
||
| 243 | 243 | $mylon = $gd_session->get('user_lon');
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 246 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | global $s; |
| 250 | 250 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
| 251 | 251 | $keywords = explode(" ", $s);
|
| 252 | 252 | |
| 253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | - foreach($keywords as $kkey=>$kword){
|
|
| 255 | - if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 253 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 254 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 255 | + if (geodir_utf8_strlen($kword) <= $klimit) {
|
|
| 256 | 256 | unset($keywords[$kkey]); |
| 257 | 257 | } |
| 258 | 258 | } |
@@ -270,24 +270,24 @@ discard block |
||
| 270 | 270 | $count = 0; |
| 271 | 271 | foreach ($keywords as $keyword) {
|
| 272 | 272 | $keyword = trim($keyword); |
| 273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 273 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
| 274 | 274 | $count++; |
| 275 | 275 | if ($count < count($keywords)) {
|
| 276 | 276 | // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
| 277 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
|
| 277 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." "; |
|
| 278 | 278 | } else {
|
| 279 | 279 | //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
| 280 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
|
| 280 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) "; |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.","; |
|
| 284 | 284 | } |
| 285 | 285 | } else {
|
| 286 | 286 | $gd_titlematch_part = ""; |
| 287 | 287 | } |
| 288 | - $s = stripslashes_deep( $s ); |
|
| 289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 290 | - $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
|
|
| 288 | + $s = stripslashes_deep($s); |
|
| 289 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
| 290 | + $fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s));
|
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | return $fields; |
@@ -311,18 +311,18 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | ########### WPML ########### |
| 313 | 313 | |
| 314 | - if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) {
|
|
| 314 | + if (geodir_wpml_is_post_type_translated($geodir_post_type)) {
|
|
| 315 | 315 | global $sitepress; |
| 316 | 316 | $lang_code = ICL_LANGUAGE_CODE; |
| 317 | 317 | $default_lang_code = $sitepress->get_default_language(); |
| 318 | 318 | if ($lang_code) {
|
| 319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 319 | + $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | } |
| 323 | 323 | ########### WPML ########### |
| 324 | 324 | |
| 325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 325 | + $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID) ";
|
|
| 326 | 326 | //===old code start |
| 327 | 327 | //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
| 328 | 328 | |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $sort_by = 'az'; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if ($snear != '' && $sort_by!='farthest') {
|
|
| 394 | + if ($snear != '' && $sort_by != 'farthest') {
|
|
| 395 | 395 | $sort_by = 'nearest'; |
| 396 | 396 | } |
| 397 | 397 | } |
@@ -405,20 +405,20 @@ discard block |
||
| 405 | 405 | break; |
| 406 | 406 | case 'low_review': |
| 407 | 407 | case 'rating_count_asc': |
| 408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 408 | + $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, "; |
|
| 409 | 409 | break; |
| 410 | 410 | case 'high_review': |
| 411 | 411 | case 'rating_count_desc': |
| 412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 412 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
| 413 | 413 | break; |
| 414 | 414 | case 'low_rating': |
| 415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 415 | + $orderby = "( ".$table.".overall_rating ) ASC, ".$table.".rating_count ASC, "; |
|
| 416 | 416 | break; |
| 417 | 417 | case 'high_rating': |
| 418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 418 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
| 419 | 419 | break; |
| 420 | 420 | case 'featured': |
| 421 | - $orderby = $table . ".is_featured asc, "; |
|
| 421 | + $orderby = $table.".is_featured asc, "; |
|
| 422 | 422 | break; |
| 423 | 423 | case 'nearest': |
| 424 | 424 | $orderby = " distance asc, "; |
@@ -434,10 +434,10 @@ discard block |
||
| 434 | 434 | break; |
| 435 | 435 | // sort by rating |
| 436 | 436 | case 'overall_rating_desc': |
| 437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 437 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
| 438 | 438 | break; |
| 439 | 439 | case 'overall_rating_asc': |
| 440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
| 440 | + $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, "; |
|
| 441 | 441 | break; |
| 442 | 442 | default: |
| 443 | 443 | |
@@ -458,24 +458,24 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
| 460 | 460 | $keywords = explode(" ", $s);
|
| 461 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 462 | - foreach($keywords as $kkey=>$kword){
|
|
| 463 | - if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 461 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 462 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 463 | + if (geodir_utf8_strlen($kword) <= $klimit) {
|
|
| 464 | 464 | unset($keywords[$kkey]); |
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
| 469 | 469 | if (count($keywords) > 1) {
|
| 470 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 470 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 471 | 471 | } else {
|
| 472 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 472 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 473 | 473 | } |
| 474 | 474 | } else {
|
| 475 | 475 | if (count($keywords) > 1) {
|
| 476 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 476 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby; |
|
| 477 | 477 | } else {
|
| 478 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 478 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby; |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | */ |
| 491 | 491 | $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
| 492 | 492 | |
| 493 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 493 | + $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 494 | 494 | |
| 495 | 495 | return $orderby; |
| 496 | 496 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | global $wpdb; |
| 514 | 514 | |
| 515 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) {
|
|
| 515 | + if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) {
|
|
| 516 | 516 | |
| 517 | 517 | $sort_array = explode('_', $sort_by);
|
| 518 | 518 | |
@@ -522,48 +522,48 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
| 524 | 524 | |
| 525 | - $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 525 | + $sort_by = str_replace('_'.$order, '', $sort_by);
|
|
| 526 | 526 | |
| 527 | 527 | switch ($sort_by): |
| 528 | 528 | |
| 529 | 529 | case 'post_date': |
| 530 | 530 | case 'comment_count': |
| 531 | 531 | |
| 532 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 532 | + $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", "; |
|
| 533 | 533 | break; |
| 534 | 534 | |
| 535 | 535 | case 'distance': |
| 536 | - $orderby = $sort_by . " " . $order . ", "; |
|
| 536 | + $orderby = $sort_by." ".$order.", "; |
|
| 537 | 537 | break; |
| 538 | 538 | |
| 539 | 539 | |
| 540 | 540 | // sort by rating |
| 541 | 541 | case 'overall_rating': |
| 542 | 542 | |
| 543 | - $use_bayesian = apply_filters('gd_use_bayesian',true,$table);
|
|
| 543 | + $use_bayesian = apply_filters('gd_use_bayesian', true, $table);
|
|
| 544 | 544 | $avg_rating = 0; |
| 545 | - if($use_bayesian){
|
|
| 546 | - $avg_num_votes = get_transient( 'gd_avg_num_votes_'.$table ); |
|
| 547 | - if(!$avg_num_votes){
|
|
| 545 | + if ($use_bayesian) {
|
|
| 546 | + $avg_num_votes = get_transient('gd_avg_num_votes_'.$table);
|
|
| 547 | + if (!$avg_num_votes) {
|
|
| 548 | 548 | $avg_num_votes = $wpdb->get_var("SELECT SUM(rating_count) FROM $table");
|
| 549 | - if($avg_num_votes){
|
|
| 549 | + if ($avg_num_votes) {
|
|
| 550 | 550 | |
| 551 | - $avg_rating = get_transient( 'gd_avg_rating_'.$table ); |
|
| 552 | - if(!$avg_rating){
|
|
| 553 | - $avg_rating = $wpdb->get_var("SELECT SUM(overall_rating) FROM $table")/$avg_num_votes;
|
|
| 551 | + $avg_rating = get_transient('gd_avg_rating_'.$table);
|
|
| 552 | + if (!$avg_rating) {
|
|
| 553 | + $avg_rating = $wpdb->get_var("SELECT SUM(overall_rating) FROM $table") / $avg_num_votes;
|
|
| 554 | 554 | } |
| 555 | - set_transient( 'gd_avg_num_votes_'.$table, $avg_num_votes, 12 * HOUR_IN_SECONDS ); |
|
| 556 | - set_transient( 'gd_avg_rating_'.$table, $avg_rating , 12 * HOUR_IN_SECONDS ); |
|
| 555 | + set_transient('gd_avg_num_votes_'.$table, $avg_num_votes, 12 * HOUR_IN_SECONDS);
|
|
| 556 | + set_transient('gd_avg_rating_'.$table, $avg_rating, 12 * HOUR_IN_SECONDS);
|
|
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - if(!$avg_num_votes){ $avg_num_votes = 0;}
|
|
| 560 | + if (!$avg_num_votes) { $avg_num_votes = 0; }
|
|
| 561 | 561 | |
| 562 | - $orderby = " (( $avg_num_votes * $avg_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating )) / ( $avg_num_votes + " . $table . ".rating_count ) $order , ";
|
|
| 562 | + $orderby = " (( $avg_num_votes * $avg_rating ) + (".$table.".rating_count * ".$table.".overall_rating )) / ( $avg_num_votes + ".$table.".rating_count ) $order , ";
|
|
| 563 | 563 | |
| 564 | 564 | //$orderby = " ( " . $table . ".rating_count * " . $table . ".overall_rating ) + (" . $table . ".rating_count * " . $table . ".overall_rating ) / ( " . $table . ".rating_count + " . $table . ".rating_count ) $order , "; // seems to work mostly with no extra overheads
|
| 565 | - }else{
|
|
| 566 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 565 | + } else {
|
|
| 566 | + $orderby = " ".$table.".".$sort_by." ".$order.", ".$table.".rating_count ".$order.", "; |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | break; |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | |
| 572 | 572 | default: |
| 573 | 573 | if (geodir_column_exist($table, $sort_by)) {
|
| 574 | - $orderby = $table . "." . $sort_by . " " . $order . ", "; |
|
| 574 | + $orderby = $table.".".$sort_by." ".$order.", "; |
|
| 575 | 575 | } |
| 576 | 576 | break; |
| 577 | 577 | |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | //if (!geodir_is_page('detail'))
|
| 622 | - add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 622 | + add_filter('posts_where', 'geodir_default_where', 1); /**/
|
|
| 623 | 623 | |
| 624 | 624 | //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
| 625 | 625 | |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
| 691 | 691 | //echo '##########'.$q_post_type; |
| 692 | 692 | if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) {
|
| 693 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 693 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
|
|
| 694 | 694 | //$where .= " AND icl_t.language_code = '$lang_code' "; |
| 695 | 695 | } |
| 696 | 696 | |
@@ -757,8 +757,8 @@ discard block |
||
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | $s = trim($s); |
| 760 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 761 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 760 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
| 761 | + $s_A = wp_specialchars_decode($s_A, ENT_QUOTES); |
|
| 762 | 762 | |
| 763 | 763 | $where = ''; |
| 764 | 764 | $better_search_terms = ''; |
@@ -769,9 +769,9 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | if ($s != '') {
|
| 771 | 771 | $keywords = explode(" ", $s);
|
| 772 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 773 | - foreach($keywords as $kkey=>$kword){
|
|
| 774 | - if(geodir_utf8_strlen($kword)<=$klimit){
|
|
| 772 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 773 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 774 | + if (geodir_utf8_strlen($kword) <= $klimit) {
|
|
| 775 | 775 | unset($keywords[$kkey]); |
| 776 | 776 | } |
| 777 | 777 | } |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | if (!empty($keywords)) {
|
| 781 | 781 | foreach ($keywords as $keyword) {
|
| 782 | 782 | $keyword = trim($keyword); |
| 783 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 783 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
| 784 | 784 | if ($keyword != '') {
|
| 785 | 785 | /** |
| 786 | 786 | * Filter the search query keywords SQL. |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | * @param array $keywords The array of keywords for the query. |
| 792 | 792 | * @param string $keyword The single keyword being searched. |
| 793 | 793 | */ |
| 794 | - $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
|
|
| 794 | + $better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword);
|
|
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | 797 | } |
@@ -799,10 +799,10 @@ discard block |
||
| 799 | 799 | |
| 800 | 800 | /* get taxonomy */ |
| 801 | 801 | $taxonomies = geodir_get_taxonomies($post_types, true); |
| 802 | - if($taxonomies) {
|
|
| 802 | + if ($taxonomies) {
|
|
| 803 | 803 | $taxonomies = implode("','", $taxonomies);
|
| 804 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 805 | - }else{$taxonomies='';}
|
|
| 804 | + $taxonomies = "'".$taxonomies."'"; |
|
| 805 | + } else {$taxonomies = ''; }
|
|
| 806 | 806 | |
| 807 | 807 | $content_where = $terms_where = ''; |
| 808 | 808 | if ($s != '') {
|
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | * @package GeoDirectory |
| 814 | 814 | * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
| 815 | 815 | */ |
| 816 | - $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
|
| 816 | + $content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
|
| 817 | 817 | /** |
| 818 | 818 | * Filter the search query term values. |
| 819 | 819 | * |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | * @package GeoDirectory |
| 822 | 822 | * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
| 823 | 823 | */ |
| 824 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 824 | + $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | |
@@ -838,16 +838,16 @@ discard block |
||
| 838 | 838 | $term_ids = array(); |
| 839 | 839 | $terms_sql = ''; |
| 840 | 840 | |
| 841 | - if(!empty($term_results)){
|
|
| 842 | - foreach($term_results as $term_id){
|
|
| 841 | + if (!empty($term_results)) {
|
|
| 842 | + foreach ($term_results as $term_id) {
|
|
| 843 | 843 | $term_ids[] = $term_id; |
| 844 | 844 | } |
| 845 | 845 | if (!empty($term_ids)) {
|
| 846 | - foreach($term_ids as $term){
|
|
| 846 | + foreach ($term_ids as $term) {
|
|
| 847 | 847 | if ($term->taxonomy == $post_types.'_tags') {
|
| 848 | - $terms_sql .= $wpdb->prepare(" OR FIND_IN_SET(%s , " . $table . ".post_tags) ", $term->name);
|
|
| 848 | + $terms_sql .= $wpdb->prepare(" OR FIND_IN_SET(%s , ".$table.".post_tags) ", $term->name);
|
|
| 849 | 849 | } else {
|
| 850 | - $terms_sql .= " OR FIND_IN_SET($term->term_id , " . $table . "." . $post_types . "category) "; |
|
| 850 | + $terms_sql .= " OR FIND_IN_SET($term->term_id , ".$table.".".$post_types."category) "; |
|
| 851 | 851 | } |
| 852 | 852 | } |
| 853 | 853 | } |
@@ -878,12 +878,12 @@ discard block |
||
| 878 | 878 | ) |
| 879 | 879 | AND $wpdb->posts.post_type in ('{$post_types}')
|
| 880 | 880 | AND ($wpdb->posts.post_status = 'publish') |
| 881 | - AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
|
| 882 | - AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
|
| 881 | + AND ( ".$table.".post_latitude between $rlat1 and $rlat2 ) |
|
| 882 | + AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) "; |
|
| 883 | 883 | |
| 884 | 884 | if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
| 885 | 885 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
| 886 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 886 | + $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist;
|
|
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | } else {
|
@@ -900,11 +900,11 @@ discard block |
||
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | ########### WPML ########### |
| 903 | - if ( geodir_wpml_is_post_type_translated( $post_types ) ) {
|
|
| 903 | + if (geodir_wpml_is_post_type_translated($post_types)) {
|
|
| 904 | 904 | $lang_code = ICL_LANGUAGE_CODE; |
| 905 | 905 | |
| 906 | 906 | if ($lang_code && $post_types) {
|
| 907 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 907 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
|
|
| 908 | 908 | } |
| 909 | 909 | } |
| 910 | 910 | ########### WPML ########### |
@@ -927,10 +927,10 @@ discard block |
||
| 927 | 927 | global $wpdb, $geodir_post_type, $table, $curr; |
| 928 | 928 | |
| 929 | 929 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
| 930 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 930 | + $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0; |
|
| 931 | 931 | |
| 932 | 932 | if (isset($_REQUEST['stype'])) {
|
| 933 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 933 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
|
|
| 934 | 934 | } else {
|
| 935 | 935 | $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
| 936 | 936 | } |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | } else |
| 944 | 944 | $where .= " AND $wpdb->posts.post_author = $user_id"; |
| 945 | 945 | |
| 946 | - if ($user_id == (int)get_current_user_id()) {
|
|
| 946 | + if ($user_id == (int) get_current_user_id()) {
|
|
| 947 | 947 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
| 948 | 948 | } else {
|
| 949 | 949 | $where .= " AND $wpdb->posts.post_status = 'publish' "; |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) {
|
| 957 | 957 | $lang_code = ICL_LANGUAGE_CODE; |
| 958 | 958 | if ($lang_code) {
|
| 959 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 959 | + $where .= " AND icl_t.language_code='".$lang_code."' "; |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | } |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | {
|
| 980 | 980 | global $wp_query, $table; |
| 981 | 981 | if (!empty($wp_query->query['with_pics_only'])) {
|
| 982 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 982 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
| 983 | 983 | } |
| 984 | 984 | return $join; |
| 985 | 985 | } |
@@ -998,16 +998,16 @@ discard block |
||
| 998 | 998 | {
|
| 999 | 999 | global $wp_query, $table; |
| 1000 | 1000 | if (!empty($wp_query->query['show_featured_only'])) {
|
| 1001 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 1001 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | if (!empty($wp_query->query['show_special_only'])) {
|
| 1004 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 1004 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
| 1005 | 1005 | } |
| 1006 | 1006 | if (!empty($wp_query->query['with_pics_only'])) {
|
| 1007 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 1007 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id"; |
|
| 1008 | 1008 | } |
| 1009 | 1009 | if (!empty($wp_query->query['with_videos_only'])) {
|
| 1010 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 1010 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
| 1011 | 1011 | } |
| 1012 | 1012 | return $where; |
| 1013 | 1013 | } |
@@ -1016,18 +1016,18 @@ discard block |
||
| 1016 | 1016 | function geodir_related_posts_fields($fields) {
|
| 1017 | 1017 | global $wp_query, $wpdb, $table, $post; |
| 1018 | 1018 | |
| 1019 | - $fields .= ", " . $table . ".* "; |
|
| 1019 | + $fields .= ", ".$table.".* "; |
|
| 1020 | 1020 | |
| 1021 | 1021 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
| 1022 | 1022 | |
| 1023 | 1023 | $mylat = $post->post_latitude; |
| 1024 | 1024 | $mylon = $post->post_longitude; |
| 1025 | 1025 | |
| 1026 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 1026 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 1027 | 1027 | return $fields; |
| 1028 | 1028 | } |
| 1029 | 1029 | function geodir_related_posts_fields_filter($query) {
|
| 1030 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 1030 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 1031 | 1031 | && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
| 1032 | 1032 | && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
| 1033 | 1033 | ) {
|
@@ -1046,25 +1046,25 @@ discard block |
||
| 1046 | 1046 | * @param string $table Listing table name. |
| 1047 | 1047 | * @return string|null If field exists in table returns order by clause else returns empty. |
| 1048 | 1048 | */ |
| 1049 | -function geodir_prepare_custom_sorting( $sorting, $table ) {
|
|
| 1049 | +function geodir_prepare_custom_sorting($sorting, $table) {
|
|
| 1050 | 1050 | $orderby = ''; |
| 1051 | 1051 | |
| 1052 | - if ( empty( $sorting ) || empty( $table ) ) {
|
|
| 1052 | + if (empty($sorting) || empty($table)) {
|
|
| 1053 | 1053 | return $orderby; |
| 1054 | 1054 | } |
| 1055 | 1055 | |
| 1056 | - if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
|
|
| 1057 | - $sorting_array = explode( '_', $sorting ); |
|
| 1056 | + if (strpos(strtoupper($sorting), '_ASC') !== false || strpos(strtoupper($sorting), '_DESC') !== false) {
|
|
| 1057 | + $sorting_array = explode('_', $sorting);
|
|
| 1058 | 1058 | |
| 1059 | - if ( ( $count = count( $sorting_array ) ) > 1 ) {
|
|
| 1060 | - $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
| 1061 | - array_pop( $sorting_array ); |
|
| 1059 | + if (($count = count($sorting_array)) > 1) {
|
|
| 1060 | + $order = !empty($sorting_array[$count - 1]) ? strtoupper($sorting_array[$count - 1]) : ''; |
|
| 1061 | + array_pop($sorting_array); |
|
| 1062 | 1062 | |
| 1063 | - if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
|
|
| 1064 | - $sort_by = implode( '_', $sorting_array ); |
|
| 1063 | + if (!empty($sorting_array) && ($order == 'ASC' || $order == 'DESC')) {
|
|
| 1064 | + $sort_by = implode('_', $sorting_array);
|
|
| 1065 | 1065 | |
| 1066 | - if ( geodir_column_exist( $table, $sort_by ) ) {
|
|
| 1067 | - $orderby = $table . "." . $sort_by . " " . $order; |
|
| 1066 | + if (geodir_column_exist($table, $sort_by)) {
|
|
| 1067 | + $orderby = $table.".".$sort_by." ".$order; |
|
| 1068 | 1068 | } |
| 1069 | 1069 | } |
| 1070 | 1070 | } |
@@ -1089,18 +1089,18 @@ discard block |
||
| 1089 | 1089 | * |
| 1090 | 1090 | * @return string Modified fields SQL. |
| 1091 | 1091 | */ |
| 1092 | -function geodir_search_widget_location_filter_fields( $fields, $table, $post_type ) {
|
|
| 1092 | +function geodir_search_widget_location_filter_fields($fields, $table, $post_type) {
|
|
| 1093 | 1093 | global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
| 1094 | 1094 | |
| 1095 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) {
|
|
| 1096 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 1095 | + if (!empty($gd_query_args_widgets['gd_location']) && geodir_is_page('search') && !empty($_REQUEST['sgeo_lat']) && !empty($_REQUEST['sgeo_lon'])) {
|
|
| 1096 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 1097 | 1097 | |
| 1098 | - if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) {
|
|
| 1099 | - $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
| 1100 | - $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
| 1101 | - $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
| 1098 | + if ($location_allowed && strpos(strtolower($fields), ' as distance ') === false && ($snear != '' || $gd_session->get('all_near_me'))) {
|
|
| 1099 | + $latitude = sanitize_text_field($_REQUEST['sgeo_lat']); |
|
| 1100 | + $longitude = sanitize_text_field($_REQUEST['sgeo_lon']); |
|
| 1101 | + $radius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 1102 | 1102 | |
| 1103 | - $fields .= $wpdb->prepare( ", (" . $radius . " * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(" . $table . ".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(" . $table . ".post_latitude) * PI() / 180) * POWER(SIN((%s - " . $table . ".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude );
|
|
| 1103 | + $fields .= $wpdb->prepare(", (".$radius." * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(".$table.".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(".$table.".post_latitude) * PI() / 180) * POWER(SIN((%s - ".$table.".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude);
|
|
| 1104 | 1104 | } |
| 1105 | 1105 | } |
| 1106 | 1106 | |
@@ -1122,14 +1122,14 @@ discard block |
||
| 1122 | 1122 | * |
| 1123 | 1123 | * @return string Modified fields SQL. |
| 1124 | 1124 | */ |
| 1125 | -function geodir_search_widget_location_filter_orderby( $orderby, $table, $post_type ) {
|
|
| 1125 | +function geodir_search_widget_location_filter_orderby($orderby, $table, $post_type) {
|
|
| 1126 | 1126 | global $gd_query_args_widgets, $snear, $gd_session; |
| 1127 | 1127 | |
| 1128 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) {
|
|
| 1129 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
| 1128 | + if (!empty($gd_query_args_widgets['gd_location']) && geodir_is_page('search') && !empty($_REQUEST['sgeo_lat']) && !empty($_REQUEST['sgeo_lon'])) {
|
|
| 1129 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
|
|
| 1130 | 1130 | |
| 1131 | - if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) {
|
|
| 1132 | - $orderby = "distance ASC, " . $orderby; |
|
| 1131 | + if ($location_allowed && ($snear != '' || $gd_session->get('all_near_me'))) {
|
|
| 1132 | + $orderby = "distance ASC, ".$orderby; |
|
| 1133 | 1133 | } |
| 1134 | 1134 | } |
| 1135 | 1135 | |
@@ -1144,21 +1144,21 @@ discard block |
||
| 1144 | 1144 | * @return string Filtered url. |
| 1145 | 1145 | */ |
| 1146 | 1146 | function geodir_search_page_base_url() {
|
| 1147 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) {
|
|
| 1148 | - remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
| 1147 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1148 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && geodir_is_wpml() ) {
|
|
| 1151 | + if (defined('DOING_AJAX') && DOING_AJAX && geodir_is_wpml()) {
|
|
| 1152 | 1152 | $url = icl_get_home_url(); |
| 1153 | 1153 | } else {
|
| 1154 | 1154 | $url = get_home_url(); |
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | - $url = trailingslashit( $url ); |
|
| 1157 | + $url = trailingslashit($url); |
|
| 1158 | 1158 | |
| 1159 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) {
|
|
| 1160 | - add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
| 1159 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1160 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | - return apply_filters( 'geodir_search_page_base_url', $url ); |
|
| 1163 | + return apply_filters('geodir_search_page_base_url', $url);
|
|
| 1164 | 1164 | } |
| 1165 | 1165 | \ No newline at end of file |
@@ -21,84 +21,84 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | function geodir_cf_checkbox($html,$location,$cf,$p=''){ |
| 23 | 23 | |
| 24 | - // check we have the post value |
|
| 25 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 26 | - else{ global $post;} |
|
| 27 | - |
|
| 28 | - if(!is_array($cf) && $cf!=''){ |
|
| 29 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 30 | - if(!$cf){return NULL;} |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - $html_var = $cf['htmlvar_name']; |
|
| 34 | - |
|
| 35 | - // Check if there is a location specific filter. |
|
| 36 | - if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){ |
|
| 37 | - /** |
|
| 38 | - * Filter the checkbox html by location. |
|
| 39 | - * |
|
| 40 | - * @param string $html The html to filter. |
|
| 41 | - * @param array $cf The custom field array. |
|
| 42 | - * @since 1.6.6 |
|
| 43 | - */ |
|
| 44 | - $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - // Check if there is a custom field specific filter. |
|
| 48 | - if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){ |
|
| 49 | - /** |
|
| 50 | - * Filter the checkbox html by individual custom field. |
|
| 51 | - * |
|
| 52 | - * @param string $html The html to filter. |
|
| 53 | - * @param string $location The location to output the html. |
|
| 54 | - * @param array $cf The custom field array. |
|
| 55 | - * @since 1.6.6 |
|
| 56 | - */ |
|
| 57 | - $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - // Check if there is a custom field key specific filter. |
|
| 61 | - if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){ |
|
| 62 | - /** |
|
| 63 | - * Filter the checkbox html by field type key. |
|
| 64 | - * |
|
| 65 | - * @param string $html The html to filter. |
|
| 66 | - * @param string $location The location to output the html. |
|
| 67 | - * @param array $cf The custom field array. |
|
| 68 | - * @since 1.6.6 |
|
| 69 | - */ |
|
| 70 | - $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - // If not html then we run the standard output. |
|
| 74 | - if(empty($html)){ |
|
| 75 | - |
|
| 76 | - if ( (int) $post->{$html_var} == 1 ): |
|
| 77 | - |
|
| 78 | - if ( $post->{$html_var} == '1' ): |
|
| 79 | - $html_val = __( 'Yes', 'geodirectory' ); |
|
| 80 | - else: |
|
| 81 | - $html_val = __( 'No', 'geodirectory' ); |
|
| 82 | - endif; |
|
| 83 | - |
|
| 84 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 85 | - if (strpos($field_icon, 'http') !== false) { |
|
| 86 | - $field_icon_af = ''; |
|
| 87 | - } elseif ($field_icon == '') { |
|
| 88 | - $field_icon_af = ''; |
|
| 89 | - } else { |
|
| 90 | - $field_icon_af = $field_icon; |
|
| 91 | - $field_icon = ''; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 95 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ''; |
|
| 96 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 97 | - endif; |
|
| 98 | - |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - return $html; |
|
| 24 | + // check we have the post value |
|
| 25 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 26 | + else{ global $post;} |
|
| 27 | + |
|
| 28 | + if(!is_array($cf) && $cf!=''){ |
|
| 29 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 30 | + if(!$cf){return NULL;} |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + $html_var = $cf['htmlvar_name']; |
|
| 34 | + |
|
| 35 | + // Check if there is a location specific filter. |
|
| 36 | + if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){ |
|
| 37 | + /** |
|
| 38 | + * Filter the checkbox html by location. |
|
| 39 | + * |
|
| 40 | + * @param string $html The html to filter. |
|
| 41 | + * @param array $cf The custom field array. |
|
| 42 | + * @since 1.6.6 |
|
| 43 | + */ |
|
| 44 | + $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + // Check if there is a custom field specific filter. |
|
| 48 | + if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){ |
|
| 49 | + /** |
|
| 50 | + * Filter the checkbox html by individual custom field. |
|
| 51 | + * |
|
| 52 | + * @param string $html The html to filter. |
|
| 53 | + * @param string $location The location to output the html. |
|
| 54 | + * @param array $cf The custom field array. |
|
| 55 | + * @since 1.6.6 |
|
| 56 | + */ |
|
| 57 | + $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf); |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + // Check if there is a custom field key specific filter. |
|
| 61 | + if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){ |
|
| 62 | + /** |
|
| 63 | + * Filter the checkbox html by field type key. |
|
| 64 | + * |
|
| 65 | + * @param string $html The html to filter. |
|
| 66 | + * @param string $location The location to output the html. |
|
| 67 | + * @param array $cf The custom field array. |
|
| 68 | + * @since 1.6.6 |
|
| 69 | + */ |
|
| 70 | + $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + // If not html then we run the standard output. |
|
| 74 | + if(empty($html)){ |
|
| 75 | + |
|
| 76 | + if ( (int) $post->{$html_var} == 1 ): |
|
| 77 | + |
|
| 78 | + if ( $post->{$html_var} == '1' ): |
|
| 79 | + $html_val = __( 'Yes', 'geodirectory' ); |
|
| 80 | + else: |
|
| 81 | + $html_val = __( 'No', 'geodirectory' ); |
|
| 82 | + endif; |
|
| 83 | + |
|
| 84 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 85 | + if (strpos($field_icon, 'http') !== false) { |
|
| 86 | + $field_icon_af = ''; |
|
| 87 | + } elseif ($field_icon == '') { |
|
| 88 | + $field_icon_af = ''; |
|
| 89 | + } else { |
|
| 90 | + $field_icon_af = $field_icon; |
|
| 91 | + $field_icon = ''; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 95 | + $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ''; |
|
| 96 | + $html .= '</span>' . $html_val . '</div>'; |
|
| 97 | + endif; |
|
| 98 | + |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + return $html; |
|
| 102 | 102 | } |
| 103 | 103 | add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3); |
| 104 | 104 | |
@@ -115,71 +115,71 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | function geodir_cf_fieldset($html,$location,$cf,$p=''){ |
| 117 | 117 | |
| 118 | - // check we have the post value |
|
| 119 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 120 | - else{ global $post;} |
|
| 121 | - |
|
| 122 | - if(!is_array($cf) && $cf!=''){ |
|
| 123 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 124 | - if(!$cf){return NULL;} |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - $html_var = $cf['htmlvar_name']; |
|
| 128 | - |
|
| 129 | - // Check if there is a location specific filter. |
|
| 130 | - if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){ |
|
| 131 | - /** |
|
| 132 | - * Filter the fieldset html by location. |
|
| 133 | - * |
|
| 134 | - * @param string $html The html to filter. |
|
| 135 | - * @param array $cf The custom field array. |
|
| 136 | - * @since 1.6.6 |
|
| 137 | - */ |
|
| 138 | - $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - // Check if there is a custom field specific filter. |
|
| 142 | - if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){ |
|
| 143 | - /** |
|
| 144 | - * Filter the fieldset html by individual custom field. |
|
| 145 | - * |
|
| 146 | - * @param string $html The html to filter. |
|
| 147 | - * @param string $location The location to output the html. |
|
| 148 | - * @param array $cf The custom field array. |
|
| 149 | - * @since 1.6.6 |
|
| 150 | - */ |
|
| 151 | - $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - // Check if there is a custom field key specific filter. |
|
| 155 | - if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){ |
|
| 156 | - /** |
|
| 157 | - * Filter the fieldset html by field type key. |
|
| 158 | - * |
|
| 159 | - * @param string $html The html to filter. |
|
| 160 | - * @param string $location The location to output the html. |
|
| 161 | - * @param array $cf The custom field array. |
|
| 162 | - * @since 1.6.6 |
|
| 163 | - */ |
|
| 164 | - $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - // If not html then we run the standard output. |
|
| 168 | - if(empty($html)){ |
|
| 169 | - |
|
| 170 | - global $field_set_start; |
|
| 171 | - $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']); |
|
| 172 | - |
|
| 173 | - if ($field_set_start == 1) { |
|
| 174 | - $html = ''; |
|
| 175 | - } else { |
|
| 176 | - $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>'; |
|
| 177 | - //$field_set_start = 1; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - return $html; |
|
| 118 | + // check we have the post value |
|
| 119 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 120 | + else{ global $post;} |
|
| 121 | + |
|
| 122 | + if(!is_array($cf) && $cf!=''){ |
|
| 123 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 124 | + if(!$cf){return NULL;} |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + $html_var = $cf['htmlvar_name']; |
|
| 128 | + |
|
| 129 | + // Check if there is a location specific filter. |
|
| 130 | + if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){ |
|
| 131 | + /** |
|
| 132 | + * Filter the fieldset html by location. |
|
| 133 | + * |
|
| 134 | + * @param string $html The html to filter. |
|
| 135 | + * @param array $cf The custom field array. |
|
| 136 | + * @since 1.6.6 |
|
| 137 | + */ |
|
| 138 | + $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + // Check if there is a custom field specific filter. |
|
| 142 | + if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){ |
|
| 143 | + /** |
|
| 144 | + * Filter the fieldset html by individual custom field. |
|
| 145 | + * |
|
| 146 | + * @param string $html The html to filter. |
|
| 147 | + * @param string $location The location to output the html. |
|
| 148 | + * @param array $cf The custom field array. |
|
| 149 | + * @since 1.6.6 |
|
| 150 | + */ |
|
| 151 | + $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + // Check if there is a custom field key specific filter. |
|
| 155 | + if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){ |
|
| 156 | + /** |
|
| 157 | + * Filter the fieldset html by field type key. |
|
| 158 | + * |
|
| 159 | + * @param string $html The html to filter. |
|
| 160 | + * @param string $location The location to output the html. |
|
| 161 | + * @param array $cf The custom field array. |
|
| 162 | + * @since 1.6.6 |
|
| 163 | + */ |
|
| 164 | + $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + // If not html then we run the standard output. |
|
| 168 | + if(empty($html)){ |
|
| 169 | + |
|
| 170 | + global $field_set_start; |
|
| 171 | + $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']); |
|
| 172 | + |
|
| 173 | + if ($field_set_start == 1) { |
|
| 174 | + $html = ''; |
|
| 175 | + } else { |
|
| 176 | + $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>'; |
|
| 177 | + //$field_set_start = 1; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + return $html; |
|
| 183 | 183 | } |
| 184 | 184 | add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3); |
| 185 | 185 | |
@@ -196,106 +196,106 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | function geodir_cf_url($html,$location,$cf,$p=''){ |
| 198 | 198 | |
| 199 | - // check we have the post value |
|
| 200 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 201 | - else{ global $post;} |
|
| 202 | - |
|
| 203 | - if(!is_array($cf) && $cf!=''){ |
|
| 204 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 205 | - if(!$cf){return NULL;} |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - $html_var = $cf['htmlvar_name']; |
|
| 209 | - |
|
| 210 | - // Check if there is a location specific filter. |
|
| 211 | - if(has_filter("geodir_custom_field_output_url_loc_{$location}")){ |
|
| 212 | - /** |
|
| 213 | - * Filter the url html by location. |
|
| 214 | - * |
|
| 215 | - * @param string $html The html to filter. |
|
| 216 | - * @param array $cf The custom field array. |
|
| 217 | - * @since 1.6.6 |
|
| 218 | - */ |
|
| 219 | - $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - // Check if there is a custom field specific filter. |
|
| 223 | - if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){ |
|
| 224 | - /** |
|
| 225 | - * Filter the url html by individual custom field. |
|
| 226 | - * |
|
| 227 | - * @param string $html The html to filter. |
|
| 228 | - * @param string $location The location to output the html. |
|
| 229 | - * @param array $cf The custom field array. |
|
| 230 | - * @since 1.6.6 |
|
| 231 | - */ |
|
| 232 | - $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - // Check if there is a custom field key specific filter. |
|
| 236 | - if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){ |
|
| 237 | - /** |
|
| 238 | - * Filter the url html by field type key. |
|
| 239 | - * |
|
| 240 | - * @param string $html The html to filter. |
|
| 241 | - * @param string $location The location to output the html. |
|
| 242 | - * @param array $cf The custom field array. |
|
| 243 | - * @since 1.6.6 |
|
| 244 | - */ |
|
| 245 | - $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - // If not html then we run the standard output. |
|
| 249 | - if(empty($html)){ |
|
| 250 | - |
|
| 251 | - if ($post->{$cf['htmlvar_name']}): |
|
| 252 | - |
|
| 253 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 254 | - if (strpos($field_icon, 'http') !== false) { |
|
| 255 | - $field_icon_af = ''; |
|
| 256 | - } elseif ($field_icon == '') { |
|
| 257 | - |
|
| 258 | - if ($cf['name'] == 'geodir_facebook') { |
|
| 259 | - $field_icon_af = '<i class="fa fa-facebook-square"></i>'; |
|
| 260 | - } elseif ($cf['name'] == 'geodir_twitter') { |
|
| 261 | - $field_icon_af = '<i class="fa fa-twitter-square"></i>'; |
|
| 262 | - } else { |
|
| 263 | - $field_icon_af = '<i class="fa fa-link"></i>'; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - } else { |
|
| 267 | - $field_icon_af = $field_icon; |
|
| 268 | - $field_icon = ''; |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']}); |
|
| 272 | - |
|
| 273 | - |
|
| 274 | - $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
|
| 275 | - $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title']; |
|
| 276 | - if(!empty($cf['default_value'])){$title = $cf['default_value'];} |
|
| 277 | - $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
|
| 278 | - |
|
| 279 | - |
|
| 280 | - |
|
| 281 | - // all search engines that use the nofollow value exclude links that use it from their ranking calculation |
|
| 282 | - $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"'; |
|
| 283 | - /** |
|
| 284 | - * Filter custom field website name. |
|
| 285 | - * |
|
| 286 | - * @since 1.0.0 |
|
| 287 | - * |
|
| 288 | - * @param string $title Website Title. |
|
| 289 | - * @param string $website Website URL. |
|
| 290 | - * @param int $post->ID Post ID. |
|
| 291 | - */ |
|
| 292 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>'; |
|
| 293 | - |
|
| 294 | - endif; |
|
| 295 | - |
|
| 296 | - } |
|
| 297 | - |
|
| 298 | - return $html; |
|
| 199 | + // check we have the post value |
|
| 200 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 201 | + else{ global $post;} |
|
| 202 | + |
|
| 203 | + if(!is_array($cf) && $cf!=''){ |
|
| 204 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 205 | + if(!$cf){return NULL;} |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + $html_var = $cf['htmlvar_name']; |
|
| 209 | + |
|
| 210 | + // Check if there is a location specific filter. |
|
| 211 | + if(has_filter("geodir_custom_field_output_url_loc_{$location}")){ |
|
| 212 | + /** |
|
| 213 | + * Filter the url html by location. |
|
| 214 | + * |
|
| 215 | + * @param string $html The html to filter. |
|
| 216 | + * @param array $cf The custom field array. |
|
| 217 | + * @since 1.6.6 |
|
| 218 | + */ |
|
| 219 | + $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + // Check if there is a custom field specific filter. |
|
| 223 | + if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){ |
|
| 224 | + /** |
|
| 225 | + * Filter the url html by individual custom field. |
|
| 226 | + * |
|
| 227 | + * @param string $html The html to filter. |
|
| 228 | + * @param string $location The location to output the html. |
|
| 229 | + * @param array $cf The custom field array. |
|
| 230 | + * @since 1.6.6 |
|
| 231 | + */ |
|
| 232 | + $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf); |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + // Check if there is a custom field key specific filter. |
|
| 236 | + if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){ |
|
| 237 | + /** |
|
| 238 | + * Filter the url html by field type key. |
|
| 239 | + * |
|
| 240 | + * @param string $html The html to filter. |
|
| 241 | + * @param string $location The location to output the html. |
|
| 242 | + * @param array $cf The custom field array. |
|
| 243 | + * @since 1.6.6 |
|
| 244 | + */ |
|
| 245 | + $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + // If not html then we run the standard output. |
|
| 249 | + if(empty($html)){ |
|
| 250 | + |
|
| 251 | + if ($post->{$cf['htmlvar_name']}): |
|
| 252 | + |
|
| 253 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 254 | + if (strpos($field_icon, 'http') !== false) { |
|
| 255 | + $field_icon_af = ''; |
|
| 256 | + } elseif ($field_icon == '') { |
|
| 257 | + |
|
| 258 | + if ($cf['name'] == 'geodir_facebook') { |
|
| 259 | + $field_icon_af = '<i class="fa fa-facebook-square"></i>'; |
|
| 260 | + } elseif ($cf['name'] == 'geodir_twitter') { |
|
| 261 | + $field_icon_af = '<i class="fa fa-twitter-square"></i>'; |
|
| 262 | + } else { |
|
| 263 | + $field_icon_af = '<i class="fa fa-link"></i>'; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + } else { |
|
| 267 | + $field_icon_af = $field_icon; |
|
| 268 | + $field_icon = ''; |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']}); |
|
| 272 | + |
|
| 273 | + |
|
| 274 | + $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
|
| 275 | + $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title']; |
|
| 276 | + if(!empty($cf['default_value'])){$title = $cf['default_value'];} |
|
| 277 | + $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
|
| 278 | + |
|
| 279 | + |
|
| 280 | + |
|
| 281 | + // all search engines that use the nofollow value exclude links that use it from their ranking calculation |
|
| 282 | + $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"'; |
|
| 283 | + /** |
|
| 284 | + * Filter custom field website name. |
|
| 285 | + * |
|
| 286 | + * @since 1.0.0 |
|
| 287 | + * |
|
| 288 | + * @param string $title Website Title. |
|
| 289 | + * @param string $website Website URL. |
|
| 290 | + * @param int $post->ID Post ID. |
|
| 291 | + */ |
|
| 292 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>'; |
|
| 293 | + |
|
| 294 | + endif; |
|
| 295 | + |
|
| 296 | + } |
|
| 297 | + |
|
| 298 | + return $html; |
|
| 299 | 299 | } |
| 300 | 300 | add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3); |
| 301 | 301 | |
@@ -312,80 +312,80 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | function geodir_cf_phone($html,$location,$cf,$p=''){ |
| 314 | 314 | |
| 315 | - // check we have the post value |
|
| 316 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 317 | - else{ global $post;} |
|
| 318 | - |
|
| 319 | - if(!is_array($cf) && $cf!=''){ |
|
| 320 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 321 | - if(!$cf){return NULL;} |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - $html_var = $cf['htmlvar_name']; |
|
| 325 | - |
|
| 326 | - // Check if there is a location specific filter. |
|
| 327 | - if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){ |
|
| 328 | - /** |
|
| 329 | - * Filter the phone html by location. |
|
| 330 | - * |
|
| 331 | - * @param string $html The html to filter. |
|
| 332 | - * @param array $cf The custom field array. |
|
| 333 | - * @since 1.6.6 |
|
| 334 | - */ |
|
| 335 | - $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf); |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - // Check if there is a custom field specific filter. |
|
| 339 | - if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){ |
|
| 340 | - /** |
|
| 341 | - * Filter the phone html by individual custom field. |
|
| 342 | - * |
|
| 343 | - * @param string $html The html to filter. |
|
| 344 | - * @param string $location The location to output the html. |
|
| 345 | - * @param array $cf The custom field array. |
|
| 346 | - * @since 1.6.6 |
|
| 347 | - */ |
|
| 348 | - $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf); |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - // Check if there is a custom field key specific filter. |
|
| 352 | - if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){ |
|
| 353 | - /** |
|
| 354 | - * Filter the phone html by field type key. |
|
| 355 | - * |
|
| 356 | - * @param string $html The html to filter. |
|
| 357 | - * @param string $location The location to output the html. |
|
| 358 | - * @param array $cf The custom field array. |
|
| 359 | - * @since 1.6.6 |
|
| 360 | - */ |
|
| 361 | - $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - // If not html then we run the standard output. |
|
| 365 | - if(empty($html)){ |
|
| 366 | - |
|
| 367 | - if ($post->{$cf['htmlvar_name']}): |
|
| 368 | - |
|
| 369 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 370 | - if (strpos($field_icon, 'http') !== false) { |
|
| 371 | - $field_icon_af = ''; |
|
| 372 | - } elseif ($field_icon == '') { |
|
| 373 | - $field_icon_af = '<i class="fa fa-phone"></i>'; |
|
| 374 | - } else { |
|
| 375 | - $field_icon_af = $field_icon; |
|
| 376 | - $field_icon = ''; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - |
|
| 380 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 381 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 382 | - $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>'; |
|
| 383 | - |
|
| 384 | - endif; |
|
| 385 | - |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - return $html; |
|
| 315 | + // check we have the post value |
|
| 316 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 317 | + else{ global $post;} |
|
| 318 | + |
|
| 319 | + if(!is_array($cf) && $cf!=''){ |
|
| 320 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 321 | + if(!$cf){return NULL;} |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + $html_var = $cf['htmlvar_name']; |
|
| 325 | + |
|
| 326 | + // Check if there is a location specific filter. |
|
| 327 | + if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){ |
|
| 328 | + /** |
|
| 329 | + * Filter the phone html by location. |
|
| 330 | + * |
|
| 331 | + * @param string $html The html to filter. |
|
| 332 | + * @param array $cf The custom field array. |
|
| 333 | + * @since 1.6.6 |
|
| 334 | + */ |
|
| 335 | + $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf); |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + // Check if there is a custom field specific filter. |
|
| 339 | + if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){ |
|
| 340 | + /** |
|
| 341 | + * Filter the phone html by individual custom field. |
|
| 342 | + * |
|
| 343 | + * @param string $html The html to filter. |
|
| 344 | + * @param string $location The location to output the html. |
|
| 345 | + * @param array $cf The custom field array. |
|
| 346 | + * @since 1.6.6 |
|
| 347 | + */ |
|
| 348 | + $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf); |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + // Check if there is a custom field key specific filter. |
|
| 352 | + if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){ |
|
| 353 | + /** |
|
| 354 | + * Filter the phone html by field type key. |
|
| 355 | + * |
|
| 356 | + * @param string $html The html to filter. |
|
| 357 | + * @param string $location The location to output the html. |
|
| 358 | + * @param array $cf The custom field array. |
|
| 359 | + * @since 1.6.6 |
|
| 360 | + */ |
|
| 361 | + $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + // If not html then we run the standard output. |
|
| 365 | + if(empty($html)){ |
|
| 366 | + |
|
| 367 | + if ($post->{$cf['htmlvar_name']}): |
|
| 368 | + |
|
| 369 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 370 | + if (strpos($field_icon, 'http') !== false) { |
|
| 371 | + $field_icon_af = ''; |
|
| 372 | + } elseif ($field_icon == '') { |
|
| 373 | + $field_icon_af = '<i class="fa fa-phone"></i>'; |
|
| 374 | + } else { |
|
| 375 | + $field_icon_af = $field_icon; |
|
| 376 | + $field_icon = ''; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + |
|
| 380 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 381 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 382 | + $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>'; |
|
| 383 | + |
|
| 384 | + endif; |
|
| 385 | + |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + return $html; |
|
| 389 | 389 | } |
| 390 | 390 | add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3); |
| 391 | 391 | |
@@ -402,85 +402,85 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | function geodir_cf_time($html,$location,$cf,$p=''){ |
| 404 | 404 | |
| 405 | - // check we have the post value |
|
| 406 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 407 | - else{ global $post;} |
|
| 408 | - |
|
| 409 | - if(!is_array($cf) && $cf!=''){ |
|
| 410 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 411 | - if(!$cf){return NULL;} |
|
| 412 | - } |
|
| 413 | - |
|
| 414 | - $html_var = $cf['htmlvar_name']; |
|
| 415 | - |
|
| 416 | - // Check if there is a location specific filter. |
|
| 417 | - if(has_filter("geodir_custom_field_output_time_loc_{$location}")){ |
|
| 418 | - /** |
|
| 419 | - * Filter the time html by location. |
|
| 420 | - * |
|
| 421 | - * @param string $html The html to filter. |
|
| 422 | - * @param array $cf The custom field array. |
|
| 423 | - * @since 1.6.6 |
|
| 424 | - */ |
|
| 425 | - $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf); |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - // Check if there is a custom field specific filter. |
|
| 429 | - if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){ |
|
| 430 | - /** |
|
| 431 | - * Filter the time html by individual custom field. |
|
| 432 | - * |
|
| 433 | - * @param string $html The html to filter. |
|
| 434 | - * @param string $location The location to output the html. |
|
| 435 | - * @param array $cf The custom field array. |
|
| 436 | - * @since 1.6.6 |
|
| 437 | - */ |
|
| 438 | - $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf); |
|
| 439 | - } |
|
| 440 | - |
|
| 441 | - // Check if there is a custom field key specific filter. |
|
| 442 | - if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){ |
|
| 443 | - /** |
|
| 444 | - * Filter the time html by field type key. |
|
| 445 | - * |
|
| 446 | - * @param string $html The html to filter. |
|
| 447 | - * @param string $location The location to output the html. |
|
| 448 | - * @param array $cf The custom field array. |
|
| 449 | - * @since 1.6.6 |
|
| 450 | - */ |
|
| 451 | - $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - // If not html then we run the standard output. |
|
| 455 | - if(empty($html)){ |
|
| 456 | - |
|
| 457 | - if ($post->{$cf['htmlvar_name']}): |
|
| 458 | - |
|
| 459 | - $value = ''; |
|
| 460 | - if ($post->{$cf['htmlvar_name']} != '') |
|
| 461 | - //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
| 462 | - $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']})); |
|
| 463 | - |
|
| 464 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 465 | - if (strpos($field_icon, 'http') !== false) { |
|
| 466 | - $field_icon_af = ''; |
|
| 467 | - } elseif ($field_icon == '') { |
|
| 468 | - $field_icon_af = '<i class="fa fa-clock-o"></i>'; |
|
| 469 | - } else { |
|
| 470 | - $field_icon_af = $field_icon; |
|
| 471 | - $field_icon = ''; |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - |
|
| 475 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 476 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 477 | - $html .= '</span>' . $value . '</div>'; |
|
| 478 | - |
|
| 479 | - endif; |
|
| 480 | - |
|
| 481 | - } |
|
| 482 | - |
|
| 483 | - return $html; |
|
| 405 | + // check we have the post value |
|
| 406 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 407 | + else{ global $post;} |
|
| 408 | + |
|
| 409 | + if(!is_array($cf) && $cf!=''){ |
|
| 410 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 411 | + if(!$cf){return NULL;} |
|
| 412 | + } |
|
| 413 | + |
|
| 414 | + $html_var = $cf['htmlvar_name']; |
|
| 415 | + |
|
| 416 | + // Check if there is a location specific filter. |
|
| 417 | + if(has_filter("geodir_custom_field_output_time_loc_{$location}")){ |
|
| 418 | + /** |
|
| 419 | + * Filter the time html by location. |
|
| 420 | + * |
|
| 421 | + * @param string $html The html to filter. |
|
| 422 | + * @param array $cf The custom field array. |
|
| 423 | + * @since 1.6.6 |
|
| 424 | + */ |
|
| 425 | + $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf); |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + // Check if there is a custom field specific filter. |
|
| 429 | + if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){ |
|
| 430 | + /** |
|
| 431 | + * Filter the time html by individual custom field. |
|
| 432 | + * |
|
| 433 | + * @param string $html The html to filter. |
|
| 434 | + * @param string $location The location to output the html. |
|
| 435 | + * @param array $cf The custom field array. |
|
| 436 | + * @since 1.6.6 |
|
| 437 | + */ |
|
| 438 | + $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf); |
|
| 439 | + } |
|
| 440 | + |
|
| 441 | + // Check if there is a custom field key specific filter. |
|
| 442 | + if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){ |
|
| 443 | + /** |
|
| 444 | + * Filter the time html by field type key. |
|
| 445 | + * |
|
| 446 | + * @param string $html The html to filter. |
|
| 447 | + * @param string $location The location to output the html. |
|
| 448 | + * @param array $cf The custom field array. |
|
| 449 | + * @since 1.6.6 |
|
| 450 | + */ |
|
| 451 | + $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + // If not html then we run the standard output. |
|
| 455 | + if(empty($html)){ |
|
| 456 | + |
|
| 457 | + if ($post->{$cf['htmlvar_name']}): |
|
| 458 | + |
|
| 459 | + $value = ''; |
|
| 460 | + if ($post->{$cf['htmlvar_name']} != '') |
|
| 461 | + //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
| 462 | + $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']})); |
|
| 463 | + |
|
| 464 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 465 | + if (strpos($field_icon, 'http') !== false) { |
|
| 466 | + $field_icon_af = ''; |
|
| 467 | + } elseif ($field_icon == '') { |
|
| 468 | + $field_icon_af = '<i class="fa fa-clock-o"></i>'; |
|
| 469 | + } else { |
|
| 470 | + $field_icon_af = $field_icon; |
|
| 471 | + $field_icon = ''; |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + |
|
| 475 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 476 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 477 | + $html .= '</span>' . $value . '</div>'; |
|
| 478 | + |
|
| 479 | + endif; |
|
| 480 | + |
|
| 481 | + } |
|
| 482 | + |
|
| 483 | + return $html; |
|
| 484 | 484 | } |
| 485 | 485 | add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3); |
| 486 | 486 | |
@@ -496,111 +496,111 @@ discard block |
||
| 496 | 496 | * @return string The html to output for the custom field. |
| 497 | 497 | */ |
| 498 | 498 | function geodir_cf_datepicker($html,$location,$cf,$p=''){ |
| 499 | - global $preview; |
|
| 500 | - // check we have the post value |
|
| 501 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 502 | - else{ global $post;} |
|
| 503 | - |
|
| 504 | - if(!is_array($cf) && $cf!=''){ |
|
| 505 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 506 | - if(!$cf){return NULL;} |
|
| 507 | - } |
|
| 508 | - |
|
| 509 | - $html_var = $cf['htmlvar_name']; |
|
| 510 | - |
|
| 511 | - // Check if there is a location specific filter. |
|
| 512 | - if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){ |
|
| 513 | - /** |
|
| 514 | - * Filter the datepicker html by location. |
|
| 515 | - * |
|
| 516 | - * @param string $html The html to filter. |
|
| 517 | - * @param array $cf The custom field array. |
|
| 518 | - * @since 1.6.6 |
|
| 519 | - */ |
|
| 520 | - $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf); |
|
| 521 | - } |
|
| 522 | - |
|
| 523 | - // Check if there is a custom field specific filter. |
|
| 524 | - if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){ |
|
| 525 | - /** |
|
| 526 | - * Filter the datepicker html by individual custom field. |
|
| 527 | - * |
|
| 528 | - * @param string $html The html to filter. |
|
| 529 | - * @param string $location The location to output the html. |
|
| 530 | - * @param array $cf The custom field array. |
|
| 531 | - * @since 1.6.6 |
|
| 532 | - */ |
|
| 533 | - $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf); |
|
| 534 | - } |
|
| 535 | - |
|
| 536 | - // Check if there is a custom field key specific filter. |
|
| 537 | - if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){ |
|
| 538 | - /** |
|
| 539 | - * Filter the datepicker html by field type key. |
|
| 540 | - * |
|
| 541 | - * @param string $html The html to filter. |
|
| 542 | - * @param string $location The location to output the html. |
|
| 543 | - * @param array $cf The custom field array. |
|
| 544 | - * @since 1.6.6 |
|
| 545 | - */ |
|
| 546 | - $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 547 | - } |
|
| 548 | - |
|
| 549 | - // If not html then we run the standard output. |
|
| 550 | - if(empty($html)){ |
|
| 551 | - |
|
| 552 | - if ($post->{$cf['htmlvar_name']}): |
|
| 553 | - |
|
| 554 | - $date_format = geodir_default_date_format(); |
|
| 555 | - if ($cf['extra_fields'] != '') { |
|
| 556 | - $date_format = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 557 | - $date_format = $date_format['date_format']; |
|
| 558 | - } |
|
| 559 | - // check if we need to change the format or not |
|
| 560 | - $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 561 | - if($date_format_len>5){// if greater then 4 then it's the old style format. |
|
| 562 | - |
|
| 563 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 564 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 565 | - |
|
| 566 | - $date_format = str_replace($search, $replace, $date_format); |
|
| 567 | - |
|
| 568 | - $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
| 569 | - }else{ |
|
| 570 | - $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
|
| 571 | - } |
|
| 572 | - |
|
| 573 | - if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") { |
|
| 574 | - $date_format_from = $preview ? $date_format : 'Y-m-d'; |
|
| 575 | - $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
|
| 576 | - //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
|
| 577 | - //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
|
| 578 | - }else{ |
|
| 579 | - return ''; |
|
| 580 | - } |
|
| 581 | - |
|
| 582 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 583 | - |
|
| 584 | - if (strpos($field_icon, 'http') !== false) { |
|
| 585 | - $field_icon_af = ''; |
|
| 586 | - } elseif ($field_icon == '') { |
|
| 587 | - $field_icon_af = '<i class="fa fa-calendar"></i>'; |
|
| 588 | - } else { |
|
| 589 | - $field_icon_af = $field_icon; |
|
| 590 | - $field_icon = ''; |
|
| 591 | - } |
|
| 592 | - |
|
| 593 | - |
|
| 594 | - |
|
| 595 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 596 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 597 | - $html .= '</span>' . $value . '</div>'; |
|
| 598 | - |
|
| 599 | - endif; |
|
| 600 | - |
|
| 601 | - } |
|
| 602 | - |
|
| 603 | - return $html; |
|
| 499 | + global $preview; |
|
| 500 | + // check we have the post value |
|
| 501 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 502 | + else{ global $post;} |
|
| 503 | + |
|
| 504 | + if(!is_array($cf) && $cf!=''){ |
|
| 505 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 506 | + if(!$cf){return NULL;} |
|
| 507 | + } |
|
| 508 | + |
|
| 509 | + $html_var = $cf['htmlvar_name']; |
|
| 510 | + |
|
| 511 | + // Check if there is a location specific filter. |
|
| 512 | + if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){ |
|
| 513 | + /** |
|
| 514 | + * Filter the datepicker html by location. |
|
| 515 | + * |
|
| 516 | + * @param string $html The html to filter. |
|
| 517 | + * @param array $cf The custom field array. |
|
| 518 | + * @since 1.6.6 |
|
| 519 | + */ |
|
| 520 | + $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf); |
|
| 521 | + } |
|
| 522 | + |
|
| 523 | + // Check if there is a custom field specific filter. |
|
| 524 | + if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){ |
|
| 525 | + /** |
|
| 526 | + * Filter the datepicker html by individual custom field. |
|
| 527 | + * |
|
| 528 | + * @param string $html The html to filter. |
|
| 529 | + * @param string $location The location to output the html. |
|
| 530 | + * @param array $cf The custom field array. |
|
| 531 | + * @since 1.6.6 |
|
| 532 | + */ |
|
| 533 | + $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf); |
|
| 534 | + } |
|
| 535 | + |
|
| 536 | + // Check if there is a custom field key specific filter. |
|
| 537 | + if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){ |
|
| 538 | + /** |
|
| 539 | + * Filter the datepicker html by field type key. |
|
| 540 | + * |
|
| 541 | + * @param string $html The html to filter. |
|
| 542 | + * @param string $location The location to output the html. |
|
| 543 | + * @param array $cf The custom field array. |
|
| 544 | + * @since 1.6.6 |
|
| 545 | + */ |
|
| 546 | + $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 547 | + } |
|
| 548 | + |
|
| 549 | + // If not html then we run the standard output. |
|
| 550 | + if(empty($html)){ |
|
| 551 | + |
|
| 552 | + if ($post->{$cf['htmlvar_name']}): |
|
| 553 | + |
|
| 554 | + $date_format = geodir_default_date_format(); |
|
| 555 | + if ($cf['extra_fields'] != '') { |
|
| 556 | + $date_format = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 557 | + $date_format = $date_format['date_format']; |
|
| 558 | + } |
|
| 559 | + // check if we need to change the format or not |
|
| 560 | + $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 561 | + if($date_format_len>5){// if greater then 4 then it's the old style format. |
|
| 562 | + |
|
| 563 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 564 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 565 | + |
|
| 566 | + $date_format = str_replace($search, $replace, $date_format); |
|
| 567 | + |
|
| 568 | + $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
| 569 | + }else{ |
|
| 570 | + $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
|
| 571 | + } |
|
| 572 | + |
|
| 573 | + if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") { |
|
| 574 | + $date_format_from = $preview ? $date_format : 'Y-m-d'; |
|
| 575 | + $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
|
| 576 | + //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
|
| 577 | + //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
|
| 578 | + }else{ |
|
| 579 | + return ''; |
|
| 580 | + } |
|
| 581 | + |
|
| 582 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 583 | + |
|
| 584 | + if (strpos($field_icon, 'http') !== false) { |
|
| 585 | + $field_icon_af = ''; |
|
| 586 | + } elseif ($field_icon == '') { |
|
| 587 | + $field_icon_af = '<i class="fa fa-calendar"></i>'; |
|
| 588 | + } else { |
|
| 589 | + $field_icon_af = $field_icon; |
|
| 590 | + $field_icon = ''; |
|
| 591 | + } |
|
| 592 | + |
|
| 593 | + |
|
| 594 | + |
|
| 595 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 596 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 597 | + $html .= '</span>' . $value . '</div>'; |
|
| 598 | + |
|
| 599 | + endif; |
|
| 600 | + |
|
| 601 | + } |
|
| 602 | + |
|
| 603 | + return $html; |
|
| 604 | 604 | } |
| 605 | 605 | add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3); |
| 606 | 606 | |
@@ -617,97 +617,97 @@ discard block |
||
| 617 | 617 | */ |
| 618 | 618 | function geodir_cf_text($html,$location,$cf,$p=''){ |
| 619 | 619 | |
| 620 | - // check we have the post value |
|
| 621 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 622 | - else{ global $post;} |
|
| 623 | - |
|
| 624 | - if(!is_array($cf) && $cf!=''){ |
|
| 625 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 626 | - if(!$cf){return NULL;} |
|
| 627 | - } |
|
| 628 | - |
|
| 629 | - $html_var = $cf['htmlvar_name']; |
|
| 630 | - |
|
| 631 | - // Check if there is a location specific filter. |
|
| 632 | - if(has_filter("geodir_custom_field_output_text_loc_{$location}")){ |
|
| 633 | - /** |
|
| 634 | - * Filter the text html by location. |
|
| 635 | - * |
|
| 636 | - * @param string $html The html to filter. |
|
| 637 | - * @param array $cf The custom field array. |
|
| 638 | - * @since 1.6.6 |
|
| 639 | - */ |
|
| 640 | - $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf); |
|
| 641 | - } |
|
| 642 | - |
|
| 643 | - // Check if there is a custom field specific filter. |
|
| 644 | - if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){ |
|
| 645 | - /** |
|
| 646 | - * Filter the text html by individual custom field. |
|
| 647 | - * |
|
| 648 | - * @param string $html The html to filter. |
|
| 649 | - * @param string $location The location to output the html. |
|
| 650 | - * @param array $cf The custom field array. |
|
| 651 | - * @since 1.6.6 |
|
| 652 | - */ |
|
| 653 | - $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf); |
|
| 654 | - } |
|
| 655 | - |
|
| 656 | - // Check if there is a custom field key specific filter. |
|
| 657 | - if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){ |
|
| 658 | - /** |
|
| 659 | - * Filter the text html by field type key. |
|
| 660 | - * |
|
| 661 | - * @param string $html The html to filter. |
|
| 662 | - * @param string $location The location to output the html. |
|
| 663 | - * @param array $cf The custom field array. |
|
| 664 | - * @since 1.6.6 |
|
| 665 | - */ |
|
| 666 | - $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 667 | - } |
|
| 620 | + // check we have the post value |
|
| 621 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 622 | + else{ global $post;} |
|
| 623 | + |
|
| 624 | + if(!is_array($cf) && $cf!=''){ |
|
| 625 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 626 | + if(!$cf){return NULL;} |
|
| 627 | + } |
|
| 628 | + |
|
| 629 | + $html_var = $cf['htmlvar_name']; |
|
| 630 | + |
|
| 631 | + // Check if there is a location specific filter. |
|
| 632 | + if(has_filter("geodir_custom_field_output_text_loc_{$location}")){ |
|
| 633 | + /** |
|
| 634 | + * Filter the text html by location. |
|
| 635 | + * |
|
| 636 | + * @param string $html The html to filter. |
|
| 637 | + * @param array $cf The custom field array. |
|
| 638 | + * @since 1.6.6 |
|
| 639 | + */ |
|
| 640 | + $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf); |
|
| 641 | + } |
|
| 642 | + |
|
| 643 | + // Check if there is a custom field specific filter. |
|
| 644 | + if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){ |
|
| 645 | + /** |
|
| 646 | + * Filter the text html by individual custom field. |
|
| 647 | + * |
|
| 648 | + * @param string $html The html to filter. |
|
| 649 | + * @param string $location The location to output the html. |
|
| 650 | + * @param array $cf The custom field array. |
|
| 651 | + * @since 1.6.6 |
|
| 652 | + */ |
|
| 653 | + $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf); |
|
| 654 | + } |
|
| 655 | + |
|
| 656 | + // Check if there is a custom field key specific filter. |
|
| 657 | + if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){ |
|
| 658 | + /** |
|
| 659 | + * Filter the text html by field type key. |
|
| 660 | + * |
|
| 661 | + * @param string $html The html to filter. |
|
| 662 | + * @param string $location The location to output the html. |
|
| 663 | + * @param array $cf The custom field array. |
|
| 664 | + * @since 1.6.6 |
|
| 665 | + */ |
|
| 666 | + $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 667 | + } |
|
| 668 | 668 | |
| 669 | 669 | |
| 670 | 670 | |
| 671 | - // If not html then we run the standard output. |
|
| 672 | - if(empty($html)){ |
|
| 671 | + // If not html then we run the standard output. |
|
| 672 | + if(empty($html)){ |
|
| 673 | 673 | |
| 674 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 674 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 675 | 675 | |
| 676 | - $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
| 676 | + $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
| 677 | 677 | |
| 678 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 679 | - if (strpos($field_icon, 'http') !== false) { |
|
| 680 | - $field_icon_af = ''; |
|
| 681 | - } elseif ($field_icon == '') { |
|
| 682 | - $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
| 683 | - } else { |
|
| 684 | - $field_icon_af = $field_icon; |
|
| 685 | - $field_icon = ''; |
|
| 686 | - } |
|
| 678 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 679 | + if (strpos($field_icon, 'http') !== false) { |
|
| 680 | + $field_icon_af = ''; |
|
| 681 | + } elseif ($field_icon == '') { |
|
| 682 | + $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
| 683 | + } else { |
|
| 684 | + $field_icon_af = $field_icon; |
|
| 685 | + $field_icon = ''; |
|
| 686 | + } |
|
| 687 | 687 | |
| 688 | 688 | |
| 689 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
| 690 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 691 | - $html .= '</span>'; |
|
| 689 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
| 690 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 691 | + $html .= '</span>'; |
|
| 692 | 692 | |
| 693 | - $value = $post->{$cf['htmlvar_name']}; |
|
| 694 | - if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
| 695 | - $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
|
| 696 | - if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
| 697 | - if(!ceil($value) > 0){return '';}// dont output blank prices |
|
| 698 | - $value = geodir_currency_format_number($value,$cf); |
|
| 699 | - } |
|
| 700 | - } |
|
| 693 | + $value = $post->{$cf['htmlvar_name']}; |
|
| 694 | + if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
| 695 | + $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
|
| 696 | + if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
| 697 | + if(!ceil($value) > 0){return '';}// dont output blank prices |
|
| 698 | + $value = geodir_currency_format_number($value,$cf); |
|
| 699 | + } |
|
| 700 | + } |
|
| 701 | 701 | |
| 702 | 702 | |
| 703 | - $html .= $value; |
|
| 704 | - $html .= '</div>'; |
|
| 703 | + $html .= $value; |
|
| 704 | + $html .= '</div>'; |
|
| 705 | 705 | |
| 706 | - endif; |
|
| 706 | + endif; |
|
| 707 | 707 | |
| 708 | - } |
|
| 708 | + } |
|
| 709 | 709 | |
| 710 | - return $html; |
|
| 710 | + return $html; |
|
| 711 | 711 | } |
| 712 | 712 | add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3); |
| 713 | 713 | |
@@ -724,98 +724,98 @@ discard block |
||
| 724 | 724 | */ |
| 725 | 725 | function geodir_cf_radio($html,$location,$cf,$p=''){ |
| 726 | 726 | |
| 727 | - // check we have the post value |
|
| 728 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 729 | - else{ global $post;} |
|
| 730 | - |
|
| 731 | - if(!is_array($cf) && $cf!=''){ |
|
| 732 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 733 | - if(!$cf){return NULL;} |
|
| 734 | - } |
|
| 735 | - |
|
| 736 | - $html_var = $cf['htmlvar_name']; |
|
| 737 | - |
|
| 738 | - // Check if there is a location specific filter. |
|
| 739 | - if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
| 740 | - /** |
|
| 741 | - * Filter the radio html by location. |
|
| 742 | - * |
|
| 743 | - * @param string $html The html to filter. |
|
| 744 | - * @param array $cf The custom field array. |
|
| 745 | - * @since 1.6.6 |
|
| 746 | - */ |
|
| 747 | - $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
| 748 | - } |
|
| 749 | - |
|
| 750 | - // Check if there is a custom field specific filter. |
|
| 751 | - if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
| 752 | - /** |
|
| 753 | - * Filter the radio html by individual custom field. |
|
| 754 | - * |
|
| 755 | - * @param string $html The html to filter. |
|
| 756 | - * @param string $location The location to output the html. |
|
| 757 | - * @param array $cf The custom field array. |
|
| 758 | - * @since 1.6.6 |
|
| 759 | - */ |
|
| 760 | - $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
| 761 | - } |
|
| 762 | - |
|
| 763 | - // Check if there is a custom field key specific filter. |
|
| 764 | - if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
| 765 | - /** |
|
| 766 | - * Filter the radio html by field type key. |
|
| 767 | - * |
|
| 768 | - * @param string $html The html to filter. |
|
| 769 | - * @param string $location The location to output the html. |
|
| 770 | - * @param array $cf The custom field array. |
|
| 771 | - * @since 1.6.6 |
|
| 772 | - */ |
|
| 773 | - $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 774 | - } |
|
| 775 | - |
|
| 776 | - // If not html then we run the standard output. |
|
| 777 | - if(empty($html)){ |
|
| 778 | - |
|
| 779 | - $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
|
| 780 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
| 781 | - |
|
| 782 | - if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') { |
|
| 783 | - $html_val = __('No', 'geodirectory'); |
|
| 784 | - } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') { |
|
| 785 | - $html_val = __('Yes', 'geodirectory'); |
|
| 786 | - } else { |
|
| 787 | - if (!empty($cf['option_values'])) { |
|
| 788 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 789 | - |
|
| 790 | - if (!empty($cf_option_values)) { |
|
| 791 | - foreach ($cf_option_values as $cf_option_value) { |
|
| 792 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
| 793 | - $html_val = $cf_option_value['label']; |
|
| 794 | - } |
|
| 795 | - } |
|
| 796 | - } |
|
| 797 | - } |
|
| 798 | - } |
|
| 799 | - |
|
| 800 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 801 | - if (strpos($field_icon, 'http') !== false) { |
|
| 802 | - $field_icon_af = ''; |
|
| 803 | - } elseif ($field_icon == '') { |
|
| 804 | - $field_icon_af = ''; |
|
| 805 | - } else { |
|
| 806 | - $field_icon_af = $field_icon; |
|
| 807 | - $field_icon = ''; |
|
| 808 | - } |
|
| 809 | - |
|
| 810 | - |
|
| 811 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 812 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 813 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 814 | - endif; |
|
| 815 | - |
|
| 816 | - } |
|
| 817 | - |
|
| 818 | - return $html; |
|
| 727 | + // check we have the post value |
|
| 728 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 729 | + else{ global $post;} |
|
| 730 | + |
|
| 731 | + if(!is_array($cf) && $cf!=''){ |
|
| 732 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 733 | + if(!$cf){return NULL;} |
|
| 734 | + } |
|
| 735 | + |
|
| 736 | + $html_var = $cf['htmlvar_name']; |
|
| 737 | + |
|
| 738 | + // Check if there is a location specific filter. |
|
| 739 | + if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
| 740 | + /** |
|
| 741 | + * Filter the radio html by location. |
|
| 742 | + * |
|
| 743 | + * @param string $html The html to filter. |
|
| 744 | + * @param array $cf The custom field array. |
|
| 745 | + * @since 1.6.6 |
|
| 746 | + */ |
|
| 747 | + $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
| 748 | + } |
|
| 749 | + |
|
| 750 | + // Check if there is a custom field specific filter. |
|
| 751 | + if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
| 752 | + /** |
|
| 753 | + * Filter the radio html by individual custom field. |
|
| 754 | + * |
|
| 755 | + * @param string $html The html to filter. |
|
| 756 | + * @param string $location The location to output the html. |
|
| 757 | + * @param array $cf The custom field array. |
|
| 758 | + * @since 1.6.6 |
|
| 759 | + */ |
|
| 760 | + $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
| 761 | + } |
|
| 762 | + |
|
| 763 | + // Check if there is a custom field key specific filter. |
|
| 764 | + if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
| 765 | + /** |
|
| 766 | + * Filter the radio html by field type key. |
|
| 767 | + * |
|
| 768 | + * @param string $html The html to filter. |
|
| 769 | + * @param string $location The location to output the html. |
|
| 770 | + * @param array $cf The custom field array. |
|
| 771 | + * @since 1.6.6 |
|
| 772 | + */ |
|
| 773 | + $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 774 | + } |
|
| 775 | + |
|
| 776 | + // If not html then we run the standard output. |
|
| 777 | + if(empty($html)){ |
|
| 778 | + |
|
| 779 | + $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
|
| 780 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
| 781 | + |
|
| 782 | + if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') { |
|
| 783 | + $html_val = __('No', 'geodirectory'); |
|
| 784 | + } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') { |
|
| 785 | + $html_val = __('Yes', 'geodirectory'); |
|
| 786 | + } else { |
|
| 787 | + if (!empty($cf['option_values'])) { |
|
| 788 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 789 | + |
|
| 790 | + if (!empty($cf_option_values)) { |
|
| 791 | + foreach ($cf_option_values as $cf_option_value) { |
|
| 792 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
| 793 | + $html_val = $cf_option_value['label']; |
|
| 794 | + } |
|
| 795 | + } |
|
| 796 | + } |
|
| 797 | + } |
|
| 798 | + } |
|
| 799 | + |
|
| 800 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 801 | + if (strpos($field_icon, 'http') !== false) { |
|
| 802 | + $field_icon_af = ''; |
|
| 803 | + } elseif ($field_icon == '') { |
|
| 804 | + $field_icon_af = ''; |
|
| 805 | + } else { |
|
| 806 | + $field_icon_af = $field_icon; |
|
| 807 | + $field_icon = ''; |
|
| 808 | + } |
|
| 809 | + |
|
| 810 | + |
|
| 811 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 812 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 813 | + $html .= '</span>' . $html_val . '</div>'; |
|
| 814 | + endif; |
|
| 815 | + |
|
| 816 | + } |
|
| 817 | + |
|
| 818 | + return $html; |
|
| 819 | 819 | } |
| 820 | 820 | add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3); |
| 821 | 821 | |
@@ -833,92 +833,92 @@ discard block |
||
| 833 | 833 | */ |
| 834 | 834 | function geodir_cf_select($html,$location,$cf,$p=''){ |
| 835 | 835 | |
| 836 | - // check we have the post value |
|
| 837 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 838 | - else{ global $post;} |
|
| 839 | - |
|
| 840 | - if(!is_array($cf) && $cf!=''){ |
|
| 841 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 842 | - if(!$cf){return NULL;} |
|
| 843 | - } |
|
| 844 | - |
|
| 845 | - $html_var = $cf['htmlvar_name']; |
|
| 846 | - |
|
| 847 | - // Check if there is a location specific filter. |
|
| 848 | - if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
| 849 | - /** |
|
| 850 | - * Filter the select html by location. |
|
| 851 | - * |
|
| 852 | - * @param string $html The html to filter. |
|
| 853 | - * @param array $cf The custom field array. |
|
| 854 | - * @since 1.6.6 |
|
| 855 | - */ |
|
| 856 | - $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
| 857 | - } |
|
| 858 | - |
|
| 859 | - // Check if there is a custom field specific filter. |
|
| 860 | - if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
| 861 | - /** |
|
| 862 | - * Filter the select html by individual custom field. |
|
| 863 | - * |
|
| 864 | - * @param string $html The html to filter. |
|
| 865 | - * @param string $location The location to output the html. |
|
| 866 | - * @param array $cf The custom field array. |
|
| 867 | - * @since 1.6.6 |
|
| 868 | - */ |
|
| 869 | - $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
| 870 | - } |
|
| 871 | - |
|
| 872 | - // Check if there is a custom field key specific filter. |
|
| 873 | - if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
| 874 | - /** |
|
| 875 | - * Filter the select html by field type key. |
|
| 876 | - * |
|
| 877 | - * @param string $html The html to filter. |
|
| 878 | - * @param string $location The location to output the html. |
|
| 879 | - * @param array $cf The custom field array. |
|
| 880 | - * @since 1.6.6 |
|
| 881 | - */ |
|
| 882 | - $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 883 | - } |
|
| 884 | - |
|
| 885 | - // If not html then we run the standard output. |
|
| 886 | - if(empty($html)){ |
|
| 887 | - |
|
| 888 | - if ($post->{$cf['htmlvar_name']}): |
|
| 889 | - $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
| 890 | - |
|
| 891 | - if (!empty($cf['option_values'])) { |
|
| 892 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 893 | - |
|
| 894 | - if (!empty($cf_option_values)) { |
|
| 895 | - foreach ($cf_option_values as $cf_option_value) { |
|
| 896 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
| 897 | - $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2". |
|
| 898 | - } |
|
| 899 | - } |
|
| 900 | - } |
|
| 901 | - } |
|
| 902 | - |
|
| 903 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 904 | - if (strpos($field_icon, 'http') !== false) { |
|
| 905 | - $field_icon_af = ''; |
|
| 906 | - } elseif ($field_icon == '') { |
|
| 907 | - $field_icon_af = ''; |
|
| 908 | - } else { |
|
| 909 | - $field_icon_af = $field_icon; |
|
| 910 | - $field_icon = ''; |
|
| 911 | - } |
|
| 912 | - |
|
| 913 | - |
|
| 914 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 915 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 916 | - $html .= '</span>' . $field_value . '</div>'; |
|
| 917 | - endif; |
|
| 918 | - |
|
| 919 | - } |
|
| 920 | - |
|
| 921 | - return $html; |
|
| 836 | + // check we have the post value |
|
| 837 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 838 | + else{ global $post;} |
|
| 839 | + |
|
| 840 | + if(!is_array($cf) && $cf!=''){ |
|
| 841 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 842 | + if(!$cf){return NULL;} |
|
| 843 | + } |
|
| 844 | + |
|
| 845 | + $html_var = $cf['htmlvar_name']; |
|
| 846 | + |
|
| 847 | + // Check if there is a location specific filter. |
|
| 848 | + if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
| 849 | + /** |
|
| 850 | + * Filter the select html by location. |
|
| 851 | + * |
|
| 852 | + * @param string $html The html to filter. |
|
| 853 | + * @param array $cf The custom field array. |
|
| 854 | + * @since 1.6.6 |
|
| 855 | + */ |
|
| 856 | + $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
| 857 | + } |
|
| 858 | + |
|
| 859 | + // Check if there is a custom field specific filter. |
|
| 860 | + if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
| 861 | + /** |
|
| 862 | + * Filter the select html by individual custom field. |
|
| 863 | + * |
|
| 864 | + * @param string $html The html to filter. |
|
| 865 | + * @param string $location The location to output the html. |
|
| 866 | + * @param array $cf The custom field array. |
|
| 867 | + * @since 1.6.6 |
|
| 868 | + */ |
|
| 869 | + $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
| 870 | + } |
|
| 871 | + |
|
| 872 | + // Check if there is a custom field key specific filter. |
|
| 873 | + if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
| 874 | + /** |
|
| 875 | + * Filter the select html by field type key. |
|
| 876 | + * |
|
| 877 | + * @param string $html The html to filter. |
|
| 878 | + * @param string $location The location to output the html. |
|
| 879 | + * @param array $cf The custom field array. |
|
| 880 | + * @since 1.6.6 |
|
| 881 | + */ |
|
| 882 | + $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 883 | + } |
|
| 884 | + |
|
| 885 | + // If not html then we run the standard output. |
|
| 886 | + if(empty($html)){ |
|
| 887 | + |
|
| 888 | + if ($post->{$cf['htmlvar_name']}): |
|
| 889 | + $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
| 890 | + |
|
| 891 | + if (!empty($cf['option_values'])) { |
|
| 892 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 893 | + |
|
| 894 | + if (!empty($cf_option_values)) { |
|
| 895 | + foreach ($cf_option_values as $cf_option_value) { |
|
| 896 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
| 897 | + $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2". |
|
| 898 | + } |
|
| 899 | + } |
|
| 900 | + } |
|
| 901 | + } |
|
| 902 | + |
|
| 903 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 904 | + if (strpos($field_icon, 'http') !== false) { |
|
| 905 | + $field_icon_af = ''; |
|
| 906 | + } elseif ($field_icon == '') { |
|
| 907 | + $field_icon_af = ''; |
|
| 908 | + } else { |
|
| 909 | + $field_icon_af = $field_icon; |
|
| 910 | + $field_icon = ''; |
|
| 911 | + } |
|
| 912 | + |
|
| 913 | + |
|
| 914 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 915 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 916 | + $html .= '</span>' . $field_value . '</div>'; |
|
| 917 | + endif; |
|
| 918 | + |
|
| 919 | + } |
|
| 920 | + |
|
| 921 | + return $html; |
|
| 922 | 922 | } |
| 923 | 923 | add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3); |
| 924 | 924 | |
@@ -935,117 +935,117 @@ discard block |
||
| 935 | 935 | */ |
| 936 | 936 | function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
| 937 | 937 | |
| 938 | - // check we have the post value |
|
| 939 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 940 | - else{ global $post;} |
|
| 941 | - |
|
| 942 | - if(!is_array($cf) && $cf!=''){ |
|
| 943 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 944 | - if(!$cf){return NULL;} |
|
| 945 | - } |
|
| 946 | - |
|
| 947 | - $html_var = $cf['htmlvar_name']; |
|
| 948 | - |
|
| 949 | - // Check if there is a location specific filter. |
|
| 950 | - if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
| 951 | - /** |
|
| 952 | - * Filter the multiselect html by location. |
|
| 953 | - * |
|
| 954 | - * @param string $html The html to filter. |
|
| 955 | - * @param array $cf The custom field array. |
|
| 956 | - * @since 1.6.6 |
|
| 957 | - */ |
|
| 958 | - $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
| 959 | - } |
|
| 960 | - |
|
| 961 | - // Check if there is a custom field specific filter. |
|
| 962 | - if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
| 963 | - /** |
|
| 964 | - * Filter the multiselect html by individual custom field. |
|
| 965 | - * |
|
| 966 | - * @param string $html The html to filter. |
|
| 967 | - * @param string $location The location to output the html. |
|
| 968 | - * @param array $cf The custom field array. |
|
| 969 | - * @since 1.6.6 |
|
| 970 | - */ |
|
| 971 | - $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
| 972 | - } |
|
| 973 | - |
|
| 974 | - // Check if there is a custom field key specific filter. |
|
| 975 | - if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
| 976 | - /** |
|
| 977 | - * Filter the multiselect html by field type key. |
|
| 978 | - * |
|
| 979 | - * @param string $html The html to filter. |
|
| 980 | - * @param string $location The location to output the html. |
|
| 981 | - * @param array $cf The custom field array. |
|
| 982 | - * @since 1.6.6 |
|
| 983 | - */ |
|
| 984 | - $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 985 | - } |
|
| 986 | - |
|
| 987 | - // If not html then we run the standard output. |
|
| 988 | - if(empty($html)){ |
|
| 989 | - |
|
| 990 | - |
|
| 991 | - if (!empty($post->{$cf['htmlvar_name']})): |
|
| 992 | - |
|
| 993 | - if (is_array($post->{$cf['htmlvar_name']})) { |
|
| 994 | - $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']}); |
|
| 995 | - } |
|
| 996 | - |
|
| 997 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 998 | - if (strpos($field_icon, 'http') !== false) { |
|
| 999 | - $field_icon_af = ''; |
|
| 1000 | - } elseif ($field_icon == '') { |
|
| 1001 | - $field_icon_af = ''; |
|
| 1002 | - } else { |
|
| 1003 | - $field_icon_af = $field_icon; |
|
| 1004 | - $field_icon = ''; |
|
| 1005 | - } |
|
| 1006 | - |
|
| 1007 | - $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
|
| 1008 | - |
|
| 1009 | - if(is_array($field_values)){ |
|
| 1010 | - $field_values = array_map('trim', $field_values); |
|
| 1011 | - } |
|
| 1012 | - |
|
| 1013 | - $option_values = array(); |
|
| 1014 | - if (!empty($cf['option_values'])) { |
|
| 1015 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 1016 | - |
|
| 1017 | - if (!empty($cf_option_values)) { |
|
| 1018 | - foreach ($cf_option_values as $cf_option_value) { |
|
| 1019 | - if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
| 1020 | - $option_values[] = $cf_option_value['label']; |
|
| 1021 | - } |
|
| 1022 | - } |
|
| 1023 | - } |
|
| 1024 | - } |
|
| 1025 | - |
|
| 1026 | - |
|
| 1027 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1028 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1029 | - $html .= '</span>'; |
|
| 1030 | - |
|
| 1031 | - if (count($option_values) > 1) { |
|
| 1032 | - $html .= '<ul>'; |
|
| 1033 | - |
|
| 1034 | - foreach ($option_values as $val) { |
|
| 1035 | - $html .= '<li>' . $val . '</li>'; |
|
| 1036 | - } |
|
| 1037 | - |
|
| 1038 | - $html .= '</ul>'; |
|
| 1039 | - } else { |
|
| 1040 | - $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
| 1041 | - } |
|
| 1042 | - |
|
| 1043 | - $html .= '</div>'; |
|
| 1044 | - endif; |
|
| 1045 | - |
|
| 1046 | - } |
|
| 1047 | - |
|
| 1048 | - return $html; |
|
| 938 | + // check we have the post value |
|
| 939 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 940 | + else{ global $post;} |
|
| 941 | + |
|
| 942 | + if(!is_array($cf) && $cf!=''){ |
|
| 943 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 944 | + if(!$cf){return NULL;} |
|
| 945 | + } |
|
| 946 | + |
|
| 947 | + $html_var = $cf['htmlvar_name']; |
|
| 948 | + |
|
| 949 | + // Check if there is a location specific filter. |
|
| 950 | + if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
| 951 | + /** |
|
| 952 | + * Filter the multiselect html by location. |
|
| 953 | + * |
|
| 954 | + * @param string $html The html to filter. |
|
| 955 | + * @param array $cf The custom field array. |
|
| 956 | + * @since 1.6.6 |
|
| 957 | + */ |
|
| 958 | + $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
| 959 | + } |
|
| 960 | + |
|
| 961 | + // Check if there is a custom field specific filter. |
|
| 962 | + if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
| 963 | + /** |
|
| 964 | + * Filter the multiselect html by individual custom field. |
|
| 965 | + * |
|
| 966 | + * @param string $html The html to filter. |
|
| 967 | + * @param string $location The location to output the html. |
|
| 968 | + * @param array $cf The custom field array. |
|
| 969 | + * @since 1.6.6 |
|
| 970 | + */ |
|
| 971 | + $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
| 972 | + } |
|
| 973 | + |
|
| 974 | + // Check if there is a custom field key specific filter. |
|
| 975 | + if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
| 976 | + /** |
|
| 977 | + * Filter the multiselect html by field type key. |
|
| 978 | + * |
|
| 979 | + * @param string $html The html to filter. |
|
| 980 | + * @param string $location The location to output the html. |
|
| 981 | + * @param array $cf The custom field array. |
|
| 982 | + * @since 1.6.6 |
|
| 983 | + */ |
|
| 984 | + $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 985 | + } |
|
| 986 | + |
|
| 987 | + // If not html then we run the standard output. |
|
| 988 | + if(empty($html)){ |
|
| 989 | + |
|
| 990 | + |
|
| 991 | + if (!empty($post->{$cf['htmlvar_name']})): |
|
| 992 | + |
|
| 993 | + if (is_array($post->{$cf['htmlvar_name']})) { |
|
| 994 | + $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']}); |
|
| 995 | + } |
|
| 996 | + |
|
| 997 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 998 | + if (strpos($field_icon, 'http') !== false) { |
|
| 999 | + $field_icon_af = ''; |
|
| 1000 | + } elseif ($field_icon == '') { |
|
| 1001 | + $field_icon_af = ''; |
|
| 1002 | + } else { |
|
| 1003 | + $field_icon_af = $field_icon; |
|
| 1004 | + $field_icon = ''; |
|
| 1005 | + } |
|
| 1006 | + |
|
| 1007 | + $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
|
| 1008 | + |
|
| 1009 | + if(is_array($field_values)){ |
|
| 1010 | + $field_values = array_map('trim', $field_values); |
|
| 1011 | + } |
|
| 1012 | + |
|
| 1013 | + $option_values = array(); |
|
| 1014 | + if (!empty($cf['option_values'])) { |
|
| 1015 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 1016 | + |
|
| 1017 | + if (!empty($cf_option_values)) { |
|
| 1018 | + foreach ($cf_option_values as $cf_option_value) { |
|
| 1019 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
| 1020 | + $option_values[] = $cf_option_value['label']; |
|
| 1021 | + } |
|
| 1022 | + } |
|
| 1023 | + } |
|
| 1024 | + } |
|
| 1025 | + |
|
| 1026 | + |
|
| 1027 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1028 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1029 | + $html .= '</span>'; |
|
| 1030 | + |
|
| 1031 | + if (count($option_values) > 1) { |
|
| 1032 | + $html .= '<ul>'; |
|
| 1033 | + |
|
| 1034 | + foreach ($option_values as $val) { |
|
| 1035 | + $html .= '<li>' . $val . '</li>'; |
|
| 1036 | + } |
|
| 1037 | + |
|
| 1038 | + $html .= '</ul>'; |
|
| 1039 | + } else { |
|
| 1040 | + $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
| 1041 | + } |
|
| 1042 | + |
|
| 1043 | + $html .= '</div>'; |
|
| 1044 | + endif; |
|
| 1045 | + |
|
| 1046 | + } |
|
| 1047 | + |
|
| 1048 | + return $html; |
|
| 1049 | 1049 | } |
| 1050 | 1050 | add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3); |
| 1051 | 1051 | |
@@ -1062,160 +1062,160 @@ discard block |
||
| 1062 | 1062 | */ |
| 1063 | 1063 | function geodir_cf_email($html,$location,$cf,$p=''){ |
| 1064 | 1064 | |
| 1065 | - // check we have the post value |
|
| 1066 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1067 | - else{ global $post;} |
|
| 1068 | - |
|
| 1069 | - if(!is_array($cf) && $cf!=''){ |
|
| 1070 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1071 | - if(!$cf){return NULL;} |
|
| 1072 | - } |
|
| 1073 | - |
|
| 1074 | - $html_var = $cf['htmlvar_name']; |
|
| 1075 | - |
|
| 1076 | - // Check if there is a location specific filter. |
|
| 1077 | - if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
| 1078 | - /** |
|
| 1079 | - * Filter the email html by location. |
|
| 1080 | - * |
|
| 1081 | - * @param string $html The html to filter. |
|
| 1082 | - * @param array $cf The custom field array. |
|
| 1083 | - * @since 1.6.6 |
|
| 1084 | - */ |
|
| 1085 | - $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
| 1086 | - } |
|
| 1087 | - |
|
| 1088 | - // Check if there is a custom field specific filter. |
|
| 1089 | - if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
| 1090 | - /** |
|
| 1091 | - * Filter the email html by individual custom field. |
|
| 1092 | - * |
|
| 1093 | - * @param string $html The html to filter. |
|
| 1094 | - * @param string $location The location to output the html. |
|
| 1095 | - * @param array $cf The custom field array. |
|
| 1096 | - * @since 1.6.6 |
|
| 1097 | - */ |
|
| 1098 | - $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
| 1099 | - } |
|
| 1100 | - |
|
| 1101 | - // Check if there is a custom field key specific filter. |
|
| 1102 | - if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
| 1103 | - /** |
|
| 1104 | - * Filter the email html by field type key. |
|
| 1105 | - * |
|
| 1106 | - * @param string $html The html to filter. |
|
| 1107 | - * @param string $location The location to output the html. |
|
| 1108 | - * @param array $cf The custom field array. |
|
| 1109 | - * @since 1.6.6 |
|
| 1110 | - */ |
|
| 1111 | - $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1112 | - } |
|
| 1113 | - |
|
| 1114 | - // If not html then we run the standard output. |
|
| 1115 | - if(empty($html)){ |
|
| 1116 | - |
|
| 1117 | - global $preview; |
|
| 1118 | - if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
| 1119 | - return ''; // Remove Send Enquiry | Send To Friend from listings page |
|
| 1120 | - } |
|
| 1121 | - |
|
| 1122 | - $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
| 1123 | - |
|
| 1124 | - if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) { |
|
| 1125 | - global $send_to_friend; |
|
| 1126 | - $send_to_friend = true; |
|
| 1127 | - $b_send_inquiry = ''; |
|
| 1128 | - $b_sendtofriend = ''; |
|
| 1129 | - |
|
| 1130 | - $html = ''; |
|
| 1131 | - if (!$preview) { |
|
| 1132 | - $b_send_inquiry = 'b_send_inquiry'; |
|
| 1133 | - $b_sendtofriend = 'b_sendtofriend'; |
|
| 1134 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1135 | - } |
|
| 1136 | - |
|
| 1137 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1138 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1139 | - $field_icon_af = ''; |
|
| 1140 | - } elseif ($field_icon == '') { |
|
| 1141 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1142 | - } else { |
|
| 1143 | - $field_icon_af = $field_icon; |
|
| 1144 | - $field_icon = ''; |
|
| 1145 | - } |
|
| 1146 | - |
|
| 1147 | - $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1148 | - $seperator = ''; |
|
| 1149 | - if ($post->{$cf['htmlvar_name']}) { |
|
| 1150 | - $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
|
| 1151 | - $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1152 | - $seperator = ' | '; |
|
| 1153 | - } |
|
| 1154 | - |
|
| 1155 | - if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
|
| 1156 | - $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);'); |
|
| 1157 | - $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1158 | - } |
|
| 1159 | - |
|
| 1160 | - $html .= '</span></div>'; |
|
| 1161 | - |
|
| 1162 | - |
|
| 1163 | - if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
| 1164 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1165 | - } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
|
| 1166 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1167 | - } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
| 1168 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1169 | - } |
|
| 1170 | - |
|
| 1171 | - /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
| 1172 | - |
|
| 1173 | - } else { |
|
| 1174 | - |
|
| 1175 | - if ($post->{$cf['htmlvar_name']}) { |
|
| 1176 | - |
|
| 1177 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1178 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1179 | - $field_icon_af = ''; |
|
| 1180 | - } elseif ($field_icon == '') { |
|
| 1181 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1182 | - } else { |
|
| 1183 | - $field_icon_af = $field_icon; |
|
| 1184 | - $field_icon = ''; |
|
| 1185 | - } |
|
| 1186 | - |
|
| 1187 | - |
|
| 1188 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1189 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1190 | - $html .= '</span><span class="geodir-email-address-output">'; |
|
| 1191 | - $email = $post->{$cf['htmlvar_name']} ; |
|
| 1192 | - if($e_split = explode('@',$email)){ |
|
| 1193 | - /** |
|
| 1194 | - * Filter email custom field name output. |
|
| 1195 | - * |
|
| 1196 | - * @since 1.5.3 |
|
| 1197 | - * |
|
| 1198 | - * @param string $email The email string being output. |
|
| 1199 | - * @param array $cf Custom field variables array. |
|
| 1200 | - */ |
|
| 1201 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1202 | - if($location=='mapbubble'){ |
|
| 1203 | - $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
|
| 1204 | - }else{ |
|
| 1205 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1206 | - } |
|
| 1207 | - |
|
| 1208 | - }else{ |
|
| 1209 | - $html .= $email; |
|
| 1210 | - } |
|
| 1211 | - $html .= '</span></div>'; |
|
| 1212 | - } |
|
| 1213 | - |
|
| 1214 | - } |
|
| 1215 | - |
|
| 1216 | - } |
|
| 1217 | - |
|
| 1218 | - return $html; |
|
| 1065 | + // check we have the post value |
|
| 1066 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1067 | + else{ global $post;} |
|
| 1068 | + |
|
| 1069 | + if(!is_array($cf) && $cf!=''){ |
|
| 1070 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1071 | + if(!$cf){return NULL;} |
|
| 1072 | + } |
|
| 1073 | + |
|
| 1074 | + $html_var = $cf['htmlvar_name']; |
|
| 1075 | + |
|
| 1076 | + // Check if there is a location specific filter. |
|
| 1077 | + if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
| 1078 | + /** |
|
| 1079 | + * Filter the email html by location. |
|
| 1080 | + * |
|
| 1081 | + * @param string $html The html to filter. |
|
| 1082 | + * @param array $cf The custom field array. |
|
| 1083 | + * @since 1.6.6 |
|
| 1084 | + */ |
|
| 1085 | + $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
| 1086 | + } |
|
| 1087 | + |
|
| 1088 | + // Check if there is a custom field specific filter. |
|
| 1089 | + if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
| 1090 | + /** |
|
| 1091 | + * Filter the email html by individual custom field. |
|
| 1092 | + * |
|
| 1093 | + * @param string $html The html to filter. |
|
| 1094 | + * @param string $location The location to output the html. |
|
| 1095 | + * @param array $cf The custom field array. |
|
| 1096 | + * @since 1.6.6 |
|
| 1097 | + */ |
|
| 1098 | + $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
| 1099 | + } |
|
| 1100 | + |
|
| 1101 | + // Check if there is a custom field key specific filter. |
|
| 1102 | + if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
| 1103 | + /** |
|
| 1104 | + * Filter the email html by field type key. |
|
| 1105 | + * |
|
| 1106 | + * @param string $html The html to filter. |
|
| 1107 | + * @param string $location The location to output the html. |
|
| 1108 | + * @param array $cf The custom field array. |
|
| 1109 | + * @since 1.6.6 |
|
| 1110 | + */ |
|
| 1111 | + $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1112 | + } |
|
| 1113 | + |
|
| 1114 | + // If not html then we run the standard output. |
|
| 1115 | + if(empty($html)){ |
|
| 1116 | + |
|
| 1117 | + global $preview; |
|
| 1118 | + if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
| 1119 | + return ''; // Remove Send Enquiry | Send To Friend from listings page |
|
| 1120 | + } |
|
| 1121 | + |
|
| 1122 | + $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
| 1123 | + |
|
| 1124 | + if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) { |
|
| 1125 | + global $send_to_friend; |
|
| 1126 | + $send_to_friend = true; |
|
| 1127 | + $b_send_inquiry = ''; |
|
| 1128 | + $b_sendtofriend = ''; |
|
| 1129 | + |
|
| 1130 | + $html = ''; |
|
| 1131 | + if (!$preview) { |
|
| 1132 | + $b_send_inquiry = 'b_send_inquiry'; |
|
| 1133 | + $b_sendtofriend = 'b_sendtofriend'; |
|
| 1134 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1135 | + } |
|
| 1136 | + |
|
| 1137 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1138 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1139 | + $field_icon_af = ''; |
|
| 1140 | + } elseif ($field_icon == '') { |
|
| 1141 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1142 | + } else { |
|
| 1143 | + $field_icon_af = $field_icon; |
|
| 1144 | + $field_icon = ''; |
|
| 1145 | + } |
|
| 1146 | + |
|
| 1147 | + $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1148 | + $seperator = ''; |
|
| 1149 | + if ($post->{$cf['htmlvar_name']}) { |
|
| 1150 | + $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
|
| 1151 | + $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1152 | + $seperator = ' | '; |
|
| 1153 | + } |
|
| 1154 | + |
|
| 1155 | + if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
|
| 1156 | + $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);'); |
|
| 1157 | + $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1158 | + } |
|
| 1159 | + |
|
| 1160 | + $html .= '</span></div>'; |
|
| 1161 | + |
|
| 1162 | + |
|
| 1163 | + if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
| 1164 | + $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1165 | + } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
|
| 1166 | + $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1167 | + } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
| 1168 | + $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1169 | + } |
|
| 1170 | + |
|
| 1171 | + /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
| 1172 | + |
|
| 1173 | + } else { |
|
| 1174 | + |
|
| 1175 | + if ($post->{$cf['htmlvar_name']}) { |
|
| 1176 | + |
|
| 1177 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1178 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1179 | + $field_icon_af = ''; |
|
| 1180 | + } elseif ($field_icon == '') { |
|
| 1181 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1182 | + } else { |
|
| 1183 | + $field_icon_af = $field_icon; |
|
| 1184 | + $field_icon = ''; |
|
| 1185 | + } |
|
| 1186 | + |
|
| 1187 | + |
|
| 1188 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1189 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1190 | + $html .= '</span><span class="geodir-email-address-output">'; |
|
| 1191 | + $email = $post->{$cf['htmlvar_name']} ; |
|
| 1192 | + if($e_split = explode('@',$email)){ |
|
| 1193 | + /** |
|
| 1194 | + * Filter email custom field name output. |
|
| 1195 | + * |
|
| 1196 | + * @since 1.5.3 |
|
| 1197 | + * |
|
| 1198 | + * @param string $email The email string being output. |
|
| 1199 | + * @param array $cf Custom field variables array. |
|
| 1200 | + */ |
|
| 1201 | + $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1202 | + if($location=='mapbubble'){ |
|
| 1203 | + $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
|
| 1204 | + }else{ |
|
| 1205 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1206 | + } |
|
| 1207 | + |
|
| 1208 | + }else{ |
|
| 1209 | + $html .= $email; |
|
| 1210 | + } |
|
| 1211 | + $html .= '</span></div>'; |
|
| 1212 | + } |
|
| 1213 | + |
|
| 1214 | + } |
|
| 1215 | + |
|
| 1216 | + } |
|
| 1217 | + |
|
| 1218 | + return $html; |
|
| 1219 | 1219 | } |
| 1220 | 1220 | add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3); |
| 1221 | 1221 | |
@@ -1232,136 +1232,136 @@ discard block |
||
| 1232 | 1232 | */ |
| 1233 | 1233 | function geodir_cf_file($html,$location,$cf,$p=''){ |
| 1234 | 1234 | |
| 1235 | - // check we have the post value |
|
| 1236 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1237 | - else{ global $post;} |
|
| 1238 | - |
|
| 1239 | - if(!is_array($cf) && $cf!=''){ |
|
| 1240 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1241 | - if(!$cf){return NULL;} |
|
| 1242 | - } |
|
| 1243 | - |
|
| 1244 | - $html_var = $cf['htmlvar_name']; |
|
| 1245 | - |
|
| 1246 | - // Check if there is a location specific filter. |
|
| 1247 | - if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1248 | - /** |
|
| 1249 | - * Filter the file html by location. |
|
| 1250 | - * |
|
| 1251 | - * @param string $html The html to filter. |
|
| 1252 | - * @param array $cf The custom field array. |
|
| 1253 | - * @since 1.6.6 |
|
| 1254 | - */ |
|
| 1255 | - $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1256 | - } |
|
| 1257 | - |
|
| 1258 | - // Check if there is a custom field specific filter. |
|
| 1259 | - if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1260 | - /** |
|
| 1261 | - * Filter the file html by individual custom field. |
|
| 1262 | - * |
|
| 1263 | - * @param string $html The html to filter. |
|
| 1264 | - * @param string $location The location to output the html. |
|
| 1265 | - * @param array $cf The custom field array. |
|
| 1266 | - * @since 1.6.6 |
|
| 1267 | - */ |
|
| 1268 | - $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1269 | - } |
|
| 1270 | - |
|
| 1271 | - // Check if there is a custom field key specific filter. |
|
| 1272 | - if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1273 | - /** |
|
| 1274 | - * Filter the file html by field type key. |
|
| 1275 | - * |
|
| 1276 | - * @param string $html The html to filter. |
|
| 1277 | - * @param string $location The location to output the html. |
|
| 1278 | - * @param array $cf The custom field array. |
|
| 1279 | - * @since 1.6.6 |
|
| 1280 | - */ |
|
| 1281 | - $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1282 | - } |
|
| 1283 | - |
|
| 1284 | - // If not html then we run the standard output. |
|
| 1285 | - if(empty($html)){ |
|
| 1286 | - |
|
| 1287 | - if (!empty($post->{$cf['htmlvar_name']})): |
|
| 1288 | - |
|
| 1289 | - $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
| 1290 | - if (!empty($files)): |
|
| 1291 | - |
|
| 1292 | - $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
| 1293 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
| 1294 | - |
|
| 1295 | - $file_paths = ''; |
|
| 1296 | - foreach ($files as $file) { |
|
| 1297 | - if (!empty($file)) { |
|
| 1298 | - |
|
| 1299 | - // $filetype = wp_check_filetype($file); |
|
| 1300 | - |
|
| 1301 | - $image_name_arr = explode('/', $file); |
|
| 1302 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1303 | - $filename = end($image_name_arr); |
|
| 1304 | - $img_name_arr = explode('.', $filename); |
|
| 1305 | - |
|
| 1306 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1307 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
| 1308 | - continue; |
|
| 1309 | - } |
|
| 1310 | - |
|
| 1311 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1312 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1313 | - |
|
| 1314 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
| 1315 | - continue; // Invalid file type. |
|
| 1316 | - } |
|
| 1317 | - |
|
| 1318 | - //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
| 1319 | - $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
| 1320 | - $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
| 1321 | - |
|
| 1322 | - // If the uploaded file is image |
|
| 1323 | - if (in_array($uploaded_file_type, $image_file_types)) { |
|
| 1324 | - $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 1325 | - $file_paths .= '<a href="'.$file.'">'; |
|
| 1326 | - $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
| 1327 | - $file_paths .= '</a>'; |
|
| 1328 | - //$file_paths .= '<img src="'.$file.'" />'; |
|
| 1329 | - $file_paths .= '</div>'; |
|
| 1330 | - }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
| 1331 | - $ext_path = '_' . $html_var . '_'; |
|
| 1332 | - $filename = explode($ext_path, $filename); |
|
| 1333 | - $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
|
| 1334 | - $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
|
| 1335 | - } else { |
|
| 1336 | - $ext_path = '_' . $html_var . '_'; |
|
| 1337 | - $filename = explode($ext_path, $filename); |
|
| 1338 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1339 | - } |
|
| 1340 | - } |
|
| 1341 | - } |
|
| 1342 | - |
|
| 1343 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1344 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1345 | - $field_icon_af = ''; |
|
| 1346 | - } elseif ($field_icon == '') { |
|
| 1347 | - $field_icon_af = ''; |
|
| 1348 | - } else { |
|
| 1349 | - $field_icon_af = $field_icon; |
|
| 1350 | - $field_icon = ''; |
|
| 1351 | - } |
|
| 1352 | - |
|
| 1353 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1354 | - $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 1355 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1356 | - $html .= '</span>'; |
|
| 1357 | - $html .= $file_paths . '</div></div>'; |
|
| 1358 | - |
|
| 1359 | - endif; |
|
| 1360 | - endif; |
|
| 1361 | - |
|
| 1362 | - } |
|
| 1363 | - |
|
| 1364 | - return $html; |
|
| 1235 | + // check we have the post value |
|
| 1236 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1237 | + else{ global $post;} |
|
| 1238 | + |
|
| 1239 | + if(!is_array($cf) && $cf!=''){ |
|
| 1240 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1241 | + if(!$cf){return NULL;} |
|
| 1242 | + } |
|
| 1243 | + |
|
| 1244 | + $html_var = $cf['htmlvar_name']; |
|
| 1245 | + |
|
| 1246 | + // Check if there is a location specific filter. |
|
| 1247 | + if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1248 | + /** |
|
| 1249 | + * Filter the file html by location. |
|
| 1250 | + * |
|
| 1251 | + * @param string $html The html to filter. |
|
| 1252 | + * @param array $cf The custom field array. |
|
| 1253 | + * @since 1.6.6 |
|
| 1254 | + */ |
|
| 1255 | + $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1256 | + } |
|
| 1257 | + |
|
| 1258 | + // Check if there is a custom field specific filter. |
|
| 1259 | + if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1260 | + /** |
|
| 1261 | + * Filter the file html by individual custom field. |
|
| 1262 | + * |
|
| 1263 | + * @param string $html The html to filter. |
|
| 1264 | + * @param string $location The location to output the html. |
|
| 1265 | + * @param array $cf The custom field array. |
|
| 1266 | + * @since 1.6.6 |
|
| 1267 | + */ |
|
| 1268 | + $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1269 | + } |
|
| 1270 | + |
|
| 1271 | + // Check if there is a custom field key specific filter. |
|
| 1272 | + if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1273 | + /** |
|
| 1274 | + * Filter the file html by field type key. |
|
| 1275 | + * |
|
| 1276 | + * @param string $html The html to filter. |
|
| 1277 | + * @param string $location The location to output the html. |
|
| 1278 | + * @param array $cf The custom field array. |
|
| 1279 | + * @since 1.6.6 |
|
| 1280 | + */ |
|
| 1281 | + $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1282 | + } |
|
| 1283 | + |
|
| 1284 | + // If not html then we run the standard output. |
|
| 1285 | + if(empty($html)){ |
|
| 1286 | + |
|
| 1287 | + if (!empty($post->{$cf['htmlvar_name']})): |
|
| 1288 | + |
|
| 1289 | + $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
| 1290 | + if (!empty($files)): |
|
| 1291 | + |
|
| 1292 | + $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
| 1293 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
| 1294 | + |
|
| 1295 | + $file_paths = ''; |
|
| 1296 | + foreach ($files as $file) { |
|
| 1297 | + if (!empty($file)) { |
|
| 1298 | + |
|
| 1299 | + // $filetype = wp_check_filetype($file); |
|
| 1300 | + |
|
| 1301 | + $image_name_arr = explode('/', $file); |
|
| 1302 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1303 | + $filename = end($image_name_arr); |
|
| 1304 | + $img_name_arr = explode('.', $filename); |
|
| 1305 | + |
|
| 1306 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1307 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
| 1308 | + continue; |
|
| 1309 | + } |
|
| 1310 | + |
|
| 1311 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1312 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1313 | + |
|
| 1314 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
| 1315 | + continue; // Invalid file type. |
|
| 1316 | + } |
|
| 1317 | + |
|
| 1318 | + //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
| 1319 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
| 1320 | + $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
| 1321 | + |
|
| 1322 | + // If the uploaded file is image |
|
| 1323 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
| 1324 | + $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 1325 | + $file_paths .= '<a href="'.$file.'">'; |
|
| 1326 | + $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
| 1327 | + $file_paths .= '</a>'; |
|
| 1328 | + //$file_paths .= '<img src="'.$file.'" />'; |
|
| 1329 | + $file_paths .= '</div>'; |
|
| 1330 | + }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
| 1331 | + $ext_path = '_' . $html_var . '_'; |
|
| 1332 | + $filename = explode($ext_path, $filename); |
|
| 1333 | + $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
|
| 1334 | + $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
|
| 1335 | + } else { |
|
| 1336 | + $ext_path = '_' . $html_var . '_'; |
|
| 1337 | + $filename = explode($ext_path, $filename); |
|
| 1338 | + $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1339 | + } |
|
| 1340 | + } |
|
| 1341 | + } |
|
| 1342 | + |
|
| 1343 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1344 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1345 | + $field_icon_af = ''; |
|
| 1346 | + } elseif ($field_icon == '') { |
|
| 1347 | + $field_icon_af = ''; |
|
| 1348 | + } else { |
|
| 1349 | + $field_icon_af = $field_icon; |
|
| 1350 | + $field_icon = ''; |
|
| 1351 | + } |
|
| 1352 | + |
|
| 1353 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1354 | + $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 1355 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1356 | + $html .= '</span>'; |
|
| 1357 | + $html .= $file_paths . '</div></div>'; |
|
| 1358 | + |
|
| 1359 | + endif; |
|
| 1360 | + endif; |
|
| 1361 | + |
|
| 1362 | + } |
|
| 1363 | + |
|
| 1364 | + return $html; |
|
| 1365 | 1365 | } |
| 1366 | 1366 | add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3); |
| 1367 | 1367 | |
@@ -1379,80 +1379,80 @@ discard block |
||
| 1379 | 1379 | */ |
| 1380 | 1380 | function geodir_cf_textarea($html,$location,$cf,$p=''){ |
| 1381 | 1381 | |
| 1382 | - // check we have the post value |
|
| 1383 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1384 | - else{ global $post;} |
|
| 1385 | - |
|
| 1386 | - if(!is_array($cf) && $cf!=''){ |
|
| 1387 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1388 | - if(!$cf){return NULL;} |
|
| 1389 | - } |
|
| 1390 | - |
|
| 1391 | - $html_var = $cf['htmlvar_name']; |
|
| 1392 | - |
|
| 1393 | - // Check if there is a location specific filter. |
|
| 1394 | - if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1395 | - /** |
|
| 1396 | - * Filter the textarea html by location. |
|
| 1397 | - * |
|
| 1398 | - * @param string $html The html to filter. |
|
| 1399 | - * @param array $cf The custom field array. |
|
| 1400 | - * @since 1.6.6 |
|
| 1401 | - */ |
|
| 1402 | - $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1403 | - } |
|
| 1404 | - |
|
| 1405 | - // Check if there is a custom field specific filter. |
|
| 1406 | - if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1407 | - /** |
|
| 1408 | - * Filter the textarea html by individual custom field. |
|
| 1409 | - * |
|
| 1410 | - * @param string $html The html to filter. |
|
| 1411 | - * @param string $location The location to output the html. |
|
| 1412 | - * @param array $cf The custom field array. |
|
| 1413 | - * @since 1.6.6 |
|
| 1414 | - */ |
|
| 1415 | - $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1416 | - } |
|
| 1417 | - |
|
| 1418 | - // Check if there is a custom field key specific filter. |
|
| 1419 | - if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1420 | - /** |
|
| 1421 | - * Filter the textarea html by field type key. |
|
| 1422 | - * |
|
| 1423 | - * @param string $html The html to filter. |
|
| 1424 | - * @param string $location The location to output the html. |
|
| 1425 | - * @param array $cf The custom field array. |
|
| 1426 | - * @since 1.6.6 |
|
| 1427 | - */ |
|
| 1428 | - $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1429 | - } |
|
| 1430 | - |
|
| 1431 | - // If not html then we run the standard output. |
|
| 1432 | - if(empty($html)){ |
|
| 1433 | - |
|
| 1434 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1435 | - |
|
| 1436 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1437 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1438 | - $field_icon_af = ''; |
|
| 1439 | - } elseif ($field_icon == '') { |
|
| 1440 | - $field_icon_af = ''; |
|
| 1441 | - } else { |
|
| 1442 | - $field_icon_af = $field_icon; |
|
| 1443 | - $field_icon = ''; |
|
| 1444 | - } |
|
| 1445 | - |
|
| 1446 | - |
|
| 1447 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1448 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1449 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1450 | - |
|
| 1451 | - } |
|
| 1452 | - |
|
| 1453 | - } |
|
| 1454 | - |
|
| 1455 | - return $html; |
|
| 1382 | + // check we have the post value |
|
| 1383 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1384 | + else{ global $post;} |
|
| 1385 | + |
|
| 1386 | + if(!is_array($cf) && $cf!=''){ |
|
| 1387 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1388 | + if(!$cf){return NULL;} |
|
| 1389 | + } |
|
| 1390 | + |
|
| 1391 | + $html_var = $cf['htmlvar_name']; |
|
| 1392 | + |
|
| 1393 | + // Check if there is a location specific filter. |
|
| 1394 | + if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1395 | + /** |
|
| 1396 | + * Filter the textarea html by location. |
|
| 1397 | + * |
|
| 1398 | + * @param string $html The html to filter. |
|
| 1399 | + * @param array $cf The custom field array. |
|
| 1400 | + * @since 1.6.6 |
|
| 1401 | + */ |
|
| 1402 | + $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1403 | + } |
|
| 1404 | + |
|
| 1405 | + // Check if there is a custom field specific filter. |
|
| 1406 | + if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1407 | + /** |
|
| 1408 | + * Filter the textarea html by individual custom field. |
|
| 1409 | + * |
|
| 1410 | + * @param string $html The html to filter. |
|
| 1411 | + * @param string $location The location to output the html. |
|
| 1412 | + * @param array $cf The custom field array. |
|
| 1413 | + * @since 1.6.6 |
|
| 1414 | + */ |
|
| 1415 | + $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1416 | + } |
|
| 1417 | + |
|
| 1418 | + // Check if there is a custom field key specific filter. |
|
| 1419 | + if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1420 | + /** |
|
| 1421 | + * Filter the textarea html by field type key. |
|
| 1422 | + * |
|
| 1423 | + * @param string $html The html to filter. |
|
| 1424 | + * @param string $location The location to output the html. |
|
| 1425 | + * @param array $cf The custom field array. |
|
| 1426 | + * @since 1.6.6 |
|
| 1427 | + */ |
|
| 1428 | + $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1429 | + } |
|
| 1430 | + |
|
| 1431 | + // If not html then we run the standard output. |
|
| 1432 | + if(empty($html)){ |
|
| 1433 | + |
|
| 1434 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1435 | + |
|
| 1436 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1437 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1438 | + $field_icon_af = ''; |
|
| 1439 | + } elseif ($field_icon == '') { |
|
| 1440 | + $field_icon_af = ''; |
|
| 1441 | + } else { |
|
| 1442 | + $field_icon_af = $field_icon; |
|
| 1443 | + $field_icon = ''; |
|
| 1444 | + } |
|
| 1445 | + |
|
| 1446 | + |
|
| 1447 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1448 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1449 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1450 | + |
|
| 1451 | + } |
|
| 1452 | + |
|
| 1453 | + } |
|
| 1454 | + |
|
| 1455 | + return $html; |
|
| 1456 | 1456 | } |
| 1457 | 1457 | add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3); |
| 1458 | 1458 | |
@@ -1470,79 +1470,79 @@ discard block |
||
| 1470 | 1470 | */ |
| 1471 | 1471 | function geodir_cf_html($html,$location,$cf,$p=''){ |
| 1472 | 1472 | |
| 1473 | - // check we have the post value |
|
| 1474 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1475 | - else{ global $post;} |
|
| 1476 | - |
|
| 1477 | - if(!is_array($cf) && $cf!=''){ |
|
| 1478 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1479 | - if(!$cf){return NULL;} |
|
| 1480 | - } |
|
| 1481 | - |
|
| 1482 | - $html_var = $cf['htmlvar_name']; |
|
| 1483 | - |
|
| 1484 | - // Check if there is a location specific filter. |
|
| 1485 | - if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1486 | - /** |
|
| 1487 | - * Filter the html html by location. |
|
| 1488 | - * |
|
| 1489 | - * @param string $html The html to filter. |
|
| 1490 | - * @param array $cf The custom field array. |
|
| 1491 | - * @since 1.6.6 |
|
| 1492 | - */ |
|
| 1493 | - $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1494 | - } |
|
| 1495 | - |
|
| 1496 | - // Check if there is a custom field specific filter. |
|
| 1497 | - if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1498 | - /** |
|
| 1499 | - * Filter the html html by individual custom field. |
|
| 1500 | - * |
|
| 1501 | - * @param string $html The html to filter. |
|
| 1502 | - * @param string $location The location to output the html. |
|
| 1503 | - * @param array $cf The custom field array. |
|
| 1504 | - * @since 1.6.6 |
|
| 1505 | - */ |
|
| 1506 | - $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1507 | - } |
|
| 1508 | - |
|
| 1509 | - // Check if there is a custom field key specific filter. |
|
| 1510 | - if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1511 | - /** |
|
| 1512 | - * Filter the html html by field type key. |
|
| 1513 | - * |
|
| 1514 | - * @param string $html The html to filter. |
|
| 1515 | - * @param string $location The location to output the html. |
|
| 1516 | - * @param array $cf The custom field array. |
|
| 1517 | - * @since 1.6.6 |
|
| 1518 | - */ |
|
| 1519 | - $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1520 | - } |
|
| 1521 | - |
|
| 1522 | - // If not html then we run the standard output. |
|
| 1523 | - if(empty($html)){ |
|
| 1524 | - |
|
| 1525 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1526 | - |
|
| 1527 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1528 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1529 | - $field_icon_af = ''; |
|
| 1530 | - } elseif ($field_icon == '') { |
|
| 1531 | - $field_icon_af = ''; |
|
| 1532 | - } else { |
|
| 1533 | - $field_icon_af = $field_icon; |
|
| 1534 | - $field_icon = ''; |
|
| 1535 | - } |
|
| 1536 | - |
|
| 1537 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1538 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1539 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1540 | - |
|
| 1541 | - } |
|
| 1542 | - |
|
| 1543 | - } |
|
| 1544 | - |
|
| 1545 | - return $html; |
|
| 1473 | + // check we have the post value |
|
| 1474 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1475 | + else{ global $post;} |
|
| 1476 | + |
|
| 1477 | + if(!is_array($cf) && $cf!=''){ |
|
| 1478 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1479 | + if(!$cf){return NULL;} |
|
| 1480 | + } |
|
| 1481 | + |
|
| 1482 | + $html_var = $cf['htmlvar_name']; |
|
| 1483 | + |
|
| 1484 | + // Check if there is a location specific filter. |
|
| 1485 | + if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1486 | + /** |
|
| 1487 | + * Filter the html html by location. |
|
| 1488 | + * |
|
| 1489 | + * @param string $html The html to filter. |
|
| 1490 | + * @param array $cf The custom field array. |
|
| 1491 | + * @since 1.6.6 |
|
| 1492 | + */ |
|
| 1493 | + $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1494 | + } |
|
| 1495 | + |
|
| 1496 | + // Check if there is a custom field specific filter. |
|
| 1497 | + if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1498 | + /** |
|
| 1499 | + * Filter the html html by individual custom field. |
|
| 1500 | + * |
|
| 1501 | + * @param string $html The html to filter. |
|
| 1502 | + * @param string $location The location to output the html. |
|
| 1503 | + * @param array $cf The custom field array. |
|
| 1504 | + * @since 1.6.6 |
|
| 1505 | + */ |
|
| 1506 | + $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1507 | + } |
|
| 1508 | + |
|
| 1509 | + // Check if there is a custom field key specific filter. |
|
| 1510 | + if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1511 | + /** |
|
| 1512 | + * Filter the html html by field type key. |
|
| 1513 | + * |
|
| 1514 | + * @param string $html The html to filter. |
|
| 1515 | + * @param string $location The location to output the html. |
|
| 1516 | + * @param array $cf The custom field array. |
|
| 1517 | + * @since 1.6.6 |
|
| 1518 | + */ |
|
| 1519 | + $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1520 | + } |
|
| 1521 | + |
|
| 1522 | + // If not html then we run the standard output. |
|
| 1523 | + if(empty($html)){ |
|
| 1524 | + |
|
| 1525 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1526 | + |
|
| 1527 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1528 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1529 | + $field_icon_af = ''; |
|
| 1530 | + } elseif ($field_icon == '') { |
|
| 1531 | + $field_icon_af = ''; |
|
| 1532 | + } else { |
|
| 1533 | + $field_icon_af = $field_icon; |
|
| 1534 | + $field_icon = ''; |
|
| 1535 | + } |
|
| 1536 | + |
|
| 1537 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1538 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1539 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1540 | + |
|
| 1541 | + } |
|
| 1542 | + |
|
| 1543 | + } |
|
| 1544 | + |
|
| 1545 | + return $html; |
|
| 1546 | 1546 | } |
| 1547 | 1547 | add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3); |
| 1548 | 1548 | |
@@ -1560,113 +1560,113 @@ discard block |
||
| 1560 | 1560 | */ |
| 1561 | 1561 | function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
| 1562 | 1562 | |
| 1563 | - // check we have the post value |
|
| 1564 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1565 | - else{ global $post;} |
|
| 1566 | - |
|
| 1567 | - if(!is_array($cf) && $cf!=''){ |
|
| 1568 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1569 | - if(!$cf){return NULL;} |
|
| 1570 | - } |
|
| 1571 | - |
|
| 1572 | - $html_var = $cf['htmlvar_name']; |
|
| 1573 | - |
|
| 1574 | - // Check if there is a location specific filter. |
|
| 1575 | - if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1576 | - /** |
|
| 1577 | - * Filter the taxonomy html by location. |
|
| 1578 | - * |
|
| 1579 | - * @param string $html The html to filter. |
|
| 1580 | - * @param array $cf The custom field array. |
|
| 1581 | - * @since 1.6.6 |
|
| 1582 | - */ |
|
| 1583 | - $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1584 | - } |
|
| 1585 | - |
|
| 1586 | - // Check if there is a custom field specific filter. |
|
| 1587 | - if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1588 | - /** |
|
| 1589 | - * Filter the taxonomy html by individual custom field. |
|
| 1590 | - * |
|
| 1591 | - * @param string $html The html to filter. |
|
| 1592 | - * @param string $location The location to output the html. |
|
| 1593 | - * @param array $cf The custom field array. |
|
| 1594 | - * @since 1.6.6 |
|
| 1595 | - */ |
|
| 1596 | - $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1597 | - } |
|
| 1598 | - |
|
| 1599 | - // Check if there is a custom field key specific filter. |
|
| 1600 | - if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1601 | - /** |
|
| 1602 | - * Filter the taxonomy html by field type key. |
|
| 1603 | - * |
|
| 1604 | - * @param string $html The html to filter. |
|
| 1605 | - * @param string $location The location to output the html. |
|
| 1606 | - * @param array $cf The custom field array. |
|
| 1607 | - * @since 1.6.6 |
|
| 1608 | - */ |
|
| 1609 | - $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1610 | - } |
|
| 1611 | - |
|
| 1612 | - // If not html then we run the standard output. |
|
| 1613 | - if(empty($html)){ |
|
| 1614 | - |
|
| 1615 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1616 | - $post_taxonomy = $post->post_type . 'category'; |
|
| 1617 | - $field_value = $post->{$html_var}; |
|
| 1618 | - $links = array(); |
|
| 1619 | - $terms = array(); |
|
| 1620 | - $termsOrdered = array(); |
|
| 1621 | - if (!is_array($field_value)) { |
|
| 1622 | - $field_value = explode(",", trim($field_value, ",")); |
|
| 1623 | - } |
|
| 1624 | - |
|
| 1625 | - $field_value = array_unique($field_value); |
|
| 1626 | - |
|
| 1627 | - if (!empty($field_value)) { |
|
| 1628 | - foreach ($field_value as $term) { |
|
| 1629 | - $term = trim($term); |
|
| 1630 | - |
|
| 1631 | - if ($term != '') { |
|
| 1632 | - $term = get_term_by('id', $term, $html_var); |
|
| 1633 | - if (is_object($term)) { |
|
| 1634 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1635 | - $terms[] = $term; |
|
| 1636 | - } |
|
| 1637 | - } |
|
| 1638 | - } |
|
| 1639 | - if (!empty($links)) { |
|
| 1640 | - // order alphabetically |
|
| 1641 | - asort($links); |
|
| 1642 | - foreach (array_keys($links) as $key) { |
|
| 1643 | - $termsOrdered[$key] = $terms[$key]; |
|
| 1644 | - } |
|
| 1645 | - $terms = $termsOrdered; |
|
| 1646 | - } |
|
| 1647 | - } |
|
| 1648 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1649 | - |
|
| 1650 | - if ($html_value != '') { |
|
| 1651 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1652 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1653 | - $field_icon_af = ''; |
|
| 1654 | - } else if ($field_icon == '') { |
|
| 1655 | - $field_icon_af = ''; |
|
| 1656 | - } else { |
|
| 1657 | - $field_icon_af = $field_icon; |
|
| 1658 | - $field_icon = ''; |
|
| 1659 | - } |
|
| 1660 | - |
|
| 1661 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1662 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1663 | - $html .= '</span> ' . $html_value . '</div>'; |
|
| 1664 | - } |
|
| 1665 | - } |
|
| 1666 | - |
|
| 1667 | - } |
|
| 1668 | - |
|
| 1669 | - return $html; |
|
| 1563 | + // check we have the post value |
|
| 1564 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1565 | + else{ global $post;} |
|
| 1566 | + |
|
| 1567 | + if(!is_array($cf) && $cf!=''){ |
|
| 1568 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1569 | + if(!$cf){return NULL;} |
|
| 1570 | + } |
|
| 1571 | + |
|
| 1572 | + $html_var = $cf['htmlvar_name']; |
|
| 1573 | + |
|
| 1574 | + // Check if there is a location specific filter. |
|
| 1575 | + if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1576 | + /** |
|
| 1577 | + * Filter the taxonomy html by location. |
|
| 1578 | + * |
|
| 1579 | + * @param string $html The html to filter. |
|
| 1580 | + * @param array $cf The custom field array. |
|
| 1581 | + * @since 1.6.6 |
|
| 1582 | + */ |
|
| 1583 | + $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1584 | + } |
|
| 1585 | + |
|
| 1586 | + // Check if there is a custom field specific filter. |
|
| 1587 | + if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1588 | + /** |
|
| 1589 | + * Filter the taxonomy html by individual custom field. |
|
| 1590 | + * |
|
| 1591 | + * @param string $html The html to filter. |
|
| 1592 | + * @param string $location The location to output the html. |
|
| 1593 | + * @param array $cf The custom field array. |
|
| 1594 | + * @since 1.6.6 |
|
| 1595 | + */ |
|
| 1596 | + $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1597 | + } |
|
| 1598 | + |
|
| 1599 | + // Check if there is a custom field key specific filter. |
|
| 1600 | + if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1601 | + /** |
|
| 1602 | + * Filter the taxonomy html by field type key. |
|
| 1603 | + * |
|
| 1604 | + * @param string $html The html to filter. |
|
| 1605 | + * @param string $location The location to output the html. |
|
| 1606 | + * @param array $cf The custom field array. |
|
| 1607 | + * @since 1.6.6 |
|
| 1608 | + */ |
|
| 1609 | + $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1610 | + } |
|
| 1611 | + |
|
| 1612 | + // If not html then we run the standard output. |
|
| 1613 | + if(empty($html)){ |
|
| 1614 | + |
|
| 1615 | + if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1616 | + $post_taxonomy = $post->post_type . 'category'; |
|
| 1617 | + $field_value = $post->{$html_var}; |
|
| 1618 | + $links = array(); |
|
| 1619 | + $terms = array(); |
|
| 1620 | + $termsOrdered = array(); |
|
| 1621 | + if (!is_array($field_value)) { |
|
| 1622 | + $field_value = explode(",", trim($field_value, ",")); |
|
| 1623 | + } |
|
| 1624 | + |
|
| 1625 | + $field_value = array_unique($field_value); |
|
| 1626 | + |
|
| 1627 | + if (!empty($field_value)) { |
|
| 1628 | + foreach ($field_value as $term) { |
|
| 1629 | + $term = trim($term); |
|
| 1630 | + |
|
| 1631 | + if ($term != '') { |
|
| 1632 | + $term = get_term_by('id', $term, $html_var); |
|
| 1633 | + if (is_object($term)) { |
|
| 1634 | + $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1635 | + $terms[] = $term; |
|
| 1636 | + } |
|
| 1637 | + } |
|
| 1638 | + } |
|
| 1639 | + if (!empty($links)) { |
|
| 1640 | + // order alphabetically |
|
| 1641 | + asort($links); |
|
| 1642 | + foreach (array_keys($links) as $key) { |
|
| 1643 | + $termsOrdered[$key] = $terms[$key]; |
|
| 1644 | + } |
|
| 1645 | + $terms = $termsOrdered; |
|
| 1646 | + } |
|
| 1647 | + } |
|
| 1648 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1649 | + |
|
| 1650 | + if ($html_value != '') { |
|
| 1651 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1652 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1653 | + $field_icon_af = ''; |
|
| 1654 | + } else if ($field_icon == '') { |
|
| 1655 | + $field_icon_af = ''; |
|
| 1656 | + } else { |
|
| 1657 | + $field_icon_af = $field_icon; |
|
| 1658 | + $field_icon = ''; |
|
| 1659 | + } |
|
| 1660 | + |
|
| 1661 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1662 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1663 | + $html .= '</span> ' . $html_value . '</div>'; |
|
| 1664 | + } |
|
| 1665 | + } |
|
| 1666 | + |
|
| 1667 | + } |
|
| 1668 | + |
|
| 1669 | + return $html; |
|
| 1670 | 1670 | } |
| 1671 | 1671 | add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3); |
| 1672 | 1672 | |
@@ -1684,176 +1684,176 @@ discard block |
||
| 1684 | 1684 | */ |
| 1685 | 1685 | function geodir_cf_address($html,$location,$cf,$p=''){ |
| 1686 | 1686 | |
| 1687 | - // check we have the post value |
|
| 1688 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1689 | - else{ global $post;} |
|
| 1690 | - |
|
| 1691 | - if(!is_array($cf) && $cf!=''){ |
|
| 1692 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1693 | - if(!$cf){return NULL;} |
|
| 1694 | - } |
|
| 1695 | - |
|
| 1696 | - $html_var = $cf['htmlvar_name']; |
|
| 1697 | - |
|
| 1698 | - // Check if there is a location specific filter. |
|
| 1699 | - if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1700 | - /** |
|
| 1701 | - * Filter the address html by location. |
|
| 1702 | - * |
|
| 1703 | - * @param string $html The html to filter. |
|
| 1704 | - * @param array $cf The custom field array. |
|
| 1705 | - * @since 1.6.6 |
|
| 1706 | - */ |
|
| 1707 | - $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1708 | - } |
|
| 1709 | - |
|
| 1710 | - // Check if there is a custom field specific filter. |
|
| 1711 | - if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1712 | - /** |
|
| 1713 | - * Filter the address html by individual custom field. |
|
| 1714 | - * |
|
| 1715 | - * @param string $html The html to filter. |
|
| 1716 | - * @param string $location The location to output the html. |
|
| 1717 | - * @param array $cf The custom field array. |
|
| 1718 | - * @since 1.6.6 |
|
| 1719 | - */ |
|
| 1720 | - $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1721 | - } |
|
| 1722 | - |
|
| 1723 | - // Check if there is a custom field key specific filter. |
|
| 1724 | - if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1725 | - /** |
|
| 1726 | - * Filter the address html by field type key. |
|
| 1727 | - * |
|
| 1728 | - * @param string $html The html to filter. |
|
| 1729 | - * @param string $location The location to output the html. |
|
| 1730 | - * @param array $cf The custom field array. |
|
| 1731 | - * @since 1.6.6 |
|
| 1732 | - */ |
|
| 1733 | - $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1734 | - } |
|
| 1735 | - |
|
| 1736 | - // If not html then we run the standard output. |
|
| 1737 | - if(empty($html)){ |
|
| 1738 | - |
|
| 1739 | - global $preview; |
|
| 1740 | - $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1741 | - |
|
| 1742 | - if ($cf['extra_fields']) { |
|
| 1743 | - |
|
| 1744 | - $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1745 | - |
|
| 1746 | - $addition_fields = ''; |
|
| 1747 | - |
|
| 1748 | - if (!empty($extra_fields)) { |
|
| 1749 | - |
|
| 1750 | - $show_city_in_address = false; |
|
| 1751 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
| 1752 | - $show_city_in_address = true; |
|
| 1753 | - } |
|
| 1754 | - /** |
|
| 1755 | - * Filter "show city in address" value. |
|
| 1756 | - * |
|
| 1757 | - * @since 1.0.0 |
|
| 1758 | - */ |
|
| 1759 | - $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
| 1760 | - |
|
| 1761 | - |
|
| 1762 | - $show_region_in_address = false; |
|
| 1763 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
| 1764 | - $show_region_in_address = true; |
|
| 1765 | - } |
|
| 1766 | - /** |
|
| 1767 | - * Filter "show region in address" value. |
|
| 1768 | - * |
|
| 1769 | - * @since 1.6.6 |
|
| 1770 | - */ |
|
| 1771 | - $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
| 1772 | - |
|
| 1773 | - $show_country_in_address = false; |
|
| 1774 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
| 1775 | - $show_country_in_address = true; |
|
| 1776 | - } |
|
| 1777 | - /** |
|
| 1778 | - * Filter "show country in address" value. |
|
| 1779 | - * |
|
| 1780 | - * @since 1.6.6 |
|
| 1781 | - */ |
|
| 1782 | - $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
| 1783 | - |
|
| 1784 | - $show_zip_in_address = false; |
|
| 1785 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 1786 | - $show_zip_in_address = true; |
|
| 1787 | - } |
|
| 1788 | - /** |
|
| 1789 | - * Filter "show zip in address" value. |
|
| 1790 | - * |
|
| 1791 | - * @since 1.6.6 |
|
| 1792 | - */ |
|
| 1793 | - $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
| 1794 | - |
|
| 1795 | - |
|
| 1796 | - } |
|
| 1797 | - |
|
| 1798 | - } |
|
| 1799 | - |
|
| 1800 | - |
|
| 1801 | - if ($post->{$html_var}) { |
|
| 1802 | - |
|
| 1803 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1804 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1805 | - $field_icon_af = ''; |
|
| 1806 | - } elseif ( $field_icon == '' ) { |
|
| 1807 | - $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 1808 | - } else { |
|
| 1809 | - $field_icon_af = $field_icon; |
|
| 1810 | - $field_icon = ''; |
|
| 1811 | - } |
|
| 1687 | + // check we have the post value |
|
| 1688 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1689 | + else{ global $post;} |
|
| 1690 | + |
|
| 1691 | + if(!is_array($cf) && $cf!=''){ |
|
| 1692 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1693 | + if(!$cf){return NULL;} |
|
| 1694 | + } |
|
| 1695 | + |
|
| 1696 | + $html_var = $cf['htmlvar_name']; |
|
| 1697 | + |
|
| 1698 | + // Check if there is a location specific filter. |
|
| 1699 | + if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1700 | + /** |
|
| 1701 | + * Filter the address html by location. |
|
| 1702 | + * |
|
| 1703 | + * @param string $html The html to filter. |
|
| 1704 | + * @param array $cf The custom field array. |
|
| 1705 | + * @since 1.6.6 |
|
| 1706 | + */ |
|
| 1707 | + $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1708 | + } |
|
| 1709 | + |
|
| 1710 | + // Check if there is a custom field specific filter. |
|
| 1711 | + if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1712 | + /** |
|
| 1713 | + * Filter the address html by individual custom field. |
|
| 1714 | + * |
|
| 1715 | + * @param string $html The html to filter. |
|
| 1716 | + * @param string $location The location to output the html. |
|
| 1717 | + * @param array $cf The custom field array. |
|
| 1718 | + * @since 1.6.6 |
|
| 1719 | + */ |
|
| 1720 | + $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1721 | + } |
|
| 1722 | + |
|
| 1723 | + // Check if there is a custom field key specific filter. |
|
| 1724 | + if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1725 | + /** |
|
| 1726 | + * Filter the address html by field type key. |
|
| 1727 | + * |
|
| 1728 | + * @param string $html The html to filter. |
|
| 1729 | + * @param string $location The location to output the html. |
|
| 1730 | + * @param array $cf The custom field array. |
|
| 1731 | + * @since 1.6.6 |
|
| 1732 | + */ |
|
| 1733 | + $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1734 | + } |
|
| 1735 | + |
|
| 1736 | + // If not html then we run the standard output. |
|
| 1737 | + if(empty($html)){ |
|
| 1738 | + |
|
| 1739 | + global $preview; |
|
| 1740 | + $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1741 | + |
|
| 1742 | + if ($cf['extra_fields']) { |
|
| 1743 | + |
|
| 1744 | + $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1745 | + |
|
| 1746 | + $addition_fields = ''; |
|
| 1747 | + |
|
| 1748 | + if (!empty($extra_fields)) { |
|
| 1749 | + |
|
| 1750 | + $show_city_in_address = false; |
|
| 1751 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
| 1752 | + $show_city_in_address = true; |
|
| 1753 | + } |
|
| 1754 | + /** |
|
| 1755 | + * Filter "show city in address" value. |
|
| 1756 | + * |
|
| 1757 | + * @since 1.0.0 |
|
| 1758 | + */ |
|
| 1759 | + $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
| 1760 | + |
|
| 1761 | + |
|
| 1762 | + $show_region_in_address = false; |
|
| 1763 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
| 1764 | + $show_region_in_address = true; |
|
| 1765 | + } |
|
| 1766 | + /** |
|
| 1767 | + * Filter "show region in address" value. |
|
| 1768 | + * |
|
| 1769 | + * @since 1.6.6 |
|
| 1770 | + */ |
|
| 1771 | + $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
| 1772 | + |
|
| 1773 | + $show_country_in_address = false; |
|
| 1774 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
| 1775 | + $show_country_in_address = true; |
|
| 1776 | + } |
|
| 1777 | + /** |
|
| 1778 | + * Filter "show country in address" value. |
|
| 1779 | + * |
|
| 1780 | + * @since 1.6.6 |
|
| 1781 | + */ |
|
| 1782 | + $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
| 1783 | + |
|
| 1784 | + $show_zip_in_address = false; |
|
| 1785 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 1786 | + $show_zip_in_address = true; |
|
| 1787 | + } |
|
| 1788 | + /** |
|
| 1789 | + * Filter "show zip in address" value. |
|
| 1790 | + * |
|
| 1791 | + * @since 1.6.6 |
|
| 1792 | + */ |
|
| 1793 | + $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
| 1794 | + |
|
| 1795 | + |
|
| 1796 | + } |
|
| 1797 | + |
|
| 1798 | + } |
|
| 1799 | + |
|
| 1800 | + |
|
| 1801 | + if ($post->{$html_var}) { |
|
| 1802 | + |
|
| 1803 | + $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1804 | + if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1805 | + $field_icon_af = ''; |
|
| 1806 | + } elseif ( $field_icon == '' ) { |
|
| 1807 | + $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 1808 | + } else { |
|
| 1809 | + $field_icon_af = $field_icon; |
|
| 1810 | + $field_icon = ''; |
|
| 1811 | + } |
|
| 1812 | 1812 | |
| 1813 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1814 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1815 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
| 1816 | - $html .= '</span>'; |
|
| 1813 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1814 | + $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1815 | + $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
| 1816 | + $html .= '</span>'; |
|
| 1817 | 1817 | |
| 1818 | - $address_fields = array(); |
|
| 1819 | - |
|
| 1820 | - if ( isset($post->post_address) ) { |
|
| 1821 | - $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>'; |
|
| 1822 | - } |
|
| 1823 | - if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1824 | - $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>'; |
|
| 1825 | - } |
|
| 1826 | - if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1827 | - $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>'; |
|
| 1828 | - } |
|
| 1829 | - if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1830 | - $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>'; |
|
| 1831 | - } |
|
| 1832 | - if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1833 | - $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>'; |
|
| 1834 | - } |
|
| 1818 | + $address_fields = array(); |
|
| 1819 | + |
|
| 1820 | + if ( isset($post->post_address) ) { |
|
| 1821 | + $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>'; |
|
| 1822 | + } |
|
| 1823 | + if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1824 | + $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>'; |
|
| 1825 | + } |
|
| 1826 | + if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1827 | + $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>'; |
|
| 1828 | + } |
|
| 1829 | + if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1830 | + $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>'; |
|
| 1831 | + } |
|
| 1832 | + if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1833 | + $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>'; |
|
| 1834 | + } |
|
| 1835 | 1835 | |
| 1836 | - /** |
|
| 1837 | - * Filter the address fields array being displayed. |
|
| 1838 | - * |
|
| 1839 | - * @param array $address_fields The array of address fields. |
|
| 1840 | - * @param object $post The current post object. |
|
| 1841 | - * @param array $cf The custom field array details. |
|
| 1842 | - * @param string $location The location to output the html. |
|
| 1843 | - * |
|
| 1844 | - * @since 1.6.21 |
|
| 1845 | - */ |
|
| 1846 | - $address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location); |
|
| 1836 | + /** |
|
| 1837 | + * Filter the address fields array being displayed. |
|
| 1838 | + * |
|
| 1839 | + * @param array $address_fields The array of address fields. |
|
| 1840 | + * @param object $post The current post object. |
|
| 1841 | + * @param array $cf The custom field array details. |
|
| 1842 | + * @param string $location The location to output the html. |
|
| 1843 | + * |
|
| 1844 | + * @since 1.6.21 |
|
| 1845 | + */ |
|
| 1846 | + $address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location); |
|
| 1847 | 1847 | |
| 1848 | - if (!empty($address_fields) && is_array($address_fields)) { |
|
| 1849 | - $address_fields = array_values($address_fields); |
|
| 1850 | - $html .= implode('<br>', $address_fields); |
|
| 1851 | - } |
|
| 1848 | + if (!empty($address_fields) && is_array($address_fields)) { |
|
| 1849 | + $address_fields = array_values($address_fields); |
|
| 1850 | + $html .= implode('<br>', $address_fields); |
|
| 1851 | + } |
|
| 1852 | 1852 | |
| 1853 | - $html .= '</div>'; |
|
| 1854 | - } |
|
| 1855 | - } |
|
| 1853 | + $html .= '</div>'; |
|
| 1854 | + } |
|
| 1855 | + } |
|
| 1856 | 1856 | |
| 1857 | - return $html; |
|
| 1857 | + return $html; |
|
| 1858 | 1858 | } |
| 1859 | 1859 | add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3); |
| 1860 | 1860 | \ No newline at end of file |
@@ -19,21 +19,21 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return string The html to output for the custom field. |
| 21 | 21 | */ |
| 22 | -function geodir_cf_checkbox($html,$location,$cf,$p=''){ |
|
| 22 | +function geodir_cf_checkbox($html, $location, $cf, $p = '') { |
|
| 23 | 23 | |
| 24 | 24 | // check we have the post value |
| 25 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 26 | - else{ global $post;} |
|
| 25 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 26 | + else { global $post; } |
|
| 27 | 27 | |
| 28 | - if(!is_array($cf) && $cf!=''){ |
|
| 28 | + if (!is_array($cf) && $cf != '') { |
|
| 29 | 29 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 30 | - if(!$cf){return NULL;} |
|
| 30 | + if (!$cf) {return NULL; } |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $html_var = $cf['htmlvar_name']; |
| 34 | 34 | |
| 35 | 35 | // Check if there is a location specific filter. |
| 36 | - if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){ |
|
| 36 | + if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) { |
|
| 37 | 37 | /** |
| 38 | 38 | * Filter the checkbox html by location. |
| 39 | 39 | * |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | * @param array $cf The custom field array. |
| 42 | 42 | * @since 1.6.6 |
| 43 | 43 | */ |
| 44 | - $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf); |
|
| 44 | + $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Check if there is a custom field specific filter. |
| 48 | - if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){ |
|
| 48 | + if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) { |
|
| 49 | 49 | /** |
| 50 | 50 | * Filter the checkbox html by individual custom field. |
| 51 | 51 | * |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | * @param array $cf The custom field array. |
| 55 | 55 | * @since 1.6.6 |
| 56 | 56 | */ |
| 57 | - $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf); |
|
| 57 | + $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Check if there is a custom field key specific filter. |
| 61 | - if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){ |
|
| 61 | + if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) { |
|
| 62 | 62 | /** |
| 63 | 63 | * Filter the checkbox html by field type key. |
| 64 | 64 | * |
@@ -67,18 +67,18 @@ discard block |
||
| 67 | 67 | * @param array $cf The custom field array. |
| 68 | 68 | * @since 1.6.6 |
| 69 | 69 | */ |
| 70 | - $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 70 | + $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // If not html then we run the standard output. |
| 74 | - if(empty($html)){ |
|
| 74 | + if (empty($html)) { |
|
| 75 | 75 | |
| 76 | - if ( (int) $post->{$html_var} == 1 ): |
|
| 76 | + if ((int) $post->{$html_var} == 1): |
|
| 77 | 77 | |
| 78 | - if ( $post->{$html_var} == '1' ): |
|
| 79 | - $html_val = __( 'Yes', 'geodirectory' ); |
|
| 78 | + if ($post->{$html_var} == '1'): |
|
| 79 | + $html_val = __('Yes', 'geodirectory'); |
|
| 80 | 80 | else: |
| 81 | - $html_val = __( 'No', 'geodirectory' ); |
|
| 81 | + $html_val = __('No', 'geodirectory'); |
|
| 82 | 82 | endif; |
| 83 | 83 | |
| 84 | 84 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | $field_icon = ''; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 95 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ''; |
|
| 96 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 94 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af; |
|
| 95 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 96 | + $html .= '</span>'.$html_val.'</div>'; |
|
| 97 | 97 | endif; |
| 98 | 98 | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return $html; |
| 102 | 102 | } |
| 103 | -add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3); |
|
| 103 | +add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3); |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -113,21 +113,21 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return string The html to output for the custom field. |
| 115 | 115 | */ |
| 116 | -function geodir_cf_fieldset($html,$location,$cf,$p=''){ |
|
| 116 | +function geodir_cf_fieldset($html, $location, $cf, $p = '') { |
|
| 117 | 117 | |
| 118 | 118 | // check we have the post value |
| 119 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 120 | - else{ global $post;} |
|
| 119 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 120 | + else { global $post; } |
|
| 121 | 121 | |
| 122 | - if(!is_array($cf) && $cf!=''){ |
|
| 122 | + if (!is_array($cf) && $cf != '') { |
|
| 123 | 123 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 124 | - if(!$cf){return NULL;} |
|
| 124 | + if (!$cf) {return NULL; } |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $html_var = $cf['htmlvar_name']; |
| 128 | 128 | |
| 129 | 129 | // Check if there is a location specific filter. |
| 130 | - if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){ |
|
| 130 | + if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) { |
|
| 131 | 131 | /** |
| 132 | 132 | * Filter the fieldset html by location. |
| 133 | 133 | * |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | * @param array $cf The custom field array. |
| 136 | 136 | * @since 1.6.6 |
| 137 | 137 | */ |
| 138 | - $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf); |
|
| 138 | + $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // Check if there is a custom field specific filter. |
| 142 | - if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){ |
|
| 142 | + if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) { |
|
| 143 | 143 | /** |
| 144 | 144 | * Filter the fieldset html by individual custom field. |
| 145 | 145 | * |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | * @param array $cf The custom field array. |
| 149 | 149 | * @since 1.6.6 |
| 150 | 150 | */ |
| 151 | - $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf); |
|
| 151 | + $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Check if there is a custom field key specific filter. |
| 155 | - if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){ |
|
| 155 | + if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) { |
|
| 156 | 156 | /** |
| 157 | 157 | * Filter the fieldset html by field type key. |
| 158 | 158 | * |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | * @param array $cf The custom field array. |
| 162 | 162 | * @since 1.6.6 |
| 163 | 163 | */ |
| 164 | - $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 164 | + $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // If not html then we run the standard output. |
| 168 | - if(empty($html)){ |
|
| 168 | + if (empty($html)) { |
|
| 169 | 169 | |
| 170 | 170 | global $field_set_start; |
| 171 | 171 | $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | if ($field_set_start == 1) { |
| 174 | 174 | $html = ''; |
| 175 | 175 | } else { |
| 176 | - $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>'; |
|
| 176 | + $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>'; |
|
| 177 | 177 | //$field_set_start = 1; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | return $html; |
| 183 | 183 | } |
| 184 | -add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3); |
|
| 184 | +add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3); |
|
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -194,21 +194,21 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return string The html to output for the custom field. |
| 196 | 196 | */ |
| 197 | -function geodir_cf_url($html,$location,$cf,$p=''){ |
|
| 197 | +function geodir_cf_url($html, $location, $cf, $p = '') { |
|
| 198 | 198 | |
| 199 | 199 | // check we have the post value |
| 200 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 201 | - else{ global $post;} |
|
| 200 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 201 | + else { global $post; } |
|
| 202 | 202 | |
| 203 | - if(!is_array($cf) && $cf!=''){ |
|
| 203 | + if (!is_array($cf) && $cf != '') { |
|
| 204 | 204 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 205 | - if(!$cf){return NULL;} |
|
| 205 | + if (!$cf) {return NULL; } |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $html_var = $cf['htmlvar_name']; |
| 209 | 209 | |
| 210 | 210 | // Check if there is a location specific filter. |
| 211 | - if(has_filter("geodir_custom_field_output_url_loc_{$location}")){ |
|
| 211 | + if (has_filter("geodir_custom_field_output_url_loc_{$location}")) { |
|
| 212 | 212 | /** |
| 213 | 213 | * Filter the url html by location. |
| 214 | 214 | * |
@@ -216,11 +216,11 @@ discard block |
||
| 216 | 216 | * @param array $cf The custom field array. |
| 217 | 217 | * @since 1.6.6 |
| 218 | 218 | */ |
| 219 | - $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf); |
|
| 219 | + $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // Check if there is a custom field specific filter. |
| 223 | - if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){ |
|
| 223 | + if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) { |
|
| 224 | 224 | /** |
| 225 | 225 | * Filter the url html by individual custom field. |
| 226 | 226 | * |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | * @param array $cf The custom field array. |
| 230 | 230 | * @since 1.6.6 |
| 231 | 231 | */ |
| 232 | - $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf); |
|
| 232 | + $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // Check if there is a custom field key specific filter. |
| 236 | - if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){ |
|
| 236 | + if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) { |
|
| 237 | 237 | /** |
| 238 | 238 | * Filter the url html by field type key. |
| 239 | 239 | * |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | * @param array $cf The custom field array. |
| 243 | 243 | * @since 1.6.6 |
| 244 | 244 | */ |
| 245 | - $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 245 | + $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // If not html then we run the standard output. |
| 249 | - if(empty($html)){ |
|
| 249 | + if (empty($html)) { |
|
| 250 | 250 | |
| 251 | 251 | if ($post->{$cf['htmlvar_name']}): |
| 252 | 252 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
| 275 | 275 | $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title']; |
| 276 | - if(!empty($cf['default_value'])){$title = $cf['default_value'];} |
|
| 276 | + if (!empty($cf['default_value'])) {$title = $cf['default_value']; } |
|
| 277 | 277 | $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
| 278 | 278 | |
| 279 | 279 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * @param string $website Website URL. |
| 290 | 290 | * @param int $post->ID Post ID. |
| 291 | 291 | */ |
| 292 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>'; |
|
| 292 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>'; |
|
| 293 | 293 | |
| 294 | 294 | endif; |
| 295 | 295 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | return $html; |
| 299 | 299 | } |
| 300 | -add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3); |
|
| 300 | +add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3); |
|
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -310,21 +310,21 @@ discard block |
||
| 310 | 310 | * |
| 311 | 311 | * @return string The html to output for the custom field. |
| 312 | 312 | */ |
| 313 | -function geodir_cf_phone($html,$location,$cf,$p=''){ |
|
| 313 | +function geodir_cf_phone($html, $location, $cf, $p = '') { |
|
| 314 | 314 | |
| 315 | 315 | // check we have the post value |
| 316 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 317 | - else{ global $post;} |
|
| 316 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 317 | + else { global $post; } |
|
| 318 | 318 | |
| 319 | - if(!is_array($cf) && $cf!=''){ |
|
| 319 | + if (!is_array($cf) && $cf != '') { |
|
| 320 | 320 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 321 | - if(!$cf){return NULL;} |
|
| 321 | + if (!$cf) {return NULL; } |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | $html_var = $cf['htmlvar_name']; |
| 325 | 325 | |
| 326 | 326 | // Check if there is a location specific filter. |
| 327 | - if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){ |
|
| 327 | + if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) { |
|
| 328 | 328 | /** |
| 329 | 329 | * Filter the phone html by location. |
| 330 | 330 | * |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | * @param array $cf The custom field array. |
| 333 | 333 | * @since 1.6.6 |
| 334 | 334 | */ |
| 335 | - $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf); |
|
| 335 | + $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | // Check if there is a custom field specific filter. |
| 339 | - if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){ |
|
| 339 | + if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) { |
|
| 340 | 340 | /** |
| 341 | 341 | * Filter the phone html by individual custom field. |
| 342 | 342 | * |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | * @param array $cf The custom field array. |
| 346 | 346 | * @since 1.6.6 |
| 347 | 347 | */ |
| 348 | - $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf); |
|
| 348 | + $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | // Check if there is a custom field key specific filter. |
| 352 | - if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){ |
|
| 352 | + if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) { |
|
| 353 | 353 | /** |
| 354 | 354 | * Filter the phone html by field type key. |
| 355 | 355 | * |
@@ -358,11 +358,11 @@ discard block |
||
| 358 | 358 | * @param array $cf The custom field array. |
| 359 | 359 | * @since 1.6.6 |
| 360 | 360 | */ |
| 361 | - $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 361 | + $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | // If not html then we run the standard output. |
| 365 | - if(empty($html)){ |
|
| 365 | + if (empty($html)) { |
|
| 366 | 366 | |
| 367 | 367 | if ($post->{$cf['htmlvar_name']}): |
| 368 | 368 | |
@@ -377,9 +377,9 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
| 380 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 381 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 382 | - $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>'; |
|
| 380 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af. |
|
| 381 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ' '; |
|
| 382 | + $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>'; |
|
| 383 | 383 | |
| 384 | 384 | endif; |
| 385 | 385 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | return $html; |
| 389 | 389 | } |
| 390 | -add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3); |
|
| 390 | +add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3); |
|
| 391 | 391 | |
| 392 | 392 | |
| 393 | 393 | /** |
@@ -400,21 +400,21 @@ discard block |
||
| 400 | 400 | * |
| 401 | 401 | * @return string The html to output for the custom field. |
| 402 | 402 | */ |
| 403 | -function geodir_cf_time($html,$location,$cf,$p=''){ |
|
| 403 | +function geodir_cf_time($html, $location, $cf, $p = '') { |
|
| 404 | 404 | |
| 405 | 405 | // check we have the post value |
| 406 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 407 | - else{ global $post;} |
|
| 406 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 407 | + else { global $post; } |
|
| 408 | 408 | |
| 409 | - if(!is_array($cf) && $cf!=''){ |
|
| 409 | + if (!is_array($cf) && $cf != '') { |
|
| 410 | 410 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 411 | - if(!$cf){return NULL;} |
|
| 411 | + if (!$cf) {return NULL; } |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | $html_var = $cf['htmlvar_name']; |
| 415 | 415 | |
| 416 | 416 | // Check if there is a location specific filter. |
| 417 | - if(has_filter("geodir_custom_field_output_time_loc_{$location}")){ |
|
| 417 | + if (has_filter("geodir_custom_field_output_time_loc_{$location}")) { |
|
| 418 | 418 | /** |
| 419 | 419 | * Filter the time html by location. |
| 420 | 420 | * |
@@ -422,11 +422,11 @@ discard block |
||
| 422 | 422 | * @param array $cf The custom field array. |
| 423 | 423 | * @since 1.6.6 |
| 424 | 424 | */ |
| 425 | - $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf); |
|
| 425 | + $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | // Check if there is a custom field specific filter. |
| 429 | - if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){ |
|
| 429 | + if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) { |
|
| 430 | 430 | /** |
| 431 | 431 | * Filter the time html by individual custom field. |
| 432 | 432 | * |
@@ -435,11 +435,11 @@ discard block |
||
| 435 | 435 | * @param array $cf The custom field array. |
| 436 | 436 | * @since 1.6.6 |
| 437 | 437 | */ |
| 438 | - $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf); |
|
| 438 | + $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // Check if there is a custom field key specific filter. |
| 442 | - if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){ |
|
| 442 | + if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) { |
|
| 443 | 443 | /** |
| 444 | 444 | * Filter the time html by field type key. |
| 445 | 445 | * |
@@ -448,11 +448,11 @@ discard block |
||
| 448 | 448 | * @param array $cf The custom field array. |
| 449 | 449 | * @since 1.6.6 |
| 450 | 450 | */ |
| 451 | - $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 451 | + $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // If not html then we run the standard output. |
| 455 | - if(empty($html)){ |
|
| 455 | + if (empty($html)) { |
|
| 456 | 456 | |
| 457 | 457 | if ($post->{$cf['htmlvar_name']}): |
| 458 | 458 | |
@@ -472,9 +472,9 @@ discard block |
||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | |
| 475 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 476 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 477 | - $html .= '</span>' . $value . '</div>'; |
|
| 475 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af; |
|
| 476 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ' '; |
|
| 477 | + $html .= '</span>'.$value.'</div>'; |
|
| 478 | 478 | |
| 479 | 479 | endif; |
| 480 | 480 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | return $html; |
| 484 | 484 | } |
| 485 | -add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3); |
|
| 485 | +add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3); |
|
| 486 | 486 | |
| 487 | 487 | |
| 488 | 488 | /** |
@@ -495,21 +495,21 @@ discard block |
||
| 495 | 495 | * |
| 496 | 496 | * @return string The html to output for the custom field. |
| 497 | 497 | */ |
| 498 | -function geodir_cf_datepicker($html,$location,$cf,$p=''){ |
|
| 498 | +function geodir_cf_datepicker($html, $location, $cf, $p = '') { |
|
| 499 | 499 | global $preview; |
| 500 | 500 | // check we have the post value |
| 501 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 502 | - else{ global $post;} |
|
| 501 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 502 | + else { global $post; } |
|
| 503 | 503 | |
| 504 | - if(!is_array($cf) && $cf!=''){ |
|
| 504 | + if (!is_array($cf) && $cf != '') { |
|
| 505 | 505 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 506 | - if(!$cf){return NULL;} |
|
| 506 | + if (!$cf) {return NULL; } |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | $html_var = $cf['htmlvar_name']; |
| 510 | 510 | |
| 511 | 511 | // Check if there is a location specific filter. |
| 512 | - if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){ |
|
| 512 | + if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) { |
|
| 513 | 513 | /** |
| 514 | 514 | * Filter the datepicker html by location. |
| 515 | 515 | * |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | * @param array $cf The custom field array. |
| 518 | 518 | * @since 1.6.6 |
| 519 | 519 | */ |
| 520 | - $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf); |
|
| 520 | + $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | // Check if there is a custom field specific filter. |
| 524 | - if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){ |
|
| 524 | + if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) { |
|
| 525 | 525 | /** |
| 526 | 526 | * Filter the datepicker html by individual custom field. |
| 527 | 527 | * |
@@ -530,11 +530,11 @@ discard block |
||
| 530 | 530 | * @param array $cf The custom field array. |
| 531 | 531 | * @since 1.6.6 |
| 532 | 532 | */ |
| 533 | - $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf); |
|
| 533 | + $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | // Check if there is a custom field key specific filter. |
| 537 | - if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){ |
|
| 537 | + if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) { |
|
| 538 | 538 | /** |
| 539 | 539 | * Filter the datepicker html by field type key. |
| 540 | 540 | * |
@@ -543,11 +543,11 @@ discard block |
||
| 543 | 543 | * @param array $cf The custom field array. |
| 544 | 544 | * @since 1.6.6 |
| 545 | 545 | */ |
| 546 | - $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 546 | + $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | // If not html then we run the standard output. |
| 550 | - if(empty($html)){ |
|
| 550 | + if (empty($html)) { |
|
| 551 | 551 | |
| 552 | 552 | if ($post->{$cf['htmlvar_name']}): |
| 553 | 553 | |
@@ -558,24 +558,24 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | // check if we need to change the format or not |
| 560 | 560 | $date_format_len = strlen(str_replace(' ', '', $date_format)); |
| 561 | - if($date_format_len>5){// if greater then 4 then it's the old style format. |
|
| 561 | + if ($date_format_len > 5) {// if greater then 4 then it's the old style format. |
|
| 562 | 562 | |
| 563 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 564 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 563 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format |
|
| 564 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format |
|
| 565 | 565 | |
| 566 | 566 | $date_format = str_replace($search, $replace, $date_format); |
| 567 | 567 | |
| 568 | - $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
| 569 | - }else{ |
|
| 568 | + $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
| 569 | + } else { |
|
| 570 | 570 | $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") { |
|
| 573 | + if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") { |
|
| 574 | 574 | $date_format_from = $preview ? $date_format : 'Y-m-d'; |
| 575 | 575 | $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
| 576 | 576 | //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
| 577 | 577 | //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
| 578 | - }else{ |
|
| 578 | + } else { |
|
| 579 | 579 | return ''; |
| 580 | 580 | } |
| 581 | 581 | |
@@ -592,9 +592,9 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | |
| 594 | 594 | |
| 595 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 596 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 597 | - $html .= '</span>' . $value . '</div>'; |
|
| 595 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af; |
|
| 596 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 597 | + $html .= '</span>'.$value.'</div>'; |
|
| 598 | 598 | |
| 599 | 599 | endif; |
| 600 | 600 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | return $html; |
| 604 | 604 | } |
| 605 | -add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3); |
|
| 605 | +add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3); |
|
| 606 | 606 | |
| 607 | 607 | |
| 608 | 608 | /** |
@@ -615,21 +615,21 @@ discard block |
||
| 615 | 615 | * |
| 616 | 616 | * @return string The html to output for the custom field. |
| 617 | 617 | */ |
| 618 | -function geodir_cf_text($html,$location,$cf,$p=''){ |
|
| 618 | +function geodir_cf_text($html, $location, $cf, $p = '') { |
|
| 619 | 619 | |
| 620 | 620 | // check we have the post value |
| 621 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 622 | - else{ global $post;} |
|
| 621 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 622 | + else { global $post; } |
|
| 623 | 623 | |
| 624 | - if(!is_array($cf) && $cf!=''){ |
|
| 624 | + if (!is_array($cf) && $cf != '') { |
|
| 625 | 625 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 626 | - if(!$cf){return NULL;} |
|
| 626 | + if (!$cf) {return NULL; } |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | $html_var = $cf['htmlvar_name']; |
| 630 | 630 | |
| 631 | 631 | // Check if there is a location specific filter. |
| 632 | - if(has_filter("geodir_custom_field_output_text_loc_{$location}")){ |
|
| 632 | + if (has_filter("geodir_custom_field_output_text_loc_{$location}")) { |
|
| 633 | 633 | /** |
| 634 | 634 | * Filter the text html by location. |
| 635 | 635 | * |
@@ -637,11 +637,11 @@ discard block |
||
| 637 | 637 | * @param array $cf The custom field array. |
| 638 | 638 | * @since 1.6.6 |
| 639 | 639 | */ |
| 640 | - $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf); |
|
| 640 | + $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | // Check if there is a custom field specific filter. |
| 644 | - if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){ |
|
| 644 | + if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) { |
|
| 645 | 645 | /** |
| 646 | 646 | * Filter the text html by individual custom field. |
| 647 | 647 | * |
@@ -650,11 +650,11 @@ discard block |
||
| 650 | 650 | * @param array $cf The custom field array. |
| 651 | 651 | * @since 1.6.6 |
| 652 | 652 | */ |
| 653 | - $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf); |
|
| 653 | + $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf); |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | // Check if there is a custom field key specific filter. |
| 657 | - if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){ |
|
| 657 | + if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) { |
|
| 658 | 658 | /** |
| 659 | 659 | * Filter the text html by field type key. |
| 660 | 660 | * |
@@ -663,15 +663,15 @@ discard block |
||
| 663 | 663 | * @param array $cf The custom field array. |
| 664 | 664 | * @since 1.6.6 |
| 665 | 665 | */ |
| 666 | - $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 666 | + $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | |
| 670 | 670 | |
| 671 | 671 | // If not html then we run the standard output. |
| 672 | - if(empty($html)){ |
|
| 672 | + if (empty($html)) { |
|
| 673 | 673 | |
| 674 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 674 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
| 675 | 675 | |
| 676 | 676 | $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
| 677 | 677 | |
@@ -686,16 +686,16 @@ discard block |
||
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | |
| 689 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
| 690 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 689 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af; |
|
| 690 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 691 | 691 | $html .= '</span>'; |
| 692 | 692 | |
| 693 | 693 | $value = $post->{$cf['htmlvar_name']}; |
| 694 | - if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
| 694 | + if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) { |
|
| 695 | 695 | $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
| 696 | - if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
| 697 | - if(!ceil($value) > 0){return '';}// dont output blank prices |
|
| 698 | - $value = geodir_currency_format_number($value,$cf); |
|
| 696 | + if (isset($extra_fields['is_price']) && $extra_fields['is_price']) { |
|
| 697 | + if (!ceil($value) > 0) {return ''; }// dont output blank prices |
|
| 698 | + $value = geodir_currency_format_number($value, $cf); |
|
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | |
| 710 | 710 | return $html; |
| 711 | 711 | } |
| 712 | -add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3); |
|
| 712 | +add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3); |
|
| 713 | 713 | |
| 714 | 714 | |
| 715 | 715 | /** |
@@ -722,21 +722,21 @@ discard block |
||
| 722 | 722 | * |
| 723 | 723 | * @return string The html to output for the custom field. |
| 724 | 724 | */ |
| 725 | -function geodir_cf_radio($html,$location,$cf,$p=''){ |
|
| 725 | +function geodir_cf_radio($html, $location, $cf, $p = '') { |
|
| 726 | 726 | |
| 727 | 727 | // check we have the post value |
| 728 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 729 | - else{ global $post;} |
|
| 728 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 729 | + else { global $post; } |
|
| 730 | 730 | |
| 731 | - if(!is_array($cf) && $cf!=''){ |
|
| 731 | + if (!is_array($cf) && $cf != '') { |
|
| 732 | 732 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 733 | - if(!$cf){return NULL;} |
|
| 733 | + if (!$cf) {return NULL; } |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | $html_var = $cf['htmlvar_name']; |
| 737 | 737 | |
| 738 | 738 | // Check if there is a location specific filter. |
| 739 | - if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
| 739 | + if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) { |
|
| 740 | 740 | /** |
| 741 | 741 | * Filter the radio html by location. |
| 742 | 742 | * |
@@ -744,11 +744,11 @@ discard block |
||
| 744 | 744 | * @param array $cf The custom field array. |
| 745 | 745 | * @since 1.6.6 |
| 746 | 746 | */ |
| 747 | - $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
| 747 | + $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf); |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | // Check if there is a custom field specific filter. |
| 751 | - if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
| 751 | + if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) { |
|
| 752 | 752 | /** |
| 753 | 753 | * Filter the radio html by individual custom field. |
| 754 | 754 | * |
@@ -757,11 +757,11 @@ discard block |
||
| 757 | 757 | * @param array $cf The custom field array. |
| 758 | 758 | * @since 1.6.6 |
| 759 | 759 | */ |
| 760 | - $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
| 760 | + $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf); |
|
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | // Check if there is a custom field key specific filter. |
| 764 | - if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
| 764 | + if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) { |
|
| 765 | 765 | /** |
| 766 | 766 | * Filter the radio html by field type key. |
| 767 | 767 | * |
@@ -770,11 +770,11 @@ discard block |
||
| 770 | 770 | * @param array $cf The custom field array. |
| 771 | 771 | * @since 1.6.6 |
| 772 | 772 | */ |
| 773 | - $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 773 | + $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | // If not html then we run the standard output. |
| 777 | - if(empty($html)){ |
|
| 777 | + if (empty($html)) { |
|
| 778 | 778 | |
| 779 | 779 | $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
| 780 | 780 | if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
@@ -808,16 +808,16 @@ discard block |
||
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | |
| 811 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 812 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 813 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 811 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af; |
|
| 812 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 813 | + $html .= '</span>'.$html_val.'</div>'; |
|
| 814 | 814 | endif; |
| 815 | 815 | |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | return $html; |
| 819 | 819 | } |
| 820 | -add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3); |
|
| 820 | +add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3); |
|
| 821 | 821 | |
| 822 | 822 | |
| 823 | 823 | /** |
@@ -831,21 +831,21 @@ discard block |
||
| 831 | 831 | * |
| 832 | 832 | * @return string The html to output for the custom field. |
| 833 | 833 | */ |
| 834 | -function geodir_cf_select($html,$location,$cf,$p=''){ |
|
| 834 | +function geodir_cf_select($html, $location, $cf, $p = '') { |
|
| 835 | 835 | |
| 836 | 836 | // check we have the post value |
| 837 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 838 | - else{ global $post;} |
|
| 837 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 838 | + else { global $post; } |
|
| 839 | 839 | |
| 840 | - if(!is_array($cf) && $cf!=''){ |
|
| 840 | + if (!is_array($cf) && $cf != '') { |
|
| 841 | 841 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 842 | - if(!$cf){return NULL;} |
|
| 842 | + if (!$cf) {return NULL; } |
|
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | $html_var = $cf['htmlvar_name']; |
| 846 | 846 | |
| 847 | 847 | // Check if there is a location specific filter. |
| 848 | - if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
| 848 | + if (has_filter("geodir_custom_field_output_select_loc_{$location}")) { |
|
| 849 | 849 | /** |
| 850 | 850 | * Filter the select html by location. |
| 851 | 851 | * |
@@ -853,11 +853,11 @@ discard block |
||
| 853 | 853 | * @param array $cf The custom field array. |
| 854 | 854 | * @since 1.6.6 |
| 855 | 855 | */ |
| 856 | - $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
| 856 | + $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf); |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | // Check if there is a custom field specific filter. |
| 860 | - if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
| 860 | + if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) { |
|
| 861 | 861 | /** |
| 862 | 862 | * Filter the select html by individual custom field. |
| 863 | 863 | * |
@@ -866,11 +866,11 @@ discard block |
||
| 866 | 866 | * @param array $cf The custom field array. |
| 867 | 867 | * @since 1.6.6 |
| 868 | 868 | */ |
| 869 | - $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
| 869 | + $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf); |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | // Check if there is a custom field key specific filter. |
| 873 | - if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
| 873 | + if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) { |
|
| 874 | 874 | /** |
| 875 | 875 | * Filter the select html by field type key. |
| 876 | 876 | * |
@@ -879,11 +879,11 @@ discard block |
||
| 879 | 879 | * @param array $cf The custom field array. |
| 880 | 880 | * @since 1.6.6 |
| 881 | 881 | */ |
| 882 | - $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 882 | + $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | // If not html then we run the standard output. |
| 886 | - if(empty($html)){ |
|
| 886 | + if (empty($html)) { |
|
| 887 | 887 | |
| 888 | 888 | if ($post->{$cf['htmlvar_name']}): |
| 889 | 889 | $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
@@ -911,16 +911,16 @@ discard block |
||
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | |
| 914 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 915 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 916 | - $html .= '</span>' . $field_value . '</div>'; |
|
| 914 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
| 915 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 916 | + $html .= '</span>'.$field_value.'</div>'; |
|
| 917 | 917 | endif; |
| 918 | 918 | |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | return $html; |
| 922 | 922 | } |
| 923 | -add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3); |
|
| 923 | +add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3); |
|
| 924 | 924 | |
| 925 | 925 | |
| 926 | 926 | /** |
@@ -933,21 +933,21 @@ discard block |
||
| 933 | 933 | * |
| 934 | 934 | * @return string The html to output for the custom field. |
| 935 | 935 | */ |
| 936 | -function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
|
| 936 | +function geodir_cf_multiselect($html, $location, $cf, $p = '') { |
|
| 937 | 937 | |
| 938 | 938 | // check we have the post value |
| 939 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 940 | - else{ global $post;} |
|
| 939 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 940 | + else { global $post; } |
|
| 941 | 941 | |
| 942 | - if(!is_array($cf) && $cf!=''){ |
|
| 942 | + if (!is_array($cf) && $cf != '') { |
|
| 943 | 943 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 944 | - if(!$cf){return NULL;} |
|
| 944 | + if (!$cf) {return NULL; } |
|
| 945 | 945 | } |
| 946 | 946 | |
| 947 | 947 | $html_var = $cf['htmlvar_name']; |
| 948 | 948 | |
| 949 | 949 | // Check if there is a location specific filter. |
| 950 | - if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
| 950 | + if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) { |
|
| 951 | 951 | /** |
| 952 | 952 | * Filter the multiselect html by location. |
| 953 | 953 | * |
@@ -955,11 +955,11 @@ discard block |
||
| 955 | 955 | * @param array $cf The custom field array. |
| 956 | 956 | * @since 1.6.6 |
| 957 | 957 | */ |
| 958 | - $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
| 958 | + $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf); |
|
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | // Check if there is a custom field specific filter. |
| 962 | - if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
| 962 | + if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) { |
|
| 963 | 963 | /** |
| 964 | 964 | * Filter the multiselect html by individual custom field. |
| 965 | 965 | * |
@@ -968,11 +968,11 @@ discard block |
||
| 968 | 968 | * @param array $cf The custom field array. |
| 969 | 969 | * @since 1.6.6 |
| 970 | 970 | */ |
| 971 | - $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
| 971 | + $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf); |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | // Check if there is a custom field key specific filter. |
| 975 | - if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
| 975 | + if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) { |
|
| 976 | 976 | /** |
| 977 | 977 | * Filter the multiselect html by field type key. |
| 978 | 978 | * |
@@ -981,11 +981,11 @@ discard block |
||
| 981 | 981 | * @param array $cf The custom field array. |
| 982 | 982 | * @since 1.6.6 |
| 983 | 983 | */ |
| 984 | - $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 984 | + $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | // If not html then we run the standard output. |
| 988 | - if(empty($html)){ |
|
| 988 | + if (empty($html)) { |
|
| 989 | 989 | |
| 990 | 990 | |
| 991 | 991 | if (!empty($post->{$cf['htmlvar_name']})): |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | |
| 1007 | 1007 | $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
| 1008 | 1008 | |
| 1009 | - if(is_array($field_values)){ |
|
| 1009 | + if (is_array($field_values)) { |
|
| 1010 | 1010 | $field_values = array_map('trim', $field_values); |
| 1011 | 1011 | } |
| 1012 | 1012 | |
@@ -1024,15 +1024,15 @@ discard block |
||
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | |
| 1027 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1028 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1027 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1028 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1029 | 1029 | $html .= '</span>'; |
| 1030 | 1030 | |
| 1031 | 1031 | if (count($option_values) > 1) { |
| 1032 | 1032 | $html .= '<ul>'; |
| 1033 | 1033 | |
| 1034 | 1034 | foreach ($option_values as $val) { |
| 1035 | - $html .= '<li>' . $val . '</li>'; |
|
| 1035 | + $html .= '<li>'.$val.'</li>'; |
|
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | $html .= '</ul>'; |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | return $html; |
| 1049 | 1049 | } |
| 1050 | -add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3); |
|
| 1050 | +add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3); |
|
| 1051 | 1051 | |
| 1052 | 1052 | |
| 1053 | 1053 | /** |
@@ -1060,21 +1060,21 @@ discard block |
||
| 1060 | 1060 | * |
| 1061 | 1061 | * @return string The html to output for the custom field. |
| 1062 | 1062 | */ |
| 1063 | -function geodir_cf_email($html,$location,$cf,$p=''){ |
|
| 1063 | +function geodir_cf_email($html, $location, $cf, $p = '') { |
|
| 1064 | 1064 | |
| 1065 | 1065 | // check we have the post value |
| 1066 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1067 | - else{ global $post;} |
|
| 1066 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1067 | + else { global $post; } |
|
| 1068 | 1068 | |
| 1069 | - if(!is_array($cf) && $cf!=''){ |
|
| 1069 | + if (!is_array($cf) && $cf != '') { |
|
| 1070 | 1070 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1071 | - if(!$cf){return NULL;} |
|
| 1071 | + if (!$cf) {return NULL; } |
|
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | $html_var = $cf['htmlvar_name']; |
| 1075 | 1075 | |
| 1076 | 1076 | // Check if there is a location specific filter. |
| 1077 | - if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
| 1077 | + if (has_filter("geodir_custom_field_output_email_loc_{$location}")) { |
|
| 1078 | 1078 | /** |
| 1079 | 1079 | * Filter the email html by location. |
| 1080 | 1080 | * |
@@ -1082,11 +1082,11 @@ discard block |
||
| 1082 | 1082 | * @param array $cf The custom field array. |
| 1083 | 1083 | * @since 1.6.6 |
| 1084 | 1084 | */ |
| 1085 | - $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
| 1085 | + $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | // Check if there is a custom field specific filter. |
| 1089 | - if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
| 1089 | + if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) { |
|
| 1090 | 1090 | /** |
| 1091 | 1091 | * Filter the email html by individual custom field. |
| 1092 | 1092 | * |
@@ -1095,11 +1095,11 @@ discard block |
||
| 1095 | 1095 | * @param array $cf The custom field array. |
| 1096 | 1096 | * @since 1.6.6 |
| 1097 | 1097 | */ |
| 1098 | - $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
| 1098 | + $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf); |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | // Check if there is a custom field key specific filter. |
| 1102 | - if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
| 1102 | + if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) { |
|
| 1103 | 1103 | /** |
| 1104 | 1104 | * Filter the email html by field type key. |
| 1105 | 1105 | * |
@@ -1108,18 +1108,18 @@ discard block |
||
| 1108 | 1108 | * @param array $cf The custom field array. |
| 1109 | 1109 | * @since 1.6.6 |
| 1110 | 1110 | */ |
| 1111 | - $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1111 | + $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | // If not html then we run the standard output. |
| 1115 | - if(empty($html)){ |
|
| 1115 | + if (empty($html)) { |
|
| 1116 | 1116 | |
| 1117 | 1117 | global $preview; |
| 1118 | 1118 | if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
| 1119 | 1119 | return ''; // Remove Send Enquiry | Send To Friend from listings page |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | - $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
| 1122 | + $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type); |
|
| 1123 | 1123 | |
| 1124 | 1124 | if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) { |
| 1125 | 1125 | global $send_to_friend; |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | if (!$preview) { |
| 1132 | 1132 | $b_send_inquiry = 'b_send_inquiry'; |
| 1133 | 1133 | $b_sendtofriend = 'b_sendtofriend'; |
| 1134 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1134 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -1144,28 +1144,28 @@ discard block |
||
| 1144 | 1144 | $field_icon = ''; |
| 1145 | 1145 | } |
| 1146 | 1146 | |
| 1147 | - $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1147 | + $html .= '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1148 | 1148 | $seperator = ''; |
| 1149 | 1149 | if ($post->{$cf['htmlvar_name']}) { |
| 1150 | 1150 | $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);'); |
| 1151 | - $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1151 | + $html .= '<a href="'.$b_send_inquiry_url.'" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>'; |
|
| 1152 | 1152 | $seperator = ' | '; |
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
| 1156 | 1156 | $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);'); |
| 1157 | - $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1157 | + $html .= $seperator.'<a href="'.$b_sendtofriend_url.'" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>'; |
|
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | $html .= '</span></div>'; |
| 1161 | 1161 | |
| 1162 | 1162 | |
| 1163 | 1163 | if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
| 1164 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1164 | + $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>'; |
|
| 1165 | 1165 | } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
| 1166 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1166 | + $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>'; |
|
| 1167 | 1167 | } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
| 1168 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1168 | + $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>'; |
|
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
@@ -1185,11 +1185,11 @@ discard block |
||
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | 1187 | |
| 1188 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1189 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1188 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1189 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1190 | 1190 | $html .= '</span><span class="geodir-email-address-output">'; |
| 1191 | 1191 | $email = $post->{$cf['htmlvar_name']} ; |
| 1192 | - if($e_split = explode('@',$email)){ |
|
| 1192 | + if ($e_split = explode('@', $email)) { |
|
| 1193 | 1193 | /** |
| 1194 | 1194 | * Filter email custom field name output. |
| 1195 | 1195 | * |
@@ -1198,15 +1198,15 @@ discard block |
||
| 1198 | 1198 | * @param string $email The email string being output. |
| 1199 | 1199 | * @param array $cf Custom field variables array. |
| 1200 | 1200 | */ |
| 1201 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1202 | - if($location=='mapbubble'){ |
|
| 1203 | - $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
|
| 1204 | - }else{ |
|
| 1205 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1201 | + $email_name = apply_filters('geodir_email_field_name_output', $email, $cf); |
|
| 1202 | + if ($location == 'mapbubble') { |
|
| 1203 | + $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
|
| 1204 | + } else { |
|
| 1205 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | - }else{ |
|
| 1209 | - $html .= $email; |
|
| 1208 | + } else { |
|
| 1209 | + $html .= $email; |
|
| 1210 | 1210 | } |
| 1211 | 1211 | $html .= '</span></div>'; |
| 1212 | 1212 | } |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | |
| 1218 | 1218 | return $html; |
| 1219 | 1219 | } |
| 1220 | -add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3); |
|
| 1220 | +add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3); |
|
| 1221 | 1221 | |
| 1222 | 1222 | |
| 1223 | 1223 | /** |
@@ -1230,21 +1230,21 @@ discard block |
||
| 1230 | 1230 | * |
| 1231 | 1231 | * @return string The html to output for the custom field. |
| 1232 | 1232 | */ |
| 1233 | -function geodir_cf_file($html,$location,$cf,$p=''){ |
|
| 1233 | +function geodir_cf_file($html, $location, $cf, $p = '') { |
|
| 1234 | 1234 | |
| 1235 | 1235 | // check we have the post value |
| 1236 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1237 | - else{ global $post;} |
|
| 1236 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1237 | + else { global $post; } |
|
| 1238 | 1238 | |
| 1239 | - if(!is_array($cf) && $cf!=''){ |
|
| 1239 | + if (!is_array($cf) && $cf != '') { |
|
| 1240 | 1240 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1241 | - if(!$cf){return NULL;} |
|
| 1241 | + if (!$cf) {return NULL; } |
|
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | $html_var = $cf['htmlvar_name']; |
| 1245 | 1245 | |
| 1246 | 1246 | // Check if there is a location specific filter. |
| 1247 | - if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1247 | + if (has_filter("geodir_custom_field_output_file_loc_{$location}")) { |
|
| 1248 | 1248 | /** |
| 1249 | 1249 | * Filter the file html by location. |
| 1250 | 1250 | * |
@@ -1252,11 +1252,11 @@ discard block |
||
| 1252 | 1252 | * @param array $cf The custom field array. |
| 1253 | 1253 | * @since 1.6.6 |
| 1254 | 1254 | */ |
| 1255 | - $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1255 | + $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf); |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | // Check if there is a custom field specific filter. |
| 1259 | - if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1259 | + if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) { |
|
| 1260 | 1260 | /** |
| 1261 | 1261 | * Filter the file html by individual custom field. |
| 1262 | 1262 | * |
@@ -1265,11 +1265,11 @@ discard block |
||
| 1265 | 1265 | * @param array $cf The custom field array. |
| 1266 | 1266 | * @since 1.6.6 |
| 1267 | 1267 | */ |
| 1268 | - $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1268 | + $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf); |
|
| 1269 | 1269 | } |
| 1270 | 1270 | |
| 1271 | 1271 | // Check if there is a custom field key specific filter. |
| 1272 | - if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1272 | + if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) { |
|
| 1273 | 1273 | /** |
| 1274 | 1274 | * Filter the file html by field type key. |
| 1275 | 1275 | * |
@@ -1278,11 +1278,11 @@ discard block |
||
| 1278 | 1278 | * @param array $cf The custom field array. |
| 1279 | 1279 | * @since 1.6.6 |
| 1280 | 1280 | */ |
| 1281 | - $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1281 | + $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | 1284 | // If not html then we run the standard output. |
| 1285 | - if(empty($html)){ |
|
| 1285 | + if (empty($html)) { |
|
| 1286 | 1286 | |
| 1287 | 1287 | if (!empty($post->{$cf['htmlvar_name']})): |
| 1288 | 1288 | |
@@ -1290,7 +1290,7 @@ discard block |
||
| 1290 | 1290 | if (!empty($files)): |
| 1291 | 1291 | |
| 1292 | 1292 | $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
| 1293 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
| 1293 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : ''; |
|
| 1294 | 1294 | |
| 1295 | 1295 | $file_paths = ''; |
| 1296 | 1296 | foreach ($files as $file) { |
@@ -1328,14 +1328,14 @@ discard block |
||
| 1328 | 1328 | //$file_paths .= '<img src="'.$file.'" />'; |
| 1329 | 1329 | $file_paths .= '</div>'; |
| 1330 | 1330 | }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
| 1331 | - $ext_path = '_' . $html_var . '_'; |
|
| 1331 | + $ext_path = '_'.$html_var.'_'; |
|
| 1332 | 1332 | $filename = explode($ext_path, $filename); |
| 1333 | 1333 | $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
| 1334 | 1334 | $file_paths .= do_shortcode('[audio src="'.$file.'" ]'); |
| 1335 | 1335 | } else { |
| 1336 | - $ext_path = '_' . $html_var . '_'; |
|
| 1336 | + $ext_path = '_'.$html_var.'_'; |
|
| 1337 | 1337 | $filename = explode($ext_path, $filename); |
| 1338 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1338 | + $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>'; |
|
| 1339 | 1339 | } |
| 1340 | 1340 | } |
| 1341 | 1341 | } |
@@ -1350,11 +1350,11 @@ discard block |
||
| 1350 | 1350 | $field_icon = ''; |
| 1351 | 1351 | } |
| 1352 | 1352 | |
| 1353 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1353 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1354 | 1354 | $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
| 1355 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1355 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1356 | 1356 | $html .= '</span>'; |
| 1357 | - $html .= $file_paths . '</div></div>'; |
|
| 1357 | + $html .= $file_paths.'</div></div>'; |
|
| 1358 | 1358 | |
| 1359 | 1359 | endif; |
| 1360 | 1360 | endif; |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | |
| 1364 | 1364 | return $html; |
| 1365 | 1365 | } |
| 1366 | -add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3); |
|
| 1366 | +add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3); |
|
| 1367 | 1367 | |
| 1368 | 1368 | |
| 1369 | 1369 | |
@@ -1377,21 +1377,21 @@ discard block |
||
| 1377 | 1377 | * |
| 1378 | 1378 | * @return string The html to output for the custom field. |
| 1379 | 1379 | */ |
| 1380 | -function geodir_cf_textarea($html,$location,$cf,$p=''){ |
|
| 1380 | +function geodir_cf_textarea($html, $location, $cf, $p = '') { |
|
| 1381 | 1381 | |
| 1382 | 1382 | // check we have the post value |
| 1383 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1384 | - else{ global $post;} |
|
| 1383 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1384 | + else { global $post; } |
|
| 1385 | 1385 | |
| 1386 | - if(!is_array($cf) && $cf!=''){ |
|
| 1386 | + if (!is_array($cf) && $cf != '') { |
|
| 1387 | 1387 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1388 | - if(!$cf){return NULL;} |
|
| 1388 | + if (!$cf) {return NULL; } |
|
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | $html_var = $cf['htmlvar_name']; |
| 1392 | 1392 | |
| 1393 | 1393 | // Check if there is a location specific filter. |
| 1394 | - if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1394 | + if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) { |
|
| 1395 | 1395 | /** |
| 1396 | 1396 | * Filter the textarea html by location. |
| 1397 | 1397 | * |
@@ -1399,11 +1399,11 @@ discard block |
||
| 1399 | 1399 | * @param array $cf The custom field array. |
| 1400 | 1400 | * @since 1.6.6 |
| 1401 | 1401 | */ |
| 1402 | - $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1402 | + $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf); |
|
| 1403 | 1403 | } |
| 1404 | 1404 | |
| 1405 | 1405 | // Check if there is a custom field specific filter. |
| 1406 | - if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1406 | + if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) { |
|
| 1407 | 1407 | /** |
| 1408 | 1408 | * Filter the textarea html by individual custom field. |
| 1409 | 1409 | * |
@@ -1412,11 +1412,11 @@ discard block |
||
| 1412 | 1412 | * @param array $cf The custom field array. |
| 1413 | 1413 | * @since 1.6.6 |
| 1414 | 1414 | */ |
| 1415 | - $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1415 | + $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf); |
|
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | 1418 | // Check if there is a custom field key specific filter. |
| 1419 | - if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1419 | + if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) { |
|
| 1420 | 1420 | /** |
| 1421 | 1421 | * Filter the textarea html by field type key. |
| 1422 | 1422 | * |
@@ -1425,11 +1425,11 @@ discard block |
||
| 1425 | 1425 | * @param array $cf The custom field array. |
| 1426 | 1426 | * @since 1.6.6 |
| 1427 | 1427 | */ |
| 1428 | - $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1428 | + $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1429 | 1429 | } |
| 1430 | 1430 | |
| 1431 | 1431 | // If not html then we run the standard output. |
| 1432 | - if(empty($html)){ |
|
| 1432 | + if (empty($html)) { |
|
| 1433 | 1433 | |
| 1434 | 1434 | if (!empty($post->{$cf['htmlvar_name']})) { |
| 1435 | 1435 | |
@@ -1444,9 +1444,9 @@ discard block |
||
| 1444 | 1444 | } |
| 1445 | 1445 | |
| 1446 | 1446 | |
| 1447 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1448 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1449 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1447 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1448 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1449 | + $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>'; |
|
| 1450 | 1450 | |
| 1451 | 1451 | } |
| 1452 | 1452 | |
@@ -1454,7 +1454,7 @@ discard block |
||
| 1454 | 1454 | |
| 1455 | 1455 | return $html; |
| 1456 | 1456 | } |
| 1457 | -add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3); |
|
| 1457 | +add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3); |
|
| 1458 | 1458 | |
| 1459 | 1459 | |
| 1460 | 1460 | |
@@ -1468,21 +1468,21 @@ discard block |
||
| 1468 | 1468 | * |
| 1469 | 1469 | * @return string The html to output for the custom field. |
| 1470 | 1470 | */ |
| 1471 | -function geodir_cf_html($html,$location,$cf,$p=''){ |
|
| 1471 | +function geodir_cf_html($html, $location, $cf, $p = '') { |
|
| 1472 | 1472 | |
| 1473 | 1473 | // check we have the post value |
| 1474 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1475 | - else{ global $post;} |
|
| 1474 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1475 | + else { global $post; } |
|
| 1476 | 1476 | |
| 1477 | - if(!is_array($cf) && $cf!=''){ |
|
| 1477 | + if (!is_array($cf) && $cf != '') { |
|
| 1478 | 1478 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1479 | - if(!$cf){return NULL;} |
|
| 1479 | + if (!$cf) {return NULL; } |
|
| 1480 | 1480 | } |
| 1481 | 1481 | |
| 1482 | 1482 | $html_var = $cf['htmlvar_name']; |
| 1483 | 1483 | |
| 1484 | 1484 | // Check if there is a location specific filter. |
| 1485 | - if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1485 | + if (has_filter("geodir_custom_field_output_html_loc_{$location}")) { |
|
| 1486 | 1486 | /** |
| 1487 | 1487 | * Filter the html html by location. |
| 1488 | 1488 | * |
@@ -1490,11 +1490,11 @@ discard block |
||
| 1490 | 1490 | * @param array $cf The custom field array. |
| 1491 | 1491 | * @since 1.6.6 |
| 1492 | 1492 | */ |
| 1493 | - $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1493 | + $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf); |
|
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | // Check if there is a custom field specific filter. |
| 1497 | - if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1497 | + if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) { |
|
| 1498 | 1498 | /** |
| 1499 | 1499 | * Filter the html html by individual custom field. |
| 1500 | 1500 | * |
@@ -1503,11 +1503,11 @@ discard block |
||
| 1503 | 1503 | * @param array $cf The custom field array. |
| 1504 | 1504 | * @since 1.6.6 |
| 1505 | 1505 | */ |
| 1506 | - $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1506 | + $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf); |
|
| 1507 | 1507 | } |
| 1508 | 1508 | |
| 1509 | 1509 | // Check if there is a custom field key specific filter. |
| 1510 | - if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1510 | + if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) { |
|
| 1511 | 1511 | /** |
| 1512 | 1512 | * Filter the html html by field type key. |
| 1513 | 1513 | * |
@@ -1516,11 +1516,11 @@ discard block |
||
| 1516 | 1516 | * @param array $cf The custom field array. |
| 1517 | 1517 | * @since 1.6.6 |
| 1518 | 1518 | */ |
| 1519 | - $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1519 | + $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | // If not html then we run the standard output. |
| 1523 | - if(empty($html)){ |
|
| 1523 | + if (empty($html)) { |
|
| 1524 | 1524 | |
| 1525 | 1525 | if (!empty($post->{$cf['htmlvar_name']})) { |
| 1526 | 1526 | |
@@ -1534,9 +1534,9 @@ discard block |
||
| 1534 | 1534 | $field_icon = ''; |
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1538 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1539 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1537 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1538 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1539 | + $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>'; |
|
| 1540 | 1540 | |
| 1541 | 1541 | } |
| 1542 | 1542 | |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | |
| 1545 | 1545 | return $html; |
| 1546 | 1546 | } |
| 1547 | -add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3); |
|
| 1547 | +add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3); |
|
| 1548 | 1548 | |
| 1549 | 1549 | |
| 1550 | 1550 | |
@@ -1558,21 +1558,21 @@ discard block |
||
| 1558 | 1558 | * |
| 1559 | 1559 | * @return string The html to output for the custom field. |
| 1560 | 1560 | */ |
| 1561 | -function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
|
| 1561 | +function geodir_cf_taxonomy($html, $location, $cf, $p = '') { |
|
| 1562 | 1562 | |
| 1563 | 1563 | // check we have the post value |
| 1564 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1565 | - else{ global $post;} |
|
| 1564 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1565 | + else { global $post; } |
|
| 1566 | 1566 | |
| 1567 | - if(!is_array($cf) && $cf!=''){ |
|
| 1567 | + if (!is_array($cf) && $cf != '') { |
|
| 1568 | 1568 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1569 | - if(!$cf){return NULL;} |
|
| 1569 | + if (!$cf) {return NULL; } |
|
| 1570 | 1570 | } |
| 1571 | 1571 | |
| 1572 | 1572 | $html_var = $cf['htmlvar_name']; |
| 1573 | 1573 | |
| 1574 | 1574 | // Check if there is a location specific filter. |
| 1575 | - if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1575 | + if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) { |
|
| 1576 | 1576 | /** |
| 1577 | 1577 | * Filter the taxonomy html by location. |
| 1578 | 1578 | * |
@@ -1580,11 +1580,11 @@ discard block |
||
| 1580 | 1580 | * @param array $cf The custom field array. |
| 1581 | 1581 | * @since 1.6.6 |
| 1582 | 1582 | */ |
| 1583 | - $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1583 | + $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf); |
|
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | // Check if there is a custom field specific filter. |
| 1587 | - if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1587 | + if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) { |
|
| 1588 | 1588 | /** |
| 1589 | 1589 | * Filter the taxonomy html by individual custom field. |
| 1590 | 1590 | * |
@@ -1593,11 +1593,11 @@ discard block |
||
| 1593 | 1593 | * @param array $cf The custom field array. |
| 1594 | 1594 | * @since 1.6.6 |
| 1595 | 1595 | */ |
| 1596 | - $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1596 | + $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf); |
|
| 1597 | 1597 | } |
| 1598 | 1598 | |
| 1599 | 1599 | // Check if there is a custom field key specific filter. |
| 1600 | - if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1600 | + if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) { |
|
| 1601 | 1601 | /** |
| 1602 | 1602 | * Filter the taxonomy html by field type key. |
| 1603 | 1603 | * |
@@ -1606,14 +1606,14 @@ discard block |
||
| 1606 | 1606 | * @param array $cf The custom field array. |
| 1607 | 1607 | * @since 1.6.6 |
| 1608 | 1608 | */ |
| 1609 | - $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1609 | + $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | // If not html then we run the standard output. |
| 1613 | - if(empty($html)){ |
|
| 1613 | + if (empty($html)) { |
|
| 1614 | 1614 | |
| 1615 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1616 | - $post_taxonomy = $post->post_type . 'category'; |
|
| 1615 | + if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) { |
|
| 1616 | + $post_taxonomy = $post->post_type.'category'; |
|
| 1617 | 1617 | $field_value = $post->{$html_var}; |
| 1618 | 1618 | $links = array(); |
| 1619 | 1619 | $terms = array(); |
@@ -1631,7 +1631,7 @@ discard block |
||
| 1631 | 1631 | if ($term != '') { |
| 1632 | 1632 | $term = get_term_by('id', $term, $html_var); |
| 1633 | 1633 | if (is_object($term)) { |
| 1634 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1634 | + $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>"; |
|
| 1635 | 1635 | $terms[] = $term; |
| 1636 | 1636 | } |
| 1637 | 1637 | } |
@@ -1645,7 +1645,7 @@ discard block |
||
| 1645 | 1645 | $terms = $termsOrdered; |
| 1646 | 1646 | } |
| 1647 | 1647 | } |
| 1648 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1648 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : ''; |
|
| 1649 | 1649 | |
| 1650 | 1650 | if ($html_value != '') { |
| 1651 | 1651 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -1658,9 +1658,9 @@ discard block |
||
| 1658 | 1658 | $field_icon = ''; |
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1662 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1663 | - $html .= '</span> ' . $html_value . '</div>'; |
|
| 1661 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1662 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ''; |
|
| 1663 | + $html .= '</span> '.$html_value.'</div>'; |
|
| 1664 | 1664 | } |
| 1665 | 1665 | } |
| 1666 | 1666 | |
@@ -1668,7 +1668,7 @@ discard block |
||
| 1668 | 1668 | |
| 1669 | 1669 | return $html; |
| 1670 | 1670 | } |
| 1671 | -add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3); |
|
| 1671 | +add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3); |
|
| 1672 | 1672 | |
| 1673 | 1673 | |
| 1674 | 1674 | /** |
@@ -1682,21 +1682,21 @@ discard block |
||
| 1682 | 1682 | * |
| 1683 | 1683 | * @return string The html to output for the custom field. |
| 1684 | 1684 | */ |
| 1685 | -function geodir_cf_address($html,$location,$cf,$p=''){ |
|
| 1685 | +function geodir_cf_address($html, $location, $cf, $p = '') { |
|
| 1686 | 1686 | |
| 1687 | 1687 | // check we have the post value |
| 1688 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1689 | - else{ global $post;} |
|
| 1688 | + if (is_int($p)) {$post = geodir_get_post_info($p); } |
|
| 1689 | + else { global $post; } |
|
| 1690 | 1690 | |
| 1691 | - if(!is_array($cf) && $cf!=''){ |
|
| 1691 | + if (!is_array($cf) && $cf != '') { |
|
| 1692 | 1692 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
| 1693 | - if(!$cf){return NULL;} |
|
| 1693 | + if (!$cf) {return NULL; } |
|
| 1694 | 1694 | } |
| 1695 | 1695 | |
| 1696 | 1696 | $html_var = $cf['htmlvar_name']; |
| 1697 | 1697 | |
| 1698 | 1698 | // Check if there is a location specific filter. |
| 1699 | - if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1699 | + if (has_filter("geodir_custom_field_output_address_loc_{$location}")) { |
|
| 1700 | 1700 | /** |
| 1701 | 1701 | * Filter the address html by location. |
| 1702 | 1702 | * |
@@ -1704,11 +1704,11 @@ discard block |
||
| 1704 | 1704 | * @param array $cf The custom field array. |
| 1705 | 1705 | * @since 1.6.6 |
| 1706 | 1706 | */ |
| 1707 | - $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1707 | + $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf); |
|
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | 1710 | // Check if there is a custom field specific filter. |
| 1711 | - if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1711 | + if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) { |
|
| 1712 | 1712 | /** |
| 1713 | 1713 | * Filter the address html by individual custom field. |
| 1714 | 1714 | * |
@@ -1717,11 +1717,11 @@ discard block |
||
| 1717 | 1717 | * @param array $cf The custom field array. |
| 1718 | 1718 | * @since 1.6.6 |
| 1719 | 1719 | */ |
| 1720 | - $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1720 | + $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf); |
|
| 1721 | 1721 | } |
| 1722 | 1722 | |
| 1723 | 1723 | // Check if there is a custom field key specific filter. |
| 1724 | - if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1724 | + if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) { |
|
| 1725 | 1725 | /** |
| 1726 | 1726 | * Filter the address html by field type key. |
| 1727 | 1727 | * |
@@ -1730,14 +1730,14 @@ discard block |
||
| 1730 | 1730 | * @param array $cf The custom field array. |
| 1731 | 1731 | * @since 1.6.6 |
| 1732 | 1732 | */ |
| 1733 | - $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1733 | + $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | |
| 1736 | 1736 | // If not html then we run the standard output. |
| 1737 | - if(empty($html)){ |
|
| 1737 | + if (empty($html)) { |
|
| 1738 | 1738 | |
| 1739 | 1739 | global $preview; |
| 1740 | - $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1740 | + $html_var = $cf['htmlvar_name'].'_address'; |
|
| 1741 | 1741 | |
| 1742 | 1742 | if ($cf['extra_fields']) { |
| 1743 | 1743 | |
@@ -1800,37 +1800,37 @@ discard block |
||
| 1800 | 1800 | |
| 1801 | 1801 | if ($post->{$html_var}) { |
| 1802 | 1802 | |
| 1803 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1804 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1803 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1804 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1805 | 1805 | $field_icon_af = ''; |
| 1806 | - } elseif ( $field_icon == '' ) { |
|
| 1806 | + } elseif ($field_icon == '') { |
|
| 1807 | 1807 | $field_icon_af = '<i class="fa fa-home"></i>'; |
| 1808 | 1808 | } else { |
| 1809 | 1809 | $field_icon_af = $field_icon; |
| 1810 | 1810 | $field_icon = ''; |
| 1811 | 1811 | } |
| 1812 | 1812 | |
| 1813 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1814 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1815 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
| 1813 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1814 | + $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af; |
|
| 1815 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : ' '; |
|
| 1816 | 1816 | $html .= '</span>'; |
| 1817 | 1817 | |
| 1818 | 1818 | $address_fields = array(); |
| 1819 | 1819 | |
| 1820 | - if ( isset($post->post_address) ) { |
|
| 1821 | - $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>'; |
|
| 1820 | + if (isset($post->post_address)) { |
|
| 1821 | + $address_fields['post_address'] = '<span itemprop="streetAddress">'.$post->post_address.'</span>'; |
|
| 1822 | 1822 | } |
| 1823 | - if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1824 | - $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>'; |
|
| 1823 | + if ($show_city_in_address && isset($post->post_city) && $post->post_city) { |
|
| 1824 | + $address_fields['post_city'] = '<span itemprop="addressLocality">'.$post->post_city.'</span>'; |
|
| 1825 | 1825 | } |
| 1826 | - if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1827 | - $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>'; |
|
| 1826 | + if ($show_region_in_address && isset($post->post_region) && $post->post_region) { |
|
| 1827 | + $address_fields['post_region'] = '<span itemprop="addressRegion">'.$post->post_region.'</span>'; |
|
| 1828 | 1828 | } |
| 1829 | - if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1830 | - $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>'; |
|
| 1829 | + if ($show_zip_in_address && isset($post->post_zip) && $post->post_zip) { |
|
| 1830 | + $address_fields['post_zip'] = '<span itemprop="postalCode">'.$post->post_zip.'</span>'; |
|
| 1831 | 1831 | } |
| 1832 | - if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1833 | - $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>'; |
|
| 1832 | + if ($show_country_in_address && isset($post->post_country) && $post->post_country) { |
|
| 1833 | + $address_fields['post_country'] = '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span>'; |
|
| 1834 | 1834 | } |
| 1835 | 1835 | |
| 1836 | 1836 | /** |
@@ -1856,4 +1856,4 @@ discard block |
||
| 1856 | 1856 | |
| 1857 | 1857 | return $html; |
| 1858 | 1858 | } |
| 1859 | -add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3); |
|
| 1860 | 1859 | \ No newline at end of file |
| 1860 | +add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3); |
|
| 1861 | 1861 | \ No newline at end of file |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | function geodir_cf_checkbox($html,$location,$cf,$p=''){ |
| 23 | 23 | |
| 24 | 24 | // check we have the post value |
| 25 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 26 | - else{ global $post;} |
|
| 25 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 27 | 26 | |
| 28 | 27 | if(!is_array($cf) && $cf!=''){ |
| 29 | 28 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -77,8 +76,10 @@ discard block |
||
| 77 | 76 | |
| 78 | 77 | if ( $post->{$html_var} == '1' ): |
| 79 | 78 | $html_val = __( 'Yes', 'geodirectory' ); |
| 80 | - else: |
|
| 79 | + else { |
|
| 80 | + : |
|
| 81 | 81 | $html_val = __( 'No', 'geodirectory' ); |
| 82 | + } |
|
| 82 | 83 | endif; |
| 83 | 84 | |
| 84 | 85 | $field_icon = geodir_field_icon_proccess($cf); |
@@ -116,8 +117,7 @@ discard block |
||
| 116 | 117 | function geodir_cf_fieldset($html,$location,$cf,$p=''){ |
| 117 | 118 | |
| 118 | 119 | // check we have the post value |
| 119 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 120 | - else{ global $post;} |
|
| 120 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 121 | 121 | |
| 122 | 122 | if(!is_array($cf) && $cf!=''){ |
| 123 | 123 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -197,8 +197,7 @@ discard block |
||
| 197 | 197 | function geodir_cf_url($html,$location,$cf,$p=''){ |
| 198 | 198 | |
| 199 | 199 | // check we have the post value |
| 200 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 201 | - else{ global $post;} |
|
| 200 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 202 | 201 | |
| 203 | 202 | if(!is_array($cf) && $cf!=''){ |
| 204 | 203 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -313,8 +312,7 @@ discard block |
||
| 313 | 312 | function geodir_cf_phone($html,$location,$cf,$p=''){ |
| 314 | 313 | |
| 315 | 314 | // check we have the post value |
| 316 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 317 | - else{ global $post;} |
|
| 315 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 318 | 316 | |
| 319 | 317 | if(!is_array($cf) && $cf!=''){ |
| 320 | 318 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -403,8 +401,7 @@ discard block |
||
| 403 | 401 | function geodir_cf_time($html,$location,$cf,$p=''){ |
| 404 | 402 | |
| 405 | 403 | // check we have the post value |
| 406 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 407 | - else{ global $post;} |
|
| 404 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 408 | 405 | |
| 409 | 406 | if(!is_array($cf) && $cf!=''){ |
| 410 | 407 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -457,9 +454,10 @@ discard block |
||
| 457 | 454 | if ($post->{$cf['htmlvar_name']}): |
| 458 | 455 | |
| 459 | 456 | $value = ''; |
| 460 | - if ($post->{$cf['htmlvar_name']} != '') |
|
| 461 | - //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
| 457 | + if ($post->{$cf['htmlvar_name']} != '') { |
|
| 458 | + //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
| 462 | 459 | $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']})); |
| 460 | + } |
|
| 463 | 461 | |
| 464 | 462 | $field_icon = geodir_field_icon_proccess($cf); |
| 465 | 463 | if (strpos($field_icon, 'http') !== false) { |
@@ -498,8 +496,7 @@ discard block |
||
| 498 | 496 | function geodir_cf_datepicker($html,$location,$cf,$p=''){ |
| 499 | 497 | global $preview; |
| 500 | 498 | // check we have the post value |
| 501 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 502 | - else{ global $post;} |
|
| 499 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 503 | 500 | |
| 504 | 501 | if(!is_array($cf) && $cf!=''){ |
| 505 | 502 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -566,7 +563,7 @@ discard block |
||
| 566 | 563 | $date_format = str_replace($search, $replace, $date_format); |
| 567 | 564 | |
| 568 | 565 | $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
| 569 | - }else{ |
|
| 566 | + } else{ |
|
| 570 | 567 | $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
| 571 | 568 | } |
| 572 | 569 | |
@@ -575,7 +572,7 @@ discard block |
||
| 575 | 572 | $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
| 576 | 573 | //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
| 577 | 574 | //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
| 578 | - }else{ |
|
| 575 | + } else{ |
|
| 579 | 576 | return ''; |
| 580 | 577 | } |
| 581 | 578 | |
@@ -618,8 +615,7 @@ discard block |
||
| 618 | 615 | function geodir_cf_text($html,$location,$cf,$p=''){ |
| 619 | 616 | |
| 620 | 617 | // check we have the post value |
| 621 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 622 | - else{ global $post;} |
|
| 618 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 623 | 619 | |
| 624 | 620 | if(!is_array($cf) && $cf!=''){ |
| 625 | 621 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -725,8 +721,7 @@ discard block |
||
| 725 | 721 | function geodir_cf_radio($html,$location,$cf,$p=''){ |
| 726 | 722 | |
| 727 | 723 | // check we have the post value |
| 728 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 729 | - else{ global $post;} |
|
| 724 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 730 | 725 | |
| 731 | 726 | if(!is_array($cf) && $cf!=''){ |
| 732 | 727 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -834,8 +829,7 @@ discard block |
||
| 834 | 829 | function geodir_cf_select($html,$location,$cf,$p=''){ |
| 835 | 830 | |
| 836 | 831 | // check we have the post value |
| 837 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 838 | - else{ global $post;} |
|
| 832 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 839 | 833 | |
| 840 | 834 | if(!is_array($cf) && $cf!=''){ |
| 841 | 835 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -936,8 +930,7 @@ discard block |
||
| 936 | 930 | function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
| 937 | 931 | |
| 938 | 932 | // check we have the post value |
| 939 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 940 | - else{ global $post;} |
|
| 933 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 941 | 934 | |
| 942 | 935 | if(!is_array($cf) && $cf!=''){ |
| 943 | 936 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1063,8 +1056,7 @@ discard block |
||
| 1063 | 1056 | function geodir_cf_email($html,$location,$cf,$p=''){ |
| 1064 | 1057 | |
| 1065 | 1058 | // check we have the post value |
| 1066 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1067 | - else{ global $post;} |
|
| 1059 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1068 | 1060 | |
| 1069 | 1061 | if(!is_array($cf) && $cf!=''){ |
| 1070 | 1062 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1201,11 +1193,11 @@ discard block |
||
| 1201 | 1193 | $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
| 1202 | 1194 | if($location=='mapbubble'){ |
| 1203 | 1195 | $html .= "<a href=\"mailto:$email\">$email_name</a>"; |
| 1204 | - }else{ |
|
| 1196 | + } else{ |
|
| 1205 | 1197 | $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
| 1206 | 1198 | } |
| 1207 | 1199 | |
| 1208 | - }else{ |
|
| 1200 | + } else{ |
|
| 1209 | 1201 | $html .= $email; |
| 1210 | 1202 | } |
| 1211 | 1203 | $html .= '</span></div>'; |
@@ -1233,8 +1225,7 @@ discard block |
||
| 1233 | 1225 | function geodir_cf_file($html,$location,$cf,$p=''){ |
| 1234 | 1226 | |
| 1235 | 1227 | // check we have the post value |
| 1236 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1237 | - else{ global $post;} |
|
| 1228 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1238 | 1229 | |
| 1239 | 1230 | if(!is_array($cf) && $cf!=''){ |
| 1240 | 1231 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1327,7 +1318,7 @@ discard block |
||
| 1327 | 1318 | $file_paths .= '</a>'; |
| 1328 | 1319 | //$file_paths .= '<img src="'.$file.'" />'; |
| 1329 | 1320 | $file_paths .= '</div>'; |
| 1330 | - }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
| 1321 | + } elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio |
|
| 1331 | 1322 | $ext_path = '_' . $html_var . '_'; |
| 1332 | 1323 | $filename = explode($ext_path, $filename); |
| 1333 | 1324 | $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>'; |
@@ -1380,8 +1371,7 @@ discard block |
||
| 1380 | 1371 | function geodir_cf_textarea($html,$location,$cf,$p=''){ |
| 1381 | 1372 | |
| 1382 | 1373 | // check we have the post value |
| 1383 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1384 | - else{ global $post;} |
|
| 1374 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1385 | 1375 | |
| 1386 | 1376 | if(!is_array($cf) && $cf!=''){ |
| 1387 | 1377 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1471,8 +1461,7 @@ discard block |
||
| 1471 | 1461 | function geodir_cf_html($html,$location,$cf,$p=''){ |
| 1472 | 1462 | |
| 1473 | 1463 | // check we have the post value |
| 1474 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1475 | - else{ global $post;} |
|
| 1464 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1476 | 1465 | |
| 1477 | 1466 | if(!is_array($cf) && $cf!=''){ |
| 1478 | 1467 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1561,8 +1550,7 @@ discard block |
||
| 1561 | 1550 | function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
| 1562 | 1551 | |
| 1563 | 1552 | // check we have the post value |
| 1564 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1565 | - else{ global $post;} |
|
| 1553 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1566 | 1554 | |
| 1567 | 1555 | if(!is_array($cf) && $cf!=''){ |
| 1568 | 1556 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -1685,8 +1673,7 @@ discard block |
||
| 1685 | 1673 | function geodir_cf_address($html,$location,$cf,$p=''){ |
| 1686 | 1674 | |
| 1687 | 1675 | // check we have the post value |
| 1688 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1689 | - else{ global $post;} |
|
| 1676 | + if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;} |
|
| 1690 | 1677 | |
| 1691 | 1678 | if(!is_array($cf) && $cf!=''){ |
| 1692 | 1679 | $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
@@ -27,92 +27,92 @@ discard block |
||
| 27 | 27 | <form name="send_to_frnd" id="send_to_frnd" action="<?php echo get_permalink($post_info->ID); ?>" method="post"> |
| 28 | 28 | |
| 29 | 29 | <?php |
| 30 | - wp_nonce_field( 'send_to_frnd_'.$post_info->ID ); |
|
| 31 | - ?> |
|
| 30 | + wp_nonce_field( 'send_to_frnd_'.$post_info->ID ); |
|
| 31 | + ?> |
|
| 32 | 32 | |
| 33 | 33 | <input type="hidden" name="sendact" value="email_frnd"/> |
| 34 | 34 | <input type="hidden" id="send_to_Frnd_pid" name="pid" value="<?php echo $post_info->ID;?>"/> |
| 35 | 35 | |
| 36 | 36 | <h3><?php |
| 37 | - /** |
|
| 38 | - * Filter the title for the send to friend popup form. |
|
| 39 | - * |
|
| 40 | - * @since 1.0.0 |
|
| 41 | - * @param string $title The title for the form, defaults to global `SEND_TO_FRIEND` text. |
|
| 42 | - */ |
|
| 43 | - echo apply_filters('geodir_send_to_friend_page_title', SEND_TO_FRIEND);?></h3> |
|
| 37 | + /** |
|
| 38 | + * Filter the title for the send to friend popup form. |
|
| 39 | + * |
|
| 40 | + * @since 1.0.0 |
|
| 41 | + * @param string $title The title for the form, defaults to global `SEND_TO_FRIEND` text. |
|
| 42 | + */ |
|
| 43 | + echo apply_filters('geodir_send_to_friend_page_title', SEND_TO_FRIEND);?></h3> |
|
| 44 | 44 | |
| 45 | 45 | <p id="reply_send_success" class="sucess_msg" style="display:none;"></p> |
| 46 | 46 | <?php |
| 47 | - /** |
|
| 48 | - * Called before each field in the send to friend popup template. |
|
| 49 | - * |
|
| 50 | - * @since 1.0.0 |
|
| 51 | - * @param string $field The field name the actions is called before. |
|
| 52 | - */ |
|
| 53 | - do_action('geodir_before_stf_form_field', 'to_name');?> |
|
| 47 | + /** |
|
| 48 | + * Called before each field in the send to friend popup template. |
|
| 49 | + * |
|
| 50 | + * @since 1.0.0 |
|
| 51 | + * @param string $field The field name the actions is called before. |
|
| 52 | + */ |
|
| 53 | + do_action('geodir_before_stf_form_field', 'to_name');?> |
|
| 54 | 54 | <div class="row clearfix"> |
| 55 | 55 | <input required field_type="text" name="to_name" id="to_name" type="text" value="" placeholder="<?php _e('Friend Name', 'geodirectory');?>"/> |
| 56 | 56 | </div> |
| 57 | 57 | <?php |
| 58 | - /** |
|
| 59 | - * Called after each field in the send to friend popup template. |
|
| 60 | - * |
|
| 61 | - * @since 1.0.0 |
|
| 62 | - * @param string $field The field name the actions is called after. |
|
| 63 | - */ |
|
| 64 | - do_action('geodir_after_stf_form_field', 'to_name');?> |
|
| 58 | + /** |
|
| 59 | + * Called after each field in the send to friend popup template. |
|
| 60 | + * |
|
| 61 | + * @since 1.0.0 |
|
| 62 | + * @param string $field The field name the actions is called after. |
|
| 63 | + */ |
|
| 64 | + do_action('geodir_after_stf_form_field', 'to_name');?> |
|
| 65 | 65 | <?php |
| 66 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 67 | - do_action('geodir_before_stf_form_field', 'to_email');?> |
|
| 66 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 67 | + do_action('geodir_before_stf_form_field', 'to_email');?> |
|
| 68 | 68 | <div class="row clearfix"> |
| 69 | 69 | <input required field_type="email" name="to_email" id="to_email" type="email" value="" placeholder="<?php _e('Friend Email', 'geodirectory');?>"/> |
| 70 | 70 | </div> |
| 71 | 71 | <?php |
| 72 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 73 | - do_action('geodir_after_stf_form_field', 'to_email');?> |
|
| 72 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 73 | + do_action('geodir_after_stf_form_field', 'to_email');?> |
|
| 74 | 74 | <?php |
| 75 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 76 | - do_action('geodir_before_stf_form_field', 'yourname');?> |
|
| 75 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 76 | + do_action('geodir_before_stf_form_field', 'yourname');?> |
|
| 77 | 77 | <div class="row clearfix"> |
| 78 | 78 | <input required field_type="text" name="yourname" id="yourname" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/> |
| 79 | 79 | </div> |
| 80 | 80 | <?php |
| 81 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 82 | - do_action('geodir_after_stf_form_field', 'yourname');?> |
|
| 81 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 82 | + do_action('geodir_after_stf_form_field', 'yourname');?> |
|
| 83 | 83 | <?php |
| 84 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 85 | - do_action('geodir_before_stf_form_field', 'youremail');?> |
|
| 84 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 85 | + do_action('geodir_before_stf_form_field', 'youremail');?> |
|
| 86 | 86 | <div class="row clearfix"> |
| 87 | 87 | <input required field_type="email" name="youremail" id="youremail" type="email" value="" placeholder="<?php _e('Your Email', 'geodirectory');?>"/> |
| 88 | 88 | </div> |
| 89 | 89 | <?php |
| 90 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 91 | - do_action('geodir_after_stf_form_field', 'youremail');?> |
|
| 90 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 91 | + do_action('geodir_after_stf_form_field', 'youremail');?> |
|
| 92 | 92 | <?php |
| 93 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 94 | - do_action('geodir_before_stf_form_field', 'frnd_subject');?> |
|
| 93 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 94 | + do_action('geodir_before_stf_form_field', 'frnd_subject');?> |
|
| 95 | 95 | <div class="row clearfix"> |
| 96 | 96 | <input required field_type="text" name="frnd_subject" |
| 97 | 97 | value="<?php echo __('About', 'geodirectory') . ' ' . $post_info->post_title;?>" |
| 98 | 98 | id="frnd_subject" type="text" placeholder="<?php _e('Subject', 'geodirectory');?>"/> |
| 99 | 99 | </div> |
| 100 | 100 | <?php |
| 101 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 102 | - do_action('geodir_after_stf_form_field', 'frnd_subject');?> |
|
| 101 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 102 | + do_action('geodir_after_stf_form_field', 'frnd_subject');?> |
|
| 103 | 103 | <?php |
| 104 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 105 | - do_action('geodir_before_stf_form_field', 'frnd_comments');?> |
|
| 104 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 105 | + do_action('geodir_before_stf_form_field', 'frnd_comments');?> |
|
| 106 | 106 | <div class="row clearfix"> |
| 107 | 107 | <textarea required field_type="textarea" name="frnd_comments" id="frnd_comments" cols="" |
| 108 | 108 | rows="" placeholder="<?php echo SEND_TO_FRIEND_SAMPLE_CONTENT;?>"><?php echo SEND_TO_FRIEND_SAMPLE_CONTENT;?></textarea> |
| 109 | 109 | </div> |
| 110 | 110 | <?php |
| 111 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 112 | - do_action('geodir_after_stf_form_field', 'frnd_comments');?> |
|
| 111 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 112 | + do_action('geodir_after_stf_form_field', 'frnd_comments');?> |
|
| 113 | 113 | <?php if (function_exists('geodir_get_captch')) { |
| 114 | - geodir_get_captch('-1'); |
|
| 115 | - }?> |
|
| 114 | + geodir_get_captch('-1'); |
|
| 115 | + }?> |
|
| 116 | 116 | <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory')?> " class="button "/> |
| 117 | 117 | </form> |
| 118 | 118 | </div> <?php |
@@ -124,68 +124,68 @@ discard block |
||
| 124 | 124 | action="<?php echo get_permalink($post_info->ID); ?>"> |
| 125 | 125 | |
| 126 | 126 | <?php |
| 127 | - wp_nonce_field( 'send_inquiry_'.$post_info->ID ); |
|
| 128 | - ?> |
|
| 127 | + wp_nonce_field( 'send_inquiry_'.$post_info->ID ); |
|
| 128 | + ?> |
|
| 129 | 129 | <input type="hidden" name="sendact" value="send_inqury"/> |
| 130 | 130 | <input type="hidden" name="pid" value="<?php echo $post_info->ID;?>"/> |
| 131 | 131 | |
| 132 | 132 | <h3><?php |
| 133 | - /** |
|
| 134 | - * Filter the title for the send inquiry popup form. |
|
| 135 | - * |
|
| 136 | - * @since 1.0.0 |
|
| 137 | - * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
|
| 138 | - */ |
|
| 139 | - echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
| 133 | + /** |
|
| 134 | + * Filter the title for the send inquiry popup form. |
|
| 135 | + * |
|
| 136 | + * @since 1.0.0 |
|
| 137 | + * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
|
| 138 | + */ |
|
| 139 | + echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
| 140 | 140 | |
| 141 | 141 | <p id="inquiry_send_success" class="sucess_msg" style="display:none;"></p> |
| 142 | 142 | <?php |
| 143 | - /** |
|
| 144 | - * Called before each field in the send to friend inquiry template. |
|
| 145 | - * |
|
| 146 | - * @since 1.0.0 |
|
| 147 | - * @param string $field The field name the actions is called before. |
|
| 148 | - */ |
|
| 149 | - do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
| 143 | + /** |
|
| 144 | + * Called before each field in the send to friend inquiry template. |
|
| 145 | + * |
|
| 146 | + * @since 1.0.0 |
|
| 147 | + * @param string $field The field name the actions is called before. |
|
| 148 | + */ |
|
| 149 | + do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
| 150 | 150 | <div class="row clearfix"> |
| 151 | 151 | <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/> |
| 152 | 152 | </div> |
| 153 | 153 | <?php |
| 154 | - /** |
|
| 155 | - * Called after each field in the send to friend inquiry template. |
|
| 156 | - * |
|
| 157 | - * @since 1.0.0 |
|
| 158 | - * @param string $field The field name the actions is called after. |
|
| 159 | - */ |
|
| 160 | - do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
| 154 | + /** |
|
| 155 | + * Called after each field in the send to friend inquiry template. |
|
| 156 | + * |
|
| 157 | + * @since 1.0.0 |
|
| 158 | + * @param string $field The field name the actions is called after. |
|
| 159 | + */ |
|
| 160 | + do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
| 161 | 161 | <?php |
| 162 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 163 | - do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
| 162 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 163 | + do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
| 164 | 164 | <div class="row clearfix"> |
| 165 | 165 | <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory');?>"/> |
| 166 | 166 | </div> |
| 167 | 167 | <?php |
| 168 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 169 | - do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
| 168 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 169 | + do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
| 170 | 170 | <?php |
| 171 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 172 | - do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
| 171 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 172 | + do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
| 173 | 173 | <div class="row clearfix"> |
| 174 | 174 | <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory');?>"/> |
| 175 | 175 | </div> |
| 176 | 176 | <?php |
| 177 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 178 | - do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
| 177 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 178 | + do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
| 179 | 179 | <?php |
| 180 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 181 | - do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
| 180 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 181 | + do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
| 182 | 182 | <div class="row clearfix"> |
| 183 | 183 | <textarea required field_type="textarea" name="inq_msg" cols="" |
| 184 | 184 | rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT;?>"></textarea> |
| 185 | 185 | </div> |
| 186 | 186 | <?php |
| 187 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 188 | - do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
| 187 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 188 | + do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
| 189 | 189 | <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory');?>" |
| 190 | 190 | class="button clearfix"/> |
| 191 | 191 | </form> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @param int $post_id The post id requested by the popup. |
| 20 | 20 | * @param object $post_info The post object requested by the popup. |
| 21 | 21 | */ |
| 22 | -do_action('geodir_popup_forms_template_start',$post_id,$post_info); |
|
| 22 | +do_action('geodir_popup_forms_template_start', $post_id, $post_info); |
|
| 23 | 23 | |
| 24 | 24 | if ($_REQUEST['popuptype'] == 'b_sendtofriend') { ?> |
| 25 | 25 | |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | <form name="send_to_frnd" id="send_to_frnd" action="<?php echo get_permalink($post_info->ID); ?>" method="post"> |
| 28 | 28 | |
| 29 | 29 | <?php |
| 30 | - wp_nonce_field( 'send_to_frnd_'.$post_info->ID ); |
|
| 30 | + wp_nonce_field('send_to_frnd_'.$post_info->ID); |
|
| 31 | 31 | ?> |
| 32 | 32 | |
| 33 | 33 | <input type="hidden" name="sendact" value="email_frnd"/> |
| 34 | - <input type="hidden" id="send_to_Frnd_pid" name="pid" value="<?php echo $post_info->ID;?>"/> |
|
| 34 | + <input type="hidden" id="send_to_Frnd_pid" name="pid" value="<?php echo $post_info->ID; ?>"/> |
|
| 35 | 35 | |
| 36 | 36 | <h3><?php |
| 37 | 37 | /** |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @since 1.0.0 |
| 41 | 41 | * @param string $title The title for the form, defaults to global `SEND_TO_FRIEND` text. |
| 42 | 42 | */ |
| 43 | - echo apply_filters('geodir_send_to_friend_page_title', SEND_TO_FRIEND);?></h3> |
|
| 43 | + echo apply_filters('geodir_send_to_friend_page_title', SEND_TO_FRIEND); ?></h3> |
|
| 44 | 44 | |
| 45 | 45 | <p id="reply_send_success" class="sucess_msg" style="display:none;"></p> |
| 46 | 46 | <?php |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * @since 1.0.0 |
| 51 | 51 | * @param string $field The field name the actions is called before. |
| 52 | 52 | */ |
| 53 | - do_action('geodir_before_stf_form_field', 'to_name');?> |
|
| 53 | + do_action('geodir_before_stf_form_field', 'to_name'); ?> |
|
| 54 | 54 | <div class="row clearfix"> |
| 55 | - <input required field_type="text" name="to_name" id="to_name" type="text" value="" placeholder="<?php _e('Friend Name', 'geodirectory');?>"/> |
|
| 55 | + <input required field_type="text" name="to_name" id="to_name" type="text" value="" placeholder="<?php _e('Friend Name', 'geodirectory'); ?>"/> |
|
| 56 | 56 | </div> |
| 57 | 57 | <?php |
| 58 | 58 | /** |
@@ -61,55 +61,55 @@ discard block |
||
| 61 | 61 | * @since 1.0.0 |
| 62 | 62 | * @param string $field The field name the actions is called after. |
| 63 | 63 | */ |
| 64 | - do_action('geodir_after_stf_form_field', 'to_name');?> |
|
| 64 | + do_action('geodir_after_stf_form_field', 'to_name'); ?> |
|
| 65 | 65 | <?php |
| 66 | 66 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 67 | - do_action('geodir_before_stf_form_field', 'to_email');?> |
|
| 67 | + do_action('geodir_before_stf_form_field', 'to_email'); ?> |
|
| 68 | 68 | <div class="row clearfix"> |
| 69 | - <input required field_type="email" name="to_email" id="to_email" type="email" value="" placeholder="<?php _e('Friend Email', 'geodirectory');?>"/> |
|
| 69 | + <input required field_type="email" name="to_email" id="to_email" type="email" value="" placeholder="<?php _e('Friend Email', 'geodirectory'); ?>"/> |
|
| 70 | 70 | </div> |
| 71 | 71 | <?php |
| 72 | 72 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 73 | - do_action('geodir_after_stf_form_field', 'to_email');?> |
|
| 73 | + do_action('geodir_after_stf_form_field', 'to_email'); ?> |
|
| 74 | 74 | <?php |
| 75 | 75 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 76 | - do_action('geodir_before_stf_form_field', 'yourname');?> |
|
| 76 | + do_action('geodir_before_stf_form_field', 'yourname'); ?> |
|
| 77 | 77 | <div class="row clearfix"> |
| 78 | - <input required field_type="text" name="yourname" id="yourname" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/> |
|
| 78 | + <input required field_type="text" name="yourname" id="yourname" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory'); ?>"/> |
|
| 79 | 79 | </div> |
| 80 | 80 | <?php |
| 81 | 81 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 82 | - do_action('geodir_after_stf_form_field', 'yourname');?> |
|
| 82 | + do_action('geodir_after_stf_form_field', 'yourname'); ?> |
|
| 83 | 83 | <?php |
| 84 | 84 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 85 | - do_action('geodir_before_stf_form_field', 'youremail');?> |
|
| 85 | + do_action('geodir_before_stf_form_field', 'youremail'); ?> |
|
| 86 | 86 | <div class="row clearfix"> |
| 87 | - <input required field_type="email" name="youremail" id="youremail" type="email" value="" placeholder="<?php _e('Your Email', 'geodirectory');?>"/> |
|
| 87 | + <input required field_type="email" name="youremail" id="youremail" type="email" value="" placeholder="<?php _e('Your Email', 'geodirectory'); ?>"/> |
|
| 88 | 88 | </div> |
| 89 | 89 | <?php |
| 90 | 90 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 91 | - do_action('geodir_after_stf_form_field', 'youremail');?> |
|
| 91 | + do_action('geodir_after_stf_form_field', 'youremail'); ?> |
|
| 92 | 92 | <?php |
| 93 | 93 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 94 | - do_action('geodir_before_stf_form_field', 'frnd_subject');?> |
|
| 94 | + do_action('geodir_before_stf_form_field', 'frnd_subject'); ?> |
|
| 95 | 95 | <div class="row clearfix"> |
| 96 | 96 | <input required field_type="text" name="frnd_subject" |
| 97 | - value="<?php echo __('About', 'geodirectory') . ' ' . $post_info->post_title;?>" |
|
| 98 | - id="frnd_subject" type="text" placeholder="<?php _e('Subject', 'geodirectory');?>"/> |
|
| 97 | + value="<?php echo __('About', 'geodirectory').' '.$post_info->post_title; ?>" |
|
| 98 | + id="frnd_subject" type="text" placeholder="<?php _e('Subject', 'geodirectory'); ?>"/> |
|
| 99 | 99 | </div> |
| 100 | 100 | <?php |
| 101 | 101 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 102 | - do_action('geodir_after_stf_form_field', 'frnd_subject');?> |
|
| 102 | + do_action('geodir_after_stf_form_field', 'frnd_subject'); ?> |
|
| 103 | 103 | <?php |
| 104 | 104 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 105 | - do_action('geodir_before_stf_form_field', 'frnd_comments');?> |
|
| 105 | + do_action('geodir_before_stf_form_field', 'frnd_comments'); ?> |
|
| 106 | 106 | <div class="row clearfix"> |
| 107 | 107 | <textarea required field_type="textarea" name="frnd_comments" id="frnd_comments" cols="" |
| 108 | - rows="" placeholder="<?php echo SEND_TO_FRIEND_SAMPLE_CONTENT;?>"><?php echo SEND_TO_FRIEND_SAMPLE_CONTENT;?></textarea> |
|
| 108 | + rows="" placeholder="<?php echo SEND_TO_FRIEND_SAMPLE_CONTENT; ?>"><?php echo SEND_TO_FRIEND_SAMPLE_CONTENT; ?></textarea> |
|
| 109 | 109 | </div> |
| 110 | 110 | <?php |
| 111 | 111 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 112 | - do_action('geodir_after_stf_form_field', 'frnd_comments');?> |
|
| 112 | + do_action('geodir_after_stf_form_field', 'frnd_comments'); ?> |
|
| 113 | 113 | <?php if (function_exists('geodir_get_captch')) { |
| 114 | 114 | geodir_get_captch('-1'); |
| 115 | 115 | }?> |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | action="<?php echo get_permalink($post_info->ID); ?>"> |
| 125 | 125 | |
| 126 | 126 | <?php |
| 127 | - wp_nonce_field( 'send_inquiry_'.$post_info->ID ); |
|
| 127 | + wp_nonce_field('send_inquiry_'.$post_info->ID); |
|
| 128 | 128 | ?> |
| 129 | 129 | <input type="hidden" name="sendact" value="send_inqury"/> |
| 130 | - <input type="hidden" name="pid" value="<?php echo $post_info->ID;?>"/> |
|
| 130 | + <input type="hidden" name="pid" value="<?php echo $post_info->ID; ?>"/> |
|
| 131 | 131 | |
| 132 | 132 | <h3><?php |
| 133 | 133 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @since 1.0.0 |
| 137 | 137 | * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
| 138 | 138 | */ |
| 139 | - echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
| 139 | + echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY); ?> </h3> |
|
| 140 | 140 | |
| 141 | 141 | <p id="inquiry_send_success" class="sucess_msg" style="display:none;"></p> |
| 142 | 142 | <?php |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | * @since 1.0.0 |
| 147 | 147 | * @param string $field The field name the actions is called before. |
| 148 | 148 | */ |
| 149 | - do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
| 149 | + do_action('geodir_before_inquiry_form_field', 'inq_name'); ?> |
|
| 150 | 150 | <div class="row clearfix"> |
| 151 | - <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/> |
|
| 151 | + <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory'); ?>"/> |
|
| 152 | 152 | </div> |
| 153 | 153 | <?php |
| 154 | 154 | /** |
@@ -157,36 +157,36 @@ discard block |
||
| 157 | 157 | * @since 1.0.0 |
| 158 | 158 | * @param string $field The field name the actions is called after. |
| 159 | 159 | */ |
| 160 | - do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
| 160 | + do_action('geodir_after_inquiry_form_field', 'inq_name'); ?> |
|
| 161 | 161 | <?php |
| 162 | 162 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 163 | - do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
| 163 | + do_action('geodir_before_inquiry_form_field', 'inq_email'); ?> |
|
| 164 | 164 | <div class="row clearfix"> |
| 165 | - <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory');?>"/> |
|
| 165 | + <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory'); ?>"/> |
|
| 166 | 166 | </div> |
| 167 | 167 | <?php |
| 168 | 168 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 169 | - do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
| 169 | + do_action('geodir_after_inquiry_form_field', 'inq_email'); ?> |
|
| 170 | 170 | <?php |
| 171 | 171 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 172 | - do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
| 172 | + do_action('geodir_before_inquiry_form_field', 'inq_phone'); ?> |
|
| 173 | 173 | <div class="row clearfix"> |
| 174 | - <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory');?>"/> |
|
| 174 | + <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory'); ?>"/> |
|
| 175 | 175 | </div> |
| 176 | 176 | <?php |
| 177 | 177 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 178 | - do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
| 178 | + do_action('geodir_after_inquiry_form_field', 'inq_phone'); ?> |
|
| 179 | 179 | <?php |
| 180 | 180 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 181 | - do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
| 181 | + do_action('geodir_before_inquiry_form_field', 'inq_msg'); ?> |
|
| 182 | 182 | <div class="row clearfix"> |
| 183 | 183 | <textarea required field_type="textarea" name="inq_msg" cols="" |
| 184 | - rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT;?>"></textarea> |
|
| 184 | + rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT; ?>"></textarea> |
|
| 185 | 185 | </div> |
| 186 | 186 | <?php |
| 187 | 187 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 188 | - do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
| 189 | - <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory');?>" |
|
| 188 | + do_action('geodir_after_inquiry_form_field', 'inq_msg'); ?> |
|
| 189 | + <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory'); ?>" |
|
| 190 | 190 | class="button clearfix"/> |
| 191 | 191 | </form> |
| 192 | 192 | </div> <?php |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function geodir_divi_signup_body_class($classes) |
| 21 | 21 | { |
| 22 | - if (geodir_is_page('login')) { |
|
| 23 | - $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
| 24 | - $classes[] = 'divi-gd-signup'; |
|
| 25 | - } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
| 26 | - $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
|
| 27 | - } |
|
| 28 | - return $classes; |
|
| 22 | + if (geodir_is_page('login')) { |
|
| 23 | + $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
| 24 | + $classes[] = 'divi-gd-signup'; |
|
| 25 | + } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
| 26 | + $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
|
| 27 | + } |
|
| 28 | + return $classes; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | add_action('geodir_wrapper_close', 'geodir_divi_action_wrapper_close', 11); |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function geodir_divi_action_wrapper_close() |
| 39 | 39 | { |
| 40 | - if (geodir_is_page('login')) { |
|
| 41 | - // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
| 42 | - echo '</div></div>'; |
|
| 43 | - } |
|
| 40 | + if (geodir_is_page('login')) { |
|
| 41 | + // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
| 42 | + echo '</div></div>'; |
|
| 43 | + } |
|
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | if (geodir_is_page('login')) { |
| 23 | 23 | $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
| 24 | 24 | $classes[] = 'divi-gd-signup'; |
| 25 | - } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) { |
|
| 25 | + } else if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
| 26 | 26 | $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar'; |
| 27 | 27 | } |
| 28 | 28 | return $classes; |
@@ -17,26 +17,26 @@ discard block |
||
| 17 | 17 | function gd_compat_php_genesis() |
| 18 | 18 | { |
| 19 | 19 | // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS |
| 20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - // make top section wide |
|
| 29 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 30 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 31 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
| 32 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
| 33 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
| 34 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
| 28 | + // make top section wide |
|
| 29 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 30 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 31 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
| 32 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
| 33 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
| 34 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
| 35 | 35 | |
| 36 | - // REMOVE PAGE TITLES |
|
| 37 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 38 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 39 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 36 | + // REMOVE PAGE TITLES |
|
| 37 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 38 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 39 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | } |
@@ -53,25 +53,25 @@ discard block |
||
| 53 | 53 | function gd_genesis_compat_left_sidebars() |
| 54 | 54 | { |
| 55 | 55 | |
| 56 | - if (is_page_geodir_home()) { |
|
| 57 | - remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
| 58 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
| 59 | - } elseif (geodir_is_page('location')) { |
|
| 60 | - remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
| 61 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
| 62 | - } elseif (geodir_is_page('listing')) { |
|
| 63 | - remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
| 64 | - add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
| 65 | - } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
| 66 | - //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
| 67 | - //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
| 68 | - } elseif (geodir_is_page('search')) { |
|
| 69 | - remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
| 70 | - add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
| 71 | - } elseif (geodir_is_page('author')) { |
|
| 72 | - remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
| 73 | - add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
| 74 | - } |
|
| 56 | + if (is_page_geodir_home()) { |
|
| 57 | + remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
| 58 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
| 59 | + } elseif (geodir_is_page('location')) { |
|
| 60 | + remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
| 61 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
| 62 | + } elseif (geodir_is_page('listing')) { |
|
| 63 | + remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
| 64 | + add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
| 65 | + } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
| 66 | + //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
| 67 | + //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
| 68 | + } elseif (geodir_is_page('search')) { |
|
| 69 | + remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
| 70 | + add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
| 71 | + } elseif (geodir_is_page('author')) { |
|
| 72 | + remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
| 73 | + add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | } |
@@ -88,68 +88,68 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | function geodir_set_body_scs($classes) |
| 90 | 90 | { |
| 91 | - $remove_class = false; |
|
| 92 | - $new_class = ''; |
|
| 93 | - if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
| 94 | - $remove_class = true; |
|
| 95 | - if (get_option('geodir_show_home_left_section')) { |
|
| 96 | - $new_class .= 'sidebar-'; |
|
| 97 | - } |
|
| 98 | - if (get_option('geodir_show_home_contant_section')) { |
|
| 99 | - $new_class .= 'content'; |
|
| 100 | - } |
|
| 101 | - if (get_option('geodir_show_home_right_section')) { |
|
| 102 | - $new_class .= '-sidebar'; |
|
| 103 | - } |
|
| 104 | - } elseif (geodir_is_page('listing')) { |
|
| 105 | - $remove_class = true; |
|
| 106 | - if (get_option('geodir_show_listing_left_section')) { |
|
| 107 | - $new_class .= 'sidebar-'; |
|
| 108 | - } |
|
| 109 | - $new_class .= 'content'; |
|
| 110 | - if (get_option('geodir_show_listing_right_section')) { |
|
| 111 | - $new_class .= '-sidebar'; |
|
| 112 | - } |
|
| 113 | - } elseif (geodir_is_page('detail')) { |
|
| 114 | - $remove_class = true; |
|
| 115 | - if (get_option('geodir_detail_sidebar_left_section')) { |
|
| 116 | - $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
| 117 | - } else { |
|
| 118 | - $new_class .= 'content-sidebar'; |
|
| 119 | - } |
|
| 120 | - } elseif (geodir_is_page('search')) { |
|
| 121 | - $remove_class = true; |
|
| 122 | - if (get_option('geodir_show_search_left_section')) { |
|
| 123 | - $new_class .= 'sidebar-'; |
|
| 124 | - } |
|
| 125 | - $new_class .= 'content'; |
|
| 126 | - if (get_option('geodir_show_search_right_section')) { |
|
| 127 | - $new_class .= '-sidebar'; |
|
| 128 | - } |
|
| 129 | - } elseif (geodir_is_page('author')) { |
|
| 130 | - $remove_class = true; |
|
| 131 | - if (get_option('geodir_show_author_left_section')) { |
|
| 132 | - $new_class .= 'sidebar-'; |
|
| 133 | - } |
|
| 134 | - $new_class .= 'content'; |
|
| 135 | - if (get_option('geodir_show_author_right_section')) { |
|
| 136 | - $new_class .= '-sidebar'; |
|
| 137 | - } |
|
| 138 | - } elseif (geodir_is_page('add-listing')) { |
|
| 139 | - $remove_class = true; |
|
| 140 | - $new_class .= 'content-sidebar'; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - if ($remove_class) { |
|
| 144 | - $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
| 145 | - if ( $new_class == 'content' ) { |
|
| 146 | - $new_class = 'content-no-sidebar'; |
|
| 147 | - $classes[] = 'full-width-content'; |
|
| 148 | - } |
|
| 149 | - $classes[] = $new_class; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - return $classes; |
|
| 91 | + $remove_class = false; |
|
| 92 | + $new_class = ''; |
|
| 93 | + if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) { |
|
| 94 | + $remove_class = true; |
|
| 95 | + if (get_option('geodir_show_home_left_section')) { |
|
| 96 | + $new_class .= 'sidebar-'; |
|
| 97 | + } |
|
| 98 | + if (get_option('geodir_show_home_contant_section')) { |
|
| 99 | + $new_class .= 'content'; |
|
| 100 | + } |
|
| 101 | + if (get_option('geodir_show_home_right_section')) { |
|
| 102 | + $new_class .= '-sidebar'; |
|
| 103 | + } |
|
| 104 | + } elseif (geodir_is_page('listing')) { |
|
| 105 | + $remove_class = true; |
|
| 106 | + if (get_option('geodir_show_listing_left_section')) { |
|
| 107 | + $new_class .= 'sidebar-'; |
|
| 108 | + } |
|
| 109 | + $new_class .= 'content'; |
|
| 110 | + if (get_option('geodir_show_listing_right_section')) { |
|
| 111 | + $new_class .= '-sidebar'; |
|
| 112 | + } |
|
| 113 | + } elseif (geodir_is_page('detail')) { |
|
| 114 | + $remove_class = true; |
|
| 115 | + if (get_option('geodir_detail_sidebar_left_section')) { |
|
| 116 | + $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
| 117 | + } else { |
|
| 118 | + $new_class .= 'content-sidebar'; |
|
| 119 | + } |
|
| 120 | + } elseif (geodir_is_page('search')) { |
|
| 121 | + $remove_class = true; |
|
| 122 | + if (get_option('geodir_show_search_left_section')) { |
|
| 123 | + $new_class .= 'sidebar-'; |
|
| 124 | + } |
|
| 125 | + $new_class .= 'content'; |
|
| 126 | + if (get_option('geodir_show_search_right_section')) { |
|
| 127 | + $new_class .= '-sidebar'; |
|
| 128 | + } |
|
| 129 | + } elseif (geodir_is_page('author')) { |
|
| 130 | + $remove_class = true; |
|
| 131 | + if (get_option('geodir_show_author_left_section')) { |
|
| 132 | + $new_class .= 'sidebar-'; |
|
| 133 | + } |
|
| 134 | + $new_class .= 'content'; |
|
| 135 | + if (get_option('geodir_show_author_right_section')) { |
|
| 136 | + $new_class .= '-sidebar'; |
|
| 137 | + } |
|
| 138 | + } elseif (geodir_is_page('add-listing')) { |
|
| 139 | + $remove_class = true; |
|
| 140 | + $new_class .= 'content-sidebar'; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + if ($remove_class) { |
|
| 144 | + $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
| 145 | + if ( $new_class == 'content' ) { |
|
| 146 | + $new_class = 'content-no-sidebar'; |
|
| 147 | + $classes[] = 'full-width-content'; |
|
| 148 | + } |
|
| 149 | + $classes[] = $new_class; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + return $classes; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | add_action('genesis_after_header', 'gd_genesis_compat_add_top_section_back', 11); |
@@ -162,17 +162,17 @@ discard block |
||
| 162 | 162 | function gd_genesis_compat_add_top_section_back() |
| 163 | 163 | { |
| 164 | 164 | |
| 165 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 166 | - geodir_action_geodir_sidebar_home_top(); |
|
| 167 | - } elseif (geodir_is_page('listing')) { |
|
| 168 | - geodir_action_geodir_sidebar_listings_top(); |
|
| 169 | - } elseif (geodir_is_page('detail')) { |
|
| 170 | - geodir_action_geodir_sidebar_detail_top(); |
|
| 171 | - } elseif (geodir_is_page('search')) { |
|
| 172 | - geodir_action_geodir_sidebar_search_top(); |
|
| 173 | - } elseif (geodir_is_page('author')) { |
|
| 174 | - geodir_action_geodir_sidebar_author_top(); |
|
| 175 | - } |
|
| 165 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 166 | + geodir_action_geodir_sidebar_home_top(); |
|
| 167 | + } elseif (geodir_is_page('listing')) { |
|
| 168 | + geodir_action_geodir_sidebar_listings_top(); |
|
| 169 | + } elseif (geodir_is_page('detail')) { |
|
| 170 | + geodir_action_geodir_sidebar_detail_top(); |
|
| 171 | + } elseif (geodir_is_page('search')) { |
|
| 172 | + geodir_action_geodir_sidebar_search_top(); |
|
| 173 | + } elseif (geodir_is_page('author')) { |
|
| 174 | + geodir_action_geodir_sidebar_author_top(); |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | } |
@@ -185,12 +185,12 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | function geodir_replace_breadcrumb() |
| 187 | 187 | { |
| 188 | - if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
| 189 | - } else { |
|
| 190 | - echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
| 191 | - geodir_breadcrumb(); |
|
| 192 | - echo '</div></div>'; |
|
| 193 | - } |
|
| 188 | + if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
| 189 | + } else { |
|
| 190 | + echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
| 191 | + geodir_breadcrumb(); |
|
| 192 | + echo '</div></div>'; |
|
| 193 | + } |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // Force Full Width on signup page |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | function geodir_genesis_meta() |
| 205 | 205 | { |
| 206 | - if (geodir_is_page('login')) { |
|
| 207 | - add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
| 208 | - } |
|
| 206 | + if (geodir_is_page('login')) { |
|
| 207 | + add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
| 208 | + } |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | function geodir_add_listing_page_title_genesis_before() |
| 219 | 219 | { |
| 220 | 220 | |
| 221 | - echo "<div class='entry' >"; |
|
| 221 | + echo "<div class='entry' >"; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | function geodir_add_listing_form_genesis_after() |
| 233 | 233 | { |
| 234 | 234 | |
| 235 | - echo "</div>"; |
|
| 235 | + echo "</div>"; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
@@ -251,38 +251,38 @@ discard block |
||
| 251 | 251 | { |
| 252 | 252 | |
| 253 | 253 | |
| 254 | - $title = ''; |
|
| 255 | - $subtitle = ''; |
|
| 256 | - |
|
| 257 | - if (geodir_is_page('listing')) { |
|
| 258 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 259 | - geodir_action_listings_title(); |
|
| 260 | - echo '</div>'; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - if (geodir_is_page('add-listing')) { |
|
| 264 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 265 | - geodir_action_add_listing_page_title(); |
|
| 266 | - echo '</div>'; |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - if (geodir_is_page('author')) { |
|
| 270 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 271 | - geodir_action_author_page_title(); |
|
| 272 | - echo '</div>'; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
| 276 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 277 | - echo get_the_title(); |
|
| 278 | - echo '</div>'; |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - if (geodir_is_page('search')) { |
|
| 282 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 283 | - geodir_action_search_page_title(); |
|
| 284 | - echo '</div>'; |
|
| 285 | - } |
|
| 254 | + $title = ''; |
|
| 255 | + $subtitle = ''; |
|
| 256 | + |
|
| 257 | + if (geodir_is_page('listing')) { |
|
| 258 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 259 | + geodir_action_listings_title(); |
|
| 260 | + echo '</div>'; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + if (geodir_is_page('add-listing')) { |
|
| 264 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 265 | + geodir_action_add_listing_page_title(); |
|
| 266 | + echo '</div>'; |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + if (geodir_is_page('author')) { |
|
| 270 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 271 | + geodir_action_author_page_title(); |
|
| 272 | + echo '</div>'; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
| 276 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 277 | + echo get_the_title(); |
|
| 278 | + echo '</div>'; |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + if (geodir_is_page('search')) { |
|
| 282 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 283 | + geodir_action_search_page_title(); |
|
| 284 | + echo '</div>'; |
|
| 285 | + } |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | function gd_genesis_listing_page_title_bar() |
| 297 | 297 | { |
| 298 | - geodir_action_listings_title(); |
|
| 299 | - //geodir_action_listings_description(); |
|
| 298 | + geodir_action_listings_title(); |
|
| 299 | + //geodir_action_listings_description(); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | |
@@ -309,19 +309,19 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | function gd_compat_php_genesis_geo_1280_fix() |
| 311 | 311 | { |
| 312 | - if (function_exists('geo1280_search_bar')) { |
|
| 313 | - remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
| 314 | - add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
| 312 | + if (function_exists('geo1280_search_bar')) { |
|
| 313 | + remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
| 314 | + add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
| 315 | 315 | |
| 316 | - // |
|
| 316 | + // |
|
| 317 | 317 | |
| 318 | - remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
| 319 | - remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
| 320 | - add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
| 318 | + remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
| 319 | + remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
| 320 | + add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
| 321 | 321 | |
| 322 | - remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
| 323 | - add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
| 324 | - } |
|
| 322 | + remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
| 323 | + add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
| 324 | + } |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | function geo1280_search_bar_fix() |
| 334 | 334 | { |
| 335 | 335 | |
| 336 | - echo '<div class="geo1280-placeholder"></div>'; |
|
| 337 | - if (is_active_sidebar('search-bar')) { |
|
| 338 | - genesis_widget_area('search-bar', array( |
|
| 339 | - 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
| 340 | - 'after' => '</div></div>', |
|
| 341 | - )); |
|
| 342 | - } |
|
| 336 | + echo '<div class="geo1280-placeholder"></div>'; |
|
| 337 | + if (is_active_sidebar('search-bar')) { |
|
| 338 | + genesis_widget_area('search-bar', array( |
|
| 339 | + 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
| 340 | + 'after' => '</div></div>', |
|
| 341 | + )); |
|
| 342 | + } |
|
| 343 | 343 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | |
| 143 | 143 | if ($remove_class) { |
| 144 | 144 | $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
| 145 | - if ( $new_class == 'content' ) { |
|
| 145 | + if ($new_class == 'content') { |
|
| 146 | 146 | $new_class = 'content-no-sidebar'; |
| 147 | 147 | $classes[] = 'full-width-content'; |
| 148 | 148 | } |
@@ -13,34 +13,34 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function geodir_user_favourite_listing_count($user_id=false) |
| 15 | 15 | { |
| 16 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 16 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 17 | 17 | |
| 18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
| 19 | - if(!$user_id){return array();} |
|
| 18 | + if(!$user_id){$user_id = $current_user->ID;} |
|
| 19 | + if(!$user_id){return array();} |
|
| 20 | 20 | |
| 21 | - $site_id = ''; |
|
| 22 | - if ( is_multisite() ) { |
|
| 23 | - $blog_id = get_current_blog_id(); |
|
| 24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 25 | - } |
|
| 21 | + $site_id = ''; |
|
| 22 | + if ( is_multisite() ) { |
|
| 23 | + $blog_id = get_current_blog_id(); |
|
| 24 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - $user_favorites = geodir_get_user_favourites($user_id); |
|
| 28 | - $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
| 27 | + $user_favorites = geodir_get_user_favourites($user_id); |
|
| 28 | + $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
| 29 | 29 | |
| 30 | - $user_listing = array(); |
|
| 31 | - if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
| 32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
| 30 | + $user_listing = array(); |
|
| 31 | + if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
| 32 | + $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
| 33 | 33 | |
| 34 | - foreach ($all_posts as $ptype) { |
|
| 35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
| 34 | + foreach ($all_posts as $ptype) { |
|
| 35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
| 36 | 36 | |
| 37 | - if ($total_posts > 0) { |
|
| 38 | - $user_listing[$ptype] = $total_posts; |
|
| 39 | - } |
|
| 40 | - } |
|
| 41 | - } |
|
| 37 | + if ($total_posts > 0) { |
|
| 38 | + $user_listing[$ptype] = $total_posts; |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - return $user_listing; |
|
| 43 | + return $user_listing; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -50,48 +50,48 @@ discard block |
||
| 50 | 50 | * @package GeoDirectory |
| 51 | 51 | */ |
| 52 | 52 | function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
| 53 | - // My Favourites in Dashboard |
|
| 54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
| 55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
| 56 | - |
|
| 57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
| 58 | - $favourite_links = $output_type == 'link' ? array() : ''; |
|
| 59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 60 | - |
|
| 61 | - $author_link = get_author_posts_url( $user_id ); |
|
| 62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 63 | - |
|
| 64 | - foreach ( $post_types as $key => $postobj ) { |
|
| 65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
| 66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
| 67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * Filter favorite listing link. |
|
| 71 | - * |
|
| 72 | - * @since 1.0.0 |
|
| 73 | - * @param string $post_type_link Favorite listing link. |
|
| 74 | - * @param string $key Favorite listing array key. |
|
| 75 | - * @param int $current_user->ID Current user ID. |
|
| 76 | - */ |
|
| 77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
| 78 | - |
|
| 79 | - if ( $output_type == 'select' ) { |
|
| 80 | - $selected = ''; |
|
| 81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
| 82 | - $selected = 'selected="selected"'; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
| 86 | - } elseif ( $output_type == 'link' ) { |
|
| 87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - if ( ! empty( $favourite_links ) ) { |
|
| 93 | - if ( $output_type == 'select' ) { |
|
| 94 | - ?> |
|
| 53 | + // My Favourites in Dashboard |
|
| 54 | + $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
| 55 | + $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
| 56 | + |
|
| 57 | + if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
| 58 | + $favourite_links = $output_type == 'link' ? array() : ''; |
|
| 59 | + $post_types = geodir_get_posttypes( 'object' ); |
|
| 60 | + |
|
| 61 | + $author_link = get_author_posts_url( $user_id ); |
|
| 62 | + $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 63 | + |
|
| 64 | + foreach ( $post_types as $key => $postobj ) { |
|
| 65 | + if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
| 66 | + $name = __( $postobj->labels->name, 'geodirectory' ); |
|
| 67 | + $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * Filter favorite listing link. |
|
| 71 | + * |
|
| 72 | + * @since 1.0.0 |
|
| 73 | + * @param string $post_type_link Favorite listing link. |
|
| 74 | + * @param string $key Favorite listing array key. |
|
| 75 | + * @param int $current_user->ID Current user ID. |
|
| 76 | + */ |
|
| 77 | + $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
| 78 | + |
|
| 79 | + if ( $output_type == 'select' ) { |
|
| 80 | + $selected = ''; |
|
| 81 | + if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
| 82 | + $selected = 'selected="selected"'; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
| 86 | + } elseif ( $output_type == 'link' ) { |
|
| 87 | + $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + if ( ! empty( $favourite_links ) ) { |
|
| 93 | + if ( $output_type == 'select' ) { |
|
| 94 | + ?> |
|
| 95 | 95 | <li> |
| 96 | 96 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
| 97 | 97 | <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
@@ -99,55 +99,55 @@ discard block |
||
| 99 | 99 | </select> |
| 100 | 100 | </li> |
| 101 | 101 | <?php |
| 102 | - } elseif ( $output_type == 'link' ) { |
|
| 103 | - echo implode( " | ", $favourite_links ); |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - } |
|
| 102 | + } elseif ( $output_type == 'link' ) { |
|
| 103 | + echo implode( " | ", $favourite_links ); |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
| 110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
| 111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
| 112 | - |
|
| 113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
| 114 | - $listing_links = $output_type == 'link' ? array() : ''; |
|
| 115 | - |
|
| 116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 117 | - |
|
| 118 | - $author_link = get_author_posts_url( $user_id ); |
|
| 119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 120 | - |
|
| 121 | - foreach ( $post_types as $key => $postobj ) { |
|
| 122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
| 123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
| 124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Filter my listing link. |
|
| 128 | - * |
|
| 129 | - * @since 1.0.0 |
|
| 130 | - * @param string $listing_link My listing link. |
|
| 131 | - * @param string $key My listing array key. |
|
| 132 | - * @param int $current_user->ID Current user ID. |
|
| 133 | - */ |
|
| 134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
| 135 | - if ( $output_type == 'select' ) { |
|
| 136 | - $selected = ''; |
|
| 137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
| 138 | - $selected = 'selected="selected"'; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
| 142 | - } elseif ( $output_type == 'link' ) { |
|
| 143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - if ( ! empty( $listing_links ) ) { |
|
| 149 | - if ( $output_type == 'select' ) { |
|
| 150 | - ?> |
|
| 110 | + $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
| 111 | + $user_listing = geodir_user_post_listing_count( $user_id ); |
|
| 112 | + |
|
| 113 | + if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
| 114 | + $listing_links = $output_type == 'link' ? array() : ''; |
|
| 115 | + |
|
| 116 | + $post_types = geodir_get_posttypes( 'object' ); |
|
| 117 | + |
|
| 118 | + $author_link = get_author_posts_url( $user_id ); |
|
| 119 | + $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 120 | + |
|
| 121 | + foreach ( $post_types as $key => $postobj ) { |
|
| 122 | + if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
| 123 | + $name = __( $postobj->labels->name, 'geodirectory' ); |
|
| 124 | + $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Filter my listing link. |
|
| 128 | + * |
|
| 129 | + * @since 1.0.0 |
|
| 130 | + * @param string $listing_link My listing link. |
|
| 131 | + * @param string $key My listing array key. |
|
| 132 | + * @param int $current_user->ID Current user ID. |
|
| 133 | + */ |
|
| 134 | + $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
| 135 | + if ( $output_type == 'select' ) { |
|
| 136 | + $selected = ''; |
|
| 137 | + if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
| 138 | + $selected = 'selected="selected"'; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
| 142 | + } elseif ( $output_type == 'link' ) { |
|
| 143 | + $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + if ( ! empty( $listing_links ) ) { |
|
| 149 | + if ( $output_type == 'select' ) { |
|
| 150 | + ?> |
|
| 151 | 151 | <li> |
| 152 | 152 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
| 153 | 153 | <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | </select> |
| 156 | 156 | </li> |
| 157 | 157 | <?php |
| 158 | - } elseif ( $output_type == 'link' ) { |
|
| 159 | - echo implode( " | ", $listing_links ); |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - } |
|
| 158 | + } elseif ( $output_type == 'link' ) { |
|
| 159 | + echo implode( " | ", $listing_links ); |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | * @return mixed |
| 171 | 171 | */ |
| 172 | 172 | function geodir_get_user_favourites($user_id=''){ |
| 173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
| 174 | - $site_id = ''; |
|
| 175 | - if ( is_multisite() ) { |
|
| 176 | - $blog_id = get_current_blog_id(); |
|
| 177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
| 173 | + if(!$user_id){$user_id = get_current_user_id();} |
|
| 174 | + $site_id = ''; |
|
| 175 | + if ( is_multisite() ) { |
|
| 176 | + $blog_id = get_current_blog_id(); |
|
| 177 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
| 181 | 181 | } |
| 182 | 182 | \ No newline at end of file |
@@ -11,17 +11,17 @@ discard block |
||
| 11 | 11 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 12 | 12 | * @return array User listing count for each post type. |
| 13 | 13 | */ |
| 14 | -function geodir_user_favourite_listing_count($user_id=false) |
|
| 14 | +function geodir_user_favourite_listing_count($user_id = false) |
|
| 15 | 15 | { |
| 16 | 16 | global $wpdb, $plugin_prefix, $current_user; |
| 17 | 17 | |
| 18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
| 19 | - if(!$user_id){return array();} |
|
| 18 | + if (!$user_id) {$user_id = $current_user->ID; } |
|
| 19 | + if (!$user_id) {return array(); } |
|
| 20 | 20 | |
| 21 | 21 | $site_id = ''; |
| 22 | - if ( is_multisite() ) { |
|
| 22 | + if (is_multisite()) { |
|
| 23 | 23 | $blog_id = get_current_blog_id(); |
| 24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 24 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $user_favorites = geodir_get_user_favourites($user_id); |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $user_listing = array(); |
| 31 | 31 | if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
| 32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
| 32 | + $user_favorites = "'".implode("','", $user_favorites)."'"; |
|
| 33 | 33 | |
| 34 | 34 | foreach ($all_posts as $ptype) { |
| 35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
| 35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_type='".$ptype."' AND post_status = 'publish' AND ID IN (".$user_favorites.")"); |
|
| 36 | 36 | |
| 37 | 37 | if ($total_posts > 0) { |
| 38 | 38 | $user_listing[$ptype] = $total_posts; |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | * @since 1.5.9 |
| 50 | 50 | * @package GeoDirectory |
| 51 | 51 | */ |
| 52 | -function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
|
| 52 | +function geodir_user_show_favourites($user_id = '', $output_type = 'select') { |
|
| 53 | 53 | // My Favourites in Dashboard |
| 54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
| 55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
| 54 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
| 55 | + $user_favourite = geodir_user_favourite_listing_count($user_id); |
|
| 56 | 56 | |
| 57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
| 57 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
| 58 | 58 | $favourite_links = $output_type == 'link' ? array() : ''; |
| 59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 59 | + $post_types = geodir_get_posttypes('object'); |
|
| 60 | 60 | |
| 61 | - $author_link = get_author_posts_url( $user_id ); |
|
| 62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 61 | + $author_link = get_author_posts_url($user_id); |
|
| 62 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
| 63 | 63 | |
| 64 | - foreach ( $post_types as $key => $postobj ) { |
|
| 65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
| 66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
| 67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
| 64 | + foreach ($post_types as $key => $postobj) { |
|
| 65 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
| 66 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
| 67 | + $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * Filter favorite listing link. |
@@ -74,54 +74,54 @@ discard block |
||
| 74 | 74 | * @param string $key Favorite listing array key. |
| 75 | 75 | * @param int $current_user->ID Current user ID. |
| 76 | 76 | */ |
| 77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
| 77 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id); |
|
| 78 | 78 | |
| 79 | - if ( $output_type == 'select' ) { |
|
| 79 | + if ($output_type == 'select') { |
|
| 80 | 80 | $selected = ''; |
| 81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
| 81 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
| 82 | 82 | $selected = 'selected="selected"'; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
| 86 | - } elseif ( $output_type == 'link' ) { |
|
| 87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
| 85 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.$name.'</option>'; |
|
| 86 | + } elseif ($output_type == 'link') { |
|
| 87 | + $favourite_links[] = '<a href="'.$post_type_link.'">'.$name.'</a>'; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if ( ! empty( $favourite_links ) ) { |
|
| 93 | - if ( $output_type == 'select' ) { |
|
| 92 | + if (!empty($favourite_links)) { |
|
| 93 | + if ($output_type == 'select') { |
|
| 94 | 94 | ?> |
| 95 | 95 | <li> |
| 96 | - <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
|
| 97 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
| 96 | + <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Favorites', 'geodirectory'); ?>"> |
|
| 97 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Favorites", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
| 98 | 98 | <?php echo $favourite_links; ?> |
| 99 | 99 | </select> |
| 100 | 100 | </li> |
| 101 | 101 | <?php |
| 102 | - } elseif ( $output_type == 'link' ) { |
|
| 103 | - echo implode( " | ", $favourite_links ); |
|
| 102 | + } elseif ($output_type == 'link') { |
|
| 103 | + echo implode(" | ", $favourite_links); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | -function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
|
| 110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
| 111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
| 109 | +function geodir_user_show_listings($user_id = '', $output_type = 'select') { |
|
| 110 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
| 111 | + $user_listing = geodir_user_post_listing_count($user_id); |
|
| 112 | 112 | |
| 113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
| 113 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
| 114 | 114 | $listing_links = $output_type == 'link' ? array() : ''; |
| 115 | 115 | |
| 116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 116 | + $post_types = geodir_get_posttypes('object'); |
|
| 117 | 117 | |
| 118 | - $author_link = get_author_posts_url( $user_id ); |
|
| 119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 118 | + $author_link = get_author_posts_url($user_id); |
|
| 119 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
| 120 | 120 | |
| 121 | - foreach ( $post_types as $key => $postobj ) { |
|
| 122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
| 123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
| 124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
| 121 | + foreach ($post_types as $key => $postobj) { |
|
| 122 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
| 123 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
| 124 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Filter my listing link. |
@@ -131,32 +131,32 @@ discard block |
||
| 131 | 131 | * @param string $key My listing array key. |
| 132 | 132 | * @param int $current_user->ID Current user ID. |
| 133 | 133 | */ |
| 134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
| 135 | - if ( $output_type == 'select' ) { |
|
| 134 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id); |
|
| 135 | + if ($output_type == 'select') { |
|
| 136 | 136 | $selected = ''; |
| 137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
| 137 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
| 138 | 138 | $selected = 'selected="selected"'; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
| 142 | - } elseif ( $output_type == 'link' ) { |
|
| 143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
| 141 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.$name.'</option>'; |
|
| 142 | + } elseif ($output_type == 'link') { |
|
| 143 | + $listing_links[] = '<a href="'.$listing_link.'">'.$name.'</a>'; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( ! empty( $listing_links ) ) { |
|
| 149 | - if ( $output_type == 'select' ) { |
|
| 148 | + if (!empty($listing_links)) { |
|
| 149 | + if ($output_type == 'select') { |
|
| 150 | 150 | ?> |
| 151 | 151 | <li> |
| 152 | - <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
|
| 153 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
| 152 | + <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Listings', 'geodirectory'); ?>"> |
|
| 153 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Listings", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
| 154 | 154 | <?php echo $listing_links; ?> |
| 155 | 155 | </select> |
| 156 | 156 | </li> |
| 157 | 157 | <?php |
| 158 | - } elseif ( $output_type == 'link' ) { |
|
| 159 | - echo implode( " | ", $listing_links ); |
|
| 158 | + } elseif ($output_type == 'link') { |
|
| 159 | + echo implode(" | ", $listing_links); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | * @since 1.6.24 |
| 170 | 170 | * @return mixed |
| 171 | 171 | */ |
| 172 | -function geodir_get_user_favourites($user_id=''){ |
|
| 173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
| 172 | +function geodir_get_user_favourites($user_id = '') { |
|
| 173 | + if (!$user_id) {$user_id = get_current_user_id(); } |
|
| 174 | 174 | $site_id = ''; |
| 175 | - if ( is_multisite() ) { |
|
| 175 | + if (is_multisite()) { |
|
| 176 | 176 | $blog_id = get_current_blog_id(); |
| 177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 177 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |