@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Template functions |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * Template functions |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Locates template based on the template type. |
@@ -29,21 +29,21 @@ discard block |
||
29 | 29 | case 'add-listing': |
30 | 30 | |
31 | 31 | $sc_post_type = ''; |
32 | - if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) { |
|
32 | + if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) { |
|
33 | 33 | $listing_page_id = $post->ID; |
34 | 34 | |
35 | - $regex_pattern = get_shortcode_regex(); |
|
36 | - preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches); |
|
35 | + $regex_pattern = get_shortcode_regex(); |
|
36 | + preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches); |
|
37 | 37 | |
38 | - if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) { |
|
39 | - $shortcode_atts = shortcode_parse_atts($regex_matches[3]); |
|
40 | - $sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : ''; |
|
41 | - } |
|
38 | + if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) { |
|
39 | + $shortcode_atts = shortcode_parse_atts($regex_matches[3]); |
|
40 | + $sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : ''; |
|
41 | + } |
|
42 | 42 | } else { |
43 | 43 | $listing_page_id = geodir_add_listing_page_id(); |
44 | 44 | } |
45 | 45 | |
46 | - $is_wpml = function_exists('icl_object_id') ? true : false; |
|
46 | + $is_wpml = function_exists('icl_object_id') ? true : false; |
|
47 | 47 | |
48 | 48 | if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type']) |
49 | 49 | && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | if (!empty($post_types)) |
56 | 56 | $post_type = $post_types[0]; |
57 | 57 | |
58 | - if($sc_post_type != '' ) |
|
59 | - $post_type = $sc_post_type; |
|
58 | + if($sc_post_type != '' ) |
|
59 | + $post_type = $sc_post_type; |
|
60 | 60 | |
61 | 61 | if ($is_wpml && !empty($wp->query_vars['page_id'])) { |
62 | - wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type))); |
|
63 | - } else { |
|
64 | - wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type); |
|
65 | - } |
|
62 | + wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type))); |
|
63 | + } else { |
|
64 | + wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type); |
|
65 | + } |
|
66 | 66 | exit(); |
67 | 67 | } |
68 | 68 | return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php")); |
@@ -481,21 +481,21 @@ discard block |
||
481 | 481 | */ |
482 | 482 | function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) { |
483 | 483 | if ($favorite) { |
484 | - $message = __('No favorite listings found which match your selection.', 'geodirectory'); |
|
485 | - } else { |
|
486 | - $message = __('No listings found which match your selection.', 'geodirectory'); |
|
487 | - } |
|
484 | + $message = __('No favorite listings found which match your selection.', 'geodirectory'); |
|
485 | + } else { |
|
486 | + $message = __('No listings found which match your selection.', 'geodirectory'); |
|
487 | + } |
|
488 | 488 | |
489 | - /** |
|
490 | - * Filter the no listing found message. |
|
491 | - * |
|
492 | - * @since 1.5.5 |
|
493 | - * @param string $template_listview Listing listview template. |
|
494 | - * @param bool $favorite Are favorite listings results? |
|
495 | - */ |
|
496 | - $message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite); |
|
489 | + /** |
|
490 | + * Filter the no listing found message. |
|
491 | + * |
|
492 | + * @since 1.5.5 |
|
493 | + * @param string $template_listview Listing listview template. |
|
494 | + * @param bool $favorite Are favorite listings results? |
|
495 | + */ |
|
496 | + $message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite); |
|
497 | 497 | |
498 | - echo '<li class="no-listing">' . $message . '</li>'; |
|
498 | + echo '<li class="no-listing">' . $message . '</li>'; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | /** |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | * @return string Breadcrumb HTML. |
510 | 510 | */ |
511 | 511 | function geodir_strip_breadcrumb_li_wrappers($breadcrumb, $separator) { |
512 | - $breadcrumb = str_replace(array('</li><li>', '</li> <li>'), '', $breadcrumb); |
|
512 | + $breadcrumb = str_replace(array('</li><li>', '</li> <li>'), '', $breadcrumb); |
|
513 | 513 | |
514 | - return $breadcrumb; |
|
514 | + return $breadcrumb; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
@@ -522,30 +522,30 @@ discard block |
||
522 | 522 | * @return string Listing listview class. |
523 | 523 | */ |
524 | 524 | function geodir_convert_listing_view_class($columns = '') { |
525 | - $class = ''; |
|
525 | + $class = ''; |
|
526 | 526 | |
527 | - switch ((int)$columns) { |
|
528 | - case 1: |
|
529 | - $class = ''; |
|
530 | - break; |
|
531 | - case 2: |
|
532 | - $class = 'gridview_onehalf'; |
|
533 | - break; |
|
534 | - case 3: |
|
535 | - $class = 'gridview_onethird'; |
|
536 | - break; |
|
537 | - case 4: |
|
538 | - $class = 'gridview_onefourth'; |
|
539 | - break; |
|
540 | - case 5: |
|
541 | - $class = 'gridview_onefifth'; |
|
542 | - break; |
|
543 | - default: |
|
544 | - $class = ''; |
|
545 | - break; |
|
546 | - } |
|
527 | + switch ((int)$columns) { |
|
528 | + case 1: |
|
529 | + $class = ''; |
|
530 | + break; |
|
531 | + case 2: |
|
532 | + $class = 'gridview_onehalf'; |
|
533 | + break; |
|
534 | + case 3: |
|
535 | + $class = 'gridview_onethird'; |
|
536 | + break; |
|
537 | + case 4: |
|
538 | + $class = 'gridview_onefourth'; |
|
539 | + break; |
|
540 | + case 5: |
|
541 | + $class = 'gridview_onefifth'; |
|
542 | + break; |
|
543 | + default: |
|
544 | + $class = ''; |
|
545 | + break; |
|
546 | + } |
|
547 | 547 | |
548 | - return $class; |
|
548 | + return $class; |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -558,18 +558,18 @@ discard block |
||
558 | 558 | * @return bool Modified value for display the excerpt. |
559 | 559 | */ |
560 | 560 | function geodir_show_listing_post_excerpt($display, $view, $post) { |
561 | - if ($view == 'listview') { |
|
562 | - if (geodir_is_page('author')) { |
|
563 | - $word_limit = get_option('geodir_author_desc_word_limit'); |
|
564 | - } else { |
|
565 | - $word_limit = get_option('geodir_desc_word_limit'); |
|
566 | - } |
|
561 | + if ($view == 'listview') { |
|
562 | + if (geodir_is_page('author')) { |
|
563 | + $word_limit = get_option('geodir_author_desc_word_limit'); |
|
564 | + } else { |
|
565 | + $word_limit = get_option('geodir_desc_word_limit'); |
|
566 | + } |
|
567 | 567 | |
568 | - if ($word_limit !== '' && ($word_limit == 0 || $word_limit == '0')) { |
|
569 | - $display = false; |
|
570 | - } |
|
571 | - } |
|
572 | - return $display; |
|
568 | + if ($word_limit !== '' && ($word_limit == 0 || $word_limit == '0')) { |
|
569 | + $display = false; |
|
570 | + } |
|
571 | + } |
|
572 | + return $display; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | /** |
@@ -584,24 +584,24 @@ discard block |
||
584 | 584 | * @return string Rating icons html content. |
585 | 585 | */ |
586 | 586 | function geodir_font_awesome_rating_form_html($html, $star_texts = array(), $default = '') { |
587 | - if (get_option('geodir_reviewrating_enable_font_awesome') == '1') { |
|
588 | - $html = '<select class="gd-fa-rating">'; |
|
589 | - $html .= '<option value=""></option>'; |
|
590 | - if (!empty($star_texts) && is_array($star_texts)) { |
|
591 | - foreach ($star_texts as $i => $text) { |
|
592 | - $html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>'; |
|
593 | - } |
|
594 | - } else { |
|
595 | - $html .= '<option value="1">1</option>'; |
|
596 | - $html .= '<option value="2">2</option>'; |
|
597 | - $html .= '<option value="3">3</option>'; |
|
598 | - $html .= '<option value="4">4</option>'; |
|
599 | - $html .= '<option value="5">5</option>'; |
|
600 | - } |
|
601 | - $html .= '</select>'; |
|
602 | - } |
|
603 | - |
|
604 | - return $html; |
|
587 | + if (get_option('geodir_reviewrating_enable_font_awesome') == '1') { |
|
588 | + $html = '<select class="gd-fa-rating">'; |
|
589 | + $html .= '<option value=""></option>'; |
|
590 | + if (!empty($star_texts) && is_array($star_texts)) { |
|
591 | + foreach ($star_texts as $i => $text) { |
|
592 | + $html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>'; |
|
593 | + } |
|
594 | + } else { |
|
595 | + $html .= '<option value="1">1</option>'; |
|
596 | + $html .= '<option value="2">2</option>'; |
|
597 | + $html .= '<option value="3">3</option>'; |
|
598 | + $html .= '<option value="4">4</option>'; |
|
599 | + $html .= '<option value="5">5</option>'; |
|
600 | + } |
|
601 | + $html .= '</select>'; |
|
602 | + } |
|
603 | + |
|
604 | + return $html; |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | /** |
@@ -616,20 +616,20 @@ discard block |
||
616 | 616 | * @return string Rating icons html content. |
617 | 617 | */ |
618 | 618 | function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) { |
619 | - if (get_option('geodir_reviewrating_enable_font_awesome') == '1') { |
|
620 | - $rating = min($rating, $star_count); |
|
621 | - $full_stars = floor( $rating ); |
|
622 | - $half_stars = ceil( $rating - $full_stars ); |
|
623 | - $empty_stars = $star_count - $full_stars - $half_stars; |
|
619 | + if (get_option('geodir_reviewrating_enable_font_awesome') == '1') { |
|
620 | + $rating = min($rating, $star_count); |
|
621 | + $full_stars = floor( $rating ); |
|
622 | + $half_stars = ceil( $rating - $full_stars ); |
|
623 | + $empty_stars = $star_count - $full_stars - $half_stars; |
|
624 | 624 | |
625 | - $html = '<div class="gd-star-rating gd-fa-star-rating">'; |
|
626 | - $html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars ); |
|
627 | - $html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars ); |
|
628 | - $html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars); |
|
629 | - $html .= '</div>'; |
|
630 | - } |
|
631 | - |
|
632 | - return $html; |
|
625 | + $html = '<div class="gd-star-rating gd-fa-star-rating">'; |
|
626 | + $html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars ); |
|
627 | + $html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars ); |
|
628 | + $html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars); |
|
629 | + $html .= '</div>'; |
|
630 | + } |
|
631 | + |
|
632 | + return $html; |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | /** |
@@ -639,12 +639,12 @@ discard block |
||
639 | 639 | * @package GeoDirectory |
640 | 640 | */ |
641 | 641 | function geodir_font_awesome_rating_css() { |
642 | - // Font awesome rating style |
|
643 | - if (get_option('geodir_reviewrating_enable_font_awesome') == '1') { |
|
644 | - $full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575'); |
|
645 | - if ($full_color != '#757575') { |
|
646 | - echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after, |
|
642 | + // Font awesome rating style |
|
643 | + if (get_option('geodir_reviewrating_enable_font_awesome') == '1') { |
|
644 | + $full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575'); |
|
645 | + if ($full_color != '#757575') { |
|
646 | + echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after, |
|
647 | 647 | .gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;</style>'; |
648 | - } |
|
649 | - } |
|
648 | + } |
|
649 | + } |
|
650 | 650 | } |
651 | 651 | \ No newline at end of file |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | |
185 | 185 | wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
186 | 186 | if ($is_detail_page) { |
187 | - wp_enqueue_script('geodirectory-post-custom-js'); |
|
188 | - } |
|
187 | + wp_enqueue_script('geodirectory-post-custom-js'); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | // font awesome rating script |
191 | - if (get_option('geodir_reviewrating_enable_font_awesome')) { |
|
192 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
193 | - wp_enqueue_script('geodir-barrating-js'); |
|
194 | - } else { // default rating script |
|
195 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
196 | - wp_enqueue_script('geodir-jRating-js'); |
|
197 | - } |
|
191 | + if (get_option('geodir_reviewrating_enable_font_awesome')) { |
|
192 | + wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
193 | + wp_enqueue_script('geodir-barrating-js'); |
|
194 | + } else { // default rating script |
|
195 | + wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
196 | + wp_enqueue_script('geodir-jRating-js'); |
|
197 | + } |
|
198 | 198 | |
199 | 199 | wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
200 | 200 | wp_enqueue_script('geodir-on-document-load'); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | function geodir_footer_scripts() |
232 | 232 | { |
233 | - echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
233 | + echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
234 | 234 | echo stripslashes(get_option('geodir_footer_scripts')); |
235 | 235 | } |
236 | 236 | |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | return; |
364 | 364 | |
365 | 365 | if (!is_single()) { |
366 | - if (function_exists('geodir_location_geo_home_link')) { |
|
367 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
368 | - } |
|
366 | + if (function_exists('geodir_location_geo_home_link')) { |
|
367 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
368 | + } |
|
369 | 369 | $numposts = $wp_query->found_posts; |
370 | 370 | |
371 | 371 | |
@@ -376,22 +376,22 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | if ($max_page > 1 || $always_show) { |
379 | - // Extra pagination info |
|
380 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
381 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
382 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
379 | + // Extra pagination info |
|
380 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
381 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
382 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
383 | 383 | |
384 | - if ($geodir_pagination_more_info != '') { |
|
385 | - $pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>'; |
|
384 | + if ($geodir_pagination_more_info != '') { |
|
385 | + $pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>'; |
|
386 | 386 | |
387 | - if ($geodir_pagination_more_info == 'before') { |
|
388 | - $before = $before . $pagination_info; |
|
389 | - } else if ($geodir_pagination_more_info == 'after') { |
|
390 | - $after = $pagination_info . $after; |
|
391 | - } |
|
392 | - } |
|
387 | + if ($geodir_pagination_more_info == 'before') { |
|
388 | + $before = $before . $pagination_info; |
|
389 | + } else if ($geodir_pagination_more_info == 'after') { |
|
390 | + $after = $pagination_info . $after; |
|
391 | + } |
|
392 | + } |
|
393 | 393 | |
394 | - echo "$before <div class='Navi'>"; |
|
394 | + echo "$before <div class='Navi'>"; |
|
395 | 395 | if ($paged >= ($pages_to_show - 1)) { |
396 | 396 | echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
397 | 397 | } |
@@ -412,9 +412,9 @@ discard block |
||
412 | 412 | echo "</div> $after"; |
413 | 413 | } |
414 | 414 | |
415 | - if (function_exists('geodir_location_geo_home_link')) { |
|
416 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
417 | - } |
|
415 | + if (function_exists('geodir_location_geo_home_link')) { |
|
416 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
417 | + } |
|
418 | 418 | } |
419 | 419 | } |
420 | 420 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin functions. |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * Admin functions. |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Updates option value when GeoDirectory get deactivated. |
@@ -132,14 +132,14 @@ discard block |
||
132 | 132 | wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION); |
133 | 133 | wp_enqueue_script('geodirectory-goMap-script'); |
134 | 134 | |
135 | - // font awesome rating script |
|
136 | - if (get_option('geodir_reviewrating_enable_font_awesome')) { |
|
137 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION); |
|
138 | - wp_enqueue_script('geodir-barrating-js'); |
|
139 | - } else { // default rating script |
|
140 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION); |
|
141 | - wp_enqueue_script('geodir-jRating-js'); |
|
142 | - } |
|
135 | + // font awesome rating script |
|
136 | + if (get_option('geodir_reviewrating_enable_font_awesome')) { |
|
137 | + wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION); |
|
138 | + wp_enqueue_script('geodir-barrating-js'); |
|
139 | + } else { // default rating script |
|
140 | + wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION); |
|
141 | + wp_enqueue_script('geodir-jRating-js'); |
|
142 | + } |
|
143 | 143 | |
144 | 144 | wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION); |
145 | 145 | wp_enqueue_script('geodir-on-document-load'); |
@@ -337,13 +337,13 @@ discard block |
||
337 | 337 | flush_rewrite_rules(false); |
338 | 338 | |
339 | 339 | break; |
340 | - case 'fail': |
|
341 | - $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
|
340 | + case 'fail': |
|
341 | + $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
|
342 | 342 | |
343 | - if ($gderr == 21) |
|
344 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>'; |
|
345 | - else |
|
346 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>'; |
|
343 | + if ($gderr == 21) |
|
344 | + echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>'; |
|
345 | + else |
|
346 | + echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>'; |
|
347 | 347 | break; |
348 | 348 | } |
349 | 349 | } |
@@ -383,15 +383,15 @@ discard block |
||
383 | 383 | if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
384 | 384 | if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
385 | 385 | |
386 | - /** |
|
387 | - * Fires before updating geodirectory admin settings. |
|
388 | - * |
|
389 | - * @since 1.4.2 |
|
390 | - * |
|
391 | - * @param string $current_tab Current tab in geodirectory settings. |
|
392 | - * @param array $geodir_settings Array of geodirectory settings. |
|
393 | - */ |
|
394 | - do_action('geodir_before_update_options', $current_tab, $geodir_settings); |
|
386 | + /** |
|
387 | + * Fires before updating geodirectory admin settings. |
|
388 | + * |
|
389 | + * @since 1.4.2 |
|
390 | + * |
|
391 | + * @param string $current_tab Current tab in geodirectory settings. |
|
392 | + * @param array $geodir_settings Array of geodirectory settings. |
|
393 | + */ |
|
394 | + do_action('geodir_before_update_options', $current_tab, $geodir_settings); |
|
395 | 395 | |
396 | 396 | if (!empty($geodir_settings[$current_tab])) |
397 | 397 | geodir_update_options($geodir_settings[$current_tab]); |
@@ -480,11 +480,11 @@ discard block |
||
480 | 480 | <?php |
481 | 481 | |
482 | 482 | $default_location = geodir_get_default_location(); |
483 | - $city = isset($default_location->city) ? $default_location->city : ''; |
|
484 | - $region =isset($default_location->region) ? $default_location->region : ''; |
|
485 | - $country =isset($default_location->country) ? $default_location->country : ''; |
|
486 | - $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
487 | - $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
483 | + $city = isset($default_location->city) ? $default_location->city : ''; |
|
484 | + $region =isset($default_location->region) ? $default_location->region : ''; |
|
485 | + $country =isset($default_location->country) ? $default_location->country : ''; |
|
486 | + $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
487 | + $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
488 | 488 | |
489 | 489 | ?> |
490 | 490 | var geocoder = new google.maps.Geocoder(); |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | */ |
758 | 758 | function geodir_update_options($options, $dummy = false) |
759 | 759 | { |
760 | - // print_r($_POST); print_r($options); exit; |
|
760 | + // print_r($_POST); print_r($options); exit; |
|
761 | 761 | |
762 | 762 | if ((!isset($_POST) || !$_POST) && !$dummy) return false; |
763 | 763 | |
@@ -2253,10 +2253,10 @@ discard block |
||
2253 | 2253 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
2254 | 2254 | style=" <?php echo esc_attr($value['css']); ?>" |
2255 | 2255 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) { |
2256 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
2257 | - } else { |
|
2258 | - echo esc_attr($value['std']); |
|
2259 | - } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
2256 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
2257 | + } else { |
|
2258 | + echo esc_attr($value['std']); |
|
2259 | + } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
2260 | 2260 | </tr><?php |
2261 | 2261 | break; |
2262 | 2262 | |
@@ -2270,10 +2270,10 @@ discard block |
||
2270 | 2270 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
2271 | 2271 | style="<?php echo esc_attr($value['css']); ?>" |
2272 | 2272 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) { |
2273 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
2274 | - } else { |
|
2275 | - echo esc_attr($value['std']); |
|
2276 | - } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
2273 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
2274 | + } else { |
|
2275 | + echo esc_attr($value['std']); |
|
2276 | + } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td> |
|
2277 | 2277 | </tr><?php |
2278 | 2278 | break; |
2279 | 2279 | |
@@ -2293,10 +2293,10 @@ discard block |
||
2293 | 2293 | id="<?php echo esc_attr($value['id']); ?>" type="text" |
2294 | 2294 | style="<?php echo esc_attr($value['css']); ?>" |
2295 | 2295 | value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) { |
2296 | - echo esc_attr(stripslashes(get_option($value['id']))); |
|
2297 | - } else { |
|
2298 | - echo esc_attr($value['std']); |
|
2299 | - } ?>" class="colorpick"/> <span |
|
2296 | + echo esc_attr(stripslashes(get_option($value['id']))); |
|
2297 | + } else { |
|
2298 | + echo esc_attr($value['std']); |
|
2299 | + } ?>" class="colorpick"/> <span |
|
2300 | 2300 | class="description"><?php echo $value['desc']; ?></span> |
2301 | 2301 | |
2302 | 2302 | <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv" |
@@ -2685,22 +2685,22 @@ discard block |
||
2685 | 2685 | |
2686 | 2686 | case 'single_select_page' : |
2687 | 2687 | // WPML |
2688 | - $switch_lang = false; |
|
2689 | - $disabled = ''; |
|
2690 | - if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') { |
|
2691 | - global $sitepress; |
|
2688 | + $switch_lang = false; |
|
2689 | + $disabled = ''; |
|
2690 | + if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') { |
|
2691 | + global $sitepress; |
|
2692 | 2692 | |
2693 | - $default_lang = $sitepress->get_default_language(); |
|
2694 | - $current_lang = $sitepress->get_current_language(); |
|
2693 | + $default_lang = $sitepress->get_default_language(); |
|
2694 | + $current_lang = $sitepress->get_current_language(); |
|
2695 | 2695 | |
2696 | - if ($current_lang != 'all' && $current_lang != $default_lang) { |
|
2697 | - $disabled = "disabled='disabled'"; |
|
2698 | - $switch_lang = $current_lang; |
|
2699 | - $sitepress->switch_lang('all', true); |
|
2700 | - } |
|
2701 | - } |
|
2702 | - // |
|
2703 | - $page_setting = (int)get_option($value['id']); |
|
2696 | + if ($current_lang != 'all' && $current_lang != $default_lang) { |
|
2697 | + $disabled = "disabled='disabled'"; |
|
2698 | + $switch_lang = $current_lang; |
|
2699 | + $sitepress->switch_lang('all', true); |
|
2700 | + } |
|
2701 | + } |
|
2702 | + // |
|
2703 | + $page_setting = (int)get_option($value['id']); |
|
2704 | 2704 | |
2705 | 2705 | $args = array('name' => $value['id'], |
2706 | 2706 | 'id' => $value['id'], |
@@ -2721,9 +2721,9 @@ discard block |
||
2721 | 2721 | <span class="description"><?php echo $value['desc'] ?></span> |
2722 | 2722 | </td> |
2723 | 2723 | </tr><?php |
2724 | - if ($switch_lang) { |
|
2725 | - $sitepress->switch_lang($switch_lang, true); |
|
2726 | - } |
|
2724 | + if ($switch_lang) { |
|
2725 | + $sitepress->switch_lang($switch_lang, true); |
|
2726 | + } |
|
2727 | 2727 | break; |
2728 | 2728 | case 'single_select_country' : |
2729 | 2729 | $countries = $geodirectory->countries->countries; |
@@ -3355,22 +3355,22 @@ discard block |
||
3355 | 3355 | * @return string Post type ex: gd_place |
3356 | 3356 | */ |
3357 | 3357 | function geodir_admin_current_post_type() { |
3358 | - global $post, $typenow, $current_screen; |
|
3358 | + global $post, $typenow, $current_screen; |
|
3359 | 3359 | |
3360 | - $post_type = NULL; |
|
3360 | + $post_type = NULL; |
|
3361 | 3361 | |
3362 | - if ($post && isset($post->post_type)) |
|
3363 | - $post_type = $post->post_type; |
|
3364 | - elseif ($typenow) |
|
3365 | - $post_type = $typenow; |
|
3366 | - elseif ($current_screen && isset($current_screen->post_type)) |
|
3367 | - $post_type = $current_screen->post_type; |
|
3368 | - elseif (isset($_REQUEST['post_type'])) |
|
3369 | - $post_type = sanitize_key($_REQUEST['post_type']); |
|
3370 | - elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
3371 | - $post_type = get_post_type($_REQUEST['post']); |
|
3372 | - |
|
3373 | - return $post_type; |
|
3362 | + if ($post && isset($post->post_type)) |
|
3363 | + $post_type = $post->post_type; |
|
3364 | + elseif ($typenow) |
|
3365 | + $post_type = $typenow; |
|
3366 | + elseif ($current_screen && isset($current_screen->post_type)) |
|
3367 | + $post_type = $current_screen->post_type; |
|
3368 | + elseif (isset($_REQUEST['post_type'])) |
|
3369 | + $post_type = sanitize_key($_REQUEST['post_type']); |
|
3370 | + elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
3371 | + $post_type = get_post_type($_REQUEST['post']); |
|
3372 | + |
|
3373 | + return $post_type; |
|
3374 | 3374 | } |
3375 | 3375 | |
3376 | 3376 | /** |
@@ -3385,33 +3385,33 @@ discard block |
||
3385 | 3385 | * @param array $geodir_settings Array of geodirectory settings. |
3386 | 3386 | */ |
3387 | 3387 | function geodir_before_update_options($current_tab, $geodir_settings) { |
3388 | - $active_tab = isset($_REQUEST['active_tab']) ? trim($_REQUEST['active_tab']) : ''; |
|
3388 | + $active_tab = isset($_REQUEST['active_tab']) ? trim($_REQUEST['active_tab']) : ''; |
|
3389 | 3389 | |
3390 | - // Permalink settings |
|
3391 | - if ($current_tab == 'permalink_settings') { |
|
3392 | - $listing_prefix = isset($_POST['geodir_listing_prefix']) ? trim($_POST['geodir_listing_prefix']) : ''; |
|
3393 | - $location_prefix = isset($_POST['geodir_location_prefix']) ? trim($_POST['geodir_location_prefix']) : ''; |
|
3390 | + // Permalink settings |
|
3391 | + if ($current_tab == 'permalink_settings') { |
|
3392 | + $listing_prefix = isset($_POST['geodir_listing_prefix']) ? trim($_POST['geodir_listing_prefix']) : ''; |
|
3393 | + $location_prefix = isset($_POST['geodir_location_prefix']) ? trim($_POST['geodir_location_prefix']) : ''; |
|
3394 | 3394 | |
3395 | - // Don't allow same slug url for listing and location |
|
3396 | - if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) { |
|
3397 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21'); |
|
3398 | - wp_redirect($redirect_url); |
|
3399 | - exit; |
|
3400 | - } |
|
3395 | + // Don't allow same slug url for listing and location |
|
3396 | + if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) { |
|
3397 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21'); |
|
3398 | + wp_redirect($redirect_url); |
|
3399 | + exit; |
|
3400 | + } |
|
3401 | 3401 | |
3402 | - // Don't allow to update page settings on different language. |
|
3403 | - if (geodir_is_wpml()) { |
|
3404 | - global $sitepress; |
|
3405 | - $current_language = $sitepress->get_current_language(); |
|
3406 | - $default_language = $sitepress->get_default_language(); |
|
3402 | + // Don't allow to update page settings on different language. |
|
3403 | + if (geodir_is_wpml()) { |
|
3404 | + global $sitepress; |
|
3405 | + $current_language = $sitepress->get_current_language(); |
|
3406 | + $default_language = $sitepress->get_default_language(); |
|
3407 | 3407 | |
3408 | - if ($current_language != 'all' && $current_language != $default_language) { |
|
3409 | - $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab); |
|
3410 | - wp_redirect($redirect_url); |
|
3411 | - exit; |
|
3412 | - } |
|
3413 | - } |
|
3414 | - } |
|
3408 | + if ($current_language != 'all' && $current_language != $default_language) { |
|
3409 | + $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab); |
|
3410 | + wp_redirect($redirect_url); |
|
3411 | + exit; |
|
3412 | + } |
|
3413 | + } |
|
3414 | + } |
|
3415 | 3415 | } |
3416 | 3416 | |
3417 | 3417 | |
@@ -3442,7 +3442,7 @@ discard block |
||
3442 | 3442 | * @return array Array of tab data. |
3443 | 3443 | */ |
3444 | 3444 | function geodir_import_export_tab( $tabs ) { |
3445 | - $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) ); |
|
3445 | + $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) ); |
|
3446 | 3446 | return $tabs; |
3447 | 3447 | } |
3448 | 3448 | |
@@ -3456,8 +3456,8 @@ discard block |
||
3456 | 3456 | * @return string Html content. |
3457 | 3457 | */ |
3458 | 3458 | function geodir_import_export_page() { |
3459 | - $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
3460 | - $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv'; |
|
3459 | + $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
3460 | + $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv'; |
|
3461 | 3461 | /** |
3462 | 3462 | * Filter sample category data csv file url. |
3463 | 3463 | * |
@@ -3466,9 +3466,9 @@ discard block |
||
3466 | 3466 | * |
3467 | 3467 | * @param string $gd_cats_sample_csv Sample category data csv file url. |
3468 | 3468 | */ |
3469 | - $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv ); |
|
3469 | + $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv ); |
|
3470 | 3470 | |
3471 | - $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; |
|
3471 | + $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'; |
|
3472 | 3472 | /** |
3473 | 3473 | * Filter sample post data csv file url. |
3474 | 3474 | * |
@@ -3479,42 +3479,42 @@ discard block |
||
3479 | 3479 | */ |
3480 | 3480 | $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv ); |
3481 | 3481 | |
3482 | - $gd_posttypes = geodir_get_posttypes( 'array' ); |
|
3482 | + $gd_posttypes = geodir_get_posttypes( 'array' ); |
|
3483 | 3483 | |
3484 | - $gd_posttypes_option = ''; |
|
3485 | - foreach ( $gd_posttypes as $gd_posttype => $row ) { |
|
3486 | - $gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>'; |
|
3487 | - } |
|
3488 | - wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
3484 | + $gd_posttypes_option = ''; |
|
3485 | + foreach ( $gd_posttypes as $gd_posttype => $row ) { |
|
3486 | + $gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>'; |
|
3487 | + } |
|
3488 | + wp_enqueue_script( 'jquery-ui-progressbar' ); |
|
3489 | 3489 | |
3490 | - $gd_chunksize_options = array(); |
|
3491 | - $gd_chunksize_options[100] = 100; |
|
3492 | - $gd_chunksize_options[200] = 200; |
|
3493 | - $gd_chunksize_options[500] = 500; |
|
3494 | - $gd_chunksize_options[1000] = 1000; |
|
3495 | - $gd_chunksize_options[2000] = 2000; |
|
3496 | - $gd_chunksize_options[5000] = 5000; |
|
3497 | - $gd_chunksize_options[10000] = 10000; |
|
3498 | - $gd_chunksize_options[20000] = 20000; |
|
3499 | - $gd_chunksize_options[50000] = 50000; |
|
3500 | - $gd_chunksize_options[100000] = 100000; |
|
3490 | + $gd_chunksize_options = array(); |
|
3491 | + $gd_chunksize_options[100] = 100; |
|
3492 | + $gd_chunksize_options[200] = 200; |
|
3493 | + $gd_chunksize_options[500] = 500; |
|
3494 | + $gd_chunksize_options[1000] = 1000; |
|
3495 | + $gd_chunksize_options[2000] = 2000; |
|
3496 | + $gd_chunksize_options[5000] = 5000; |
|
3497 | + $gd_chunksize_options[10000] = 10000; |
|
3498 | + $gd_chunksize_options[20000] = 20000; |
|
3499 | + $gd_chunksize_options[50000] = 50000; |
|
3500 | + $gd_chunksize_options[100000] = 100000; |
|
3501 | 3501 | |
3502 | - /** |
|
3503 | - * Filter max entries per export csv file. |
|
3504 | - * |
|
3505 | - * @since 1.5.6 |
|
3506 | - * @package GeoDirectory |
|
3507 | - * |
|
3508 | - * @param string $gd_chunksize_options Entries options. |
|
3509 | - */ |
|
3502 | + /** |
|
3503 | + * Filter max entries per export csv file. |
|
3504 | + * |
|
3505 | + * @since 1.5.6 |
|
3506 | + * @package GeoDirectory |
|
3507 | + * |
|
3508 | + * @param string $gd_chunksize_options Entries options. |
|
3509 | + */ |
|
3510 | 3510 | $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options ); |
3511 | 3511 | |
3512 | - $gd_chunksize_option = ''; |
|
3513 | - foreach ($gd_chunksize_options as $value => $title) { |
|
3514 | - $gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>'; |
|
3515 | - } |
|
3512 | + $gd_chunksize_option = ''; |
|
3513 | + foreach ($gd_chunksize_options as $value => $title) { |
|
3514 | + $gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>'; |
|
3515 | + } |
|
3516 | 3516 | |
3517 | - $uploads = wp_upload_dir(); |
|
3517 | + $uploads = wp_upload_dir(); |
|
3518 | 3518 | ?> |
3519 | 3519 | </form> |
3520 | 3520 | <div class="inner_content_tab_main gd-import-export"> |
@@ -3576,13 +3576,13 @@ discard block |
||
3576 | 3576 | <input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample"> |
3577 | 3577 | <input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" /> |
3578 | 3578 | <?php |
3579 | - /** |
|
3580 | - * Called just after the sample CSV download link. |
|
3581 | - * |
|
3582 | - * @since 1.0.0 |
|
3583 | - */ |
|
3584 | - do_action('geodir_sample_csv_download_link'); |
|
3585 | - ?> |
|
3579 | + /** |
|
3580 | + * Called just after the sample CSV download link. |
|
3581 | + * |
|
3582 | + * @since 1.0.0 |
|
3583 | + */ |
|
3584 | + do_action('geodir_sample_csv_download_link'); |
|
3585 | + ?> |
|
3586 | 3586 | <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span> |
3587 | 3587 | <div class="filelist"></div> |
3588 | 3588 | </div> |
@@ -3690,14 +3690,14 @@ discard block |
||
3690 | 3690 | <input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample"> |
3691 | 3691 | <input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" /> |
3692 | 3692 | <?php |
3693 | - /** |
|
3694 | - * Called just after the sample CSV download link. |
|
3695 | - * |
|
3696 | - * @since 1.0.0 |
|
3693 | + /** |
|
3694 | + * Called just after the sample CSV download link. |
|
3695 | + * |
|
3696 | + * @since 1.0.0 |
|
3697 | 3697 | * @package GeoDirectory |
3698 | - */ |
|
3699 | - do_action('geodir_sample_cats_csv_download_link'); |
|
3700 | - ?> |
|
3698 | + */ |
|
3699 | + do_action('geodir_sample_cats_csv_download_link'); |
|
3700 | + ?> |
|
3701 | 3701 | <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span> |
3702 | 3702 | <div class="filelist"></div> |
3703 | 3703 | </div> |
@@ -3773,19 +3773,19 @@ discard block |
||
3773 | 3773 | </div> |
3774 | 3774 | </div> |
3775 | 3775 | <?php |
3776 | - /** |
|
3777 | - * Allows you to add more setting to the GD > Import & Export page. |
|
3778 | - * |
|
3779 | - * Called after the last setting on the GD > Import & Export page. |
|
3780 | - * @since 1.4.6 |
|
3776 | + /** |
|
3777 | + * Allows you to add more setting to the GD > Import & Export page. |
|
3778 | + * |
|
3779 | + * Called after the last setting on the GD > Import & Export page. |
|
3780 | + * @since 1.4.6 |
|
3781 | 3781 | * @package GeoDirectory |
3782 | - * |
|
3783 | - * @param array $gd_posttypes GD post types. |
|
3782 | + * |
|
3783 | + * @param array $gd_posttypes GD post types. |
|
3784 | 3784 | * @param array $gd_chunksize_options File chunk size options. |
3785 | 3785 | * @param string $nonce Wordpress security token for GD import & export. |
3786 | - */ |
|
3787 | - do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
|
3788 | - ?> |
|
3786 | + */ |
|
3787 | + do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce ); |
|
3788 | + ?> |
|
3789 | 3789 | </div> |
3790 | 3790 | </div> |
3791 | 3791 | <script type="text/javascript"> |
@@ -5760,32 +5760,32 @@ discard block |
||
5760 | 5760 | * @return int|bool Term id when success, false when fail. |
5761 | 5761 | */ |
5762 | 5762 | function geodir_imex_insert_term( $taxonomy, $term_data ) { |
5763 | - if ( empty( $taxonomy ) || empty( $term_data ) ) { |
|
5764 | - return false; |
|
5765 | - } |
|
5763 | + if ( empty( $taxonomy ) || empty( $term_data ) ) { |
|
5764 | + return false; |
|
5765 | + } |
|
5766 | 5766 | |
5767 | - $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
5768 | - $args = array(); |
|
5769 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
5770 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
5771 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
5767 | + $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
5768 | + $args = array(); |
|
5769 | + $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
5770 | + $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
5771 | + $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
5772 | 5772 | |
5773 | - if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) { |
|
5774 | - $term_args = array_merge( $term_data, $args ); |
|
5775 | - $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); |
|
5776 | - $term_args = wp_parse_args( $term_args, $defaults ); |
|
5777 | - $term_args = sanitize_term( $term_args, $taxonomy, 'db' ); |
|
5778 | - $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
|
5779 | - } |
|
5773 | + if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) { |
|
5774 | + $term_args = array_merge( $term_data, $args ); |
|
5775 | + $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); |
|
5776 | + $term_args = wp_parse_args( $term_args, $defaults ); |
|
5777 | + $term_args = sanitize_term( $term_args, $taxonomy, 'db' ); |
|
5778 | + $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args ); |
|
5779 | + } |
|
5780 | 5780 | |
5781 | 5781 | if( !empty( $term ) ) { |
5782 | - $result = wp_insert_term( $term, $taxonomy, $args ); |
|
5782 | + $result = wp_insert_term( $term, $taxonomy, $args ); |
|
5783 | 5783 | if( !is_wp_error( $result ) ) { |
5784 | 5784 | return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0; |
5785 | 5785 | } |
5786 | 5786 | } |
5787 | 5787 | |
5788 | - return false; |
|
5788 | + return false; |
|
5789 | 5789 | } |
5790 | 5790 | |
5791 | 5791 | /** |
@@ -5812,39 +5812,39 @@ discard block |
||
5812 | 5812 | * @return int|bool Term id when success, false when fail. |
5813 | 5813 | */ |
5814 | 5814 | function geodir_imex_update_term( $taxonomy, $term_data ) { |
5815 | - if ( empty( $taxonomy ) || empty( $term_data ) ) { |
|
5816 | - return false; |
|
5817 | - } |
|
5815 | + if ( empty( $taxonomy ) || empty( $term_data ) ) { |
|
5816 | + return false; |
|
5817 | + } |
|
5818 | 5818 | |
5819 | - $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
5820 | - $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0; |
|
5819 | + $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : ''; |
|
5820 | + $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0; |
|
5821 | 5821 | |
5822 | - $args = array(); |
|
5823 | - $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
5824 | - $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
5825 | - $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
5822 | + $args = array(); |
|
5823 | + $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : ''; |
|
5824 | + $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : ''; |
|
5825 | + $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : ''; |
|
5826 | 5826 | |
5827 | - if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) { |
|
5828 | - $term_data['term_id'] = $term_info['term_id']; |
|
5827 | + if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) { |
|
5828 | + $term_data['term_id'] = $term_info['term_id']; |
|
5829 | 5829 | |
5830 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
5830 | + $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
5831 | 5831 | |
5832 | - if( !is_wp_error( $result ) ) { |
|
5832 | + if( !is_wp_error( $result ) ) { |
|
5833 | 5833 | return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0; |
5834 | 5834 | } |
5835 | - } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) { |
|
5836 | - $term_data['term_id'] = $term_info['term_id']; |
|
5835 | + } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) { |
|
5836 | + $term_data['term_id'] = $term_info['term_id']; |
|
5837 | 5837 | |
5838 | - $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
5838 | + $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data ); |
|
5839 | 5839 | |
5840 | - if( !is_wp_error( $result ) ) { |
|
5840 | + if( !is_wp_error( $result ) ) { |
|
5841 | 5841 | return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0; |
5842 | 5842 | } |
5843 | - } else { |
|
5844 | - return geodir_imex_insert_term( $taxonomy, $term_data ); |
|
5845 | - } |
|
5843 | + } else { |
|
5844 | + return geodir_imex_insert_term( $taxonomy, $term_data ); |
|
5845 | + } |
|
5846 | 5846 | |
5847 | - return false; |
|
5847 | + return false; |
|
5848 | 5848 | } |
5849 | 5849 | |
5850 | 5850 | /** |
@@ -5857,21 +5857,21 @@ discard block |
||
5857 | 5857 | * @return int Posts count. |
5858 | 5858 | */ |
5859 | 5859 | function geodir_get_posts_count( $post_type ) { |
5860 | - $posts_count = wp_count_posts( $post_type ); |
|
5861 | - $posts_count = array_sum( (array)$posts_count ); |
|
5860 | + $posts_count = wp_count_posts( $post_type ); |
|
5861 | + $posts_count = array_sum( (array)$posts_count ); |
|
5862 | 5862 | |
5863 | - /** |
|
5864 | - * Modify returned post counts for the current post type. |
|
5865 | - * |
|
5866 | - * @since 1.4.6 |
|
5863 | + /** |
|
5864 | + * Modify returned post counts for the current post type. |
|
5865 | + * |
|
5866 | + * @since 1.4.6 |
|
5867 | 5867 | * @package GeoDirectory |
5868 | - * |
|
5869 | - * @param int $posts_count Post counts. |
|
5870 | - * @param string $post_type Post type. |
|
5871 | - */ |
|
5872 | - $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
5868 | + * |
|
5869 | + * @param int $posts_count Post counts. |
|
5870 | + * @param string $post_type Post type. |
|
5871 | + */ |
|
5872 | + $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type ); |
|
5873 | 5873 | |
5874 | - return $posts_count; |
|
5874 | + return $posts_count; |
|
5875 | 5875 | } |
5876 | 5876 | |
5877 | 5877 | /** |
@@ -5888,18 +5888,18 @@ discard block |
||
5888 | 5888 | * @return int Posts count. |
5889 | 5889 | */ |
5890 | 5890 | function geodir_imex_count_events( $posts_count, $post_type ) { |
5891 | - if ( $post_type == 'gd_event' ) { |
|
5892 | - global $wpdb, $plugin_prefix; |
|
5891 | + if ( $post_type == 'gd_event' ) { |
|
5892 | + global $wpdb, $plugin_prefix; |
|
5893 | 5893 | |
5894 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
5895 | - $schedule_table = EVENT_SCHEDULE; |
|
5894 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
5895 | + $schedule_table = EVENT_SCHEDULE; |
|
5896 | 5896 | |
5897 | - $query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s"; |
|
5897 | + $query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s"; |
|
5898 | 5898 | |
5899 | - $posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) ); |
|
5900 | - } |
|
5899 | + $posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) ); |
|
5900 | + } |
|
5901 | 5901 | |
5902 | - return $posts_count; |
|
5902 | + return $posts_count; |
|
5903 | 5903 | } |
5904 | 5904 | |
5905 | 5905 | /** |
@@ -5919,290 +5919,290 @@ discard block |
||
5919 | 5919 | * @return array Array of posts data. |
5920 | 5920 | */ |
5921 | 5921 | function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) { |
5922 | - global $wp_filesystem; |
|
5922 | + global $wp_filesystem; |
|
5923 | 5923 | |
5924 | - $posts = geodir_get_export_posts( $post_type, $per_page, $page_no ); |
|
5924 | + $posts = geodir_get_export_posts( $post_type, $per_page, $page_no ); |
|
5925 | 5925 | |
5926 | - $csv_rows = array(); |
|
5926 | + $csv_rows = array(); |
|
5927 | 5927 | |
5928 | - if ( !empty( $posts ) ) { |
|
5929 | - $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' ); |
|
5928 | + if ( !empty( $posts ) ) { |
|
5929 | + $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' ); |
|
5930 | 5930 | |
5931 | - $csv_row = array(); |
|
5932 | - $csv_row[] = 'post_id'; |
|
5933 | - $csv_row[] = 'post_title'; |
|
5934 | - $csv_row[] = 'post_author'; |
|
5935 | - $csv_row[] = 'post_content'; |
|
5936 | - $csv_row[] = 'post_category'; |
|
5937 | - $csv_row[] = 'default_category'; |
|
5938 | - $csv_row[] = 'post_tags'; |
|
5939 | - $csv_row[] = 'post_type'; |
|
5940 | - if ( $post_type == 'gd_event' ) { |
|
5941 | - $csv_row[] = 'event_date'; |
|
5942 | - $csv_row[] = 'event_enddate'; |
|
5943 | - $csv_row[] = 'starttime'; |
|
5944 | - $csv_row[] = 'endtime'; |
|
5931 | + $csv_row = array(); |
|
5932 | + $csv_row[] = 'post_id'; |
|
5933 | + $csv_row[] = 'post_title'; |
|
5934 | + $csv_row[] = 'post_author'; |
|
5935 | + $csv_row[] = 'post_content'; |
|
5936 | + $csv_row[] = 'post_category'; |
|
5937 | + $csv_row[] = 'default_category'; |
|
5938 | + $csv_row[] = 'post_tags'; |
|
5939 | + $csv_row[] = 'post_type'; |
|
5940 | + if ( $post_type == 'gd_event' ) { |
|
5941 | + $csv_row[] = 'event_date'; |
|
5942 | + $csv_row[] = 'event_enddate'; |
|
5943 | + $csv_row[] = 'starttime'; |
|
5944 | + $csv_row[] = 'endtime'; |
|
5945 | 5945 | |
5946 | - $csv_row[] = 'is_recurring_event'; |
|
5947 | - $csv_row[] = 'event_duration_days'; |
|
5948 | - $csv_row[] = 'recurring_dates'; |
|
5949 | - $csv_row[] = 'is_whole_day_event'; |
|
5950 | - $csv_row[] = 'event_starttimes'; |
|
5951 | - $csv_row[] = 'event_endtimes'; |
|
5952 | - $csv_row[] = 'recurring_type'; |
|
5953 | - $csv_row[] = 'recurring_interval'; |
|
5954 | - $csv_row[] = 'recurring_week_days'; |
|
5955 | - $csv_row[] = 'recurring_week_nos'; |
|
5956 | - $csv_row[] = 'max_recurring_count'; |
|
5957 | - $csv_row[] = 'recurring_end_date'; |
|
5958 | - } |
|
5959 | - $csv_row[] = 'post_status'; |
|
5960 | - $csv_row[] = 'is_featured'; |
|
5961 | - if ($is_payment_plugin) { |
|
5962 | - $csv_row[] = 'package_id'; |
|
5963 | - $csv_row[] = 'expire_date'; |
|
5964 | - } |
|
5965 | - $csv_row[] = 'geodir_video'; |
|
5966 | - $csv_row[] = 'post_address'; |
|
5967 | - $csv_row[] = 'post_city'; |
|
5968 | - $csv_row[] = 'post_region'; |
|
5969 | - $csv_row[] = 'post_country'; |
|
5970 | - $csv_row[] = 'post_zip'; |
|
5971 | - $csv_row[] = 'post_latitude'; |
|
5972 | - $csv_row[] = 'post_longitude'; |
|
5973 | - $csv_row[] = 'geodir_timing'; |
|
5974 | - $csv_row[] = 'geodir_contact'; |
|
5975 | - $csv_row[] = 'geodir_email'; |
|
5976 | - $csv_row[] = 'geodir_website'; |
|
5977 | - $csv_row[] = 'geodir_twitter'; |
|
5978 | - $csv_row[] = 'geodir_facebook'; |
|
5979 | - $csv_row[] = 'geodir_video'; |
|
5980 | - $csv_row[] = 'geodir_special_offers'; |
|
5981 | - // WPML |
|
5982 | - $is_wpml = geodir_is_wpml(); |
|
5983 | - if ($is_wpml) { |
|
5984 | - $csv_row[] = 'language'; |
|
5985 | - $csv_row[] = 'original_post_id'; |
|
5986 | - } |
|
5987 | - // WPML |
|
5946 | + $csv_row[] = 'is_recurring_event'; |
|
5947 | + $csv_row[] = 'event_duration_days'; |
|
5948 | + $csv_row[] = 'recurring_dates'; |
|
5949 | + $csv_row[] = 'is_whole_day_event'; |
|
5950 | + $csv_row[] = 'event_starttimes'; |
|
5951 | + $csv_row[] = 'event_endtimes'; |
|
5952 | + $csv_row[] = 'recurring_type'; |
|
5953 | + $csv_row[] = 'recurring_interval'; |
|
5954 | + $csv_row[] = 'recurring_week_days'; |
|
5955 | + $csv_row[] = 'recurring_week_nos'; |
|
5956 | + $csv_row[] = 'max_recurring_count'; |
|
5957 | + $csv_row[] = 'recurring_end_date'; |
|
5958 | + } |
|
5959 | + $csv_row[] = 'post_status'; |
|
5960 | + $csv_row[] = 'is_featured'; |
|
5961 | + if ($is_payment_plugin) { |
|
5962 | + $csv_row[] = 'package_id'; |
|
5963 | + $csv_row[] = 'expire_date'; |
|
5964 | + } |
|
5965 | + $csv_row[] = 'geodir_video'; |
|
5966 | + $csv_row[] = 'post_address'; |
|
5967 | + $csv_row[] = 'post_city'; |
|
5968 | + $csv_row[] = 'post_region'; |
|
5969 | + $csv_row[] = 'post_country'; |
|
5970 | + $csv_row[] = 'post_zip'; |
|
5971 | + $csv_row[] = 'post_latitude'; |
|
5972 | + $csv_row[] = 'post_longitude'; |
|
5973 | + $csv_row[] = 'geodir_timing'; |
|
5974 | + $csv_row[] = 'geodir_contact'; |
|
5975 | + $csv_row[] = 'geodir_email'; |
|
5976 | + $csv_row[] = 'geodir_website'; |
|
5977 | + $csv_row[] = 'geodir_twitter'; |
|
5978 | + $csv_row[] = 'geodir_facebook'; |
|
5979 | + $csv_row[] = 'geodir_video'; |
|
5980 | + $csv_row[] = 'geodir_special_offers'; |
|
5981 | + // WPML |
|
5982 | + $is_wpml = geodir_is_wpml(); |
|
5983 | + if ($is_wpml) { |
|
5984 | + $csv_row[] = 'language'; |
|
5985 | + $csv_row[] = 'original_post_id'; |
|
5986 | + } |
|
5987 | + // WPML |
|
5988 | 5988 | |
5989 | - $custom_fields = geodir_imex_get_custom_fields( $post_type ); |
|
5990 | - if ( !empty( $custom_fields ) ) { |
|
5991 | - foreach ( $custom_fields as $custom_field ) { |
|
5992 | - $csv_row[] = $custom_field->htmlvar_name; |
|
5993 | - } |
|
5994 | - } |
|
5989 | + $custom_fields = geodir_imex_get_custom_fields( $post_type ); |
|
5990 | + if ( !empty( $custom_fields ) ) { |
|
5991 | + foreach ( $custom_fields as $custom_field ) { |
|
5992 | + $csv_row[] = $custom_field->htmlvar_name; |
|
5993 | + } |
|
5994 | + } |
|
5995 | 5995 | |
5996 | - // Export franchise fields |
|
5997 | - $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
5998 | - if ($is_franchise_active) { |
|
5999 | - $csv_row[] = 'gd_is_franchise'; |
|
6000 | - $csv_row[] = 'gd_franchise_lock'; |
|
6001 | - $csv_row[] = 'franchise'; |
|
6002 | - } |
|
5996 | + // Export franchise fields |
|
5997 | + $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false; |
|
5998 | + if ($is_franchise_active) { |
|
5999 | + $csv_row[] = 'gd_is_franchise'; |
|
6000 | + $csv_row[] = 'gd_franchise_lock'; |
|
6001 | + $csv_row[] = 'franchise'; |
|
6002 | + } |
|
6003 | 6003 | |
6004 | - $csv_rows[] = $csv_row; |
|
6004 | + $csv_rows[] = $csv_row; |
|
6005 | 6005 | |
6006 | - $images_count = 5; |
|
6006 | + $images_count = 5; |
|
6007 | 6007 | $xx=0; |
6008 | - foreach ( $posts as $post ) {$xx++; |
|
6009 | - $post_id = $post['ID']; |
|
6008 | + foreach ( $posts as $post ) {$xx++; |
|
6009 | + $post_id = $post['ID']; |
|
6010 | 6010 | |
6011 | - $gd_post_info = geodir_get_post_info( $post_id ); |
|
6012 | - $post_info = (array)$gd_post_info; |
|
6011 | + $gd_post_info = geodir_get_post_info( $post_id ); |
|
6012 | + $post_info = (array)$gd_post_info; |
|
6013 | 6013 | |
6014 | - $taxonomy_category = $post_type . 'category'; |
|
6015 | - $taxonomy_tags = $post_type . '_tags'; |
|
6014 | + $taxonomy_category = $post_type . 'category'; |
|
6015 | + $taxonomy_tags = $post_type . '_tags'; |
|
6016 | 6016 | |
6017 | - $post_category = ''; |
|
6018 | - $default_category_id = $gd_post_info->default_category; |
|
6019 | - $default_category = ''; |
|
6020 | - $post_tags = ''; |
|
6021 | - $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
6017 | + $post_category = ''; |
|
6018 | + $default_category_id = $gd_post_info->default_category; |
|
6019 | + $default_category = ''; |
|
6020 | + $post_tags = ''; |
|
6021 | + $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
6022 | 6022 | |
6023 | - if ( !empty( $terms ) && !is_wp_error( $terms ) ) { |
|
6024 | - $post_category = array(); |
|
6025 | - $post_tags = array(); |
|
6023 | + if ( !empty( $terms ) && !is_wp_error( $terms ) ) { |
|
6024 | + $post_category = array(); |
|
6025 | + $post_tags = array(); |
|
6026 | 6026 | |
6027 | - foreach ( $terms as $term ) { |
|
6028 | - if ( $term->taxonomy == $taxonomy_category ) { |
|
6029 | - $post_category[] = $term->name; |
|
6027 | + foreach ( $terms as $term ) { |
|
6028 | + if ( $term->taxonomy == $taxonomy_category ) { |
|
6029 | + $post_category[] = $term->name; |
|
6030 | 6030 | |
6031 | - if ($default_category_id == $term->term_id) { |
|
6032 | - $default_category = $term->name; // Default category. |
|
6033 | - } |
|
6034 | - } |
|
6031 | + if ($default_category_id == $term->term_id) { |
|
6032 | + $default_category = $term->name; // Default category. |
|
6033 | + } |
|
6034 | + } |
|
6035 | 6035 | |
6036 | - if ( $term->taxonomy == $taxonomy_tags ) { |
|
6037 | - $post_tags[] = $term->name; |
|
6038 | - } |
|
6039 | - } |
|
6036 | + if ( $term->taxonomy == $taxonomy_tags ) { |
|
6037 | + $post_tags[] = $term->name; |
|
6038 | + } |
|
6039 | + } |
|
6040 | 6040 | |
6041 | - if (empty($default_category) && !empty($post_category)) { |
|
6042 | - $default_category = $post_category[0]; // Set first one as default category. |
|
6043 | - } |
|
6044 | - $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : ''; |
|
6045 | - $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : ''; |
|
6046 | - } |
|
6041 | + if (empty($default_category) && !empty($post_category)) { |
|
6042 | + $default_category = $post_category[0]; // Set first one as default category. |
|
6043 | + } |
|
6044 | + $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : ''; |
|
6045 | + $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : ''; |
|
6046 | + } |
|
6047 | 6047 | |
6048 | - // Franchise data |
|
6049 | - $franchise_id = NULL; |
|
6050 | - $franchise_info = array(); |
|
6051 | - $locked_fields = array(); |
|
6048 | + // Franchise data |
|
6049 | + $franchise_id = NULL; |
|
6050 | + $franchise_info = array(); |
|
6051 | + $locked_fields = array(); |
|
6052 | 6052 | |
6053 | - if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) { |
|
6054 | - $franchise_id = $post_info['franchise']; |
|
6055 | - $gd_franchise_info = geodir_get_post_info($franchise_id); |
|
6053 | + if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) { |
|
6054 | + $franchise_id = $post_info['franchise']; |
|
6055 | + $gd_franchise_info = geodir_get_post_info($franchise_id); |
|
6056 | 6056 | |
6057 | - if (geodir_franchise_pkg_is_active($gd_franchise_info)) { |
|
6058 | - $franchise_info = (array)$gd_franchise_info; |
|
6059 | - $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true); |
|
6057 | + if (geodir_franchise_pkg_is_active($gd_franchise_info)) { |
|
6058 | + $franchise_info = (array)$gd_franchise_info; |
|
6059 | + $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true); |
|
6060 | 6060 | |
6061 | - if (!empty($locked_fields)) { |
|
6062 | - foreach( $locked_fields as $locked_field) { |
|
6063 | - if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) { |
|
6064 | - $post_info[$locked_field] = $franchise_info[$locked_field]; |
|
6065 | - } |
|
6061 | + if (!empty($locked_fields)) { |
|
6062 | + foreach( $locked_fields as $locked_field) { |
|
6063 | + if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) { |
|
6064 | + $post_info[$locked_field] = $franchise_info[$locked_field]; |
|
6065 | + } |
|
6066 | 6066 | |
6067 | - if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) { |
|
6068 | - $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
6067 | + if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) { |
|
6068 | + $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) ); |
|
6069 | 6069 | |
6070 | - if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) { |
|
6071 | - $franchise_post_category = array(); |
|
6072 | - $franchise_post_tags = array(); |
|
6070 | + if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) { |
|
6071 | + $franchise_post_category = array(); |
|
6072 | + $franchise_post_tags = array(); |
|
6073 | 6073 | |
6074 | - foreach ( $franchise_terms as $franchise_term ) { |
|
6075 | - if ( $franchise_term->taxonomy == $taxonomy_category ) { |
|
6076 | - $franchise_post_category[] = $franchise_term->name; |
|
6077 | - } |
|
6074 | + foreach ( $franchise_terms as $franchise_term ) { |
|
6075 | + if ( $franchise_term->taxonomy == $taxonomy_category ) { |
|
6076 | + $franchise_post_category[] = $franchise_term->name; |
|
6077 | + } |
|
6078 | 6078 | |
6079 | - if ( $franchise_term->taxonomy == $taxonomy_tags ) { |
|
6080 | - $franchise_post_tags[] = $franchise_term->name; |
|
6081 | - } |
|
6082 | - } |
|
6079 | + if ( $franchise_term->taxonomy == $taxonomy_tags ) { |
|
6080 | + $franchise_post_tags[] = $franchise_term->name; |
|
6081 | + } |
|
6082 | + } |
|
6083 | 6083 | |
6084 | - if (in_array($taxonomy_category, $locked_fields)) { |
|
6085 | - $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : ''; |
|
6086 | - } |
|
6087 | - if (in_array('post_tags', $locked_fields)) { |
|
6088 | - $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : ''; |
|
6089 | - } |
|
6090 | - } |
|
6091 | - } |
|
6092 | - } |
|
6093 | - } |
|
6094 | - } |
|
6095 | - } |
|
6084 | + if (in_array($taxonomy_category, $locked_fields)) { |
|
6085 | + $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : ''; |
|
6086 | + } |
|
6087 | + if (in_array('post_tags', $locked_fields)) { |
|
6088 | + $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : ''; |
|
6089 | + } |
|
6090 | + } |
|
6091 | + } |
|
6092 | + } |
|
6093 | + } |
|
6094 | + } |
|
6095 | + } |
|
6096 | 6096 | |
6097 | - $post_images = geodir_get_images( $post_id ); |
|
6098 | - $current_images = array(); |
|
6099 | - if ( !empty( $post_images ) ) { |
|
6100 | - foreach ( $post_images as $post_image ) { |
|
6101 | - $post_image = (array)$post_image; |
|
6102 | - $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : ''; |
|
6103 | - if ( $image ) { |
|
6104 | - $current_images[] = $image; |
|
6105 | - } |
|
6106 | - } |
|
6097 | + $post_images = geodir_get_images( $post_id ); |
|
6098 | + $current_images = array(); |
|
6099 | + if ( !empty( $post_images ) ) { |
|
6100 | + foreach ( $post_images as $post_image ) { |
|
6101 | + $post_image = (array)$post_image; |
|
6102 | + $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : ''; |
|
6103 | + if ( $image ) { |
|
6104 | + $current_images[] = $image; |
|
6105 | + } |
|
6106 | + } |
|
6107 | 6107 | |
6108 | - $images_count = max( $images_count, count( $current_images ) ); |
|
6109 | - } |
|
6108 | + $images_count = max( $images_count, count( $current_images ) ); |
|
6109 | + } |
|
6110 | 6110 | |
6111 | - $csv_row = array(); |
|
6112 | - $csv_row[] = $post_id; // post_id |
|
6113 | - $csv_row[] = $post_info['post_title']; // post_title |
|
6114 | - $csv_row[] = $post_info['post_author']; // post_author |
|
6115 | - $csv_row[] = $post_info['post_content']; // post_content |
|
6116 | - $csv_row[] = $post_category; // post_category |
|
6117 | - $csv_row[] = $default_category; // default_category |
|
6118 | - $csv_row[] = $post_tags; // post_tags |
|
6119 | - $csv_row[] = $post_type; // post_type |
|
6120 | - if ( $post_type == 'gd_event' ) { |
|
6121 | - $event_data = geodir_imex_get_event_data($post, $gd_post_info); |
|
6122 | - $csv_row[] = $event_data['event_date']; // event_date |
|
6123 | - $csv_row[] = $event_data['event_enddate']; // enddate |
|
6124 | - $csv_row[] = $event_data['starttime']; // starttime |
|
6125 | - $csv_row[] = $event_data['endtime']; // endtime |
|
6111 | + $csv_row = array(); |
|
6112 | + $csv_row[] = $post_id; // post_id |
|
6113 | + $csv_row[] = $post_info['post_title']; // post_title |
|
6114 | + $csv_row[] = $post_info['post_author']; // post_author |
|
6115 | + $csv_row[] = $post_info['post_content']; // post_content |
|
6116 | + $csv_row[] = $post_category; // post_category |
|
6117 | + $csv_row[] = $default_category; // default_category |
|
6118 | + $csv_row[] = $post_tags; // post_tags |
|
6119 | + $csv_row[] = $post_type; // post_type |
|
6120 | + if ( $post_type == 'gd_event' ) { |
|
6121 | + $event_data = geodir_imex_get_event_data($post, $gd_post_info); |
|
6122 | + $csv_row[] = $event_data['event_date']; // event_date |
|
6123 | + $csv_row[] = $event_data['event_enddate']; // enddate |
|
6124 | + $csv_row[] = $event_data['starttime']; // starttime |
|
6125 | + $csv_row[] = $event_data['endtime']; // endtime |
|
6126 | 6126 | |
6127 | - $csv_row[] = $event_data['is_recurring_event']; // is_recurring |
|
6128 | - $csv_row[] = $event_data['event_duration_days']; // duration_x |
|
6129 | - $csv_row[] = $event_data['recurring_dates']; // recurring_dates |
|
6130 | - $csv_row[] = $event_data['is_whole_day_event']; // all_day |
|
6131 | - $csv_row[] = $event_data['event_starttimes']; // starttimes |
|
6132 | - $csv_row[] = $event_data['event_endtimes']; // endtimes |
|
6133 | - $csv_row[] = $event_data['recurring_type']; // repeat_type |
|
6134 | - $csv_row[] = $event_data['recurring_interval']; // repeat_x |
|
6135 | - $csv_row[] = $event_data['recurring_week_days']; // repeat_days |
|
6136 | - $csv_row[] = $event_data['recurring_week_nos']; // repeat_weeks |
|
6137 | - $csv_row[] = $event_data['max_recurring_count']; // max_repeat |
|
6138 | - $csv_row[] = $event_data['recurring_end_date']; // repeat_end |
|
6139 | - } |
|
6140 | - $csv_row[] = $post_info['post_status']; // post_status |
|
6141 | - $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
6142 | - if ($is_payment_plugin) { |
|
6143 | - $csv_row[] = (int)$post_info['package_id']; // package_id |
|
6144 | - $csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date |
|
6145 | - } |
|
6146 | - $csv_row[] = $post_info['geodir_video']; // geodir_video |
|
6147 | - $csv_row[] = $post_info['post_address']; // post_address |
|
6148 | - $csv_row[] = $post_info['post_city']; // post_city |
|
6149 | - $csv_row[] = $post_info['post_region']; // post_region |
|
6150 | - $csv_row[] = $post_info['post_country']; // post_country |
|
6151 | - $csv_row[] = $post_info['post_zip']; // post_zip |
|
6152 | - $csv_row[] = $post_info['post_latitude']; // post_latitude |
|
6153 | - $csv_row[] = $post_info['post_longitude']; // post_longitude |
|
6154 | - $csv_row[] = $post_info['geodir_timing']; // geodir_timing |
|
6155 | - $csv_row[] = $post_info['geodir_contact']; // geodir_contact |
|
6156 | - $csv_row[] = $post_info['geodir_email']; // geodir_email |
|
6157 | - $csv_row[] = $post_info['geodir_website']; // geodir_website |
|
6158 | - $csv_row[] = $post_info['geodir_twitter']; // geodir_twitter |
|
6159 | - $csv_row[] = $post_info['geodir_facebook']; // geodir_facebook |
|
6160 | - $csv_row[] = $post_info['geodir_video']; // geodir_video |
|
6161 | - $csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers |
|
6162 | - // WPML |
|
6163 | - if ($is_wpml) { |
|
6164 | - $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type ); |
|
6165 | - $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type ); |
|
6166 | - } |
|
6167 | - // WPML |
|
6127 | + $csv_row[] = $event_data['is_recurring_event']; // is_recurring |
|
6128 | + $csv_row[] = $event_data['event_duration_days']; // duration_x |
|
6129 | + $csv_row[] = $event_data['recurring_dates']; // recurring_dates |
|
6130 | + $csv_row[] = $event_data['is_whole_day_event']; // all_day |
|
6131 | + $csv_row[] = $event_data['event_starttimes']; // starttimes |
|
6132 | + $csv_row[] = $event_data['event_endtimes']; // endtimes |
|
6133 | + $csv_row[] = $event_data['recurring_type']; // repeat_type |
|
6134 | + $csv_row[] = $event_data['recurring_interval']; // repeat_x |
|
6135 | + $csv_row[] = $event_data['recurring_week_days']; // repeat_days |
|
6136 | + $csv_row[] = $event_data['recurring_week_nos']; // repeat_weeks |
|
6137 | + $csv_row[] = $event_data['max_recurring_count']; // max_repeat |
|
6138 | + $csv_row[] = $event_data['recurring_end_date']; // repeat_end |
|
6139 | + } |
|
6140 | + $csv_row[] = $post_info['post_status']; // post_status |
|
6141 | + $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured |
|
6142 | + if ($is_payment_plugin) { |
|
6143 | + $csv_row[] = (int)$post_info['package_id']; // package_id |
|
6144 | + $csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date |
|
6145 | + } |
|
6146 | + $csv_row[] = $post_info['geodir_video']; // geodir_video |
|
6147 | + $csv_row[] = $post_info['post_address']; // post_address |
|
6148 | + $csv_row[] = $post_info['post_city']; // post_city |
|
6149 | + $csv_row[] = $post_info['post_region']; // post_region |
|
6150 | + $csv_row[] = $post_info['post_country']; // post_country |
|
6151 | + $csv_row[] = $post_info['post_zip']; // post_zip |
|
6152 | + $csv_row[] = $post_info['post_latitude']; // post_latitude |
|
6153 | + $csv_row[] = $post_info['post_longitude']; // post_longitude |
|
6154 | + $csv_row[] = $post_info['geodir_timing']; // geodir_timing |
|
6155 | + $csv_row[] = $post_info['geodir_contact']; // geodir_contact |
|
6156 | + $csv_row[] = $post_info['geodir_email']; // geodir_email |
|
6157 | + $csv_row[] = $post_info['geodir_website']; // geodir_website |
|
6158 | + $csv_row[] = $post_info['geodir_twitter']; // geodir_twitter |
|
6159 | + $csv_row[] = $post_info['geodir_facebook']; // geodir_facebook |
|
6160 | + $csv_row[] = $post_info['geodir_video']; // geodir_video |
|
6161 | + $csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers |
|
6162 | + // WPML |
|
6163 | + if ($is_wpml) { |
|
6164 | + $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type ); |
|
6165 | + $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type ); |
|
6166 | + } |
|
6167 | + // WPML |
|
6168 | 6168 | |
6169 | - if ( !empty( $custom_fields ) ) { |
|
6170 | - foreach ( $custom_fields as $custom_field ) { |
|
6171 | - $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
6172 | - } |
|
6173 | - } |
|
6169 | + if ( !empty( $custom_fields ) ) { |
|
6170 | + foreach ( $custom_fields as $custom_field ) { |
|
6171 | + $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : ''; |
|
6172 | + } |
|
6173 | + } |
|
6174 | 6174 | |
6175 | - // Franchise data |
|
6176 | - if ($is_franchise_active) { |
|
6177 | - $gd_is_franchise = ''; |
|
6178 | - $locaked_fields = ''; |
|
6179 | - $franchise = ''; |
|
6175 | + // Franchise data |
|
6176 | + if ($is_franchise_active) { |
|
6177 | + $gd_is_franchise = ''; |
|
6178 | + $locaked_fields = ''; |
|
6179 | + $franchise = ''; |
|
6180 | 6180 | |
6181 | - if (geodir_franchise_pkg_is_active($gd_post_info)) { |
|
6182 | - $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true ); |
|
6183 | - $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : ''; |
|
6184 | - $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : ''); |
|
6185 | - $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id |
|
6186 | - } |
|
6181 | + if (geodir_franchise_pkg_is_active($gd_post_info)) { |
|
6182 | + $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true ); |
|
6183 | + $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : ''; |
|
6184 | + $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : ''); |
|
6185 | + $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id |
|
6186 | + } |
|
6187 | 6187 | |
6188 | - $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise |
|
6189 | - $csv_row[] = $locaked_fields; // gd_franchise_lock fields |
|
6190 | - $csv_row[] = (int)$franchise; // franchise id |
|
6191 | - } |
|
6188 | + $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise |
|
6189 | + $csv_row[] = $locaked_fields; // gd_franchise_lock fields |
|
6190 | + $csv_row[] = (int)$franchise; // franchise id |
|
6191 | + } |
|
6192 | 6192 | |
6193 | - for ( $c = 0; $c < $images_count; $c++ ) { |
|
6194 | - $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
|
6195 | - } |
|
6193 | + for ( $c = 0; $c < $images_count; $c++ ) { |
|
6194 | + $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE |
|
6195 | + } |
|
6196 | 6196 | |
6197 | - $csv_rows[] = $csv_row; |
|
6197 | + $csv_rows[] = $csv_row; |
|
6198 | 6198 | |
6199 | - } |
|
6199 | + } |
|
6200 | 6200 | |
6201 | - for ( $c = 0; $c < $images_count; $c++ ) { |
|
6202 | - $csv_rows[0][] = 'IMAGE'; |
|
6203 | - } |
|
6204 | - } |
|
6205 | - return $csv_rows; |
|
6201 | + for ( $c = 0; $c < $images_count; $c++ ) { |
|
6202 | + $csv_rows[0][] = 'IMAGE'; |
|
6203 | + } |
|
6204 | + } |
|
6205 | + return $csv_rows; |
|
6206 | 6206 | } |
6207 | 6207 | |
6208 | 6208 | /** |
@@ -6221,48 +6221,48 @@ discard block |
||
6221 | 6221 | * @return array Array of posts data. |
6222 | 6222 | */ |
6223 | 6223 | function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) { |
6224 | - global $wpdb, $plugin_prefix; |
|
6224 | + global $wpdb, $plugin_prefix; |
|
6225 | 6225 | |
6226 | - if ( ! post_type_exists( $post_type ) ) |
|
6227 | - return new stdClass; |
|
6226 | + if ( ! post_type_exists( $post_type ) ) |
|
6227 | + return new stdClass; |
|
6228 | 6228 | |
6229 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
6229 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
6230 | 6230 | |
6231 | - $limit = ''; |
|
6232 | - if ( $per_page > 0 && $page_no > 0 ) { |
|
6233 | - $offset = ( $page_no - 1 ) * $per_page; |
|
6231 | + $limit = ''; |
|
6232 | + if ( $per_page > 0 && $page_no > 0 ) { |
|
6233 | + $offset = ( $page_no - 1 ) * $per_page; |
|
6234 | 6234 | |
6235 | - if ( $offset > 0 ) { |
|
6236 | - $limit = " LIMIT " . $offset . "," . $per_page; |
|
6237 | - } else { |
|
6238 | - $limit = " LIMIT " . $per_page; |
|
6239 | - } |
|
6240 | - } |
|
6235 | + if ( $offset > 0 ) { |
|
6236 | + $limit = " LIMIT " . $offset . "," . $per_page; |
|
6237 | + } else { |
|
6238 | + $limit = " LIMIT " . $per_page; |
|
6239 | + } |
|
6240 | + } |
|
6241 | 6241 | |
6242 | - $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ORDER BY {$wpdb->posts}.ID ASC" . $limit; |
|
6243 | - /** |
|
6244 | - * Modify returned posts SQL query for the current post type. |
|
6245 | - * |
|
6246 | - * @since 1.4.6 |
|
6242 | + $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ORDER BY {$wpdb->posts}.ID ASC" . $limit; |
|
6243 | + /** |
|
6244 | + * Modify returned posts SQL query for the current post type. |
|
6245 | + * |
|
6246 | + * @since 1.4.6 |
|
6247 | 6247 | * @package GeoDirectory |
6248 | - * |
|
6249 | - * @param int $query The SQL query. |
|
6250 | - * @param string $post_type Post type. |
|
6251 | - */ |
|
6252 | - $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
6253 | - |
|
6254 | - $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A ); |
|
6255 | - |
|
6256 | - /** |
|
6257 | - * Modify returned post results for the current post type. |
|
6258 | - * |
|
6259 | - * @since 1.4.6 |
|
6248 | + * |
|
6249 | + * @param int $query The SQL query. |
|
6250 | + * @param string $post_type Post type. |
|
6251 | + */ |
|
6252 | + $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type ); |
|
6253 | + |
|
6254 | + $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A ); |
|
6255 | + |
|
6256 | + /** |
|
6257 | + * Modify returned post results for the current post type. |
|
6258 | + * |
|
6259 | + * @since 1.4.6 |
|
6260 | 6260 | * @package GeoDirectory |
6261 | - * |
|
6262 | - * @param object $results An object containing all post ids. |
|
6263 | - * @param string $post_type Post type. |
|
6264 | - */ |
|
6265 | - return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
6261 | + * |
|
6262 | + * @param object $results An object containing all post ids. |
|
6263 | + * @param string $post_type Post type. |
|
6264 | + */ |
|
6265 | + return apply_filters( 'geodir_export_posts', $results, $post_type ); |
|
6266 | 6266 | } |
6267 | 6267 | |
6268 | 6268 | /** |
@@ -6280,16 +6280,16 @@ discard block |
||
6280 | 6280 | * @return string The SQL query. |
6281 | 6281 | */ |
6282 | 6282 | function geodir_imex_get_events_query( $query, $post_type ) { |
6283 | - if ( $post_type == 'gd_event' ) { |
|
6284 | - global $wpdb, $plugin_prefix; |
|
6283 | + if ( $post_type == 'gd_event' ) { |
|
6284 | + global $wpdb, $plugin_prefix; |
|
6285 | 6285 | |
6286 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
6287 | - $schedule_table = EVENT_SCHEDULE; |
|
6286 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
6287 | + $schedule_table = EVENT_SCHEDULE; |
|
6288 | 6288 | |
6289 | - $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC"; |
|
6290 | - } |
|
6289 | + $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC"; |
|
6290 | + } |
|
6291 | 6291 | |
6292 | - return $query; |
|
6292 | + return $query; |
|
6293 | 6293 | } |
6294 | 6294 | |
6295 | 6295 | /** |
@@ -6302,16 +6302,16 @@ discard block |
||
6302 | 6302 | * @return int Total terms count. |
6303 | 6303 | */ |
6304 | 6304 | function geodir_get_terms_count( $post_type ) { |
6305 | - $args = array( 'hide_empty' => 0 ); |
|
6305 | + $args = array( 'hide_empty' => 0 ); |
|
6306 | 6306 | |
6307 | - remove_all_filters( 'get_terms' ); |
|
6307 | + remove_all_filters( 'get_terms' ); |
|
6308 | 6308 | |
6309 | - $taxonomy = $post_type . 'category'; |
|
6309 | + $taxonomy = $post_type . 'category'; |
|
6310 | 6310 | |
6311 | - $count_terms = wp_count_terms( $taxonomy, $args ); |
|
6312 | - $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
6311 | + $count_terms = wp_count_terms( $taxonomy, $args ); |
|
6312 | + $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0; |
|
6313 | 6313 | |
6314 | - return $count_terms; |
|
6314 | + return $count_terms; |
|
6315 | 6315 | } |
6316 | 6316 | |
6317 | 6317 | /** |
@@ -6327,76 +6327,76 @@ discard block |
||
6327 | 6327 | * @return array Array of terms data. |
6328 | 6328 | */ |
6329 | 6329 | function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) { |
6330 | - $args = array( 'hide_empty' => 0, 'orderby' => 'id' ); |
|
6330 | + $args = array( 'hide_empty' => 0, 'orderby' => 'id' ); |
|
6331 | 6331 | |
6332 | - remove_all_filters( 'get_terms' ); |
|
6332 | + remove_all_filters( 'get_terms' ); |
|
6333 | 6333 | |
6334 | - $taxonomy = $post_type . 'category'; |
|
6334 | + $taxonomy = $post_type . 'category'; |
|
6335 | 6335 | |
6336 | - if ( $per_page > 0 && $page_no > 0 ) { |
|
6337 | - $args['offset'] = ( $page_no - 1 ) * $per_page; |
|
6338 | - $args['number'] = $per_page; |
|
6339 | - } |
|
6336 | + if ( $per_page > 0 && $page_no > 0 ) { |
|
6337 | + $args['offset'] = ( $page_no - 1 ) * $per_page; |
|
6338 | + $args['number'] = $per_page; |
|
6339 | + } |
|
6340 | 6340 | |
6341 | - $terms = get_terms( $taxonomy, $args ); |
|
6341 | + $terms = get_terms( $taxonomy, $args ); |
|
6342 | 6342 | |
6343 | - $csv_rows = array(); |
|
6343 | + $csv_rows = array(); |
|
6344 | 6344 | |
6345 | - if ( !empty( $terms ) ) { |
|
6346 | - $csv_row = array(); |
|
6347 | - $csv_row[] = 'cat_id'; |
|
6348 | - $csv_row[] = 'cat_name'; |
|
6349 | - $csv_row[] = 'cat_slug'; |
|
6350 | - $csv_row[] = 'cat_posttype'; |
|
6351 | - $csv_row[] = 'cat_parent'; |
|
6352 | - $csv_row[] = 'cat_schema'; |
|
6353 | - $csv_row[] = 'cat_description'; |
|
6354 | - $csv_row[] = 'cat_top_description'; |
|
6355 | - $csv_row[] = 'cat_image'; |
|
6356 | - $csv_row[] = 'cat_icon'; |
|
6357 | - // WPML |
|
6358 | - $is_wpml = geodir_is_wpml(); |
|
6359 | - if ($is_wpml) { |
|
6360 | - $csv_row[] = 'cat_language'; |
|
6361 | - } |
|
6362 | - // WPML |
|
6345 | + if ( !empty( $terms ) ) { |
|
6346 | + $csv_row = array(); |
|
6347 | + $csv_row[] = 'cat_id'; |
|
6348 | + $csv_row[] = 'cat_name'; |
|
6349 | + $csv_row[] = 'cat_slug'; |
|
6350 | + $csv_row[] = 'cat_posttype'; |
|
6351 | + $csv_row[] = 'cat_parent'; |
|
6352 | + $csv_row[] = 'cat_schema'; |
|
6353 | + $csv_row[] = 'cat_description'; |
|
6354 | + $csv_row[] = 'cat_top_description'; |
|
6355 | + $csv_row[] = 'cat_image'; |
|
6356 | + $csv_row[] = 'cat_icon'; |
|
6357 | + // WPML |
|
6358 | + $is_wpml = geodir_is_wpml(); |
|
6359 | + if ($is_wpml) { |
|
6360 | + $csv_row[] = 'cat_language'; |
|
6361 | + } |
|
6362 | + // WPML |
|
6363 | 6363 | |
6364 | - $csv_rows[] = $csv_row; |
|
6364 | + $csv_rows[] = $csv_row; |
|
6365 | 6365 | |
6366 | - foreach ( $terms as $term ) { |
|
6367 | - $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type ); |
|
6368 | - $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
6366 | + foreach ( $terms as $term ) { |
|
6367 | + $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type ); |
|
6368 | + $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : ''; |
|
6369 | 6369 | |
6370 | - $cat_image = geodir_get_default_catimage( $term->term_id, $post_type ); |
|
6371 | - $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
6370 | + $cat_image = geodir_get_default_catimage( $term->term_id, $post_type ); |
|
6371 | + $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; |
|
6372 | 6372 | |
6373 | - $cat_parent = ''; |
|
6374 | - if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) { |
|
6375 | - $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy ); |
|
6376 | - $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : ''; |
|
6377 | - } |
|
6373 | + $cat_parent = ''; |
|
6374 | + if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) { |
|
6375 | + $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy ); |
|
6376 | + $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : ''; |
|
6377 | + } |
|
6378 | 6378 | |
6379 | - $csv_row = array(); |
|
6380 | - $csv_row[] = $term->term_id; |
|
6381 | - $csv_row[] = $term->name; |
|
6382 | - $csv_row[] = $term->slug; |
|
6383 | - $csv_row[] = $post_type; |
|
6384 | - $csv_row[] = $cat_parent; |
|
6385 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
|
6386 | - $csv_row[] = $term->description; |
|
6387 | - $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type ); |
|
6388 | - $csv_row[] = $cat_image; |
|
6389 | - $csv_row[] = $cat_icon; |
|
6390 | - // WPML |
|
6391 | - if ($is_wpml) { |
|
6392 | - $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
|
6393 | - } |
|
6394 | - // WPML |
|
6379 | + $csv_row = array(); |
|
6380 | + $csv_row[] = $term->term_id; |
|
6381 | + $csv_row[] = $term->name; |
|
6382 | + $csv_row[] = $term->slug; |
|
6383 | + $csv_row[] = $post_type; |
|
6384 | + $csv_row[] = $cat_parent; |
|
6385 | + $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type ); |
|
6386 | + $csv_row[] = $term->description; |
|
6387 | + $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type ); |
|
6388 | + $csv_row[] = $cat_image; |
|
6389 | + $csv_row[] = $cat_icon; |
|
6390 | + // WPML |
|
6391 | + if ($is_wpml) { |
|
6392 | + $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy ); |
|
6393 | + } |
|
6394 | + // WPML |
|
6395 | 6395 | |
6396 | - $csv_rows[] = $csv_row; |
|
6397 | - } |
|
6398 | - } |
|
6399 | - return $csv_rows; |
|
6396 | + $csv_rows[] = $csv_row; |
|
6397 | + } |
|
6398 | + } |
|
6399 | + return $csv_rows; |
|
6400 | 6400 | } |
6401 | 6401 | |
6402 | 6402 | /** |
@@ -6409,9 +6409,9 @@ discard block |
||
6409 | 6409 | * @return string Path to the cache directory. |
6410 | 6410 | */ |
6411 | 6411 | function geodir_path_import_export( $relative = true ) { |
6412 | - $upload_dir = wp_upload_dir(); |
|
6412 | + $upload_dir = wp_upload_dir(); |
|
6413 | 6413 | |
6414 | - return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache'; |
|
6414 | + return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache'; |
|
6415 | 6415 | } |
6416 | 6416 | |
6417 | 6417 | /** |
@@ -6428,29 +6428,29 @@ discard block |
||
6428 | 6428 | * @return bool true if success otherwise false. |
6429 | 6429 | */ |
6430 | 6430 | function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) { |
6431 | - if ( empty( $csv_data ) ) { |
|
6432 | - return false; |
|
6433 | - } |
|
6431 | + if ( empty( $csv_data ) ) { |
|
6432 | + return false; |
|
6433 | + } |
|
6434 | 6434 | |
6435 | - global $wp_filesystem; |
|
6435 | + global $wp_filesystem; |
|
6436 | 6436 | |
6437 | - $mode = $clear ? 'w+' : 'a+'; |
|
6437 | + $mode = $clear ? 'w+' : 'a+'; |
|
6438 | 6438 | |
6439 | - if ( function_exists( 'fputcsv' ) ) { |
|
6440 | - $file = fopen( $file_path, $mode ); |
|
6441 | - foreach( $csv_data as $csv_row ) { |
|
6442 | - //$csv_row = array_map( 'utf8_decode', $csv_row ); |
|
6443 | - $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' ); |
|
6444 | - } |
|
6445 | - fclose( $file ); |
|
6446 | - } else { |
|
6447 | - foreach( $csv_data as $csv_row ) { |
|
6448 | - //$csv_row = array_map( 'utf8_decode', $csv_row ); |
|
6449 | - $wp_filesystem->put_contents( $file_path, $csv_row ); |
|
6450 | - } |
|
6451 | - } |
|
6439 | + if ( function_exists( 'fputcsv' ) ) { |
|
6440 | + $file = fopen( $file_path, $mode ); |
|
6441 | + foreach( $csv_data as $csv_row ) { |
|
6442 | + //$csv_row = array_map( 'utf8_decode', $csv_row ); |
|
6443 | + $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' ); |
|
6444 | + } |
|
6445 | + fclose( $file ); |
|
6446 | + } else { |
|
6447 | + foreach( $csv_data as $csv_row ) { |
|
6448 | + //$csv_row = array_map( 'utf8_decode', $csv_row ); |
|
6449 | + $wp_filesystem->put_contents( $file_path, $csv_row ); |
|
6450 | + } |
|
6451 | + } |
|
6452 | 6452 | |
6453 | - return true; |
|
6453 | + return true; |
|
6454 | 6454 | } |
6455 | 6455 | |
6456 | 6456 | /** |
@@ -6465,17 +6465,17 @@ discard block |
||
6465 | 6465 | * @return int No of file rows. |
6466 | 6466 | */ |
6467 | 6467 | function geodir_import_export_line_count( $file ) { |
6468 | - global $wp_filesystem; |
|
6468 | + global $wp_filesystem; |
|
6469 | 6469 | |
6470 | - if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) { |
|
6471 | - $contents = $wp_filesystem->get_contents_array( $file ); |
|
6470 | + if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) { |
|
6471 | + $contents = $wp_filesystem->get_contents_array( $file ); |
|
6472 | 6472 | |
6473 | - if ( !empty( $contents ) && is_array( $contents ) ) { |
|
6474 | - return count( $contents ) - 1; |
|
6475 | - } |
|
6476 | - } |
|
6473 | + if ( !empty( $contents ) && is_array( $contents ) ) { |
|
6474 | + return count( $contents ) - 1; |
|
6475 | + } |
|
6476 | + } |
|
6477 | 6477 | |
6478 | - return NULL; |
|
6478 | + return NULL; |
|
6479 | 6479 | } |
6480 | 6480 | |
6481 | 6481 | /** |
@@ -6489,12 +6489,12 @@ discard block |
||
6489 | 6489 | * @return object Queried object. |
6490 | 6490 | */ |
6491 | 6491 | function geodir_imex_get_custom_fields( $post_type ) { |
6492 | - global $wpdb; |
|
6492 | + global $wpdb; |
|
6493 | 6493 | |
6494 | - $sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) ); |
|
6495 | - $rows = $wpdb->get_results( $sql ); |
|
6494 | + $sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) ); |
|
6495 | + $rows = $wpdb->get_results( $sql ); |
|
6496 | 6496 | |
6497 | - return $rows; |
|
6497 | + return $rows; |
|
6498 | 6498 | } |
6499 | 6499 | |
6500 | 6500 | /** |
@@ -6505,11 +6505,11 @@ discard block |
||
6505 | 6505 | * @return True if WPML is active else False. |
6506 | 6506 | */ |
6507 | 6507 | function geodir_is_wpml() { |
6508 | - if (function_exists('icl_object_id')) { |
|
6509 | - return true; |
|
6510 | - } |
|
6508 | + if (function_exists('icl_object_id')) { |
|
6509 | + return true; |
|
6510 | + } |
|
6511 | 6511 | |
6512 | - return false; |
|
6512 | + return false; |
|
6513 | 6513 | } |
6514 | 6514 | |
6515 | 6515 | /** |
@@ -6524,9 +6524,9 @@ discard block |
||
6524 | 6524 | * @return Language code. |
6525 | 6525 | */ |
6526 | 6526 | function geodir_get_language_for_element($element_id, $element_type) { |
6527 | - global $sitepress; |
|
6527 | + global $sitepress; |
|
6528 | 6528 | |
6529 | - return $sitepress->get_language_for_element($element_id, $element_type); |
|
6529 | + return $sitepress->get_language_for_element($element_id, $element_type); |
|
6530 | 6530 | } |
6531 | 6531 | |
6532 | 6532 | /** |
@@ -6540,18 +6540,18 @@ discard block |
||
6540 | 6540 | * @param int $tr_post_id Translation Post ID. |
6541 | 6541 | */ |
6542 | 6542 | function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id) { |
6543 | - $post_type = get_post_type($master_post_id); |
|
6543 | + $post_type = get_post_type($master_post_id); |
|
6544 | 6544 | |
6545 | - if (in_array($post_type, geodir_get_posttypes())) { |
|
6546 | - // Duplicate post details |
|
6547 | - geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang); |
|
6545 | + if (in_array($post_type, geodir_get_posttypes())) { |
|
6546 | + // Duplicate post details |
|
6547 | + geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang); |
|
6548 | 6548 | |
6549 | - // Duplicate taxonomies |
|
6550 | - geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang); |
|
6549 | + // Duplicate taxonomies |
|
6550 | + geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang); |
|
6551 | 6551 | |
6552 | - // Duplicate post images |
|
6553 | - geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang); |
|
6554 | - } |
|
6552 | + // Duplicate post images |
|
6553 | + geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang); |
|
6554 | + } |
|
6555 | 6555 | } |
6556 | 6556 | |
6557 | 6557 | /** |
@@ -6568,23 +6568,23 @@ discard block |
||
6568 | 6568 | * @return bool True for success, False for fail. |
6569 | 6569 | */ |
6570 | 6570 | function geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang) { |
6571 | - global $wpdb, $plugin_prefix; |
|
6571 | + global $wpdb, $plugin_prefix; |
|
6572 | 6572 | |
6573 | - $post_type = get_post_type($master_post_id); |
|
6574 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
6573 | + $post_type = get_post_type($master_post_id); |
|
6574 | + $post_table = $plugin_prefix . $post_type . '_detail'; |
|
6575 | 6575 | |
6576 | - $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id)); |
|
6577 | - $data = (array)$wpdb->get_row($query); |
|
6576 | + $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id)); |
|
6577 | + $data = (array)$wpdb->get_row($query); |
|
6578 | 6578 | |
6579 | - if ( !empty( $data ) ) { |
|
6580 | - $data['post_id'] = $tr_post_id; |
|
6581 | - unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
|
6579 | + if ( !empty( $data ) ) { |
|
6580 | + $data['post_id'] = $tr_post_id; |
|
6581 | + unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']); |
|
6582 | 6582 | |
6583 | - $wpdb->update($post_table, $data, array('post_id' => $tr_post_id)); |
|
6584 | - return true; |
|
6585 | - } |
|
6583 | + $wpdb->update($post_table, $data, array('post_id' => $tr_post_id)); |
|
6584 | + return true; |
|
6585 | + } |
|
6586 | 6586 | |
6587 | - return false; |
|
6587 | + return false; |
|
6588 | 6588 | } |
6589 | 6589 | |
6590 | 6590 | /** |
@@ -6601,40 +6601,40 @@ discard block |
||
6601 | 6601 | * @return bool True for success, False for fail. |
6602 | 6602 | */ |
6603 | 6603 | function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) { |
6604 | - global $sitepress, $wpdb; |
|
6605 | - $post_type = get_post_type($master_post_id); |
|
6604 | + global $sitepress, $wpdb; |
|
6605 | + $post_type = get_post_type($master_post_id); |
|
6606 | 6606 | |
6607 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language |
|
6607 | + remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language |
|
6608 | 6608 | |
6609 | - $taxonomies = get_object_taxonomies($post_type); |
|
6610 | - foreach ($taxonomies as $taxonomy) { |
|
6611 | - $terms = get_the_terms($master_post_id, $taxonomy); |
|
6612 | - $terms_array = array(); |
|
6609 | + $taxonomies = get_object_taxonomies($post_type); |
|
6610 | + foreach ($taxonomies as $taxonomy) { |
|
6611 | + $terms = get_the_terms($master_post_id, $taxonomy); |
|
6612 | + $terms_array = array(); |
|
6613 | 6613 | |
6614 | - if ($terms) { |
|
6615 | - foreach ($terms as $term) { |
|
6616 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
6614 | + if ($terms) { |
|
6615 | + foreach ($terms as $term) { |
|
6616 | + $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
6617 | 6617 | |
6618 | - if (!is_null($tr_id)){ |
|
6619 | - // not using get_term - unfiltered get_term |
|
6620 | - $translated_term = $wpdb->get_row($wpdb->prepare(" |
|
6618 | + if (!is_null($tr_id)){ |
|
6619 | + // not using get_term - unfiltered get_term |
|
6620 | + $translated_term = $wpdb->get_row($wpdb->prepare(" |
|
6621 | 6621 | SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy)); |
6622 | 6622 | |
6623 | - $terms_array[] = $translated_term->term_id; |
|
6624 | - } |
|
6625 | - } |
|
6623 | + $terms_array[] = $translated_term->term_id; |
|
6624 | + } |
|
6625 | + } |
|
6626 | 6626 | |
6627 | - if (!is_taxonomy_hierarchical($taxonomy)){ |
|
6628 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
6629 | - } |
|
6627 | + if (!is_taxonomy_hierarchical($taxonomy)){ |
|
6628 | + $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
6629 | + } |
|
6630 | 6630 | |
6631 | - wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
|
6631 | + wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
|
6632 | 6632 | |
6633 | - if ($taxonomy == $post_type . 'category') { |
|
6634 | - geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
6635 | - } |
|
6636 | - } |
|
6637 | - } |
|
6633 | + if ($taxonomy == $post_type . 'category') { |
|
6634 | + geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
6635 | + } |
|
6636 | + } |
|
6637 | + } |
|
6638 | 6638 | } |
6639 | 6639 | |
6640 | 6640 | /** |
@@ -6650,29 +6650,29 @@ discard block |
||
6650 | 6650 | * @return bool True for success, False for fail. |
6651 | 6651 | */ |
6652 | 6652 | function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) { |
6653 | - global $wpdb; |
|
6653 | + global $wpdb; |
|
6654 | 6654 | |
6655 | - $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id)); |
|
6656 | - $wpdb->query($query); |
|
6655 | + $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id)); |
|
6656 | + $wpdb->query($query); |
|
6657 | 6657 | |
6658 | - $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id)); |
|
6659 | - $post_images = $wpdb->get_results($query); |
|
6658 | + $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id)); |
|
6659 | + $post_images = $wpdb->get_results($query); |
|
6660 | 6660 | |
6661 | - if ( !empty( $post_images ) ) { |
|
6662 | - foreach ( $post_images as $post_image) { |
|
6663 | - $image_data = (array)$post_image; |
|
6664 | - unset($image_data['ID']); |
|
6665 | - $image_data['post_id'] = $tr_post_id; |
|
6661 | + if ( !empty( $post_images ) ) { |
|
6662 | + foreach ( $post_images as $post_image) { |
|
6663 | + $image_data = (array)$post_image; |
|
6664 | + unset($image_data['ID']); |
|
6665 | + $image_data['post_id'] = $tr_post_id; |
|
6666 | 6666 | |
6667 | - $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data); |
|
6667 | + $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data); |
|
6668 | 6668 | |
6669 | - geodir_set_wp_featured_image($tr_post_id); |
|
6670 | - } |
|
6669 | + geodir_set_wp_featured_image($tr_post_id); |
|
6670 | + } |
|
6671 | 6671 | |
6672 | - return true; |
|
6673 | - } |
|
6672 | + return true; |
|
6673 | + } |
|
6674 | 6674 | |
6675 | - return false; |
|
6675 | + return false; |
|
6676 | 6676 | } |
6677 | 6677 | |
6678 | 6678 | /** |
@@ -6686,141 +6686,141 @@ discard block |
||
6686 | 6686 | * @return array Event data array. |
6687 | 6687 | */ |
6688 | 6688 | function geodir_imex_get_event_data($post, $gd_post_info) { |
6689 | - $event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : ''; |
|
6690 | - $event_enddate = $event_date; |
|
6691 | - $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : ''; |
|
6692 | - $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : ''; |
|
6689 | + $event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : ''; |
|
6690 | + $event_enddate = $event_date; |
|
6691 | + $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : ''; |
|
6692 | + $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : ''; |
|
6693 | 6693 | |
6694 | - $is_recurring_event = ''; |
|
6695 | - $event_duration_days = ''; |
|
6696 | - $is_whole_day_event = ''; |
|
6697 | - $recurring_dates = ''; |
|
6698 | - $event_starttimes = ''; |
|
6699 | - $event_endtimes = ''; |
|
6700 | - $recurring_type = ''; |
|
6701 | - $recurring_interval = ''; |
|
6702 | - $recurring_week_days = ''; |
|
6703 | - $recurring_week_nos = ''; |
|
6704 | - $max_recurring_count = ''; |
|
6705 | - $recurring_end_date = ''; |
|
6706 | - $recurring_dates = ''; |
|
6694 | + $is_recurring_event = ''; |
|
6695 | + $event_duration_days = ''; |
|
6696 | + $is_whole_day_event = ''; |
|
6697 | + $recurring_dates = ''; |
|
6698 | + $event_starttimes = ''; |
|
6699 | + $event_endtimes = ''; |
|
6700 | + $recurring_type = ''; |
|
6701 | + $recurring_interval = ''; |
|
6702 | + $recurring_week_days = ''; |
|
6703 | + $recurring_week_nos = ''; |
|
6704 | + $max_recurring_count = ''; |
|
6705 | + $recurring_end_date = ''; |
|
6706 | + $recurring_dates = ''; |
|
6707 | 6707 | |
6708 | - $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array(); |
|
6709 | - if (!empty($recurring_data)) { |
|
6710 | - $event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date; |
|
6711 | - $event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date; |
|
6712 | - $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime; |
|
6713 | - $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime; |
|
6714 | - $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : ''; |
|
6715 | - $different_times = !empty($recurring_data['different_times']) ? true : false; |
|
6708 | + $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array(); |
|
6709 | + if (!empty($recurring_data)) { |
|
6710 | + $event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date; |
|
6711 | + $event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date; |
|
6712 | + $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime; |
|
6713 | + $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime; |
|
6714 | + $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : ''; |
|
6715 | + $different_times = !empty($recurring_data['different_times']) ? true : false; |
|
6716 | 6716 | |
6717 | - $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info ); |
|
6718 | - $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true; |
|
6717 | + $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info ); |
|
6718 | + $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true; |
|
6719 | 6719 | |
6720 | - if ($recurring_pkg && $is_recurring) { |
|
6721 | - $recurring_dates = $event_date; |
|
6722 | - $event_enddate = ''; |
|
6723 | - $is_recurring_event = 1; |
|
6720 | + if ($recurring_pkg && $is_recurring) { |
|
6721 | + $recurring_dates = $event_date; |
|
6722 | + $event_enddate = ''; |
|
6723 | + $is_recurring_event = 1; |
|
6724 | 6724 | |
6725 | - $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom'; |
|
6725 | + $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom'; |
|
6726 | 6726 | |
6727 | - if (!empty($recurring_data['event_recurring_dates'])) { |
|
6728 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
6727 | + if (!empty($recurring_data['event_recurring_dates'])) { |
|
6728 | + $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
6729 | 6729 | |
6730 | - if (!empty($event_recurring_dates)) { |
|
6731 | - $recurring_dates = array(); |
|
6730 | + if (!empty($event_recurring_dates)) { |
|
6731 | + $recurring_dates = array(); |
|
6732 | 6732 | |
6733 | - foreach ($event_recurring_dates as $date) { |
|
6734 | - $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) ); |
|
6735 | - } |
|
6733 | + foreach ($event_recurring_dates as $date) { |
|
6734 | + $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) ); |
|
6735 | + } |
|
6736 | 6736 | |
6737 | - $recurring_dates = implode(",", $recurring_dates); |
|
6738 | - } |
|
6739 | - } |
|
6737 | + $recurring_dates = implode(",", $recurring_dates); |
|
6738 | + } |
|
6739 | + } |
|
6740 | 6740 | |
6741 | - if ($recurring_type == 'custom') { |
|
6742 | - if (!$is_whole_day_event) { |
|
6743 | - $event_starttimes = $starttime; |
|
6744 | - $event_endtimes = $endtime; |
|
6741 | + if ($recurring_type == 'custom') { |
|
6742 | + if (!$is_whole_day_event) { |
|
6743 | + $event_starttimes = $starttime; |
|
6744 | + $event_endtimes = $endtime; |
|
6745 | 6745 | |
6746 | - if (!empty($recurring_data['starttimes'])) { |
|
6747 | - $times = array(); |
|
6746 | + if (!empty($recurring_data['starttimes'])) { |
|
6747 | + $times = array(); |
|
6748 | 6748 | |
6749 | - foreach ($recurring_data['starttimes'] as $time) { |
|
6750 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
6751 | - } |
|
6749 | + foreach ($recurring_data['starttimes'] as $time) { |
|
6750 | + $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
6751 | + } |
|
6752 | 6752 | |
6753 | - $event_starttimes = implode(",", $times); |
|
6754 | - } |
|
6753 | + $event_starttimes = implode(",", $times); |
|
6754 | + } |
|
6755 | 6755 | |
6756 | - if (!empty($recurring_data['endtimes'])) { |
|
6757 | - $times = array(); |
|
6756 | + if (!empty($recurring_data['endtimes'])) { |
|
6757 | + $times = array(); |
|
6758 | 6758 | |
6759 | - foreach ($recurring_data['endtimes'] as $time) { |
|
6760 | - $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
6761 | - } |
|
6759 | + foreach ($recurring_data['endtimes'] as $time) { |
|
6760 | + $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00'; |
|
6761 | + } |
|
6762 | 6762 | |
6763 | - $event_endtimes = implode(",", $times); |
|
6764 | - } |
|
6763 | + $event_endtimes = implode(",", $times); |
|
6764 | + } |
|
6765 | 6765 | |
6766 | - if (!$different_times) { |
|
6767 | - $event_starttimes = ''; |
|
6768 | - $event_endtimes = ''; |
|
6769 | - } |
|
6770 | - } |
|
6771 | - } else { |
|
6772 | - $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1; |
|
6773 | - $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
6766 | + if (!$different_times) { |
|
6767 | + $event_starttimes = ''; |
|
6768 | + $event_endtimes = ''; |
|
6769 | + } |
|
6770 | + } |
|
6771 | + } else { |
|
6772 | + $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1; |
|
6773 | + $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1; |
|
6774 | 6774 | |
6775 | - if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) { |
|
6776 | - $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); |
|
6775 | + if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) { |
|
6776 | + $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); |
|
6777 | 6777 | |
6778 | - $days = array(); |
|
6779 | - foreach ($recurring_data['repeat_days'] as $day) { |
|
6780 | - if (isset($week_days[$day])) { |
|
6781 | - $days[] = $week_days[$day]; |
|
6782 | - } |
|
6783 | - } |
|
6778 | + $days = array(); |
|
6779 | + foreach ($recurring_data['repeat_days'] as $day) { |
|
6780 | + if (isset($week_days[$day])) { |
|
6781 | + $days[] = $week_days[$day]; |
|
6782 | + } |
|
6783 | + } |
|
6784 | 6784 | |
6785 | - $recurring_week_days = implode(",", array_unique($days)); |
|
6786 | - } |
|
6785 | + $recurring_week_days = implode(",", array_unique($days)); |
|
6786 | + } |
|
6787 | 6787 | |
6788 | - $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos; |
|
6789 | - if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) { |
|
6790 | - $recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : ''; |
|
6791 | - $max_recurring_count = empty($recurring_end_date) ? 1 : ''; |
|
6792 | - } else { |
|
6793 | - $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1); |
|
6794 | - } |
|
6795 | - } |
|
6796 | - } |
|
6797 | - } |
|
6798 | - if ($is_whole_day_event) { |
|
6799 | - $starttime = ''; |
|
6800 | - $endtime = ''; |
|
6801 | - $event_starttimes = ''; |
|
6802 | - $event_endtimes = ''; |
|
6803 | - } |
|
6788 | + $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos; |
|
6789 | + if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) { |
|
6790 | + $recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : ''; |
|
6791 | + $max_recurring_count = empty($recurring_end_date) ? 1 : ''; |
|
6792 | + } else { |
|
6793 | + $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1); |
|
6794 | + } |
|
6795 | + } |
|
6796 | + } |
|
6797 | + } |
|
6798 | + if ($is_whole_day_event) { |
|
6799 | + $starttime = ''; |
|
6800 | + $endtime = ''; |
|
6801 | + $event_starttimes = ''; |
|
6802 | + $event_endtimes = ''; |
|
6803 | + } |
|
6804 | 6804 | |
6805 | - $data = array(); |
|
6806 | - $data['event_date'] = $event_date; |
|
6807 | - $data['event_enddate'] = $event_enddate; |
|
6808 | - $data['starttime'] = $starttime; |
|
6809 | - $data['endtime'] = $endtime; |
|
6810 | - $data['is_recurring_event'] = $is_recurring_event; |
|
6811 | - $data['recurring_dates'] = $recurring_dates; |
|
6812 | - $data['event_duration_days'] = $event_duration_days; |
|
6813 | - $data['is_whole_day_event'] = $is_whole_day_event; |
|
6814 | - $data['event_starttimes'] = $event_starttimes; |
|
6815 | - $data['event_endtimes'] = $event_endtimes; |
|
6816 | - $data['recurring_type'] = $recurring_type; |
|
6817 | - $data['recurring_interval'] = $recurring_interval; |
|
6818 | - $data['recurring_week_days'] = $recurring_week_days; |
|
6819 | - $data['recurring_week_nos'] = $recurring_week_nos; |
|
6820 | - $data['max_recurring_count'] = $max_recurring_count; |
|
6821 | - $data['recurring_end_date'] = $recurring_end_date; |
|
6805 | + $data = array(); |
|
6806 | + $data['event_date'] = $event_date; |
|
6807 | + $data['event_enddate'] = $event_enddate; |
|
6808 | + $data['starttime'] = $starttime; |
|
6809 | + $data['endtime'] = $endtime; |
|
6810 | + $data['is_recurring_event'] = $is_recurring_event; |
|
6811 | + $data['recurring_dates'] = $recurring_dates; |
|
6812 | + $data['event_duration_days'] = $event_duration_days; |
|
6813 | + $data['is_whole_day_event'] = $is_whole_day_event; |
|
6814 | + $data['event_starttimes'] = $event_starttimes; |
|
6815 | + $data['event_endtimes'] = $event_endtimes; |
|
6816 | + $data['recurring_type'] = $recurring_type; |
|
6817 | + $data['recurring_interval'] = $recurring_interval; |
|
6818 | + $data['recurring_week_days'] = $recurring_week_days; |
|
6819 | + $data['recurring_week_nos'] = $recurring_week_nos; |
|
6820 | + $data['max_recurring_count'] = $max_recurring_count; |
|
6821 | + $data['recurring_end_date'] = $recurring_end_date; |
|
6822 | 6822 | |
6823 | - return $data; |
|
6823 | + return $data; |
|
6824 | 6824 | } |
6825 | 6825 | |
6826 | 6826 | /** |
@@ -6836,12 +6836,12 @@ discard block |
||
6836 | 6836 | * @return doesn't Date. |
6837 | 6837 | */ |
6838 | 6838 | function geodir_imex_get_date_ymd($date) { |
6839 | - if (strpos($date, '/') !== false) { |
|
6840 | - $date = str_replace('/', '-', $date); // PHP doesn't work well with dd/mm/yyyy format. |
|
6841 | - } |
|
6839 | + if (strpos($date, '/') !== false) { |
|
6840 | + $date = str_replace('/', '-', $date); // PHP doesn't work well with dd/mm/yyyy format. |
|
6841 | + } |
|
6842 | 6842 | |
6843 | - $date = date_i18n('Y-m-d', strtotime($date)); |
|
6844 | - return $date; |
|
6843 | + $date = date_i18n('Y-m-d', strtotime($date)); |
|
6844 | + return $date; |
|
6845 | 6845 | } |
6846 | 6846 | |
6847 | 6847 | /** |
@@ -6854,117 +6854,117 @@ discard block |
||
6854 | 6854 | * @return array Event data array. |
6855 | 6855 | */ |
6856 | 6856 | function geodir_imex_process_event_data($gd_post) { |
6857 | - $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post ); |
|
6858 | - |
|
6859 | - $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true; |
|
6860 | - $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : ''; |
|
6861 | - $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date; |
|
6862 | - $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false; |
|
6863 | - $starttime = isset($gd_post['starttime']) && !$all_day ? $gd_post['starttime'] : ''; |
|
6864 | - $endtime = isset($gd_post['endtime']) && !$all_day ? $gd_post['endtime'] : ''; |
|
6857 | + $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post ); |
|
6858 | + |
|
6859 | + $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true; |
|
6860 | + $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : ''; |
|
6861 | + $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date; |
|
6862 | + $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false; |
|
6863 | + $starttime = isset($gd_post['starttime']) && !$all_day ? $gd_post['starttime'] : ''; |
|
6864 | + $endtime = isset($gd_post['endtime']) && !$all_day ? $gd_post['endtime'] : ''; |
|
6865 | 6865 | |
6866 | - $repeat_type = ''; |
|
6867 | - $different_times = ''; |
|
6868 | - $starttimes = ''; |
|
6869 | - $endtimes = ''; |
|
6870 | - $repeat_days = ''; |
|
6871 | - $repeat_weeks = ''; |
|
6872 | - $event_recurring_dates = ''; |
|
6873 | - $repeat_x = ''; |
|
6874 | - $duration_x = ''; |
|
6875 | - $repeat_end_type = ''; |
|
6876 | - $max_repeat = ''; |
|
6877 | - $repeat_end = ''; |
|
6866 | + $repeat_type = ''; |
|
6867 | + $different_times = ''; |
|
6868 | + $starttimes = ''; |
|
6869 | + $endtimes = ''; |
|
6870 | + $repeat_days = ''; |
|
6871 | + $repeat_weeks = ''; |
|
6872 | + $event_recurring_dates = ''; |
|
6873 | + $repeat_x = ''; |
|
6874 | + $duration_x = ''; |
|
6875 | + $repeat_end_type = ''; |
|
6876 | + $max_repeat = ''; |
|
6877 | + $repeat_end = ''; |
|
6878 | 6878 | |
6879 | - if ($recurring_pkg && $is_recurring) { |
|
6880 | - $repeat_type = $gd_post['recurring_type']; |
|
6879 | + if ($recurring_pkg && $is_recurring) { |
|
6880 | + $repeat_type = $gd_post['recurring_type']; |
|
6881 | 6881 | |
6882 | - if ($repeat_type == 'custom') { |
|
6883 | - $starttimes = !$all_day && !empty($gd_post['event_starttimes']) ? explode(",", $gd_post['event_starttimes']) : array(); |
|
6884 | - $endtimes = !$all_day && !empty($gd_post['event_endtimes']) ? explode(",", $gd_post['event_endtimes']) : array(); |
|
6882 | + if ($repeat_type == 'custom') { |
|
6883 | + $starttimes = !$all_day && !empty($gd_post['event_starttimes']) ? explode(",", $gd_post['event_starttimes']) : array(); |
|
6884 | + $endtimes = !$all_day && !empty($gd_post['event_endtimes']) ? explode(",", $gd_post['event_endtimes']) : array(); |
|
6885 | 6885 | |
6886 | - if (!empty($starttimes) || !empty($endtimes)) { |
|
6887 | - $different_times = true; |
|
6888 | - } |
|
6886 | + if (!empty($starttimes) || !empty($endtimes)) { |
|
6887 | + $different_times = true; |
|
6888 | + } |
|
6889 | 6889 | |
6890 | - $recurring_dates = isset($gd_post['recurring_dates']) && $gd_post['recurring_dates'] != '' ? explode(",", $gd_post['recurring_dates']) : array(); |
|
6891 | - if (!empty($recurring_dates)) { |
|
6892 | - $event_recurring_dates = array(); |
|
6890 | + $recurring_dates = isset($gd_post['recurring_dates']) && $gd_post['recurring_dates'] != '' ? explode(",", $gd_post['recurring_dates']) : array(); |
|
6891 | + if (!empty($recurring_dates)) { |
|
6892 | + $event_recurring_dates = array(); |
|
6893 | 6893 | |
6894 | - foreach ($recurring_dates as $recurring_date) { |
|
6895 | - $recurring_date = trim($recurring_date); |
|
6894 | + foreach ($recurring_dates as $recurring_date) { |
|
6895 | + $recurring_date = trim($recurring_date); |
|
6896 | 6896 | |
6897 | - if ($recurring_date != '') { |
|
6898 | - $event_recurring_dates[] = geodir_imex_get_date_ymd($recurring_date); |
|
6899 | - } |
|
6900 | - } |
|
6897 | + if ($recurring_date != '') { |
|
6898 | + $event_recurring_dates[] = geodir_imex_get_date_ymd($recurring_date); |
|
6899 | + } |
|
6900 | + } |
|
6901 | 6901 | |
6902 | - $event_recurring_dates = array_unique($event_recurring_dates); |
|
6903 | - $event_recurring_dates = implode(",", $event_recurring_dates); |
|
6904 | - } |
|
6905 | - } else { |
|
6906 | - $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1; |
|
6907 | - $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1; |
|
6908 | - $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1; |
|
6909 | - $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
6902 | + $event_recurring_dates = array_unique($event_recurring_dates); |
|
6903 | + $event_recurring_dates = implode(",", $event_recurring_dates); |
|
6904 | + } |
|
6905 | + } else { |
|
6906 | + $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1; |
|
6907 | + $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1; |
|
6908 | + $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1; |
|
6909 | + $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : ''; |
|
6910 | 6910 | |
6911 | - $repeat_end_type = $repeat_end != '' ? 1 : 0; |
|
6912 | - $max_repeat = $repeat_end != '' ? '' : $max_repeat; |
|
6911 | + $repeat_end_type = $repeat_end != '' ? 1 : 0; |
|
6912 | + $max_repeat = $repeat_end != '' ? '' : $max_repeat; |
|
6913 | 6913 | |
6914 | - $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat')); |
|
6914 | + $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat')); |
|
6915 | 6915 | |
6916 | - $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array(); |
|
6917 | - $repeat_days = array(); |
|
6918 | - if (!empty($a_repeat_days)) { |
|
6919 | - foreach ($a_repeat_days as $repeat_day) { |
|
6920 | - $repeat_day = geodir_strtolower(trim($repeat_day)); |
|
6916 | + $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array(); |
|
6917 | + $repeat_days = array(); |
|
6918 | + if (!empty($a_repeat_days)) { |
|
6919 | + foreach ($a_repeat_days as $repeat_day) { |
|
6920 | + $repeat_day = geodir_strtolower(trim($repeat_day)); |
|
6921 | 6921 | |
6922 | - if ($repeat_day != '' && isset($week_days[$repeat_day])) { |
|
6923 | - $repeat_days[] = $week_days[$repeat_day]; |
|
6924 | - } |
|
6925 | - } |
|
6922 | + if ($repeat_day != '' && isset($week_days[$repeat_day])) { |
|
6923 | + $repeat_days[] = $week_days[$repeat_day]; |
|
6924 | + } |
|
6925 | + } |
|
6926 | 6926 | |
6927 | - $repeat_days = array_unique($repeat_days); |
|
6928 | - } |
|
6927 | + $repeat_days = array_unique($repeat_days); |
|
6928 | + } |
|
6929 | 6929 | |
6930 | - $a_repeat_weeks = isset($gd_post['recurring_week_nos']) && trim($gd_post['recurring_week_nos']) != '' ? explode(",", trim($gd_post['recurring_week_nos'])) : array(); |
|
6931 | - $repeat_weeks = array(); |
|
6932 | - if (!empty($a_repeat_weeks)) { |
|
6933 | - foreach ($a_repeat_weeks as $repeat_week) { |
|
6934 | - $repeat_weeks[] = (int)$repeat_week; |
|
6935 | - } |
|
6930 | + $a_repeat_weeks = isset($gd_post['recurring_week_nos']) && trim($gd_post['recurring_week_nos']) != '' ? explode(",", trim($gd_post['recurring_week_nos'])) : array(); |
|
6931 | + $repeat_weeks = array(); |
|
6932 | + if (!empty($a_repeat_weeks)) { |
|
6933 | + foreach ($a_repeat_weeks as $repeat_week) { |
|
6934 | + $repeat_weeks[] = (int)$repeat_week; |
|
6935 | + } |
|
6936 | 6936 | |
6937 | - $repeat_weeks = array_unique($repeat_weeks); |
|
6938 | - } |
|
6939 | - } |
|
6940 | - } |
|
6937 | + $repeat_weeks = array_unique($repeat_weeks); |
|
6938 | + } |
|
6939 | + } |
|
6940 | + } |
|
6941 | 6941 | |
6942 | - if (isset($gd_post['recurring_dates'])) { |
|
6943 | - unset($gd_post['recurring_dates']); |
|
6944 | - } |
|
6942 | + if (isset($gd_post['recurring_dates'])) { |
|
6943 | + unset($gd_post['recurring_dates']); |
|
6944 | + } |
|
6945 | 6945 | |
6946 | - $gd_post['is_recurring'] = $is_recurring; |
|
6947 | - $gd_post['event_date'] = $event_date; |
|
6948 | - $gd_post['event_start'] = $event_date; |
|
6949 | - $gd_post['event_end'] = $event_enddate; |
|
6950 | - $gd_post['all_day'] = $all_day; |
|
6951 | - $gd_post['starttime'] = $starttime; |
|
6952 | - $gd_post['endtime'] = $endtime; |
|
6946 | + $gd_post['is_recurring'] = $is_recurring; |
|
6947 | + $gd_post['event_date'] = $event_date; |
|
6948 | + $gd_post['event_start'] = $event_date; |
|
6949 | + $gd_post['event_end'] = $event_enddate; |
|
6950 | + $gd_post['all_day'] = $all_day; |
|
6951 | + $gd_post['starttime'] = $starttime; |
|
6952 | + $gd_post['endtime'] = $endtime; |
|
6953 | 6953 | |
6954 | - $gd_post['repeat_type'] = $repeat_type; |
|
6955 | - $gd_post['different_times'] = $different_times; |
|
6956 | - $gd_post['starttimes'] = $starttimes; |
|
6957 | - $gd_post['endtimes'] = $endtimes; |
|
6958 | - $gd_post['repeat_days'] = $repeat_days; |
|
6959 | - $gd_post['repeat_weeks'] = $repeat_weeks; |
|
6960 | - $gd_post['event_recurring_dates'] = $event_recurring_dates; |
|
6961 | - $gd_post['repeat_x'] = $repeat_x; |
|
6962 | - $gd_post['duration_x'] = $duration_x; |
|
6963 | - $gd_post['repeat_end_type'] = $repeat_end_type; |
|
6964 | - $gd_post['max_repeat'] = $max_repeat; |
|
6965 | - $gd_post['repeat_end'] = $repeat_end; |
|
6966 | - |
|
6967 | - return $gd_post; |
|
6954 | + $gd_post['repeat_type'] = $repeat_type; |
|
6955 | + $gd_post['different_times'] = $different_times; |
|
6956 | + $gd_post['starttimes'] = $starttimes; |
|
6957 | + $gd_post['endtimes'] = $endtimes; |
|
6958 | + $gd_post['repeat_days'] = $repeat_days; |
|
6959 | + $gd_post['repeat_weeks'] = $repeat_weeks; |
|
6960 | + $gd_post['event_recurring_dates'] = $event_recurring_dates; |
|
6961 | + $gd_post['repeat_x'] = $repeat_x; |
|
6962 | + $gd_post['duration_x'] = $duration_x; |
|
6963 | + $gd_post['repeat_end_type'] = $repeat_end_type; |
|
6964 | + $gd_post['max_repeat'] = $max_repeat; |
|
6965 | + $gd_post['repeat_end'] = $repeat_end; |
|
6966 | + |
|
6967 | + return $gd_post; |
|
6968 | 6968 | } |
6969 | 6969 | |
6970 | 6970 | /** |
@@ -7036,12 +7036,12 @@ discard block |
||
7036 | 7036 | * @return Original element id. |
7037 | 7037 | */ |
7038 | 7038 | function geodir_imex_original_post_id($element_id, $element_type) { |
7039 | - global $sitepress; |
|
7039 | + global $sitepress; |
|
7040 | 7040 | |
7041 | - $original_element_id = $sitepress->get_original_element_id($element_id, $element_type); |
|
7042 | - $element_id = $element_id != $original_element_id ? $original_element_id : ''; |
|
7041 | + $original_element_id = $sitepress->get_original_element_id($element_id, $element_type); |
|
7042 | + $element_id = $element_id != $original_element_id ? $original_element_id : ''; |
|
7043 | 7043 | |
7044 | - return $element_id; |
|
7044 | + return $element_id; |
|
7045 | 7045 | } |
7046 | 7046 | |
7047 | 7047 | /* |
@@ -7121,15 +7121,15 @@ discard block |
||
7121 | 7121 | * @global object $sitepress Sitepress WPML object. |
7122 | 7122 | */ |
7123 | 7123 | function geodir_wpml_permalink_setting_notice() { |
7124 | - if (geodir_is_wpml()) { |
|
7125 | - global $sitepress; |
|
7126 | - $current_language = $sitepress->get_current_language(); |
|
7127 | - $default_language = $sitepress->get_default_language(); |
|
7128 | - if ($current_language != 'all' && $current_language != $default_language) { |
|
7129 | - ?> |
|
7124 | + if (geodir_is_wpml()) { |
|
7125 | + global $sitepress; |
|
7126 | + $current_language = $sitepress->get_current_language(); |
|
7127 | + $default_language = $sitepress->get_default_language(); |
|
7128 | + if ($current_language != 'all' && $current_language != $default_language) { |
|
7129 | + ?> |
|
7130 | 7130 | <div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div> |
7131 | 7131 | <?php |
7132 | - } |
|
7133 | - } |
|
7132 | + } |
|
7133 | + } |
|
7134 | 7134 | } |
7135 | 7135 | ?> |
7136 | 7136 | \ No newline at end of file |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * GeoDirectory Admin. |
|
4 | - * |
|
5 | - * Main admin file which loads all settings panels and sets up admin menus. |
|
6 | - * |
|
7 | - * @since 1.0.0 |
|
8 | - * @package GeoDirectory |
|
9 | - */ |
|
3 | + * GeoDirectory Admin. |
|
4 | + * |
|
5 | + * Main admin file which loads all settings panels and sets up admin menus. |
|
6 | + * |
|
7 | + * @since 1.0.0 |
|
8 | + * @package GeoDirectory |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | add_action('admin_init', 'geodir_admin_init'); |
12 | 12 | if (!function_exists('geodir_admin_init')) { |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | { |
86 | 86 | global $pagenow; |
87 | 87 | |
88 | - // Get the current post type |
|
89 | - $post_type = geodir_admin_current_post_type(); |
|
90 | - $geodir_post_types = geodir_get_posttypes(); |
|
88 | + // Get the current post type |
|
89 | + $post_type = geodir_admin_current_post_type(); |
|
90 | + $geodir_post_types = geodir_get_posttypes(); |
|
91 | 91 | |
92 | - if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) { |
|
92 | + if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) { |
|
93 | 93 | add_action('admin_enqueue_scripts', 'geodir_admin_scripts'); |
94 | 94 | add_action('admin_enqueue_scripts', 'geodir_admin_styles'); |
95 | 95 | } |
@@ -1517,20 +1517,20 @@ discard block |
||
1517 | 1517 | function geodir_diagnose_load_db_language() { |
1518 | 1518 | global $wpdb; |
1519 | 1519 | |
1520 | - $is_error_during_diagnose = geodirectory_load_db_language(); |
|
1520 | + $is_error_during_diagnose = geodirectory_load_db_language(); |
|
1521 | 1521 | |
1522 | 1522 | $output_str = ''; |
1523 | 1523 | |
1524 | 1524 | if ($is_error_during_diagnose) { |
1525 | 1525 | $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>"; |
1526 | - $info_div_class = "geodir_problem_info"; |
|
1526 | + $info_div_class = "geodir_problem_info"; |
|
1527 | 1527 | } else { |
1528 | 1528 | $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>"; |
1529 | - $info_div_class = "geodir_noproblem_info"; |
|
1529 | + $info_div_class = "geodir_noproblem_info"; |
|
1530 | 1530 | $fix_button_txt = ''; |
1531 | 1531 | } |
1532 | 1532 | |
1533 | - echo "<ul class='$info_div_class'>"; |
|
1533 | + echo "<ul class='$info_div_class'>"; |
|
1534 | 1534 | echo $output_str; |
1535 | 1535 | echo $fix_button_txt; |
1536 | 1536 | echo "</ul>"; |
@@ -1655,7 +1655,7 @@ discard block |
||
1655 | 1655 | $uploads = wp_upload_dir(); |
1656 | 1656 | ini_set('auto_detect_line_endings', true); |
1657 | 1657 | |
1658 | - $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
|
1658 | + $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
|
1659 | 1659 | |
1660 | 1660 | $task = isset($_POST['task']) ? $_POST['task'] : ''; |
1661 | 1661 | $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
@@ -1855,8 +1855,8 @@ discard block |
||
1855 | 1855 | $post_longitude = addslashes($buffer[$c]); |
1856 | 1856 | } |
1857 | 1857 | |
1858 | - // Post status |
|
1859 | - if ($customKeyarray[$c] == 'post_status') { |
|
1858 | + // Post status |
|
1859 | + if ($customKeyarray[$c] == 'post_status') { |
|
1860 | 1860 | $post_status = sanitize_key( $buffer[$c] ); |
1861 | 1861 | } |
1862 | 1862 | } |
@@ -1873,10 +1873,10 @@ discard block |
||
1873 | 1873 | } |
1874 | 1874 | } |
1875 | 1875 | |
1876 | - // Default post status |
|
1877 | - $default_status = 'publish'; |
|
1878 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
1879 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
1876 | + // Default post status |
|
1877 | + $default_status = 'publish'; |
|
1878 | + $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
1879 | + $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
1880 | 1880 | |
1881 | 1881 | $my_post['post_title'] = $post_title; |
1882 | 1882 | $my_post['post_content'] = $post_desc; |
@@ -2099,5 +2099,5 @@ discard block |
||
2099 | 2099 | add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
2100 | 2100 | |
2101 | 2101 | if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') { |
2102 | - add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice'); |
|
2102 | + add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice'); |
|
2103 | 2103 | } |
2104 | 2104 | \ No newline at end of file |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | } ?>"> |
153 | 153 | <form method="post" id="mainform" |
154 | 154 | class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) { |
155 | - echo sanitize_text_field($sub['subtab']); |
|
156 | - } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data"> |
|
155 | + echo sanitize_text_field($sub['subtab']); |
|
156 | + } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data"> |
|
157 | 157 | <input type="hidden" class="active_tab" name="active_tab" |
158 | 158 | value="<?php if (isset($_REQUEST['active_tab'])) { |
159 | - echo sanitize_text_field($_REQUEST['active_tab']); |
|
160 | - } ?>"/> |
|
159 | + echo sanitize_text_field($_REQUEST['active_tab']); |
|
160 | + } ?>"/> |
|
161 | 161 | <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?> |
162 | 162 | <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?> |
163 | 163 | <?php |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | <input class="require" type="text" size="80" style="width:440px" |
416 | 416 | id="<?php echo $prefix;?>city" name="city" |
417 | 417 | value="<?php if (isset($location_result->city)) { |
418 | - echo $location_result->city; |
|
419 | - } ?>"/> |
|
418 | + echo $location_result->city; |
|
419 | + } ?>"/> |
|
420 | 420 | |
421 | 421 | <div |
422 | 422 | class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div> |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | <input class="require" type="text" size="80" style="width:440px" |
432 | 432 | id="<?php echo $prefix;?>region" name="region" |
433 | 433 | value="<?php if (isset($location_result->region)) { |
434 | - echo $location_result->region; |
|
435 | - } ?>"/> |
|
434 | + echo $location_result->region; |
|
435 | + } ?>"/> |
|
436 | 436 | |
437 | 437 | <div |
438 | 438 | class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div> |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | <input type="text" class="require" size="80" style="width:440px" |
486 | 486 | id="<?php echo $prefix;?>latitude" name="latitude" |
487 | 487 | value="<?php if (isset($location_result->city_latitude)) { |
488 | - echo $location_result->city_latitude; |
|
489 | - } ?>"/> |
|
488 | + echo $location_result->city_latitude; |
|
489 | + } ?>"/> |
|
490 | 490 | |
491 | 491 | <div |
492 | 492 | class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div> |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | <input type="text" class="require" size="80" style="width:440px" |
503 | 503 | id="<?php echo $prefix;?>longitude" name="longitude" |
504 | 504 | value="<?php if (isset($location_result->city_longitude)) { |
505 | - echo $location_result->city_longitude; |
|
506 | - } ?>"/> |
|
505 | + echo $location_result->city_longitude; |
|
506 | + } ?>"/> |
|
507 | 507 | |
508 | 508 | <div |
509 | 509 | class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div> |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | case 'compatibility_settings' : |
547 | 547 | geodir_theme_compatibility_setting_page(); |
548 | 548 | break; |
549 | - case 'import_export' : |
|
549 | + case 'import_export' : |
|
550 | 550 | geodir_import_export_page(); |
551 | 551 | break; |
552 | 552 |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Custom fields functions |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - * @global object $wpdb WordPress Database object. |
|
8 | - * @global string $table_prefix WordPress Database Table prefix. |
|
9 | - */ |
|
3 | + * Custom fields functions |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + * @global object $wpdb WordPress Database object. |
|
8 | + * @global string $table_prefix WordPress Database Table prefix. |
|
9 | + */ |
|
10 | 10 | global $wpdb, $table_prefix; |
11 | 11 | |
12 | 12 | if (!function_exists('geodir_column_exist')) { |
13 | - /** |
|
14 | - * Check table column exist or not. |
|
15 | - * |
|
16 | - * @since 1.0.0 |
|
17 | - * @package GeoDirectory |
|
13 | + /** |
|
14 | + * Check table column exist or not. |
|
15 | + * |
|
16 | + * @since 1.0.0 |
|
17 | + * @package GeoDirectory |
|
18 | 18 | * @global object $wpdb WordPress Database object. |
19 | - * @param string $db The table name. |
|
20 | - * @param string $column The column name. |
|
21 | - * @return bool If column exists returns true. Otherwise false. |
|
22 | - */ |
|
23 | - function geodir_column_exist($db, $column) |
|
19 | + * @param string $db The table name. |
|
20 | + * @param string $column The column name. |
|
21 | + * @return bool If column exists returns true. Otherwise false. |
|
22 | + */ |
|
23 | + function geodir_column_exist($db, $column) |
|
24 | 24 | { |
25 | 25 | global $wpdb; |
26 | 26 | $exists = false; |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | if (!function_exists('geodir_add_column_if_not_exist')) { |
39 | - /** |
|
40 | - * Add column if table column not exist. |
|
41 | - * |
|
42 | - * @since 1.0.0 |
|
43 | - * @package GeoDirectory |
|
39 | + /** |
|
40 | + * Add column if table column not exist. |
|
41 | + * |
|
42 | + * @since 1.0.0 |
|
43 | + * @package GeoDirectory |
|
44 | 44 | * @global object $wpdb WordPress Database object. |
45 | - * @param string $db The table name. |
|
46 | - * @param string $column The column name. |
|
47 | - * @param string $column_attr The column attributes. |
|
48 | - */ |
|
49 | - function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
45 | + * @param string $db The table name. |
|
46 | + * @param string $column The column name. |
|
47 | + * @param string $column_attr The column attributes. |
|
48 | + */ |
|
49 | + function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
50 | 50 | { |
51 | 51 | global $wpdb; |
52 | 52 | $result = 0;// no rows affected |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | if (!function_exists('geodir_custom_field_adminhtml')) { |
155 | - /** |
|
156 | - * Adds admin html for custom fields. |
|
157 | - * |
|
158 | - * @since 1.0.0 |
|
159 | - * @package GeoDirectory |
|
155 | + /** |
|
156 | + * Adds admin html for custom fields. |
|
157 | + * |
|
158 | + * @since 1.0.0 |
|
159 | + * @package GeoDirectory |
|
160 | 160 | * @global object $wpdb WordPress Database object. |
161 | - * @param string $field_type The form field type. |
|
162 | - * @param object|int $result_str The custom field results object or row id. |
|
163 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
164 | - * @param bool $default when set to true field will be for admin use only. |
|
165 | - */ |
|
166 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
161 | + * @param string $field_type The form field type. |
|
162 | + * @param object|int $result_str The custom field results object or row id. |
|
163 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
164 | + * @param bool $default when set to true field will be for admin use only. |
|
165 | + */ |
|
166 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
167 | 167 | { |
168 | 168 | global $wpdb; |
169 | 169 | $cf = $result_str; |
@@ -186,32 +186,32 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | if (!function_exists('geodir_custom_field_delete')) { |
189 | - /** |
|
190 | - * Delete custom field using field id. |
|
191 | - * |
|
192 | - * @since 1.0.0 |
|
193 | - * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
194 | - * @package GeoDirectory |
|
189 | + /** |
|
190 | + * Delete custom field using field id. |
|
191 | + * |
|
192 | + * @since 1.0.0 |
|
193 | + * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
194 | + * @package GeoDirectory |
|
195 | 195 | * @global object $wpdb WordPress Database object. |
196 | 196 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
197 | - * @param string $field_id The custom field ID. |
|
198 | - * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
199 | - */ |
|
200 | - function geodir_custom_field_delete($field_id = '') { |
|
197 | + * @param string $field_id The custom field ID. |
|
198 | + * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
199 | + */ |
|
200 | + function geodir_custom_field_delete($field_id = '') { |
|
201 | 201 | global $wpdb, $plugin_prefix; |
202 | 202 | |
203 | - if ($field_id != '') { |
|
203 | + if ($field_id != '') { |
|
204 | 204 | $cf = trim($field_id, '_'); |
205 | 205 | |
206 | 206 | if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) { |
207 | 207 | $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf))); |
208 | 208 | |
209 | 209 | $post_type = $field->post_type; |
210 | - $htmlvar_name = $field->htmlvar_name; |
|
210 | + $htmlvar_name = $field->htmlvar_name; |
|
211 | 211 | |
212 | - if ($post_type != '' && $htmlvar_name != '') { |
|
213 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type))); |
|
214 | - } |
|
212 | + if ($post_type != '' && $htmlvar_name != '') { |
|
213 | + $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type))); |
|
214 | + } |
|
215 | 215 | |
216 | 216 | /** |
217 | 217 | * Called after a custom field is deleted. |
@@ -248,15 +248,15 @@ discard block |
||
248 | 248 | } |
249 | 249 | |
250 | 250 | if (!function_exists('geodir_custom_field_save')) { |
251 | - /** |
|
252 | - * Save or Update custom fields into the database. |
|
253 | - * |
|
254 | - * @since 1.0.0 |
|
251 | + /** |
|
252 | + * Save or Update custom fields into the database. |
|
253 | + * |
|
254 | + * @since 1.0.0 |
|
255 | 255 | * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
256 | - * @package GeoDirectory |
|
256 | + * @package GeoDirectory |
|
257 | 257 | * @global object $wpdb WordPress Database object. |
258 | 258 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
259 | - * @param array $request_field { |
|
259 | + * @param array $request_field { |
|
260 | 260 | * Attributes of the request field array. |
261 | 261 | * |
262 | 262 | * @type string $action Ajax Action name. Default "geodir_ajax_action". |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * @type string $css_class Enter custom css class for field custom style. |
290 | 290 | * |
291 | 291 | * } |
292 | - * @param bool $default Not yet implemented. |
|
293 | - * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
294 | - */ |
|
295 | - function geodir_custom_field_save($request_field = array(), $default = false) |
|
292 | + * @param bool $default Not yet implemented. |
|
293 | + * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
294 | + */ |
|
295 | + function geodir_custom_field_save($request_field = array(), $default = false) |
|
296 | 296 | { |
297 | 297 | |
298 | 298 | global $wpdb, $plugin_prefix; |
@@ -976,27 +976,27 @@ discard block |
||
976 | 976 | if (isset($option_values) && $option_values && $field_type == 'select') { |
977 | 977 | $option_values_arr = explode(',', $option_values); |
978 | 978 | |
979 | - if (is_array($option_values_arr)) { |
|
979 | + if (is_array($option_values_arr)) { |
|
980 | 980 | $op_max = 0; |
981 | 981 | |
982 | - foreach ($option_values_arr as $op_val) { |
|
982 | + foreach ($option_values_arr as $op_val) { |
|
983 | 983 | if (strlen($op_val) && strlen($op_val) > $op_max) { |
984 | - $op_max = strlen($op_val); |
|
985 | - } |
|
984 | + $op_max = strlen($op_val); |
|
985 | + } |
|
986 | 986 | } |
987 | 987 | |
988 | - if ($op_max) { |
|
989 | - $op_size = $op_max; |
|
990 | - } |
|
988 | + if ($op_max) { |
|
989 | + $op_size = $op_max; |
|
990 | + } |
|
991 | 991 | } |
992 | 992 | } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') { |
993 | 993 | if (strlen($option_values)) { |
994 | 994 | $op_size = strlen($option_values); |
995 | 995 | } |
996 | 996 | |
997 | - if (isset($request_field['multi_display_type'])) { |
|
998 | - $extra_fields = $request_field['multi_display_type']; |
|
999 | - } |
|
997 | + if (isset($request_field['multi_display_type'])) { |
|
998 | + $extra_fields = $request_field['multi_display_type']; |
|
999 | + } |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | $meta_field_add = $data_type . "( $op_size ) NULL "; |
@@ -1214,10 +1214,10 @@ discard block |
||
1214 | 1214 | $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
1215 | 1215 | |
1216 | 1216 | $fieldset_id = ''; |
1217 | - $fieldset_field_class = 'gd-fieldset-details'; |
|
1218 | - foreach ($custom_fields as $key => $val) { |
|
1217 | + $fieldset_field_class = 'gd-fieldset-details'; |
|
1218 | + foreach ($custom_fields as $key => $val) { |
|
1219 | 1219 | $val = stripslashes_deep($val); // strip slashes from labels |
1220 | - $name = $val['name']; |
|
1220 | + $name = $val['name']; |
|
1221 | 1221 | $site_title = $val['site_title']; |
1222 | 1222 | $type = $val['type']; |
1223 | 1223 | $admin_desc = $val['desc']; |
@@ -1582,15 +1582,15 @@ discard block |
||
1582 | 1582 | <?php if ($option_values) { |
1583 | 1583 | $option_values = geodir_string_values_to_options($option_values, true); |
1584 | 1584 | |
1585 | - if (!empty($option_values)) { |
|
1586 | - foreach ($option_values as $option_value) { |
|
1587 | - if (empty($option_value['optgroup'])) { |
|
1588 | - ?> |
|
1585 | + if (!empty($option_values)) { |
|
1586 | + foreach ($option_values as $option_value) { |
|
1587 | + if (empty($option_value['optgroup'])) { |
|
1588 | + ?> |
|
1589 | 1589 | <input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?> |
1590 | 1590 | <?php |
1591 | - } |
|
1592 | - } |
|
1593 | - } |
|
1591 | + } |
|
1592 | + } |
|
1593 | + } |
|
1594 | 1594 | } |
1595 | 1595 | ?> |
1596 | 1596 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
@@ -2033,8 +2033,8 @@ discard block |
||
2033 | 2033 | $file_totImg = count($curImages); |
2034 | 2034 | } |
2035 | 2035 | |
2036 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
2037 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
2036 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
2037 | + $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
2038 | 2038 | |
2039 | 2039 | ?> |
2040 | 2040 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
@@ -2062,10 +2062,10 @@ discard block |
||
2062 | 2062 | <?php } ?> |
2063 | 2063 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
2064 | 2064 | value="<?php if (isset($file_totImg)) { |
2065 | - echo esc_attr($file_totImg); |
|
2066 | - } else { |
|
2067 | - echo '0'; |
|
2068 | - } ?>"/> |
|
2065 | + echo esc_attr($file_totImg); |
|
2066 | + } else { |
|
2067 | + echo '0'; |
|
2068 | + } ?>"/> |
|
2069 | 2069 | |
2070 | 2070 | <div style="float:left; width:55%;"> |
2071 | 2071 | <div |
@@ -2124,18 +2124,18 @@ discard block |
||
2124 | 2124 | |
2125 | 2125 | |
2126 | 2126 | if (!function_exists('geodir_get_field_infoby')) { |
2127 | - /** |
|
2128 | - * Get custom field using key and value. |
|
2129 | - * |
|
2130 | - * @since 1.0.0 |
|
2131 | - * @package GeoDirectory |
|
2127 | + /** |
|
2128 | + * Get custom field using key and value. |
|
2129 | + * |
|
2130 | + * @since 1.0.0 |
|
2131 | + * @package GeoDirectory |
|
2132 | 2132 | * @global object $wpdb WordPress Database object. |
2133 | - * @param string $key The key you want to look for. |
|
2134 | - * @param string $value The value of the key you want to look for. |
|
2135 | - * @param string $geodir_post_type The post type. |
|
2136 | - * @return bool|mixed Returns field info when available. otherwise returns false. |
|
2137 | - */ |
|
2138 | - function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
2133 | + * @param string $key The key you want to look for. |
|
2134 | + * @param string $value The value of the key you want to look for. |
|
2135 | + * @param string $geodir_post_type The post type. |
|
2136 | + * @return bool|mixed Returns field info when available. otherwise returns false. |
|
2137 | + */ |
|
2138 | + function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
2139 | 2139 | { |
2140 | 2140 | |
2141 | 2141 | global $wpdb; |
@@ -2158,21 +2158,21 @@ discard block |
||
2158 | 2158 | |
2159 | 2159 | |
2160 | 2160 | if (!function_exists('geodir_show_listing_info')) { |
2161 | - /** |
|
2162 | - * Show listing info depending on field location. |
|
2163 | - * |
|
2164 | - * @since 1.0.0 |
|
2165 | - * @since 1.5.7 Custom fields option values added to db translation. |
|
2161 | + /** |
|
2162 | + * Show listing info depending on field location. |
|
2163 | + * |
|
2164 | + * @since 1.0.0 |
|
2165 | + * @since 1.5.7 Custom fields option values added to db translation. |
|
2166 | 2166 | * Changes to display url fields title. |
2167 | - * @package GeoDirectory |
|
2167 | + * @package GeoDirectory |
|
2168 | 2168 | * @global object $wpdb WordPress Database object. |
2169 | 2169 | * @global object $post The current post object. |
2170 | 2170 | * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
2171 | 2171 | * |
2172 | - * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
2173 | - * @return string Returns listing info html. |
|
2174 | - */ |
|
2175 | - function geodir_show_listing_info($fields_location = '') { |
|
2172 | + * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
2173 | + * @return string Returns listing info html. |
|
2174 | + */ |
|
2175 | + function geodir_show_listing_info($fields_location = '') { |
|
2176 | 2176 | global $post, $preview, $wpdb, $send_to_friend; |
2177 | 2177 | |
2178 | 2178 | $payment_info = array(); |
@@ -2181,7 +2181,7 @@ discard block |
||
2181 | 2181 | $package_info = geodir_post_package_info($package_info, $post); |
2182 | 2182 | $post_package_id = $package_info->pid; |
2183 | 2183 | $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type; |
2184 | - $send_to_friend = false; |
|
2184 | + $send_to_friend = false; |
|
2185 | 2185 | |
2186 | 2186 | ob_start(); |
2187 | 2187 | $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location); |
@@ -2195,7 +2195,7 @@ discard block |
||
2195 | 2195 | |
2196 | 2196 | $i = 1; |
2197 | 2197 | foreach ($fields_info as $type) { |
2198 | - $type = stripslashes_deep($type); // strip slashes |
|
2198 | + $type = stripslashes_deep($type); // strip slashes |
|
2199 | 2199 | $html = ''; |
2200 | 2200 | $html_var = ''; |
2201 | 2201 | $field_icon = ''; |
@@ -2400,13 +2400,13 @@ discard block |
||
2400 | 2400 | $field_icon = ''; |
2401 | 2401 | } |
2402 | 2402 | |
2403 | - $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']}); |
|
2403 | + $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']}); |
|
2404 | 2404 | |
2405 | 2405 | |
2406 | - $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
|
2407 | - $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title']; |
|
2406 | + $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
|
2407 | + $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title']; |
|
2408 | 2408 | if(!empty($type['default_value'])){$title = $type['default_value'];} |
2409 | - $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
|
2409 | + $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
|
2410 | 2410 | |
2411 | 2411 | |
2412 | 2412 | $geodir_odd_even = ''; |
@@ -2624,22 +2624,22 @@ discard block |
||
2624 | 2624 | if ($post->{$type['htmlvar_name']} != ''): |
2625 | 2625 | |
2626 | 2626 | if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') { |
2627 | - $html_val = __('No', 'geodirectory'); |
|
2628 | - } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') { |
|
2629 | - $html_val = __('Yes', 'geodirectory'); |
|
2630 | - } else { |
|
2631 | - if (!empty($type['option_values'])) { |
|
2632 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
2627 | + $html_val = __('No', 'geodirectory'); |
|
2628 | + } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') { |
|
2629 | + $html_val = __('Yes', 'geodirectory'); |
|
2630 | + } else { |
|
2631 | + if (!empty($type['option_values'])) { |
|
2632 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
2633 | 2633 | |
2634 | - if (!empty($cf_option_values)) { |
|
2635 | - foreach ($cf_option_values as $cf_option_value) { |
|
2636 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) { |
|
2637 | - $html_val = $cf_option_value['label']; |
|
2638 | - } |
|
2639 | - } |
|
2640 | - } |
|
2641 | - } |
|
2642 | - } |
|
2634 | + if (!empty($cf_option_values)) { |
|
2635 | + foreach ($cf_option_values as $cf_option_value) { |
|
2636 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) { |
|
2637 | + $html_val = $cf_option_value['label']; |
|
2638 | + } |
|
2639 | + } |
|
2640 | + } |
|
2641 | + } |
|
2642 | + } |
|
2643 | 2643 | |
2644 | 2644 | if (strpos($field_icon, 'http') !== false) { |
2645 | 2645 | $field_icon_af = ''; |
@@ -2710,19 +2710,19 @@ discard block |
||
2710 | 2710 | $html_var = $type['htmlvar_name']; |
2711 | 2711 | |
2712 | 2712 | if ($post->{$type['htmlvar_name']}): |
2713 | - $field_value = __($post->$type['htmlvar_name'], 'geodirectory'); |
|
2713 | + $field_value = __($post->$type['htmlvar_name'], 'geodirectory'); |
|
2714 | 2714 | |
2715 | - if (!empty($type['option_values'])) { |
|
2716 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
2715 | + if (!empty($type['option_values'])) { |
|
2716 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
2717 | 2717 | |
2718 | - if (!empty($cf_option_values)) { |
|
2719 | - foreach ($cf_option_values as $cf_option_value) { |
|
2720 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) { |
|
2721 | - $field_value = $cf_option_value['label']; |
|
2722 | - } |
|
2723 | - } |
|
2724 | - } |
|
2725 | - } |
|
2718 | + if (!empty($cf_option_values)) { |
|
2719 | + foreach ($cf_option_values as $cf_option_value) { |
|
2720 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) { |
|
2721 | + $field_value = $cf_option_value['label']; |
|
2722 | + } |
|
2723 | + } |
|
2724 | + } |
|
2725 | + } |
|
2726 | 2726 | |
2727 | 2727 | if (strpos($field_icon, 'http') !== false) { |
2728 | 2728 | $field_icon_af = ''; |
@@ -2770,19 +2770,19 @@ discard block |
||
2770 | 2770 | $field_icon = ''; |
2771 | 2771 | } |
2772 | 2772 | |
2773 | - $field_values = explode(',', trim($post->$type['htmlvar_name'], ",")); |
|
2773 | + $field_values = explode(',', trim($post->$type['htmlvar_name'], ",")); |
|
2774 | 2774 | |
2775 | 2775 | $option_values = array(); |
2776 | - if (!empty($type['option_values'])) { |
|
2777 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
2776 | + if (!empty($type['option_values'])) { |
|
2777 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
2778 | 2778 | |
2779 | - if (!empty($cf_option_values)) { |
|
2780 | - foreach ($cf_option_values as $cf_option_value) { |
|
2781 | - if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
2782 | - $option_values[] = $cf_option_value['label']; |
|
2783 | - } |
|
2784 | - } |
|
2785 | - } |
|
2779 | + if (!empty($cf_option_values)) { |
|
2780 | + foreach ($cf_option_values as $cf_option_value) { |
|
2781 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
2782 | + $option_values[] = $cf_option_value['label']; |
|
2783 | + } |
|
2784 | + } |
|
2785 | + } |
|
2786 | 2786 | } |
2787 | 2787 | |
2788 | 2788 | $geodir_odd_even = ''; |
@@ -2802,11 +2802,11 @@ discard block |
||
2802 | 2802 | if (count($option_values) > 1) { |
2803 | 2803 | $html .= '<ul>'; |
2804 | 2804 | |
2805 | - foreach ($option_values as $val) { |
|
2805 | + foreach ($option_values as $val) { |
|
2806 | 2806 | $html .= '<li>' . $val . '</li>'; |
2807 | 2807 | } |
2808 | 2808 | |
2809 | - $html .= '</ul>'; |
|
2809 | + $html .= '</ul>'; |
|
2810 | 2810 | } else { |
2811 | 2811 | $html .= $post->$type['htmlvar_name']; |
2812 | 2812 | } |
@@ -2815,13 +2815,13 @@ discard block |
||
2815 | 2815 | endif; |
2816 | 2816 | break; |
2817 | 2817 | case 'email': |
2818 | - if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
2819 | - continue; // Remove Send Enquiry | Send To Friend from listings page |
|
2820 | - } |
|
2818 | + if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
2819 | + continue; // Remove Send Enquiry | Send To Friend from listings page |
|
2820 | + } |
|
2821 | 2821 | |
2822 | - if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) { |
|
2823 | - $send_to_friend = true; |
|
2824 | - $b_send_inquiry = ''; |
|
2822 | + if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) { |
|
2823 | + $send_to_friend = true; |
|
2824 | + $b_send_inquiry = ''; |
|
2825 | 2825 | $b_sendtofriend = ''; |
2826 | 2826 | |
2827 | 2827 | $html = ''; |
@@ -2859,7 +2859,7 @@ discard block |
||
2859 | 2859 | |
2860 | 2860 | if (isset($package_info->sendtofriend) && $package_info->sendtofriend) { |
2861 | 2861 | $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
2862 | - } |
|
2862 | + } |
|
2863 | 2863 | |
2864 | 2864 | $html .= '</span></div>'; |
2865 | 2865 | |
@@ -2932,13 +2932,13 @@ discard block |
||
2932 | 2932 | if (!empty($files)): |
2933 | 2933 | |
2934 | 2934 | $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL; |
2935 | - $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'] : ''; |
|
2935 | + $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'] : ''; |
|
2936 | 2936 | |
2937 | - $file_paths = ''; |
|
2937 | + $file_paths = ''; |
|
2938 | 2938 | foreach ($files as $file) { |
2939 | 2939 | if (!empty($file)) { |
2940 | 2940 | |
2941 | - // $filetype = wp_check_filetype($file); |
|
2941 | + // $filetype = wp_check_filetype($file); |
|
2942 | 2942 | |
2943 | 2943 | $image_name_arr = explode('/', $file); |
2944 | 2944 | $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
@@ -2947,29 +2947,29 @@ discard block |
||
2947 | 2947 | |
2948 | 2948 | $arr_file_type = wp_check_filetype($filename); |
2949 | 2949 | if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
2950 | - continue; |
|
2951 | - } |
|
2950 | + continue; |
|
2951 | + } |
|
2952 | 2952 | |
2953 | - $uploaded_file_type = $arr_file_type['type']; |
|
2954 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
2953 | + $uploaded_file_type = $arr_file_type['type']; |
|
2954 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
2955 | 2955 | |
2956 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
2957 | - continue; // Invalid file type. |
|
2958 | - } |
|
2956 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
2957 | + continue; // Invalid file type. |
|
2958 | + } |
|
2959 | 2959 | |
2960 | 2960 | //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
2961 | - $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
2961 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
2962 | 2962 | |
2963 | 2963 | // If the uploaded file is image |
2964 | 2964 | if (in_array($uploaded_file_type, $image_file_types)) { |
2965 | 2965 | $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
2966 | 2966 | $file_paths .= '<a href="'.$file.'">'; |
2967 | - $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
2968 | - $file_paths .= '</a>'; |
|
2967 | + $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
2968 | + $file_paths .= '</a>'; |
|
2969 | 2969 | //$file_paths .= '<img src="'.$file.'" />'; |
2970 | 2970 | $file_paths .= '</div>'; |
2971 | 2971 | } else { |
2972 | - $ext_path = '_' . $html_var . '_'; |
|
2972 | + $ext_path = '_' . $html_var . '_'; |
|
2973 | 2973 | $filename = explode($ext_path, $filename); |
2974 | 2974 | $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
2975 | 2975 | } |
@@ -3174,14 +3174,14 @@ discard block |
||
3174 | 3174 | } |
3175 | 3175 | |
3176 | 3176 | if (!function_exists('geodir_default_date_format')) { |
3177 | - /** |
|
3178 | - * Returns default date format. |
|
3179 | - * |
|
3180 | - * @since 1.0.0 |
|
3181 | - * @package GeoDirectory |
|
3182 | - * @return mixed|string|void Returns default date format. |
|
3183 | - */ |
|
3184 | - function geodir_default_date_format() |
|
3177 | + /** |
|
3178 | + * Returns default date format. |
|
3179 | + * |
|
3180 | + * @since 1.0.0 |
|
3181 | + * @package GeoDirectory |
|
3182 | + * @return mixed|string|void Returns default date format. |
|
3183 | + */ |
|
3184 | + function geodir_default_date_format() |
|
3185 | 3185 | { |
3186 | 3186 | if ($format = get_option('date_format')) |
3187 | 3187 | return $format; |
@@ -3191,30 +3191,30 @@ discard block |
||
3191 | 3191 | } |
3192 | 3192 | |
3193 | 3193 | if (!function_exists('geodir_get_formated_date')) { |
3194 | - /** |
|
3195 | - * Returns formatted date. |
|
3196 | - * |
|
3197 | - * @since 1.0.0 |
|
3198 | - * @package GeoDirectory |
|
3199 | - * @param string $date Date string to convert. |
|
3200 | - * @return bool|int|string Returns formatted date. |
|
3201 | - */ |
|
3202 | - function geodir_get_formated_date($date) |
|
3194 | + /** |
|
3195 | + * Returns formatted date. |
|
3196 | + * |
|
3197 | + * @since 1.0.0 |
|
3198 | + * @package GeoDirectory |
|
3199 | + * @param string $date Date string to convert. |
|
3200 | + * @return bool|int|string Returns formatted date. |
|
3201 | + */ |
|
3202 | + function geodir_get_formated_date($date) |
|
3203 | 3203 | { |
3204 | 3204 | return mysql2date(get_option('date_format'), $date); |
3205 | 3205 | } |
3206 | 3206 | } |
3207 | 3207 | |
3208 | 3208 | if (!function_exists('geodir_get_formated_time')) { |
3209 | - /** |
|
3210 | - * Returns formatted time. |
|
3211 | - * |
|
3212 | - * @since 1.0.0 |
|
3213 | - * @package GeoDirectory |
|
3214 | - * @param string $time Time string to convert. |
|
3215 | - * @return bool|int|string Returns formatted time. |
|
3216 | - */ |
|
3217 | - function geodir_get_formated_time($time) |
|
3209 | + /** |
|
3210 | + * Returns formatted time. |
|
3211 | + * |
|
3212 | + * @since 1.0.0 |
|
3213 | + * @package GeoDirectory |
|
3214 | + * @param string $time Time string to convert. |
|
3215 | + * @return bool|int|string Returns formatted time. |
|
3216 | + */ |
|
3217 | + function geodir_get_formated_time($time) |
|
3218 | 3218 | { |
3219 | 3219 | return mysql2date(get_option('time_format'), $time, $translate = true); |
3220 | 3220 | } |
@@ -3222,21 +3222,21 @@ discard block |
||
3222 | 3222 | |
3223 | 3223 | |
3224 | 3224 | if (!function_exists('geodir_save_post_file_fields')) { |
3225 | - /** |
|
3226 | - * Save post file fields |
|
3227 | - * |
|
3228 | - * @since 1.0.0 |
|
3229 | - * @since 1.4.7 Added `$extra_fields` parameter. |
|
3230 | - * @package GeoDirectory |
|
3225 | + /** |
|
3226 | + * Save post file fields |
|
3227 | + * |
|
3228 | + * @since 1.0.0 |
|
3229 | + * @since 1.4.7 Added `$extra_fields` parameter. |
|
3230 | + * @package GeoDirectory |
|
3231 | 3231 | * @global object $wpdb WordPress Database object. |
3232 | 3232 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
3233 | 3233 | * @global object $current_user Current user object. |
3234 | - * @param int $post_id |
|
3235 | - * @param string $field_id |
|
3236 | - * @param array $post_image |
|
3237 | - * @param array $extra_fields Array of extra fields. |
|
3238 | - */ |
|
3239 | - function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
3234 | + * @param int $post_id |
|
3235 | + * @param string $field_id |
|
3236 | + * @param array $post_image |
|
3237 | + * @param array $extra_fields Array of extra fields. |
|
3238 | + */ |
|
3239 | + function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
3240 | 3240 | { |
3241 | 3241 | |
3242 | 3242 | global $wpdb, $plugin_prefix, $current_user; |
@@ -3262,7 +3262,7 @@ discard block |
||
3262 | 3262 | $geodir_uploadurl = $uploads['url']; |
3263 | 3263 | $sub_dir = $uploads['subdir']; |
3264 | 3264 | |
3265 | - $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'] : ''; |
|
3265 | + $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'] : ''; |
|
3266 | 3266 | |
3267 | 3267 | for ($m = 0; $m < count($post_image); $m++) { |
3268 | 3268 | |
@@ -3279,47 +3279,47 @@ discard block |
||
3279 | 3279 | |
3280 | 3280 | $arr_file_type = wp_check_filetype($filename); |
3281 | 3281 | |
3282 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
3283 | - continue; |
|
3284 | - } |
|
3282 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
3283 | + continue; |
|
3284 | + } |
|
3285 | 3285 | |
3286 | - $uploaded_file_type = $arr_file_type['type']; |
|
3287 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
3286 | + $uploaded_file_type = $arr_file_type['type']; |
|
3287 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
3288 | 3288 | |
3289 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
3290 | - continue; // Invalid file type. |
|
3291 | - } |
|
3289 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
3290 | + continue; // Invalid file type. |
|
3291 | + } |
|
3292 | 3292 | |
3293 | 3293 | // Set an array containing a list of acceptable formats |
3294 | 3294 | //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
3295 | 3295 | |
3296 | - if (!function_exists('wp_handle_upload')) |
|
3297 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
3296 | + if (!function_exists('wp_handle_upload')) |
|
3297 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
3298 | 3298 | |
3299 | - if (!is_dir($geodir_uploadpath)) |
|
3300 | - mkdir($geodir_uploadpath); |
|
3299 | + if (!is_dir($geodir_uploadpath)) |
|
3300 | + mkdir($geodir_uploadpath); |
|
3301 | 3301 | |
3302 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
3303 | - $explode_sub_dir = explode("/", $sub_dir); |
|
3304 | - if ($curr_img_dir == end($explode_sub_dir)) { |
|
3305 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
3306 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
3307 | - } else { |
|
3308 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
3309 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
3310 | - } |
|
3302 | + $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
3303 | + $explode_sub_dir = explode("/", $sub_dir); |
|
3304 | + if ($curr_img_dir == end($explode_sub_dir)) { |
|
3305 | + $img_path = $geodir_uploadpath . '/' . $filename; |
|
3306 | + $img_url = $geodir_uploadurl . '/' . $filename; |
|
3307 | + } else { |
|
3308 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
3309 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
3310 | + } |
|
3311 | 3311 | |
3312 | - $uploaded_file = ''; |
|
3313 | - if (file_exists($img_path)) |
|
3314 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
3312 | + $uploaded_file = ''; |
|
3313 | + if (file_exists($img_path)) |
|
3314 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
3315 | 3315 | |
3316 | - if ($curr_img_dir != $geodir_uploaddir) { |
|
3317 | - if (file_exists($img_path)) |
|
3318 | - unlink($img_path); |
|
3319 | - } |
|
3316 | + if ($curr_img_dir != $geodir_uploaddir) { |
|
3317 | + if (file_exists($img_path)) |
|
3318 | + unlink($img_path); |
|
3319 | + } |
|
3320 | 3320 | |
3321 | - if (!empty($uploaded_file)) |
|
3322 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
3321 | + if (!empty($uploaded_file)) |
|
3322 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
3323 | 3323 | |
3324 | 3324 | } else { |
3325 | 3325 | $file_urls = $post_image[$m]; |
@@ -3374,16 +3374,16 @@ discard block |
||
3374 | 3374 | |
3375 | 3375 | if (!function_exists('geodir_plupload_action')) { |
3376 | 3376 | |
3377 | - /** |
|
3378 | - * Get upload directory path details |
|
3379 | - * |
|
3380 | - * @since 1.0.0 |
|
3381 | - * @package GeoDirectory |
|
3377 | + /** |
|
3378 | + * Get upload directory path details |
|
3379 | + * |
|
3380 | + * @since 1.0.0 |
|
3381 | + * @package GeoDirectory |
|
3382 | 3382 | * @global object $current_user Current user object. |
3383 | - * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
3384 | - * @return mixed Returns upload directory details as an array. |
|
3385 | - */ |
|
3386 | - function geodir_upload_dir($upload) |
|
3383 | + * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
3384 | + * @return mixed Returns upload directory details as an array. |
|
3385 | + */ |
|
3386 | + function geodir_upload_dir($upload) |
|
3387 | 3387 | { |
3388 | 3388 | global $current_user; |
3389 | 3389 | $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
@@ -3483,14 +3483,14 @@ discard block |
||
3483 | 3483 | } |
3484 | 3484 | |
3485 | 3485 | if (!function_exists('geodir_max_upload_size')) { |
3486 | - /** |
|
3487 | - * Get max upload file size |
|
3488 | - * |
|
3489 | - * @since 1.0.0 |
|
3490 | - * @package GeoDirectory |
|
3491 | - * @return mixed|void Returns max upload file size. |
|
3492 | - */ |
|
3493 | - function geodir_max_upload_size() |
|
3486 | + /** |
|
3487 | + * Get max upload file size |
|
3488 | + * |
|
3489 | + * @since 1.0.0 |
|
3490 | + * @package GeoDirectory |
|
3491 | + * @return mixed|void Returns max upload file size. |
|
3492 | + */ |
|
3493 | + function geodir_max_upload_size() |
|
3494 | 3494 | { |
3495 | 3495 | $max_filesize = (float)get_option('geodir_upload_max_filesize', 2); |
3496 | 3496 | |
@@ -3663,14 +3663,14 @@ discard block |
||
3663 | 3663 | |
3664 | 3664 | |
3665 | 3665 | if (!function_exists('geodir_custom_sort_field_save')) { |
3666 | - /** |
|
3667 | - * Save or Update custom sort fields into the database. |
|
3668 | - * |
|
3669 | - * @since 1.0.0 |
|
3670 | - * @package GeoDirectory |
|
3666 | + /** |
|
3667 | + * Save or Update custom sort fields into the database. |
|
3668 | + * |
|
3669 | + * @since 1.0.0 |
|
3670 | + * @package GeoDirectory |
|
3671 | 3671 | * @global object $wpdb WordPress Database object. |
3672 | 3672 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
3673 | - * @param array $request_field { |
|
3673 | + * @param array $request_field { |
|
3674 | 3674 | * Attributes of the Request field. |
3675 | 3675 | * |
3676 | 3676 | * @type string $action Ajax action name. |
@@ -3689,10 +3689,10 @@ discard block |
||
3689 | 3689 | * @type string $sort_order Sort Order. |
3690 | 3690 | * |
3691 | 3691 | * } |
3692 | - * @param bool $default Not yet implemented. |
|
3693 | - * @return int Returns the last affected db table row id. |
|
3694 | - */ |
|
3695 | - function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
3692 | + * @param bool $default Not yet implemented. |
|
3693 | + * @return int Returns the last affected db table row id. |
|
3694 | + */ |
|
3695 | + function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
3696 | 3696 | { |
3697 | 3697 | |
3698 | 3698 | global $wpdb, $plugin_prefix; |
@@ -3810,16 +3810,16 @@ discard block |
||
3810 | 3810 | |
3811 | 3811 | |
3812 | 3812 | if (!function_exists('geodir_custom_sort_field_delete')) { |
3813 | - /** |
|
3814 | - * Delete a custom sort field using field id. |
|
3815 | - * @since 1.0.0 |
|
3816 | - * @package GeoDirectory |
|
3813 | + /** |
|
3814 | + * Delete a custom sort field using field id. |
|
3815 | + * @since 1.0.0 |
|
3816 | + * @package GeoDirectory |
|
3817 | 3817 | * @global object $wpdb WordPress Database object. |
3818 | 3818 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
3819 | - * @param string $field_id The field ID. |
|
3820 | - * @return int|string Returns field id when successful deletion, else returns 0. |
|
3821 | - */ |
|
3822 | - function geodir_custom_sort_field_delete($field_id = '') |
|
3819 | + * @param string $field_id The field ID. |
|
3820 | + * @return int|string Returns field id when successful deletion, else returns 0. |
|
3821 | + */ |
|
3822 | + function geodir_custom_sort_field_delete($field_id = '') |
|
3823 | 3823 | { |
3824 | 3824 | |
3825 | 3825 | global $wpdb, $plugin_prefix; |
@@ -3838,18 +3838,18 @@ discard block |
||
3838 | 3838 | |
3839 | 3839 | |
3840 | 3840 | if (!function_exists('geodir_custom_sort_field_adminhtml')) { |
3841 | - /** |
|
3842 | - * Custom sort field admin html. |
|
3843 | - * |
|
3844 | - * @since 1.0.0 |
|
3845 | - * @package GeoDirectory |
|
3841 | + /** |
|
3842 | + * Custom sort field admin html. |
|
3843 | + * |
|
3844 | + * @since 1.0.0 |
|
3845 | + * @package GeoDirectory |
|
3846 | 3846 | * @global object $wpdb WordPress Database object. |
3847 | - * @param string $field_type The form field type. |
|
3848 | - * @param object|int $result_str The custom field results object or row id. |
|
3849 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
3850 | - * @param bool $default when set to true field will be for admin use only. |
|
3851 | - */ |
|
3852 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
3847 | + * @param string $field_type The form field type. |
|
3848 | + * @param object|int $result_str The custom field results object or row id. |
|
3849 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
3850 | + * @param bool $default when set to true field will be for admin use only. |
|
3851 | + */ |
|
3852 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
3853 | 3853 | { |
3854 | 3854 | global $wpdb; |
3855 | 3855 | $cf = $result_str; |
@@ -3914,10 +3914,10 @@ discard block |
||
3914 | 3914 | |
3915 | 3915 | <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
3916 | 3916 | style="display:<?php if ($field_ins_upd == 'submit') { |
3917 | - echo 'block;'; |
|
3918 | - } else { |
|
3919 | - echo 'none;'; |
|
3920 | - } ?>"> |
|
3917 | + echo 'block;'; |
|
3918 | + } else { |
|
3919 | + echo 'none;'; |
|
3920 | + } ?>"> |
|
3921 | 3921 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
3922 | 3922 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
3923 | 3923 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
@@ -3945,8 +3945,8 @@ discard block |
||
3945 | 3945 | <input type="text" name="asc_title" id="asc_title" |
3946 | 3946 | placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>" |
3947 | 3947 | value="<?php if (isset($field_info->asc_title)) { |
3948 | - echo esc_attr($field_info->asc_title); |
|
3949 | - } ?>" style="width:45%;"/> |
|
3948 | + echo esc_attr($field_info->asc_title); |
|
3949 | + } ?>" style="width:45%;"/> |
|
3950 | 3950 | |
3951 | 3951 | <input type="radio" name="is_default" |
3952 | 3952 | value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') { |
@@ -3969,8 +3969,8 @@ discard block |
||
3969 | 3969 | <input type="text" name="desc_title" id="desc_title" |
3970 | 3970 | placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>" |
3971 | 3971 | value="<?php if (isset($field_info->desc_title)) { |
3972 | - echo esc_attr($field_info->desc_title); |
|
3973 | - } ?>" style="width:45%;"/> |
|
3972 | + echo esc_attr($field_info->desc_title); |
|
3973 | + } ?>" style="width:45%;"/> |
|
3974 | 3974 | <input type="radio" name="is_default" |
3975 | 3975 | value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') { |
3976 | 3976 | echo 'checked="checked"'; |
@@ -4056,19 +4056,19 @@ discard block |
||
4056 | 4056 | } |
4057 | 4057 | |
4058 | 4058 | if (!function_exists('check_field_visibility')) { |
4059 | - /** |
|
4060 | - * Check field visibility as per price package. |
|
4061 | - * |
|
4062 | - * @since 1.0.0 |
|
4063 | - * @package GeoDirectory |
|
4059 | + /** |
|
4060 | + * Check field visibility as per price package. |
|
4061 | + * |
|
4062 | + * @since 1.0.0 |
|
4063 | + * @package GeoDirectory |
|
4064 | 4064 | * @global object $wpdb WordPress Database object. |
4065 | 4065 | * @global array $geodir_addon_list List of active GeoDirectory extensions. |
4066 | - * @param int|string $package_id The package ID. |
|
4067 | - * @param string $field_name The field name. |
|
4068 | - * @param string $post_type Optional. The wordpress post type. |
|
4069 | - * @return bool Returns true when field visible, otherwise false. |
|
4070 | - */ |
|
4071 | - function check_field_visibility($package_id, $field_name, $post_type) |
|
4066 | + * @param int|string $package_id The package ID. |
|
4067 | + * @param string $field_name The field name. |
|
4068 | + * @param string $post_type Optional. The wordpress post type. |
|
4069 | + * @return bool Returns true when field visible, otherwise false. |
|
4070 | + */ |
|
4071 | + function check_field_visibility($package_id, $field_name, $post_type) |
|
4072 | 4072 | { |
4073 | 4073 | global $wpdb, $geodir_addon_list; |
4074 | 4074 | if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) { |
@@ -4116,15 +4116,15 @@ discard block |
||
4116 | 4116 | $input_str = explode("/", $input_str, 2); |
4117 | 4117 | $label = trim($input_str[0]); |
4118 | 4118 | if ($translated && $label != '') { |
4119 | - $label = __($label, 'geodirectory'); |
|
4120 | - } |
|
4121 | - $label = ucfirst($label); |
|
4119 | + $label = __($label, 'geodirectory'); |
|
4120 | + } |
|
4121 | + $label = ucfirst($label); |
|
4122 | 4122 | $value = trim($input_str[1]); |
4123 | 4123 | } else { |
4124 | 4124 | if ($translated && $input_str != '') { |
4125 | - $input_str = __($input_str, 'geodirectory'); |
|
4126 | - } |
|
4127 | - $label = ucfirst($input_str); |
|
4125 | + $input_str = __($input_str, 'geodirectory'); |
|
4126 | + } |
|
4127 | + $label = ucfirst($input_str); |
|
4128 | 4128 | $value = $input_str; |
4129 | 4129 | } |
4130 | 4130 | |
@@ -4170,9 +4170,9 @@ discard block |
||
4170 | 4170 | if (strpos($optgroup_str, "|") !== false) { |
4171 | 4171 | $optgroup_str_arr = explode("|", $optgroup_str, 2); |
4172 | 4172 | $optgroup_label = trim($optgroup_str_arr[0]); |
4173 | - if ($translated && $optgroup_label != '') { |
|
4174 | - $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
4175 | - } |
|
4173 | + if ($translated && $optgroup_label != '') { |
|
4174 | + $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
4175 | + } |
|
4176 | 4176 | $optgroup_label = ucfirst($optgroup_label); |
4177 | 4177 | $optgroup_str = $optgroup_str_arr[1]; |
4178 | 4178 | } |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | $join = ", " . $table . " AS pd "; |
150 | 150 | |
151 | 151 | /** |
152 | - * Filter the SQL JOIN clause for the markers data |
|
153 | - * |
|
154 | - * @since 1.0.0 |
|
155 | - * |
|
156 | - * @param string $join Row of SQL JOIN clause to join table. |
|
157 | - */ |
|
158 | - $join = apply_filters('geodir_home_map_listing_join', $join); |
|
152 | + * Filter the SQL JOIN clause for the markers data |
|
153 | + * |
|
154 | + * @since 1.0.0 |
|
155 | + * |
|
156 | + * @param string $join Row of SQL JOIN clause to join table. |
|
157 | + */ |
|
158 | + $join = apply_filters('geodir_home_map_listing_join', $join); |
|
159 | 159 | |
160 | - /** |
|
161 | - * Filter the searched fields for the markers data |
|
162 | - * |
|
163 | - * @since 1.0.0 |
|
164 | - * |
|
165 | - * @param string $search Row of searched fields to use in WHERE clause. |
|
166 | - */ |
|
167 | - $search = apply_filters('geodir_home_map_listing_where', $search); |
|
160 | + /** |
|
161 | + * Filter the searched fields for the markers data |
|
162 | + * |
|
163 | + * @since 1.0.0 |
|
164 | + * |
|
165 | + * @param string $search Row of searched fields to use in WHERE clause. |
|
166 | + */ |
|
167 | + $search = apply_filters('geodir_home_map_listing_where', $search); |
|
168 | 168 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search); |
169 | 169 | $cat_type = $post_type . 'category'; |
170 | 170 | if ($post_type == 'gd_event') { |
@@ -175,35 +175,35 @@ discard block |
||
175 | 175 | |
176 | 176 | $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
177 | 177 | /** |
178 | - * Filter the SQL SELECT clause to retrive fields data |
|
179 | - * |
|
180 | - * @since 1.0.0 |
|
181 | - * |
|
182 | - * @param string $sql_select Row of SQL SELECT clause. |
|
183 | - */ |
|
184 | - $select = apply_filters('geodir_home_map_listing_select', $sql_select); |
|
178 | + * Filter the SQL SELECT clause to retrive fields data |
|
179 | + * |
|
180 | + * @since 1.0.0 |
|
181 | + * |
|
182 | + * @param string $sql_select Row of SQL SELECT clause. |
|
183 | + */ |
|
184 | + $select = apply_filters('geodir_home_map_listing_select', $sql_select); |
|
185 | 185 | |
186 | - $groupby = " GROUP BY pd.post_id"; |
|
187 | - /** |
|
188 | - * Filter the SQL GROUP BY clause to retrive map markers data. |
|
189 | - * |
|
190 | - * @since 1.5.7 |
|
191 | - * |
|
192 | - * @param string $groupby Row of SQL GROUP BY clause. |
|
193 | - */ |
|
194 | - $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
|
186 | + $groupby = " GROUP BY pd.post_id"; |
|
187 | + /** |
|
188 | + * Filter the SQL GROUP BY clause to retrive map markers data. |
|
189 | + * |
|
190 | + * @since 1.5.7 |
|
191 | + * |
|
192 | + * @param string $groupby Row of SQL GROUP BY clause. |
|
193 | + */ |
|
194 | + $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby); |
|
195 | 195 | |
196 | 196 | $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array); |
197 | 197 | |
198 | - /** |
|
199 | - * Filter the SQL query to retrive markers data |
|
200 | - * |
|
201 | - * @since 1.0.0 |
|
202 | - * |
|
203 | - * @param string $catsql Row of SQL query. |
|
204 | - * @param string $search Row of searched fields to use in WHERE clause. |
|
205 | - */ |
|
206 | - $catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search); |
|
198 | + /** |
|
199 | + * Filter the SQL query to retrive markers data |
|
200 | + * |
|
201 | + * @since 1.0.0 |
|
202 | + * |
|
203 | + * @param string $catsql Row of SQL query. |
|
204 | + * @param string $search Row of searched fields to use in WHERE clause. |
|
205 | + */ |
|
206 | + $catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search); |
|
207 | 207 | |
208 | 208 | $catinfo = $wpdb->get_results($catsql); |
209 | 209 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * All map related templates used by the plugin |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * All map related templates used by the plugin |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Contains all map related functions. |
@@ -138,33 +138,33 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | - * Filter the options to use in google map. |
|
142 | - * |
|
143 | - * @since 1.0.0 |
|
144 | - * |
|
145 | - * @param array $geodir_map_options {@see geodir_draw_map()} docblock. |
|
146 | - */ |
|
147 | - $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options); |
|
141 | + * Filter the options to use in google map. |
|
142 | + * |
|
143 | + * @since 1.0.0 |
|
144 | + * |
|
145 | + * @param array $geodir_map_options {@see geodir_draw_map()} docblock. |
|
146 | + */ |
|
147 | + $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options); |
|
148 | 148 | |
149 | 149 | $map_canvas_arr[$map_canvas_name] = array(); |
150 | 150 | |
151 | 151 | /** |
152 | - * Filter the post types to display data on map. |
|
153 | - * |
|
154 | - * @since 1.0.0 |
|
155 | - * |
|
156 | - * @param object $object Objects of post types. |
|
157 | - */ |
|
158 | - $post_types = apply_filters("geodir_map_post_type_list_{$map_canvas_name}", geodir_get_posttypes('object')); |
|
152 | + * Filter the post types to display data on map. |
|
153 | + * |
|
154 | + * @since 1.0.0 |
|
155 | + * |
|
156 | + * @param object $object Objects of post types. |
|
157 | + */ |
|
158 | + $post_types = apply_filters("geodir_map_post_type_list_{$map_canvas_name}", geodir_get_posttypes('object')); |
|
159 | 159 | |
160 | - /** |
|
161 | - * Filter the post types to exclude to display data on map. |
|
162 | - * |
|
163 | - * @since 1.0.0 |
|
164 | - * |
|
165 | - * @param array Array of post types to exclude to display data on map. |
|
166 | - */ |
|
167 | - $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
|
160 | + /** |
|
161 | + * Filter the post types to exclude to display data on map. |
|
162 | + * |
|
163 | + * @since 1.0.0 |
|
164 | + * |
|
165 | + * @param array Array of post types to exclude to display data on map. |
|
166 | + */ |
|
167 | + $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
|
168 | 168 | |
169 | 169 | if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
170 | 170 | // Set default map options |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | - * Filter the width of map. |
|
184 | - * |
|
185 | - * @since 1.0.0 |
|
186 | - * |
|
187 | - * @param int $map_width Width of map box, eg: gd_place. |
|
188 | - */ |
|
189 | - $map_width = apply_filters('geodir_change_map_width', $map_width); |
|
183 | + * Filter the width of map. |
|
184 | + * |
|
185 | + * @since 1.0.0 |
|
186 | + * |
|
187 | + * @param int $map_width Width of map box, eg: gd_place. |
|
188 | + */ |
|
189 | + $map_width = apply_filters('geodir_change_map_width', $map_width); |
|
190 | 190 | ?> |
191 | 191 | <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
192 | 192 | <div class="stick_trigger_container"> |
@@ -285,29 +285,29 @@ discard block |
||
285 | 285 | |
286 | 286 | <div id="<?php echo $map_canvas_name; ?>_directionsPanel" style="width:auto;"></div> |
287 | 287 | <?php |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt'); |
|
291 | - if (empty($geodir_default_map_search_pt)) |
|
292 | - $geodir_default_map_search_pt = 'gd_place'; |
|
293 | - |
|
294 | - /** |
|
295 | - * Filter the post type to retrive data for map |
|
296 | - * |
|
297 | - * @since 1.0.0 |
|
298 | - * |
|
299 | - * @param string $geodir_default_map_search_pt Post type, eg: gd_place. |
|
300 | - */ |
|
301 | - $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
|
302 | - ?> |
|
290 | + $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt'); |
|
291 | + if (empty($geodir_default_map_search_pt)) |
|
292 | + $geodir_default_map_search_pt = 'gd_place'; |
|
293 | + |
|
294 | + /** |
|
295 | + * Filter the post type to retrive data for map |
|
296 | + * |
|
297 | + * @since 1.0.0 |
|
298 | + * |
|
299 | + * @param string $geodir_default_map_search_pt Post type, eg: gd_place. |
|
300 | + */ |
|
301 | + $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
|
302 | + ?> |
|
303 | 303 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
304 | 304 | <?php |
305 | 305 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
306 | 306 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
307 | - $map_cat_class = ''; |
|
308 | - if ($geodir_map_options['enable_post_type_filters']) { |
|
309 | - $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
|
310 | - } |
|
307 | + $map_cat_class = ''; |
|
308 | + if ($geodir_map_options['enable_post_type_filters']) { |
|
309 | + $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
|
310 | + } |
|
311 | 311 | ?> |
312 | 312 | <div |
313 | 313 | class="map-category-listing<?php echo $map_cat_class;?>"> |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | |
351 | 351 | <?php |
352 | 352 | if ($geodir_map_options['enable_location_filters']) { |
353 | - $country = get_query_var('gd_country'); |
|
354 | - $region = get_query_var('gd_region'); |
|
355 | - $city = get_query_var('gd_city'); |
|
353 | + $country = get_query_var('gd_country'); |
|
354 | + $region = get_query_var('gd_region'); |
|
355 | + $city = get_query_var('gd_city'); |
|
356 | 356 | |
357 | 357 | //fix for location/me page |
358 | 358 | $country = $country != 'me' ? $country : ''; |
359 | - $region = $region != 'me' ? $region : ''; |
|
360 | - $city = $country != 'me' ? $city : ''; |
|
359 | + $region = $region != 'me' ? $region : ''; |
|
360 | + $city = $country != 'me' ? $city : ''; |
|
361 | 361 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
362 | 362 | ?> |
363 | 363 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | foreach ($post_types as $post_type => $args) { |
397 | 397 | if (!in_array($post_type, $exclude_post_types)) { |
398 | 398 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
399 | - echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
|
399 | + echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | ?> |
@@ -445,16 +445,16 @@ discard block |
||
445 | 445 | case 'Array': |
446 | 446 | $post_types = (array)$post_types; |
447 | 447 | break; |
448 | - case 'options': |
|
448 | + case 'options': |
|
449 | 449 | $post_types = (array)$post_types; |
450 | 450 | |
451 | - $options = array(); |
|
452 | - if (!empty($post_types)) { |
|
453 | - foreach ($post_types as $key => $info) { |
|
454 | - $options[$key] = __($info['labels']['singular_name'], 'geodirectory'); |
|
455 | - } |
|
456 | - } |
|
457 | - $post_types = $options; |
|
451 | + $options = array(); |
|
452 | + if (!empty($post_types)) { |
|
453 | + foreach ($post_types as $key => $info) { |
|
454 | + $options[$key] = __($info['labels']['singular_name'], 'geodirectory'); |
|
455 | + } |
|
456 | + } |
|
457 | + $post_types = $options; |
|
458 | 458 | break; |
459 | 459 | default: |
460 | 460 | $post_types = array_keys($post_types); |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | if (is_array($post_cat_array)) { |
1065 | 1065 | $post_cat_array = array_unique( $post_cat_array ); |
1066 | 1066 | |
1067 | - foreach ($post_cat_array as $post_cat_html) { |
|
1067 | + foreach ($post_cat_array as $post_cat_html) { |
|
1068 | 1068 | |
1069 | 1069 | $post_cat_info = explode(":", $post_cat_html); |
1070 | 1070 | $post_maincat_str = $post_cat_info[0]; |
@@ -1429,21 +1429,21 @@ discard block |
||
1429 | 1429 | } |
1430 | 1430 | } |
1431 | 1431 | |
1432 | - // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
1432 | + // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
1433 | 1433 | $site_url = trailingslashit(get_bloginfo('url')); |
1434 | 1434 | |
1435 | - $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
1436 | - if ($fix_url) { |
|
1437 | - $post_link = str_replace($site_url, '', $post_link); |
|
1438 | - } |
|
1435 | + $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
1436 | + if ($fix_url) { |
|
1437 | + $post_link = str_replace($site_url, '', $post_link); |
|
1438 | + } |
|
1439 | 1439 | |
1440 | 1440 | $post_link = trailingslashit( |
1441 | 1441 | preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
1442 | 1442 | ); |
1443 | 1443 | |
1444 | - if ($fix_url) { |
|
1445 | - $post_link = $site_url . $post_link; |
|
1446 | - } |
|
1444 | + if ($fix_url) { |
|
1445 | + $post_link = $site_url . $post_link; |
|
1446 | + } |
|
1447 | 1447 | |
1448 | 1448 | if (isset($comment_post_cache[$post->ID])) { |
1449 | 1449 | $post = $comment_post_cache[$post->ID]; |
@@ -1531,23 +1531,23 @@ discard block |
||
1531 | 1531 | |
1532 | 1532 | if (!empty($post_location)) { |
1533 | 1533 | $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
1534 | - $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
|
1535 | - $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
|
1534 | + $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
|
1535 | + $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
|
1536 | 1536 | |
1537 | - $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1537 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1538 | 1538 | |
1539 | - $location_slug = array(); |
|
1540 | - if ($geodir_show_location_url == 'all') { |
|
1541 | - $location_slug[] = $country_slug; |
|
1542 | - $location_slug[] = $region_slug; |
|
1543 | - } else if ($geodir_show_location_url == 'country_city') { |
|
1544 | - $location_slug[] = $country_slug; |
|
1545 | - } else if ($geodir_show_location_url == 'region_city') { |
|
1546 | - $location_slug[] = $region_slug; |
|
1547 | - } |
|
1548 | - $location_slug[] = $city_slug; |
|
1539 | + $location_slug = array(); |
|
1540 | + if ($geodir_show_location_url == 'all') { |
|
1541 | + $location_slug[] = $country_slug; |
|
1542 | + $location_slug[] = $region_slug; |
|
1543 | + } else if ($geodir_show_location_url == 'country_city') { |
|
1544 | + $location_slug[] = $country_slug; |
|
1545 | + } else if ($geodir_show_location_url == 'region_city') { |
|
1546 | + $location_slug[] = $region_slug; |
|
1547 | + } |
|
1548 | + $location_slug[] = $city_slug; |
|
1549 | 1549 | |
1550 | - $location_request .= implode('/', $location_slug) . '/'; |
|
1550 | + $location_request .= implode('/', $location_slug) . '/'; |
|
1551 | 1551 | } |
1552 | 1552 | } |
1553 | 1553 | |
@@ -1655,19 +1655,19 @@ discard block |
||
1655 | 1655 | if ($include_location) { |
1656 | 1656 | global $post; |
1657 | 1657 | |
1658 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1659 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1658 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1659 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1660 | 1660 | |
1661 | - if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
1661 | + if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
1662 | 1662 | $location_terms = array( |
1663 | 1663 | 'gd_country' => $post->country_slug, |
1664 | 1664 | 'gd_region' => $post->region_slug, |
1665 | 1665 | 'gd_city' => $post->city_slug |
1666 | 1666 | ); |
1667 | 1667 | |
1668 | - if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1669 | - $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
1670 | - } |
|
1668 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1669 | + $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
1670 | + } |
|
1671 | 1671 | } else { |
1672 | 1672 | $location_terms = geodir_get_current_location_terms('query_vars'); |
1673 | 1673 | } |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | if(function_exists('icl_object_id')){ |
1704 | 1704 | $post_types = get_option('geodir_post_types'); |
1705 | 1705 | $post_type = str_replace("category","",$taxonomy); |
1706 | - $post_type = str_replace("_tags","",$post_type); |
|
1706 | + $post_type = str_replace("_tags","",$post_type); |
|
1707 | 1707 | $slug = $post_types[$post_type]['rewrite']['slug']; |
1708 | 1708 | if ( gd_wpml_slug_translation_turned_on( $post_type )) { |
1709 | 1709 | |
@@ -1751,13 +1751,13 @@ discard block |
||
1751 | 1751 | * @return string The modified link. |
1752 | 1752 | */ |
1753 | 1753 | function geodir_posttype_link($link, $post_type) { |
1754 | - global $geodir_add_location_url, $post, $gd_session; |
|
1754 | + global $geodir_add_location_url, $post, $gd_session; |
|
1755 | 1755 | |
1756 | - $location_terms = array(); |
|
1756 | + $location_terms = array(); |
|
1757 | 1757 | |
1758 | - if (in_array($post_type, geodir_get_posttypes())) { |
|
1759 | - if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
|
1760 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1758 | + if (in_array($post_type, geodir_get_posttypes())) { |
|
1759 | + if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
|
1760 | + if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1761 | 1761 | $location_terms = array( |
1762 | 1762 | 'gd_country' => $post->country_slug, |
1763 | 1763 | 'gd_region' => $post->region_slug, |
@@ -1767,22 +1767,22 @@ discard block |
||
1767 | 1767 | $location_terms = geodir_get_current_location_terms('query_vars'); |
1768 | 1768 | } |
1769 | 1769 | |
1770 | - $location_terms = geodir_remove_location_terms($location_terms); |
|
1770 | + $location_terms = geodir_remove_location_terms($location_terms); |
|
1771 | 1771 | |
1772 | - if (!empty($location_terms)) { |
|
1773 | - if (get_option('permalink_structure') != '') { |
|
1774 | - $location_terms = implode("/", $location_terms); |
|
1775 | - $location_terms = rtrim($location_terms, '/'); |
|
1772 | + if (!empty($location_terms)) { |
|
1773 | + if (get_option('permalink_structure') != '') { |
|
1774 | + $location_terms = implode("/", $location_terms); |
|
1775 | + $location_terms = rtrim($location_terms, '/'); |
|
1776 | 1776 | |
1777 | - $link .= urldecode($location_terms) . '/'; |
|
1778 | - } else { |
|
1779 | - $link = geodir_getlink($link, $location_terms); |
|
1780 | - } |
|
1781 | - } |
|
1782 | - } |
|
1783 | - } |
|
1777 | + $link .= urldecode($location_terms) . '/'; |
|
1778 | + } else { |
|
1779 | + $link = geodir_getlink($link, $location_terms); |
|
1780 | + } |
|
1781 | + } |
|
1782 | + } |
|
1783 | + } |
|
1784 | 1784 | |
1785 | - return $link; |
|
1785 | + return $link; |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | /** |