@@ -15,29 +15,29 @@ discard block |
||
15 | 15 | <?php |
16 | 16 | |
17 | 17 | |
18 | - global $wpdb; |
|
18 | + global $wpdb; |
|
19 | 19 | |
20 | - $post_id = $_REQUEST['pid']; |
|
21 | - $post_info = get_post($post_id); |
|
20 | + $post_id = $_REQUEST['pid']; |
|
21 | + $post_info = get_post($post_id); |
|
22 | 22 | |
23 | - $posted_date = $post_info->post_date; |
|
24 | - $productlink = get_permalink($post_id); |
|
25 | - $siteName = get_bloginfo('name'); |
|
26 | - $siteurl = home_url(); |
|
27 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
23 | + $posted_date = $post_info->post_date; |
|
24 | + $productlink = get_permalink($post_id); |
|
25 | + $siteName = get_bloginfo('name'); |
|
26 | + $siteurl = home_url(); |
|
27 | + $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
28 | 28 | |
29 | - $loginurl = geodir_login_url(); |
|
30 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
29 | + $loginurl = geodir_login_url(); |
|
30 | + $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
31 | 31 | |
32 | - $post_author = $post_info->post_author; |
|
32 | + $post_author = $post_info->post_author; |
|
33 | 33 | |
34 | - $user_info = get_userdata($post_author); |
|
35 | - $username = $user_info->user_login; |
|
36 | - $user_email = $user_info->user_email; |
|
34 | + $user_info = get_userdata($post_author); |
|
35 | + $username = $user_info->user_login; |
|
36 | + $user_email = $user_info->user_email; |
|
37 | 37 | |
38 | - $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory')); |
|
38 | + $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory')); |
|
39 | 39 | |
40 | - /* |
|
40 | + /* |
|
41 | 41 | * Filter the success page message before variable replacements. |
42 | 42 | * |
43 | 43 | * @since 1.5.7 |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * @param object $post_info Post object. |
46 | 46 | * @param object $user_info User object. |
47 | 47 | */ |
48 | - $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info); |
|
48 | + $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info); |
|
49 | 49 | |
50 | - $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]'); |
|
51 | - $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
|
52 | - $message = str_replace($search_array, $replace_array, $message); |
|
50 | + $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]'); |
|
51 | + $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
|
52 | + $message = str_replace($search_array, $replace_array, $message); |
|
53 | 53 | |
54 | - /* |
|
54 | + /* |
|
55 | 55 | * Filter the success page message after variable replacements. |
56 | 56 | * |
57 | 57 | * @since 1.5.7 |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | * @param object $post_info Post object. |
60 | 60 | * @param object $user_info User object. |
61 | 61 | */ |
62 | - $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info); |
|
62 | + $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info); |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | - ?> |
|
66 | + ?> |
|
67 | 67 | |
68 | 68 | <?php |
69 | 69 | |
70 | - /* |
|
70 | + /* |
|
71 | 71 | * Action called before the success page message wrapper. |
72 | 72 | * |
73 | 73 | * @since 1.5.7 |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @param object $post_info Post object. |
76 | 76 | * @param object $user_info User object. |
77 | 77 | */ |
78 | - do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
79 | - echo '<h5 class="geodir_information">'; |
|
80 | - echo $message; |
|
81 | - echo '</h5>'; |
|
82 | - /* |
|
78 | + do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
79 | + echo '<h5 class="geodir_information">'; |
|
80 | + echo $message; |
|
81 | + echo '</h5>'; |
|
82 | + /* |
|
83 | 83 | * Action called after the success page message wrapper. |
84 | 84 | * |
85 | 85 | * @since 1.5.7 |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * @param object $post_info Post object. |
88 | 88 | * @param object $user_info User object. |
89 | 89 | */ |
90 | - do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
90 | + do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
91 | 91 | |
92 | - ?> |
|
92 | + ?> |
|
93 | 93 | |
94 | 94 | </div> |
95 | 95 | \ No newline at end of file |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | $productlink = get_permalink($post_id); |
25 | 25 | $siteName = get_bloginfo('name'); |
26 | 26 | $siteurl = home_url(); |
27 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
27 | + $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>'; |
|
28 | 28 | |
29 | 29 | $loginurl = geodir_login_url(); |
30 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
30 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
31 | 31 | |
32 | 32 | $post_author = $post_info->post_author; |
33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $username = $user_info->user_login; |
36 | 36 | $user_email = $user_info->user_email; |
37 | 37 | |
38 | - $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory')); |
|
38 | + $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')), 'geodirectory')); |
|
39 | 39 | |
40 | 40 | /* |
41 | 41 | * Filter the success page message before variable replacements. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param object $post_info Post object. |
46 | 46 | * @param object $user_info User object. |
47 | 47 | */ |
48 | - $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info); |
|
48 | + $message = apply_filters('geodir_success_page_msg_before_var_replace', $message, $post_info, $user_info); |
|
49 | 49 | |
50 | 50 | $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]'); |
51 | 51 | $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param object $post_info Post object. |
60 | 60 | * @param object $user_info User object. |
61 | 61 | */ |
62 | - $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info); |
|
62 | + $message = apply_filters('geodir_success_page_msg_after_var_replace', $message, $post_info, $user_info); |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param object $post_info Post object. |
76 | 76 | * @param object $user_info User object. |
77 | 77 | */ |
78 | - do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
78 | + do_action('geodir_before_success_page_msg_wrapper', $message, $post_info, $user_info); |
|
79 | 79 | echo '<h5 class="geodir_information">'; |
80 | 80 | echo $message; |
81 | 81 | echo '</h5>'; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param object $post_info Post object. |
88 | 88 | * @param object $user_info User object. |
89 | 89 | */ |
90 | - do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
90 | + do_action('geodir_after_success_page_msg_wrapper', $message, $post_info, $user_info); |
|
91 | 91 | |
92 | 92 | ?> |
93 | 93 |
@@ -356,10 +356,11 @@ discard block |
||
356 | 356 | $instance['character_count'] = $new_instance['character_count']; |
357 | 357 | $instance['tab_layout'] = $new_instance['tab_layout']; |
358 | 358 | $instance['excerpt_type'] = $new_instance['excerpt_type']; |
359 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
360 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
361 | - else |
|
362 | - $instance['add_location_filter'] = '0'; |
|
359 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
360 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
361 | + } else { |
|
362 | + $instance['add_location_filter'] = '0'; |
|
363 | + } |
|
363 | 364 | $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
364 | 365 | return $instance; |
365 | 366 | } |
@@ -510,7 +511,10 @@ discard block |
||
510 | 511 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
511 | 512 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
512 | 513 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
513 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
514 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
515 | + echo 'checked="checked"'; |
|
516 | +} |
|
517 | +?> |
|
514 | 518 | value="1"/> |
515 | 519 | </label> |
516 | 520 | </p> |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | * @param string $instance ['tab_layout'] Best of widget tab layout name. |
52 | 52 | */ |
53 | 53 | $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']); |
54 | - echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">'; |
|
54 | + echo '<div class="bestof-widget-tab-layout '.$tab_layout.'">'; |
|
55 | 55 | echo $before_widget; |
56 | 56 | $loc_terms = geodir_get_current_location_terms(); |
57 | 57 | if (!empty($loc_terms)) { |
58 | - $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
58 | + $cur_location = ' : '.geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
59 | 59 | } else { |
60 | 60 | $cur_location = ''; |
61 | 61 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param string $instance ['title'] The widget title. |
78 | 78 | */ |
79 | - $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
79 | + $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name').$cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Filter the post type. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | - echo $before_title . __($title,'geodirectory') . $after_title; |
|
205 | + echo $before_title.__($title, 'geodirectory').$after_title; |
|
206 | 206 | |
207 | 207 | //term navigation - start |
208 | 208 | echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">'; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
214 | 214 | |
215 | 215 | if ($is_dropdown) { |
216 | - $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">'; |
|
216 | + $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="'.esc_attr(__('Select Category', 'geodirectory')).'">'; |
|
217 | 217 | } else { |
218 | 218 | $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
219 | 219 | $nav_html .= '<dt></dt>'; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | if ($is_dropdown) { |
232 | 232 | $selected = ($cat_count == 1) ? 'selected="selected"' : ''; |
233 | - $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>'; |
|
233 | + $nav_html .= '<option '.$selected.' value="'.$cat->term_id.'">'.geodir_ucwords($cat->name).'</option>'; |
|
234 | 234 | } else { |
235 | 235 | if ($cat_count == 1) { |
236 | 236 | $nav_html .= '<dd class="geodir-tab-active">'; |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | $nav_html .= '<dd class="">'; |
239 | 239 | } |
240 | 240 | $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : ''; |
241 | - $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">'; |
|
242 | - $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>'; |
|
241 | + $nav_html .= '<a data-termid="'.$cat->term_id.'" href="'.get_term_link($cat, $cat->taxonomy).'">'; |
|
242 | + $nav_html .= '<img alt="'.$cat->name.' icon" class="bestof-cat-icon" src="'.$term_icon_url.'"/>'; |
|
243 | 243 | $nav_html .= '<span>'; |
244 | 244 | $nav_html .= geodir_ucwords($cat->name); |
245 | 245 | $nav_html .= '<small>'; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | if ($num_reviews == 0) { |
249 | 249 | $reviews = __('No Reviews', 'geodirectory'); |
250 | 250 | } elseif ($num_reviews > 1) { |
251 | - $reviews = $num_reviews . __(' Reviews', 'geodirectory'); |
|
251 | + $reviews = $num_reviews.__(' Reviews', 'geodirectory'); |
|
252 | 252 | } else { |
253 | 253 | $reviews = __('1 Review', 'geodirectory'); |
254 | 254 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term); |
323 | 323 | |
324 | - echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
324 | + echo '<h3 class="bestof-cat-title">'.wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name).'<a href="'.esc_url($view_all_link).'">'.__("View all", 'geodirectory').'</a></h3>'; |
|
325 | 325 | } |
326 | 326 | if ($excerpt_type == 'show-reviews') { |
327 | 327 | add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | public function form($instance) |
380 | 380 | { |
381 | - $instance = wp_parse_args((array)$instance, |
|
381 | + $instance = wp_parse_args((array) $instance, |
|
382 | 382 | array( |
383 | 383 | 'title' => '', |
384 | 384 | 'post_type' => '', |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | ?> |
405 | 405 | <p> |
406 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
406 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
407 | 407 | |
408 | 408 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
409 | 409 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | <p> |
415 | 415 | <label |
416 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
416 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
417 | 417 | |
418 | 418 | <?php $postypes = geodir_get_posttypes(); |
419 | 419 | /** |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | <p> |
446 | 446 | |
447 | 447 | <label |
448 | - for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
448 | + for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
449 | 449 | |
450 | 450 | <input class="widefat" id="<?php echo $this->get_field_id('post_limit'); ?>" |
451 | 451 | name="<?php echo $this->get_field_name('post_limit'); ?>" type="text" |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | <p> |
457 | 457 | |
458 | 458 | <label |
459 | - for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory');?> |
|
459 | + for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory'); ?> |
|
460 | 460 | |
461 | 461 | <input class="widefat" id="<?php echo $this->get_field_id('categ_limit'); ?>" |
462 | 462 | name="<?php echo $this->get_field_name('categ_limit'); ?>" type="text" |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | |
467 | 467 | <p> |
468 | 468 | <label |
469 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
469 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
470 | 470 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
471 | 471 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
472 | 472 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | </p> |
475 | 475 | <p> |
476 | 476 | <label |
477 | - for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory');?> |
|
477 | + for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory'); ?> |
|
478 | 478 | |
479 | 479 | <select class="widefat" id="<?php echo $this->get_field_id('tab_layout'); ?>" |
480 | 480 | name="<?php echo $this->get_field_name('tab_layout'); ?>"> |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | |
496 | 496 | <p> |
497 | 497 | <label |
498 | - for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory');?> |
|
498 | + for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory'); ?> |
|
499 | 499 | |
500 | 500 | <select class="widefat" id="<?php echo $this->get_field_id('excerpt_type'); ?>" |
501 | 501 | name="<?php echo $this->get_field_name('excerpt_type'); ?>"> |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | |
513 | 513 | <p> |
514 | 514 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
515 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
515 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
516 | 516 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
517 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
517 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
518 | 518 | value="1"/> |
519 | 519 | </label> |
520 | 520 | </p> |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
663 | 663 | $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term); |
664 | 664 | |
665 | - echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
665 | + echo '<h3 class="bestof-cat-title">'.wp_sprintf(__('Best of %s', 'geodirectory'), $term->name).'<a href="'.esc_url($view_all_link).'">'.__("View all", 'geodirectory').'</a></h3>'; |
|
666 | 666 | } |
667 | 667 | if ($excerpt_type == 'show-reviews') { |
668 | 668 | add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
@@ -14,282 +14,282 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_bestof_widget extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
18 | - * Register the best of widget with WordPress. |
|
19 | - * |
|
20 | - * @since 1.3.9 |
|
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | - */ |
|
23 | - public function __construct() |
|
24 | - { |
|
25 | - $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory')); |
|
26 | - parent::__construct( |
|
27 | - 'bestof_widget', // Base ID |
|
28 | - __('GD > Best of widget', 'geodirectory'), // Name |
|
29 | - $widget_ops// Args |
|
30 | - ); |
|
31 | - } |
|
32 | - |
|
33 | - /** |
|
34 | - * Front-end display content for best of widget. |
|
35 | - * |
|
36 | - * @since 1.3.9 |
|
37 | - * @since 1.5.1 Added filter to view all link. |
|
38 | - * @since 1.5.1 Declare function public. |
|
39 | - * |
|
40 | - * @param array $args Widget arguments. |
|
41 | - * @param array $instance Saved values from database. |
|
42 | - */ |
|
43 | - public function widget($args, $instance) |
|
44 | - { |
|
45 | - extract($args); |
|
46 | - /** |
|
47 | - * Filter the best of widget tab layout. |
|
48 | - * |
|
49 | - * @since 1.3.9 |
|
50 | - * |
|
51 | - * @param string $instance ['tab_layout'] Best of widget tab layout name. |
|
52 | - */ |
|
53 | - $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']); |
|
54 | - echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">'; |
|
55 | - echo $before_widget; |
|
56 | - $loc_terms = geodir_get_current_location_terms(); |
|
57 | - if (!empty($loc_terms)) { |
|
58 | - $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
59 | - } else { |
|
60 | - $cur_location = ''; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * Filter the current location name. |
|
65 | - * |
|
66 | - * @since 1.3.9 |
|
67 | - * |
|
68 | - * @param string $cur_location Current location name. |
|
69 | - */ |
|
70 | - $cur_location = apply_filters('bestof_widget_cur_location', $cur_location); |
|
71 | - |
|
72 | - /** |
|
73 | - * Filter the widget title. |
|
74 | - * |
|
75 | - * @since 1.3.9 |
|
76 | - * |
|
77 | - * @param string $instance ['title'] The widget title. |
|
78 | - */ |
|
79 | - $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
80 | - |
|
81 | - /** |
|
82 | - * Filter the post type. |
|
83 | - * |
|
84 | - * @since 1.3.9 |
|
85 | - * |
|
86 | - * @param string $instance ['post_type'] The post type. |
|
87 | - */ |
|
88 | - $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']); |
|
89 | - |
|
90 | - /** |
|
91 | - * Filter the excerpt type. |
|
92 | - * |
|
93 | - * @since 1.5.4 |
|
94 | - * |
|
95 | - * @param string $instance ['excerpt_type'] The excerpt type. |
|
96 | - */ |
|
97 | - $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']); |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * Filter the listing limit. |
|
102 | - * |
|
103 | - * @since 1.3.9 |
|
104 | - * |
|
105 | - * @param int $instance ['post_limit'] No. of posts to display. |
|
106 | - */ |
|
107 | - $post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']); |
|
108 | - |
|
109 | - /** |
|
110 | - * Filter the category limit. |
|
111 | - * |
|
112 | - * @since 1.3.9 |
|
113 | - * |
|
114 | - * @param int $instance ['categ_limit'] No. of categories to display. |
|
115 | - */ |
|
116 | - $categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']); |
|
117 | - $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
118 | - |
|
119 | - /** |
|
120 | - * Filter the use of location filter. |
|
121 | - * |
|
122 | - * @since 1.3.9 |
|
123 | - * |
|
124 | - * @param int|bool $instance ['add_location_filter'] Filter listings using current location. |
|
125 | - */ |
|
126 | - $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']); |
|
127 | - |
|
128 | - // set post type to current viewing post type |
|
129 | - if ($use_viewing_post_type) { |
|
130 | - $current_post_type = geodir_get_current_posttype(); |
|
131 | - if ($current_post_type != '' && $current_post_type != $post_type) { |
|
132 | - $post_type = $current_post_type; |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - if (isset($instance['character_count'])) { |
|
137 | - /** |
|
138 | - * Filter the widget's excerpt character count. |
|
139 | - * |
|
140 | - * @since 1.3.9 |
|
141 | - * |
|
142 | - * @param int $instance ['character_count'] Excerpt character count. |
|
143 | - */ |
|
144 | - $character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']); |
|
145 | - } else { |
|
146 | - $character_count = ''; |
|
147 | - } |
|
148 | - |
|
149 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
150 | - |
|
151 | - $term_args = array( |
|
152 | - 'hide_empty' => true, |
|
153 | - 'parent' => 0 |
|
154 | - ); |
|
155 | - |
|
156 | - $term_args = apply_filters('bestof_widget_term_args', $term_args); |
|
157 | - |
|
158 | - if (is_tax()) { |
|
159 | - $taxonomy = get_query_var('taxonomy'); |
|
160 | - $cur_term = get_query_var('term'); |
|
161 | - $term_data = get_term_by('name', $cur_term, $taxonomy); |
|
162 | - $term_args['parent'] = $term_data->term_id; |
|
163 | - } |
|
164 | - |
|
165 | - $terms = get_terms($category_taxonomy[0], $term_args); |
|
166 | - |
|
167 | - $term_reviews = geodir_count_reviews_by_terms(); |
|
168 | - $a_terms = array(); |
|
169 | - foreach ($terms as $term) { |
|
170 | - |
|
171 | - |
|
172 | - if ($term->count > 0) { |
|
173 | - if (isset($term_reviews[$term->term_id])) { |
|
174 | - $term->review_count = $term_reviews[$term->term_id]; |
|
175 | - } else { |
|
176 | - $term->review_count = '0'; |
|
177 | - } |
|
178 | - |
|
179 | - $a_terms[] = $term; |
|
180 | - } |
|
181 | - |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - $terms = apply_filters('bestof_widget_sort_terms', geodir_sort_terms($a_terms, 'review_count'), $a_terms); |
|
186 | - |
|
187 | - $query_args = array( |
|
188 | - 'posts_per_page' => $post_limit, |
|
189 | - 'is_geodir_loop' => true, |
|
190 | - 'post_type' => $post_type, |
|
191 | - 'gd_location' => $add_location_filter ? true : false, |
|
192 | - 'order_by' => 'high_review' |
|
193 | - ); |
|
194 | - if ($character_count >= 0) { |
|
195 | - $query_args['excerpt_length'] = $character_count; |
|
196 | - } |
|
197 | - |
|
198 | - $layout = array(); |
|
199 | - if ($tab_layout == 'bestof-tabs-as-dropdown') { |
|
200 | - $layout[] = $tab_layout; |
|
201 | - } else { |
|
202 | - $layout[] = 'bestof-tabs-as-dropdown'; |
|
203 | - $layout[] = $tab_layout; |
|
204 | - } |
|
205 | - |
|
206 | - |
|
207 | - echo $before_title . __($title,'geodirectory') . $after_title; |
|
208 | - |
|
209 | - //term navigation - start |
|
210 | - echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">'; |
|
211 | - |
|
212 | - $final_html = ''; |
|
213 | - foreach ($layout as $tab_layout) { |
|
214 | - $nav_html = ''; |
|
215 | - $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
|
216 | - |
|
217 | - if ($is_dropdown) { |
|
218 | - $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">'; |
|
219 | - } else { |
|
220 | - $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
|
221 | - $nav_html .= '<dt></dt>'; |
|
222 | - } |
|
223 | - |
|
224 | - |
|
225 | - $term_icon = geodir_get_term_icon(); |
|
226 | - $cat_count = 0; |
|
227 | - if (!empty($terms)) { |
|
228 | - foreach ($terms as $cat) { |
|
229 | - $cat_count++; |
|
230 | - if ($cat_count > $categ_limit) { |
|
231 | - break; |
|
232 | - } |
|
233 | - if ($is_dropdown) { |
|
234 | - $selected = ($cat_count == 1) ? 'selected="selected"' : ''; |
|
235 | - $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>'; |
|
236 | - } else { |
|
237 | - if ($cat_count == 1) { |
|
238 | - $nav_html .= '<dd class="geodir-tab-active">'; |
|
239 | - } else { |
|
240 | - $nav_html .= '<dd class="">'; |
|
241 | - } |
|
242 | - $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : ''; |
|
243 | - $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">'; |
|
244 | - $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>'; |
|
245 | - $nav_html .= '<span>'; |
|
246 | - $nav_html .= geodir_ucwords($cat->name); |
|
247 | - $nav_html .= '<small>'; |
|
248 | - if (isset($cat->review_count)) { |
|
249 | - $num_reviews = $cat->review_count; |
|
250 | - if ($num_reviews == 0) { |
|
251 | - $reviews = __('No Reviews', 'geodirectory'); |
|
252 | - } elseif ($num_reviews > 1) { |
|
253 | - $reviews = $num_reviews . __(' Reviews', 'geodirectory'); |
|
254 | - } else { |
|
255 | - $reviews = __('1 Review', 'geodirectory'); |
|
256 | - } |
|
257 | - $nav_html .= $reviews; |
|
258 | - } |
|
259 | - $nav_html .= '</small>'; |
|
260 | - $nav_html .= '</span>'; |
|
261 | - $nav_html .= '</a>'; |
|
262 | - $nav_html .= '</dd>'; |
|
263 | - } |
|
264 | - } |
|
265 | - } |
|
266 | - |
|
267 | - if ($is_dropdown) { |
|
268 | - $nav_html .= '</select>'; |
|
269 | - } else { |
|
270 | - $nav_html .= '</dl>'; |
|
271 | - } |
|
272 | - $final_html .= $nav_html; |
|
273 | - } |
|
274 | - if ($terms) { |
|
275 | - echo $final_html; |
|
276 | - } |
|
277 | - echo '</div>'; |
|
278 | - //term navigation - end |
|
279 | - |
|
280 | - //first term listings by default - start |
|
281 | - $first_term = ''; |
|
282 | - if ($terms) { |
|
283 | - $first_term = $terms[0]; |
|
284 | - $tax_query = array( |
|
285 | - 'taxonomy' => $category_taxonomy[0], |
|
286 | - 'field' => 'id', |
|
287 | - 'terms' => $first_term->term_id |
|
288 | - ); |
|
289 | - $query_args['tax_query'] = array($tax_query); |
|
290 | - } |
|
291 | - |
|
292 | - ?> |
|
17 | + /** |
|
18 | + * Register the best of widget with WordPress. |
|
19 | + * |
|
20 | + * @since 1.3.9 |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + */ |
|
23 | + public function __construct() |
|
24 | + { |
|
25 | + $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory')); |
|
26 | + parent::__construct( |
|
27 | + 'bestof_widget', // Base ID |
|
28 | + __('GD > Best of widget', 'geodirectory'), // Name |
|
29 | + $widget_ops// Args |
|
30 | + ); |
|
31 | + } |
|
32 | + |
|
33 | + /** |
|
34 | + * Front-end display content for best of widget. |
|
35 | + * |
|
36 | + * @since 1.3.9 |
|
37 | + * @since 1.5.1 Added filter to view all link. |
|
38 | + * @since 1.5.1 Declare function public. |
|
39 | + * |
|
40 | + * @param array $args Widget arguments. |
|
41 | + * @param array $instance Saved values from database. |
|
42 | + */ |
|
43 | + public function widget($args, $instance) |
|
44 | + { |
|
45 | + extract($args); |
|
46 | + /** |
|
47 | + * Filter the best of widget tab layout. |
|
48 | + * |
|
49 | + * @since 1.3.9 |
|
50 | + * |
|
51 | + * @param string $instance ['tab_layout'] Best of widget tab layout name. |
|
52 | + */ |
|
53 | + $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']); |
|
54 | + echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">'; |
|
55 | + echo $before_widget; |
|
56 | + $loc_terms = geodir_get_current_location_terms(); |
|
57 | + if (!empty($loc_terms)) { |
|
58 | + $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
59 | + } else { |
|
60 | + $cur_location = ''; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * Filter the current location name. |
|
65 | + * |
|
66 | + * @since 1.3.9 |
|
67 | + * |
|
68 | + * @param string $cur_location Current location name. |
|
69 | + */ |
|
70 | + $cur_location = apply_filters('bestof_widget_cur_location', $cur_location); |
|
71 | + |
|
72 | + /** |
|
73 | + * Filter the widget title. |
|
74 | + * |
|
75 | + * @since 1.3.9 |
|
76 | + * |
|
77 | + * @param string $instance ['title'] The widget title. |
|
78 | + */ |
|
79 | + $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
80 | + |
|
81 | + /** |
|
82 | + * Filter the post type. |
|
83 | + * |
|
84 | + * @since 1.3.9 |
|
85 | + * |
|
86 | + * @param string $instance ['post_type'] The post type. |
|
87 | + */ |
|
88 | + $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']); |
|
89 | + |
|
90 | + /** |
|
91 | + * Filter the excerpt type. |
|
92 | + * |
|
93 | + * @since 1.5.4 |
|
94 | + * |
|
95 | + * @param string $instance ['excerpt_type'] The excerpt type. |
|
96 | + */ |
|
97 | + $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']); |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * Filter the listing limit. |
|
102 | + * |
|
103 | + * @since 1.3.9 |
|
104 | + * |
|
105 | + * @param int $instance ['post_limit'] No. of posts to display. |
|
106 | + */ |
|
107 | + $post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']); |
|
108 | + |
|
109 | + /** |
|
110 | + * Filter the category limit. |
|
111 | + * |
|
112 | + * @since 1.3.9 |
|
113 | + * |
|
114 | + * @param int $instance ['categ_limit'] No. of categories to display. |
|
115 | + */ |
|
116 | + $categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']); |
|
117 | + $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
118 | + |
|
119 | + /** |
|
120 | + * Filter the use of location filter. |
|
121 | + * |
|
122 | + * @since 1.3.9 |
|
123 | + * |
|
124 | + * @param int|bool $instance ['add_location_filter'] Filter listings using current location. |
|
125 | + */ |
|
126 | + $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']); |
|
127 | + |
|
128 | + // set post type to current viewing post type |
|
129 | + if ($use_viewing_post_type) { |
|
130 | + $current_post_type = geodir_get_current_posttype(); |
|
131 | + if ($current_post_type != '' && $current_post_type != $post_type) { |
|
132 | + $post_type = $current_post_type; |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + if (isset($instance['character_count'])) { |
|
137 | + /** |
|
138 | + * Filter the widget's excerpt character count. |
|
139 | + * |
|
140 | + * @since 1.3.9 |
|
141 | + * |
|
142 | + * @param int $instance ['character_count'] Excerpt character count. |
|
143 | + */ |
|
144 | + $character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']); |
|
145 | + } else { |
|
146 | + $character_count = ''; |
|
147 | + } |
|
148 | + |
|
149 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
150 | + |
|
151 | + $term_args = array( |
|
152 | + 'hide_empty' => true, |
|
153 | + 'parent' => 0 |
|
154 | + ); |
|
155 | + |
|
156 | + $term_args = apply_filters('bestof_widget_term_args', $term_args); |
|
157 | + |
|
158 | + if (is_tax()) { |
|
159 | + $taxonomy = get_query_var('taxonomy'); |
|
160 | + $cur_term = get_query_var('term'); |
|
161 | + $term_data = get_term_by('name', $cur_term, $taxonomy); |
|
162 | + $term_args['parent'] = $term_data->term_id; |
|
163 | + } |
|
164 | + |
|
165 | + $terms = get_terms($category_taxonomy[0], $term_args); |
|
166 | + |
|
167 | + $term_reviews = geodir_count_reviews_by_terms(); |
|
168 | + $a_terms = array(); |
|
169 | + foreach ($terms as $term) { |
|
170 | + |
|
171 | + |
|
172 | + if ($term->count > 0) { |
|
173 | + if (isset($term_reviews[$term->term_id])) { |
|
174 | + $term->review_count = $term_reviews[$term->term_id]; |
|
175 | + } else { |
|
176 | + $term->review_count = '0'; |
|
177 | + } |
|
178 | + |
|
179 | + $a_terms[] = $term; |
|
180 | + } |
|
181 | + |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + $terms = apply_filters('bestof_widget_sort_terms', geodir_sort_terms($a_terms, 'review_count'), $a_terms); |
|
186 | + |
|
187 | + $query_args = array( |
|
188 | + 'posts_per_page' => $post_limit, |
|
189 | + 'is_geodir_loop' => true, |
|
190 | + 'post_type' => $post_type, |
|
191 | + 'gd_location' => $add_location_filter ? true : false, |
|
192 | + 'order_by' => 'high_review' |
|
193 | + ); |
|
194 | + if ($character_count >= 0) { |
|
195 | + $query_args['excerpt_length'] = $character_count; |
|
196 | + } |
|
197 | + |
|
198 | + $layout = array(); |
|
199 | + if ($tab_layout == 'bestof-tabs-as-dropdown') { |
|
200 | + $layout[] = $tab_layout; |
|
201 | + } else { |
|
202 | + $layout[] = 'bestof-tabs-as-dropdown'; |
|
203 | + $layout[] = $tab_layout; |
|
204 | + } |
|
205 | + |
|
206 | + |
|
207 | + echo $before_title . __($title,'geodirectory') . $after_title; |
|
208 | + |
|
209 | + //term navigation - start |
|
210 | + echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">'; |
|
211 | + |
|
212 | + $final_html = ''; |
|
213 | + foreach ($layout as $tab_layout) { |
|
214 | + $nav_html = ''; |
|
215 | + $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
|
216 | + |
|
217 | + if ($is_dropdown) { |
|
218 | + $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">'; |
|
219 | + } else { |
|
220 | + $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
|
221 | + $nav_html .= '<dt></dt>'; |
|
222 | + } |
|
223 | + |
|
224 | + |
|
225 | + $term_icon = geodir_get_term_icon(); |
|
226 | + $cat_count = 0; |
|
227 | + if (!empty($terms)) { |
|
228 | + foreach ($terms as $cat) { |
|
229 | + $cat_count++; |
|
230 | + if ($cat_count > $categ_limit) { |
|
231 | + break; |
|
232 | + } |
|
233 | + if ($is_dropdown) { |
|
234 | + $selected = ($cat_count == 1) ? 'selected="selected"' : ''; |
|
235 | + $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>'; |
|
236 | + } else { |
|
237 | + if ($cat_count == 1) { |
|
238 | + $nav_html .= '<dd class="geodir-tab-active">'; |
|
239 | + } else { |
|
240 | + $nav_html .= '<dd class="">'; |
|
241 | + } |
|
242 | + $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : ''; |
|
243 | + $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">'; |
|
244 | + $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>'; |
|
245 | + $nav_html .= '<span>'; |
|
246 | + $nav_html .= geodir_ucwords($cat->name); |
|
247 | + $nav_html .= '<small>'; |
|
248 | + if (isset($cat->review_count)) { |
|
249 | + $num_reviews = $cat->review_count; |
|
250 | + if ($num_reviews == 0) { |
|
251 | + $reviews = __('No Reviews', 'geodirectory'); |
|
252 | + } elseif ($num_reviews > 1) { |
|
253 | + $reviews = $num_reviews . __(' Reviews', 'geodirectory'); |
|
254 | + } else { |
|
255 | + $reviews = __('1 Review', 'geodirectory'); |
|
256 | + } |
|
257 | + $nav_html .= $reviews; |
|
258 | + } |
|
259 | + $nav_html .= '</small>'; |
|
260 | + $nav_html .= '</span>'; |
|
261 | + $nav_html .= '</a>'; |
|
262 | + $nav_html .= '</dd>'; |
|
263 | + } |
|
264 | + } |
|
265 | + } |
|
266 | + |
|
267 | + if ($is_dropdown) { |
|
268 | + $nav_html .= '</select>'; |
|
269 | + } else { |
|
270 | + $nav_html .= '</dl>'; |
|
271 | + } |
|
272 | + $final_html .= $nav_html; |
|
273 | + } |
|
274 | + if ($terms) { |
|
275 | + echo $final_html; |
|
276 | + } |
|
277 | + echo '</div>'; |
|
278 | + //term navigation - end |
|
279 | + |
|
280 | + //first term listings by default - start |
|
281 | + $first_term = ''; |
|
282 | + if ($terms) { |
|
283 | + $first_term = $terms[0]; |
|
284 | + $tax_query = array( |
|
285 | + 'taxonomy' => $category_taxonomy[0], |
|
286 | + 'field' => 'id', |
|
287 | + 'terms' => $first_term->term_id |
|
288 | + ); |
|
289 | + $query_args['tax_query'] = array($tax_query); |
|
290 | + } |
|
291 | + |
|
292 | + ?> |
|
293 | 293 | <input type="hidden" id="bestof_widget_post_type" name="bestof_widget_post_type" |
294 | 294 | value="<?php echo $post_type; ?>"> |
295 | 295 | <input type="hidden" id="bestof_widget_excerpt_type" name="bestof_widget_excerpt_type" |
@@ -300,110 +300,110 @@ discard block |
||
300 | 300 | value="<?php echo $category_taxonomy[0]; ?>"> |
301 | 301 | <input type="hidden" id="bestof_widget_location_filter" name="bestof_widget_location_filter" |
302 | 302 | value="<?php if ($add_location_filter) { |
303 | - echo 1; |
|
304 | - } else { |
|
305 | - echo 0; |
|
306 | - } ?>"> |
|
303 | + echo 1; |
|
304 | + } else { |
|
305 | + echo 0; |
|
306 | + } ?>"> |
|
307 | 307 | <input type="hidden" id="bestof_widget_char_count" name="bestof_widget_char_count" |
308 | 308 | value="<?php echo $character_count; ?>"> |
309 | 309 | <div class="geo-bestof-contentwrap geodir-tabs-content" style="position: relative; z-index: 0;"> |
310 | 310 | <p id="geodir-bestof-loading" class="geodir-bestof-loading"><i class="fas fa-cog fa-spin"></i></p> |
311 | 311 | <?php |
312 | - echo '<div id="geodir-bestof-places">'; |
|
313 | - if ($terms) { |
|
314 | - $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy)); |
|
315 | - /** |
|
316 | - * Filter the page link to view all lisitngs. |
|
317 | - * |
|
318 | - * @since 1.5.1 |
|
319 | - * |
|
320 | - * @param array $view_all_link View all listings page link. |
|
321 | - * @param array $post_type The Post type. |
|
322 | - * @param array $first_term The category term object. |
|
323 | - */ |
|
324 | - $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term); |
|
325 | - |
|
326 | - echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
327 | - } |
|
328 | - if ($excerpt_type == 'show-reviews') { |
|
329 | - add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
330 | - } |
|
331 | - geodir_bestof_places_by_term($query_args); |
|
332 | - if ($excerpt_type == 'show-reviews') { |
|
333 | - remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
334 | - } |
|
335 | - echo "</div>"; |
|
336 | - ?> |
|
312 | + echo '<div id="geodir-bestof-places">'; |
|
313 | + if ($terms) { |
|
314 | + $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy)); |
|
315 | + /** |
|
316 | + * Filter the page link to view all lisitngs. |
|
317 | + * |
|
318 | + * @since 1.5.1 |
|
319 | + * |
|
320 | + * @param array $view_all_link View all listings page link. |
|
321 | + * @param array $post_type The Post type. |
|
322 | + * @param array $first_term The category term object. |
|
323 | + */ |
|
324 | + $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term); |
|
325 | + |
|
326 | + echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
327 | + } |
|
328 | + if ($excerpt_type == 'show-reviews') { |
|
329 | + add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
330 | + } |
|
331 | + geodir_bestof_places_by_term($query_args); |
|
332 | + if ($excerpt_type == 'show-reviews') { |
|
333 | + remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
334 | + } |
|
335 | + echo "</div>"; |
|
336 | + ?> |
|
337 | 337 | </div> |
338 | 338 | <?php //first term listings by default - end |
339 | - ?> |
|
339 | + ?> |
|
340 | 340 | <?php echo $after_widget; |
341 | - echo "</div>"; |
|
342 | - } |
|
343 | - |
|
344 | - /** |
|
345 | - * Sanitize best of widget form values as they are saved. |
|
346 | - * |
|
347 | - * @since 1.3.9 |
|
348 | - * @since 1.5.1 Declare function public. |
|
349 | - * |
|
350 | - * @param array $new_instance Values just sent to be saved. |
|
351 | - * @param array $old_instance Previously saved values from database. |
|
352 | - * |
|
353 | - * @return array Updated safe values to be saved. |
|
354 | - */ |
|
355 | - public function update($new_instance, $old_instance) |
|
356 | - { |
|
357 | - $instance = $old_instance; |
|
358 | - $instance['title'] = strip_tags($new_instance['title']); |
|
359 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
360 | - $instance['post_limit'] = strip_tags($new_instance['post_limit']); |
|
361 | - $instance['categ_limit'] = strip_tags($new_instance['categ_limit']); |
|
362 | - $instance['character_count'] = $new_instance['character_count']; |
|
363 | - $instance['tab_layout'] = $new_instance['tab_layout']; |
|
364 | - $instance['excerpt_type'] = $new_instance['excerpt_type']; |
|
365 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
366 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
367 | - else |
|
368 | - $instance['add_location_filter'] = '0'; |
|
369 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
370 | - return $instance; |
|
371 | - } |
|
372 | - |
|
373 | - /** |
|
374 | - * Back-end best of widget settings form. |
|
375 | - * |
|
376 | - * @since 1.3.9 |
|
377 | - * @since 1.5.1 Declare function public. |
|
378 | - * |
|
379 | - * @param array $instance Previously saved values from database. |
|
380 | - */ |
|
381 | - public function form($instance) |
|
382 | - { |
|
383 | - $instance = wp_parse_args((array)$instance, |
|
384 | - array( |
|
385 | - 'title' => '', |
|
386 | - 'post_type' => '', |
|
387 | - 'post_limit' => '5', |
|
388 | - 'categ_limit' => '3', |
|
389 | - 'character_count' => '20', |
|
390 | - 'add_location_filter' => '1', |
|
391 | - 'tab_layout' => 'bestof-tabs-on-top', |
|
392 | - 'excerpt_type' => 'show-desc', |
|
393 | - 'use_viewing_post_type' => '' |
|
394 | - ) |
|
395 | - ); |
|
396 | - $title = strip_tags($instance['title']); |
|
397 | - $post_type = strip_tags($instance['post_type']); |
|
398 | - $post_limit = strip_tags($instance['post_limit']); |
|
399 | - $categ_limit = strip_tags($instance['categ_limit']); |
|
400 | - $character_count = strip_tags($instance['character_count']); |
|
401 | - $tab_layout = strip_tags($instance['tab_layout']); |
|
402 | - $excerpt_type = strip_tags($instance['excerpt_type']); |
|
403 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
404 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
405 | - |
|
406 | - ?> |
|
341 | + echo "</div>"; |
|
342 | + } |
|
343 | + |
|
344 | + /** |
|
345 | + * Sanitize best of widget form values as they are saved. |
|
346 | + * |
|
347 | + * @since 1.3.9 |
|
348 | + * @since 1.5.1 Declare function public. |
|
349 | + * |
|
350 | + * @param array $new_instance Values just sent to be saved. |
|
351 | + * @param array $old_instance Previously saved values from database. |
|
352 | + * |
|
353 | + * @return array Updated safe values to be saved. |
|
354 | + */ |
|
355 | + public function update($new_instance, $old_instance) |
|
356 | + { |
|
357 | + $instance = $old_instance; |
|
358 | + $instance['title'] = strip_tags($new_instance['title']); |
|
359 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
360 | + $instance['post_limit'] = strip_tags($new_instance['post_limit']); |
|
361 | + $instance['categ_limit'] = strip_tags($new_instance['categ_limit']); |
|
362 | + $instance['character_count'] = $new_instance['character_count']; |
|
363 | + $instance['tab_layout'] = $new_instance['tab_layout']; |
|
364 | + $instance['excerpt_type'] = $new_instance['excerpt_type']; |
|
365 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
366 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
367 | + else |
|
368 | + $instance['add_location_filter'] = '0'; |
|
369 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
370 | + return $instance; |
|
371 | + } |
|
372 | + |
|
373 | + /** |
|
374 | + * Back-end best of widget settings form. |
|
375 | + * |
|
376 | + * @since 1.3.9 |
|
377 | + * @since 1.5.1 Declare function public. |
|
378 | + * |
|
379 | + * @param array $instance Previously saved values from database. |
|
380 | + */ |
|
381 | + public function form($instance) |
|
382 | + { |
|
383 | + $instance = wp_parse_args((array)$instance, |
|
384 | + array( |
|
385 | + 'title' => '', |
|
386 | + 'post_type' => '', |
|
387 | + 'post_limit' => '5', |
|
388 | + 'categ_limit' => '3', |
|
389 | + 'character_count' => '20', |
|
390 | + 'add_location_filter' => '1', |
|
391 | + 'tab_layout' => 'bestof-tabs-on-top', |
|
392 | + 'excerpt_type' => 'show-desc', |
|
393 | + 'use_viewing_post_type' => '' |
|
394 | + ) |
|
395 | + ); |
|
396 | + $title = strip_tags($instance['title']); |
|
397 | + $post_type = strip_tags($instance['post_type']); |
|
398 | + $post_limit = strip_tags($instance['post_limit']); |
|
399 | + $categ_limit = strip_tags($instance['categ_limit']); |
|
400 | + $character_count = strip_tags($instance['character_count']); |
|
401 | + $tab_layout = strip_tags($instance['tab_layout']); |
|
402 | + $excerpt_type = strip_tags($instance['excerpt_type']); |
|
403 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
404 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
405 | + |
|
406 | + ?> |
|
407 | 407 | <p> |
408 | 408 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
409 | 409 | |
@@ -418,14 +418,14 @@ discard block |
||
418 | 418 | for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
419 | 419 | |
420 | 420 | <?php $postypes = geodir_get_posttypes(); |
421 | - /** |
|
422 | - * Filter the post types to display in widget. |
|
423 | - * |
|
424 | - * @since 1.3.9 |
|
425 | - * |
|
426 | - * @param array $postypes Post types array. |
|
427 | - */ |
|
428 | - $postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?> |
|
421 | + /** |
|
422 | + * Filter the post types to display in widget. |
|
423 | + * |
|
424 | + * @since 1.3.9 |
|
425 | + * |
|
426 | + * @param array $postypes Post types array. |
|
427 | + */ |
|
428 | + $postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?> |
|
429 | 429 | |
430 | 430 | <select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?>" |
431 | 431 | name="<?php echo $this->get_field_name('post_type'); ?>" |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | <?php foreach ($postypes as $postypes_obj) { ?> |
435 | 435 | |
436 | 436 | <option <?php if ($post_type == $postypes_obj) { |
437 | - echo 'selected="selected"'; |
|
438 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
439 | - echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
437 | + echo 'selected="selected"'; |
|
438 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
439 | + echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
440 | 440 | |
441 | 441 | <?php } ?> |
442 | 442 | |
@@ -482,14 +482,14 @@ discard block |
||
482 | 482 | name="<?php echo $this->get_field_name('tab_layout'); ?>"> |
483 | 483 | |
484 | 484 | <option <?php if ($tab_layout == 'bestof-tabs-on-top') { |
485 | - echo 'selected="selected"'; |
|
486 | - } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option> |
|
485 | + echo 'selected="selected"'; |
|
486 | + } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option> |
|
487 | 487 | <option <?php if ($tab_layout == 'bestof-tabs-on-left') { |
488 | - echo 'selected="selected"'; |
|
489 | - } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option> |
|
488 | + echo 'selected="selected"'; |
|
489 | + } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option> |
|
490 | 490 | <option <?php if ($tab_layout == 'bestof-tabs-as-dropdown') { |
491 | - echo 'selected="selected"'; |
|
492 | - } ?> |
|
491 | + echo 'selected="selected"'; |
|
492 | + } ?> |
|
493 | 493 | value="bestof-tabs-as-dropdown"><?php _e('Tabs as Dropdown', 'geodirectory'); ?></option> |
494 | 494 | </select> |
495 | 495 | </label> |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | name="<?php echo $this->get_field_name('excerpt_type'); ?>"> |
504 | 504 | |
505 | 505 | <option <?php if ($excerpt_type == 'show-desc') { |
506 | - echo 'selected="selected"'; |
|
507 | - } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option> |
|
506 | + echo 'selected="selected"'; |
|
507 | + } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option> |
|
508 | 508 | <option <?php if ($excerpt_type == 'show-reviews') { |
509 | - echo 'selected="selected"'; |
|
510 | - } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option> |
|
509 | + echo 'selected="selected"'; |
|
510 | + } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option> |
|
511 | 511 | </select> |
512 | 512 | </label> |
513 | 513 | </p> |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
527 | 527 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
528 | 528 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
529 | - echo 'checked="checked"'; |
|
530 | - } ?> value="1"/> |
|
529 | + echo 'checked="checked"'; |
|
530 | + } ?> value="1"/> |
|
531 | 531 | </label> |
532 | 532 | </p> |
533 | 533 | <?php |
534 | - } |
|
534 | + } |
|
535 | 535 | } // class geodir_bestof_widget |
536 | 536 | |
537 | 537 | register_widget('geodir_bestof_widget'); |
@@ -551,68 +551,68 @@ discard block |
||
551 | 551 | */ |
552 | 552 | function geodir_bestof_places_by_term($query_args) |
553 | 553 | { |
554 | - global $gd_session; |
|
555 | - |
|
556 | - /** |
|
557 | - * This action called before querying widget listings. |
|
558 | - * |
|
559 | - * @since 1.0.0 |
|
560 | - */ |
|
561 | - do_action('geodir_bestof_get_widget_listings_before'); |
|
562 | - |
|
563 | - $widget_listings = geodir_get_widget_listings($query_args); |
|
564 | - |
|
565 | - /** |
|
566 | - * This action called after querying widget listings. |
|
567 | - * |
|
568 | - * @since 1.0.0 |
|
569 | - */ |
|
570 | - do_action('geodir_bestof_get_widget_listings_after'); |
|
571 | - |
|
572 | - $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : ''; |
|
573 | - |
|
574 | - if (!isset($character_count)) { |
|
575 | - /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
|
576 | - $character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count); |
|
577 | - } |
|
578 | - |
|
579 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
580 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
581 | - |
|
582 | - global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing; |
|
583 | - $current_post = $post; |
|
584 | - $current_map_jason = $map_jason; |
|
585 | - $current_map_canvas_arr = $map_canvas_arr; |
|
586 | - $current_grid_view = $gridview_columns_widget; |
|
587 | - $gridview_columns_widget = null; |
|
588 | - |
|
589 | - $gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false; |
|
590 | - $gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : ''; |
|
591 | - |
|
592 | - $gd_session->set('gd_listing_view', '1'); |
|
593 | - $geodir_is_widget_listing = true; |
|
594 | - |
|
595 | - /** |
|
596 | - * Includes the template for the listing listview. |
|
597 | - * |
|
598 | - * @since 1.3.9 |
|
599 | - */ |
|
600 | - include($template); |
|
601 | - |
|
602 | - $geodir_is_widget_listing = false; |
|
603 | - |
|
604 | - $GLOBALS['post'] = $current_post; |
|
605 | - if (!empty($current_post)) { |
|
606 | - setup_postdata($current_post); |
|
607 | - } |
|
608 | - if ($gd_listing_view_set) { // Set back previous value |
|
609 | - $gd_session->set('gd_listing_view', $gd_listing_view_old); |
|
610 | - } else { |
|
611 | - $gd_session->un_set('gd_listing_view'); |
|
612 | - } |
|
613 | - $map_jason = $current_map_jason; |
|
614 | - $map_canvas_arr = $current_map_canvas_arr; |
|
615 | - $gridview_columns_widget = $current_grid_view; |
|
554 | + global $gd_session; |
|
555 | + |
|
556 | + /** |
|
557 | + * This action called before querying widget listings. |
|
558 | + * |
|
559 | + * @since 1.0.0 |
|
560 | + */ |
|
561 | + do_action('geodir_bestof_get_widget_listings_before'); |
|
562 | + |
|
563 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
564 | + |
|
565 | + /** |
|
566 | + * This action called after querying widget listings. |
|
567 | + * |
|
568 | + * @since 1.0.0 |
|
569 | + */ |
|
570 | + do_action('geodir_bestof_get_widget_listings_after'); |
|
571 | + |
|
572 | + $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : ''; |
|
573 | + |
|
574 | + if (!isset($character_count)) { |
|
575 | + /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
|
576 | + $character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count); |
|
577 | + } |
|
578 | + |
|
579 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
580 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
581 | + |
|
582 | + global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing; |
|
583 | + $current_post = $post; |
|
584 | + $current_map_jason = $map_jason; |
|
585 | + $current_map_canvas_arr = $map_canvas_arr; |
|
586 | + $current_grid_view = $gridview_columns_widget; |
|
587 | + $gridview_columns_widget = null; |
|
588 | + |
|
589 | + $gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false; |
|
590 | + $gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : ''; |
|
591 | + |
|
592 | + $gd_session->set('gd_listing_view', '1'); |
|
593 | + $geodir_is_widget_listing = true; |
|
594 | + |
|
595 | + /** |
|
596 | + * Includes the template for the listing listview. |
|
597 | + * |
|
598 | + * @since 1.3.9 |
|
599 | + */ |
|
600 | + include($template); |
|
601 | + |
|
602 | + $geodir_is_widget_listing = false; |
|
603 | + |
|
604 | + $GLOBALS['post'] = $current_post; |
|
605 | + if (!empty($current_post)) { |
|
606 | + setup_postdata($current_post); |
|
607 | + } |
|
608 | + if ($gd_listing_view_set) { // Set back previous value |
|
609 | + $gd_session->set('gd_listing_view', $gd_listing_view_old); |
|
610 | + } else { |
|
611 | + $gd_session->un_set('gd_listing_view'); |
|
612 | + } |
|
613 | + $map_jason = $current_map_jason; |
|
614 | + $map_canvas_arr = $current_map_canvas_arr; |
|
615 | + $gridview_columns_widget = $current_grid_view; |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | //Ajax functions |
@@ -629,51 +629,51 @@ discard block |
||
629 | 629 | */ |
630 | 630 | function geodir_bestof_callback() |
631 | 631 | { |
632 | - check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce'); |
|
633 | - //set variables |
|
634 | - $post_type = strip_tags(esc_sql($_POST['post_type'])); |
|
635 | - $post_limit = strip_tags(esc_sql($_POST['post_limit'])); |
|
636 | - $character_count = strip_tags(esc_sql($_POST['char_count'])); |
|
637 | - $taxonomy = strip_tags(esc_sql($_POST['taxonomy'])); |
|
638 | - $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter'])); |
|
639 | - $term_id = strip_tags(esc_sql($_POST['term_id'])); |
|
640 | - $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type'])); |
|
641 | - |
|
642 | - $query_args = array( |
|
643 | - 'posts_per_page' => $post_limit, |
|
644 | - 'is_geodir_loop' => true, |
|
645 | - 'post_type' => $post_type, |
|
646 | - 'gd_location' => $add_location_filter ? true : false, |
|
647 | - 'order_by' => 'high_review' |
|
648 | - ); |
|
649 | - |
|
650 | - if ($character_count >= 0) { |
|
651 | - $query_args['excerpt_length'] = $character_count; |
|
652 | - } |
|
653 | - |
|
654 | - $tax_query = array( |
|
655 | - 'taxonomy' => $taxonomy, |
|
656 | - 'field' => 'id', |
|
657 | - 'terms' => $term_id |
|
658 | - ); |
|
659 | - |
|
660 | - $query_args['tax_query'] = array($tax_query); |
|
661 | - if ($term_id && $taxonomy) { |
|
662 | - $term = get_term_by('id', $term_id, $taxonomy); |
|
663 | - $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term)); |
|
664 | - /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
|
665 | - $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term); |
|
666 | - |
|
667 | - echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
668 | - } |
|
669 | - if ($excerpt_type == 'show-reviews') { |
|
670 | - add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
671 | - } |
|
672 | - geodir_bestof_places_by_term($query_args); |
|
673 | - if ($excerpt_type == 'show-reviews') { |
|
674 | - remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
675 | - } |
|
676 | - gd_die(); |
|
632 | + check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce'); |
|
633 | + //set variables |
|
634 | + $post_type = strip_tags(esc_sql($_POST['post_type'])); |
|
635 | + $post_limit = strip_tags(esc_sql($_POST['post_limit'])); |
|
636 | + $character_count = strip_tags(esc_sql($_POST['char_count'])); |
|
637 | + $taxonomy = strip_tags(esc_sql($_POST['taxonomy'])); |
|
638 | + $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter'])); |
|
639 | + $term_id = strip_tags(esc_sql($_POST['term_id'])); |
|
640 | + $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type'])); |
|
641 | + |
|
642 | + $query_args = array( |
|
643 | + 'posts_per_page' => $post_limit, |
|
644 | + 'is_geodir_loop' => true, |
|
645 | + 'post_type' => $post_type, |
|
646 | + 'gd_location' => $add_location_filter ? true : false, |
|
647 | + 'order_by' => 'high_review' |
|
648 | + ); |
|
649 | + |
|
650 | + if ($character_count >= 0) { |
|
651 | + $query_args['excerpt_length'] = $character_count; |
|
652 | + } |
|
653 | + |
|
654 | + $tax_query = array( |
|
655 | + 'taxonomy' => $taxonomy, |
|
656 | + 'field' => 'id', |
|
657 | + 'terms' => $term_id |
|
658 | + ); |
|
659 | + |
|
660 | + $query_args['tax_query'] = array($tax_query); |
|
661 | + if ($term_id && $taxonomy) { |
|
662 | + $term = get_term_by('id', $term_id, $taxonomy); |
|
663 | + $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term)); |
|
664 | + /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
|
665 | + $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term); |
|
666 | + |
|
667 | + echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
668 | + } |
|
669 | + if ($excerpt_type == 'show-reviews') { |
|
670 | + add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
671 | + } |
|
672 | + geodir_bestof_places_by_term($query_args); |
|
673 | + if ($excerpt_type == 'show-reviews') { |
|
674 | + remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
675 | + } |
|
676 | + gd_die(); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | //Javascript |
@@ -686,8 +686,8 @@ discard block |
||
686 | 686 | */ |
687 | 687 | function geodir_bestof_js() |
688 | 688 | { |
689 | - $ajax_nonce = wp_create_nonce("geodir-bestof-nonce"); |
|
690 | - ?> |
|
689 | + $ajax_nonce = wp_create_nonce("geodir-bestof-nonce"); |
|
690 | + ?> |
|
691 | 691 | <script type="text/javascript"> |
692 | 692 | jQuery(document).ready(function () { |
693 | 693 | jQuery('.geodir-bestof-cat-list a, #geodir_bestof_tab_dd').on("click change", function (e) { |
@@ -766,18 +766,18 @@ discard block |
||
766 | 766 | |
767 | 767 | function best_of_show_review_in_excerpt($excerpt) |
768 | 768 | { |
769 | - global $wpdb, $post; |
|
770 | - $review_table = GEODIR_REVIEW_TABLE; |
|
771 | - $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1"; |
|
772 | - $comments = $wpdb->get_results($request); |
|
773 | - |
|
774 | - if ($comments) { |
|
775 | - foreach ($comments as $comment) { |
|
776 | - // Set the extra comment info needed. |
|
777 | - $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
778 | - $comment_content = $comment_extra->comment_content; |
|
779 | - $excerpt = strip_tags($comment_content); |
|
780 | - } |
|
781 | - } |
|
782 | - return $excerpt; |
|
769 | + global $wpdb, $post; |
|
770 | + $review_table = GEODIR_REVIEW_TABLE; |
|
771 | + $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1"; |
|
772 | + $comments = $wpdb->get_results($request); |
|
773 | + |
|
774 | + if ($comments) { |
|
775 | + foreach ($comments as $comment) { |
|
776 | + // Set the extra comment info needed. |
|
777 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
778 | + $comment_content = $comment_extra->comment_content; |
|
779 | + $excerpt = strip_tags($comment_content); |
|
780 | + } |
|
781 | + } |
|
782 | + return $excerpt; |
|
783 | 783 | } |
784 | 784 | \ No newline at end of file |
@@ -118,10 +118,11 @@ discard block |
||
118 | 118 | $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
119 | 119 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
120 | 120 | $instance['character_count'] = $new_instance['character_count']; |
121 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
122 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
123 | - else |
|
124 | - $instance['add_location_filter'] = '0'; |
|
121 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
122 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
123 | + } else { |
|
124 | + $instance['add_location_filter'] = '0'; |
|
125 | + } |
|
125 | 126 | |
126 | 127 | return $instance; |
127 | 128 | } |
@@ -279,7 +280,10 @@ discard block |
||
279 | 280 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
280 | 281 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
281 | 282 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
282 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
283 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
284 | + echo 'checked="checked"'; |
|
285 | +} |
|
286 | +?> |
|
283 | 287 | value="1"/> |
284 | 288 | </label> |
285 | 289 | </p> |
@@ -14,160 +14,160 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_related_listing_postview extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * Register the related listing widget. |
19 | 19 | * |
20 | 20 | * @since 1.0.0 |
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | 22 | */ |
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_related_listing_post_view', 'description' => __('GD > Related Listing', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'post_related_listing', // Base ID |
|
27 | - __('GD > Related Listing', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_related_listing_post_view', 'description' => __('GD > Related Listing', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'post_related_listing', // Base ID |
|
27 | + __('GD > Related Listing', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Front-end display content for related listing widget. |
34 | 34 | * |
35 | 35 | * @since 1.0.0 |
36 | - * @since 1.5.1 Declare function public. |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | 37 | * |
38 | 38 | * @param array $args Widget arguments. |
39 | 39 | * @param array $instance Saved values from database. |
40 | 40 | */ |
41 | - public function widget($args, $instance) |
|
42 | - { |
|
41 | + public function widget($args, $instance) |
|
42 | + { |
|
43 | 43 | |
44 | - // prints the widget |
|
45 | - extract($args, EXTR_SKIP); |
|
44 | + // prints the widget |
|
45 | + extract($args, EXTR_SKIP); |
|
46 | 46 | |
47 | - /** This filter is documented in geodirectory_widgets.php */ |
|
48 | - $title = empty($instance['title']) ? __('Related Listing', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
47 | + /** This filter is documented in geodirectory_widgets.php */ |
|
48 | + $title = empty($instance['title']) ? __('Related Listing', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
49 | 49 | |
50 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
50 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
51 | 51 | $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
52 | 52 | |
53 | - /** |
|
54 | - * Filter the relation type to get related listing. |
|
55 | - * |
|
56 | - * @since 1.0.0 |
|
57 | - * @param string $instance['relate_to'] Can be tags or category. |
|
58 | - */ |
|
53 | + /** |
|
54 | + * Filter the relation type to get related listing. |
|
55 | + * |
|
56 | + * @since 1.0.0 |
|
57 | + * @param string $instance['relate_to'] Can be tags or category. |
|
58 | + */ |
|
59 | 59 | $relate_to = empty($instance['relate_to']) ? 'category' : apply_filters('widget_relate_to', $instance['relate_to']); |
60 | 60 | |
61 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
61 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
62 | 62 | $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']); |
63 | 63 | |
64 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
64 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
65 | 65 | $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']); |
66 | 66 | |
67 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
67 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
68 | 68 | $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']); |
69 | 69 | |
70 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
70 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
71 | 71 | $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
72 | 72 | |
73 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
73 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
74 | 74 | $character_count = empty($instance['character_count']) ? 20 : apply_filters('widget_list_character_count', $instance['character_count']); |
75 | 75 | |
76 | - $arr = array( |
|
77 | - 'before_title' => $before_title, |
|
78 | - 'after_title' => $after_title, |
|
79 | - 'title' => $title, |
|
80 | - 'post_number' => $post_number, |
|
81 | - 'relate_to' => $relate_to, |
|
82 | - 'layout' => $layout, |
|
83 | - 'add_location_filter' => $add_location_filter, |
|
84 | - 'listing_width' => $listing_width, |
|
85 | - 'list_sort' => $list_sort, |
|
86 | - 'character_count' => $character_count, |
|
87 | - 'is_widget' => '1' |
|
88 | - ); |
|
89 | - |
|
90 | - if ($widget_display = geodir_related_posts_display($arr)) { |
|
91 | - |
|
92 | - echo $before_widget; |
|
93 | - echo $widget_display; |
|
94 | - echo $after_widget; |
|
95 | - } |
|
96 | - } |
|
76 | + $arr = array( |
|
77 | + 'before_title' => $before_title, |
|
78 | + 'after_title' => $after_title, |
|
79 | + 'title' => $title, |
|
80 | + 'post_number' => $post_number, |
|
81 | + 'relate_to' => $relate_to, |
|
82 | + 'layout' => $layout, |
|
83 | + 'add_location_filter' => $add_location_filter, |
|
84 | + 'listing_width' => $listing_width, |
|
85 | + 'list_sort' => $list_sort, |
|
86 | + 'character_count' => $character_count, |
|
87 | + 'is_widget' => '1' |
|
88 | + ); |
|
89 | + |
|
90 | + if ($widget_display = geodir_related_posts_display($arr)) { |
|
91 | + |
|
92 | + echo $before_widget; |
|
93 | + echo $widget_display; |
|
94 | + echo $after_widget; |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Sanitize related listing widget form values as they are saved. |
100 | 100 | * |
101 | 101 | * @since 1.0.0 |
102 | - * @since 1.5.1 Declare function public. |
|
102 | + * @since 1.5.1 Declare function public. |
|
103 | 103 | * |
104 | 104 | * @param array $new_instance Values just sent to be saved. |
105 | 105 | * @param array $old_instance Previously saved values from database. |
106 | 106 | * |
107 | 107 | * @return array Updated safe values to be saved. |
108 | 108 | */ |
109 | - public function update($new_instance, $old_instance) |
|
110 | - { |
|
111 | - //save the widget |
|
112 | - $instance = $old_instance; |
|
113 | - |
|
114 | - $instance['title'] = strip_tags($new_instance['title']); |
|
115 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
116 | - $instance['relate_to'] = strip_tags($new_instance['relate_to']); |
|
117 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
118 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
119 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
120 | - $instance['character_count'] = $new_instance['character_count']; |
|
121 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
122 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
123 | - else |
|
124 | - $instance['add_location_filter'] = '0'; |
|
125 | - |
|
126 | - return $instance; |
|
127 | - } |
|
109 | + public function update($new_instance, $old_instance) |
|
110 | + { |
|
111 | + //save the widget |
|
112 | + $instance = $old_instance; |
|
113 | + |
|
114 | + $instance['title'] = strip_tags($new_instance['title']); |
|
115 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
116 | + $instance['relate_to'] = strip_tags($new_instance['relate_to']); |
|
117 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
118 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
119 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
120 | + $instance['character_count'] = $new_instance['character_count']; |
|
121 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
122 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
123 | + else |
|
124 | + $instance['add_location_filter'] = '0'; |
|
125 | + |
|
126 | + return $instance; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Back-end related listing widget settings form. |
131 | 131 | * |
132 | 132 | * @since 1.0.0 |
133 | - * @since 1.5.1 Declare function public. |
|
133 | + * @since 1.5.1 Declare function public. |
|
134 | 134 | * |
135 | 135 | * @param array $instance Previously saved values from database. |
136 | 136 | */ |
137 | - public function form($instance) |
|
138 | - { |
|
139 | - //widgetform in backend |
|
140 | - $instance = wp_parse_args((array)$instance, |
|
141 | - array('title' => '', |
|
142 | - 'list_sort' => '', |
|
143 | - 'list_order' => '', |
|
144 | - 'post_number' => '5', |
|
145 | - 'relate_to' => '', |
|
146 | - 'layout' => 'gridview_onehalf', |
|
147 | - 'listing_width' => '', |
|
148 | - 'add_location_filter' => '1', |
|
149 | - 'character_count' => '20') |
|
150 | - ); |
|
137 | + public function form($instance) |
|
138 | + { |
|
139 | + //widgetform in backend |
|
140 | + $instance = wp_parse_args((array)$instance, |
|
141 | + array('title' => '', |
|
142 | + 'list_sort' => '', |
|
143 | + 'list_order' => '', |
|
144 | + 'post_number' => '5', |
|
145 | + 'relate_to' => '', |
|
146 | + 'layout' => 'gridview_onehalf', |
|
147 | + 'listing_width' => '', |
|
148 | + 'add_location_filter' => '1', |
|
149 | + 'character_count' => '20') |
|
150 | + ); |
|
151 | 151 | |
152 | - $title = strip_tags($instance['title']); |
|
152 | + $title = strip_tags($instance['title']); |
|
153 | 153 | |
154 | - $list_sort = strip_tags($instance['list_sort']); |
|
154 | + $list_sort = strip_tags($instance['list_sort']); |
|
155 | 155 | |
156 | - $list_order = strip_tags($instance['list_order']); |
|
156 | + $list_order = strip_tags($instance['list_order']); |
|
157 | 157 | |
158 | - $post_number = strip_tags($instance['post_number']); |
|
158 | + $post_number = strip_tags($instance['post_number']); |
|
159 | 159 | |
160 | - $relate_to = strip_tags($instance['relate_to']); |
|
160 | + $relate_to = strip_tags($instance['relate_to']); |
|
161 | 161 | |
162 | - $layout = strip_tags($instance['layout']); |
|
162 | + $layout = strip_tags($instance['layout']); |
|
163 | 163 | |
164 | - $listing_width = strip_tags($instance['listing_width']); |
|
164 | + $listing_width = strip_tags($instance['listing_width']); |
|
165 | 165 | |
166 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
166 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
167 | 167 | |
168 | - $character_count = $instance['character_count']; |
|
168 | + $character_count = $instance['character_count']; |
|
169 | 169 | |
170 | - ?> |
|
170 | + ?> |
|
171 | 171 | <p> |
172 | 172 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
173 | 173 | |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
204 | 204 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
205 | 205 | <option <?php if ($relate_to == 'category') { |
206 | - echo 'selected="selected"'; |
|
207 | - } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option> |
|
206 | + echo 'selected="selected"'; |
|
207 | + } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option> |
|
208 | 208 | <option <?php if ($relate_to == 'tags') { |
209 | - echo 'selected="selected"'; |
|
210 | - } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option> |
|
209 | + echo 'selected="selected"'; |
|
210 | + } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option> |
|
211 | 211 | </select> |
212 | 212 | </label> |
213 | 213 | </p> |
@@ -218,24 +218,24 @@ discard block |
||
218 | 218 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
219 | 219 | name="<?php echo $this->get_field_name('layout'); ?>"> |
220 | 220 | <option <?php if ($layout == 'gridview_onehalf') { |
221 | - echo 'selected="selected"'; |
|
222 | - } ?> |
|
221 | + echo 'selected="selected"'; |
|
222 | + } ?> |
|
223 | 223 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
224 | 224 | <option <?php if ($layout == 'gridview_onethird') { |
225 | - echo 'selected="selected"'; |
|
226 | - } ?> |
|
225 | + echo 'selected="selected"'; |
|
226 | + } ?> |
|
227 | 227 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
228 | 228 | <option <?php if ($layout == 'gridview_onefourth') { |
229 | - echo 'selected="selected"'; |
|
230 | - } ?> |
|
229 | + echo 'selected="selected"'; |
|
230 | + } ?> |
|
231 | 231 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
232 | 232 | <option <?php if ($layout == 'gridview_onefifth') { |
233 | - echo 'selected="selected"'; |
|
234 | - } ?> |
|
233 | + echo 'selected="selected"'; |
|
234 | + } ?> |
|
235 | 235 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
236 | 236 | <option <?php if ($layout == 'list') { |
237 | - echo 'selected="selected"'; |
|
238 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
237 | + echo 'selected="selected"'; |
|
238 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
239 | 239 | |
240 | 240 | </select> |
241 | 241 | </label> |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | </p> |
268 | 268 | |
269 | 269 | <?php |
270 | - } |
|
270 | + } |
|
271 | 271 | } // class geodir_related_listing_postview |
272 | 272 | |
273 | 273 | register_widget('geodir_related_listing_postview'); |
274 | 274 | \ No newline at end of file |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public function form($instance) |
138 | 138 | { |
139 | 139 | //widgetform in backend |
140 | - $instance = wp_parse_args((array)$instance, |
|
140 | + $instance = wp_parse_args((array) $instance, |
|
141 | 141 | array('title' => '', |
142 | 142 | 'list_sort' => '', |
143 | 143 | 'list_order' => '', |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | ?> |
171 | 171 | <p> |
172 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
172 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
173 | 173 | |
174 | 174 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
175 | 175 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -177,20 +177,20 @@ discard block |
||
177 | 177 | </label> |
178 | 178 | </p> |
179 | 179 | <p> |
180 | - <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
180 | + <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
181 | 181 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" name="<?php echo $this->get_field_name('list_sort'); ?>"> |
182 | - <option value="latest"<?php selected( $list_sort, 'latest' ); ?>><?php _e('Latest', 'geodirectory'); ?></option> |
|
183 | - <option value="featured"<?php selected( $list_sort, 'featured' ); ?>><?php _e('Featured', 'geodirectory'); ?></option> |
|
184 | - <option value="high_review"<?php selected( $list_sort, 'high_review' ); ?>><?php _e('Review', 'geodirectory'); ?></option> |
|
185 | - <option value="high_rating"<?php selected( $list_sort, 'high_rating' ); ?>><?php _e('Rating', 'geodirectory'); ?></option> |
|
186 | - <option value="random"<?php selected( $list_sort, 'random' ); ?>><?php _e('Random', 'geodirectory'); ?></option> |
|
187 | - <option value="nearest"<?php selected( $list_sort, 'nearest' ); ?>><?php _e('Nearest', 'geodirectory'); ?></option> |
|
182 | + <option value="latest"<?php selected($list_sort, 'latest'); ?>><?php _e('Latest', 'geodirectory'); ?></option> |
|
183 | + <option value="featured"<?php selected($list_sort, 'featured'); ?>><?php _e('Featured', 'geodirectory'); ?></option> |
|
184 | + <option value="high_review"<?php selected($list_sort, 'high_review'); ?>><?php _e('Review', 'geodirectory'); ?></option> |
|
185 | + <option value="high_rating"<?php selected($list_sort, 'high_rating'); ?>><?php _e('Rating', 'geodirectory'); ?></option> |
|
186 | + <option value="random"<?php selected($list_sort, 'random'); ?>><?php _e('Random', 'geodirectory'); ?></option> |
|
187 | + <option value="nearest"<?php selected($list_sort, 'nearest'); ?>><?php _e('Nearest', 'geodirectory'); ?></option> |
|
188 | 188 | </select> |
189 | 189 | </label> |
190 | 190 | </p> |
191 | 191 | <p> |
192 | 192 | <label |
193 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
193 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
194 | 194 | |
195 | 195 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
196 | 196 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | </p> |
200 | 200 | <p> |
201 | 201 | <label for="<?php echo $this->get_field_id('relate_to'); ?>"> |
202 | - <?php _e('Relate to:', 'geodirectory');?> |
|
202 | + <?php _e('Relate to:', 'geodirectory'); ?> |
|
203 | 203 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
204 | 204 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
205 | 205 | <option <?php if ($relate_to == 'category') { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | <p> |
215 | 215 | <p> |
216 | 216 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
217 | - <?php _e('Layout:', 'geodirectory');?> |
|
217 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
218 | 218 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
219 | 219 | name="<?php echo $this->get_field_name('layout'); ?>"> |
220 | 220 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | </p> |
243 | 243 | <p> |
244 | 244 | <label |
245 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
245 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
246 | 246 | |
247 | 247 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
248 | 248 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | </p> |
252 | 252 | <p> |
253 | 253 | <label |
254 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
254 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
255 | 255 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
256 | 256 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
257 | 257 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | </p> |
260 | 260 | <p> |
261 | 261 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
262 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
262 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
263 | 263 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
264 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
264 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
265 | 265 | value="1"/> |
266 | 266 | </label> |
267 | 267 | </p> |
@@ -14,37 +14,37 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_recent_reviews_widget extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * Register the recent reviews widget. |
19 | 19 | * |
20 | 20 | * @since 1.0.0 |
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | 22 | */ |
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'geodir_recent_reviews', // Base ID |
|
27 | - __('GD > Recent Reviews', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'geodir_recent_reviews', // Base ID |
|
27 | + __('GD > Recent Reviews', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Front-end display content for recent reviews widget. |
34 | 34 | * |
35 | 35 | * @since 1.0.0 |
36 | - * @since 1.5.1 Declare function public. |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | 37 | * |
38 | 38 | * @param array $args Widget arguments. |
39 | 39 | * @param array $instance Saved values from database. |
40 | 40 | */ |
41 | 41 | public function widget($args, $instance) |
42 | - { |
|
43 | - // prints the widget |
|
44 | - extract($args, EXTR_SKIP); |
|
42 | + { |
|
43 | + // prints the widget |
|
44 | + extract($args, EXTR_SKIP); |
|
45 | 45 | |
46 | - /** This filter is documented in geodirectory_widgets.php */ |
|
47 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
46 | + /** This filter is documented in geodirectory_widgets.php */ |
|
47 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Filter the number of reviews to display. |
@@ -63,35 +63,35 @@ discard block |
||
63 | 63 | * @param int $g_size Height and width of the avatar image in pixels. Default 30. |
64 | 64 | */ |
65 | 65 | $g_size = apply_filters('geodir_recent_reviews_g_size', 30); |
66 | - /** |
|
67 | - * Filter the excerpt length |
|
68 | - * |
|
69 | - * @since 1.0.0 |
|
70 | - * |
|
71 | - * @param int $excerpt_length Excerpt length. Default 100. |
|
72 | - */ |
|
73 | - $excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100); |
|
74 | - $comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false); |
|
66 | + /** |
|
67 | + * Filter the excerpt length |
|
68 | + * |
|
69 | + * @since 1.0.0 |
|
70 | + * |
|
71 | + * @param int $excerpt_length Excerpt length. Default 100. |
|
72 | + */ |
|
73 | + $excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100); |
|
74 | + $comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false); |
|
75 | 75 | |
76 | - if ($comments_li) { |
|
77 | - echo $before_widget; |
|
78 | - ?> |
|
76 | + if ($comments_li) { |
|
77 | + echo $before_widget; |
|
78 | + ?> |
|
79 | 79 | <div class="widget geodir_recent_reviews_section"> |
80 | 80 | <?php if ($title) { |
81 | - echo $before_title . $title . $after_title; |
|
82 | - } ?> |
|
81 | + echo $before_title . $title . $after_title; |
|
82 | + } ?> |
|
83 | 83 | <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul> |
84 | 84 | </div> |
85 | 85 | <?php |
86 | - echo $after_widget; |
|
87 | - } |
|
88 | - } |
|
86 | + echo $after_widget; |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Sanitize recent reviews widget form values as they are saved. |
92 | 92 | * |
93 | 93 | * @since 1.0.0 |
94 | - * @since 1.5.1 Declare function public. |
|
94 | + * @since 1.5.1 Declare function public. |
|
95 | 95 | * |
96 | 96 | * @param array $new_instance Values just sent to be saved. |
97 | 97 | * @param array $old_instance Previously saved values from database. |
@@ -99,29 +99,29 @@ discard block |
||
99 | 99 | * @return array Updated safe values to be saved. |
100 | 100 | */ |
101 | 101 | public function update($new_instance, $old_instance) |
102 | - { |
|
103 | - //save the widget |
|
104 | - $instance = $old_instance; |
|
105 | - $instance['title'] = strip_tags($new_instance['title']); |
|
106 | - $instance['count'] = strip_tags($new_instance['count']); |
|
107 | - return $instance; |
|
108 | - } |
|
102 | + { |
|
103 | + //save the widget |
|
104 | + $instance = $old_instance; |
|
105 | + $instance['title'] = strip_tags($new_instance['title']); |
|
106 | + $instance['count'] = strip_tags($new_instance['count']); |
|
107 | + return $instance; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Back-end recent reviews widget settings form. |
112 | 112 | * |
113 | 113 | * @since 1.0.0 |
114 | - * @since 1.5.1 Declare function public. |
|
114 | + * @since 1.5.1 Declare function public. |
|
115 | 115 | * |
116 | 116 | * @param array $instance Previously saved values from database. |
117 | 117 | */ |
118 | 118 | public function form($instance) |
119 | - { |
|
120 | - //widgetform in backend |
|
121 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => '')); |
|
122 | - $title = strip_tags($instance['title']); |
|
123 | - $count = strip_tags($instance['count']); |
|
124 | - ?> |
|
119 | + { |
|
120 | + //widgetform in backend |
|
121 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => '')); |
|
122 | + $title = strip_tags($instance['title']); |
|
123 | + $count = strip_tags($instance['count']); |
|
124 | + ?> |
|
125 | 125 | <p><label for="<?php echo $this->get_field_id('title'); ?>">Widget Title: <input class="widefat" |
126 | 126 | id="<?php echo $this->get_field_id('title'); ?>" |
127 | 127 | name="<?php echo $this->get_field_name('title'); ?>" |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | value="<?php echo esc_attr($count); ?>"/></label> |
136 | 136 | </p> |
137 | 137 | <?php |
138 | - } |
|
138 | + } |
|
139 | 139 | } // class geodir_recent_reviews_widget |
140 | 140 | |
141 | 141 | register_widget('geodir_recent_reviews_widget'); |
142 | 142 | \ No newline at end of file |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ?> |
79 | 79 | <div class="widget geodir_recent_reviews_section"> |
80 | 80 | <?php if ($title) { |
81 | - echo $before_title . $title . $after_title; |
|
81 | + echo $before_title.$title.$after_title; |
|
82 | 82 | } ?> |
83 | 83 | <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul> |
84 | 84 | </div> |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function form($instance) |
119 | 119 | { |
120 | 120 | //widgetform in backend |
121 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => '')); |
|
121 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => '')); |
|
122 | 122 | $title = strip_tags($instance['title']); |
123 | 123 | $count = strip_tags($instance['count']); |
124 | 124 | ?> |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | function geodir_activation() |
25 | 25 | { |
26 | 26 | |
27 | - geodir_install(); |
|
28 | - add_action('wp_loaded', 'geodir_flush_activation'); |
|
27 | + geodir_install(); |
|
28 | + add_action('wp_loaded', 'geodir_flush_activation'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function geodir_flush_activation() |
38 | 38 | { |
39 | - // Remove rewrite rules and then recreate rewrite rules. |
|
40 | - // flush late so everything is loaded |
|
41 | - flush_rewrite_rules(); |
|
39 | + // Remove rewrite rules and then recreate rewrite rules. |
|
40 | + // flush late so everything is loaded |
|
41 | + flush_rewrite_rules(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,44 +50,44 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function geodir_install() |
52 | 52 | { |
53 | - global $geodir_settings; |
|
54 | - |
|
55 | - /** |
|
56 | - * Called before the GD installation scripts have run. |
|
57 | - * |
|
58 | - * @since 1.0.0 |
|
59 | - * @see 'geodir_installation_end' |
|
60 | - */ |
|
61 | - do_action('geodir_installation_start'); |
|
62 | - |
|
63 | - // Do install |
|
64 | - if (!get_option('geodir_default_data_installed')) { |
|
65 | - geodir_create_tables(); // in admin db install.php |
|
66 | - geodir_register_defaults(); // geodir_functions/ taxonomy_functions.php |
|
67 | - geodir_create_default_fields(); |
|
68 | - //geodir_default_taxonomies(); |
|
69 | - geodir_set_default_options(); |
|
70 | - geodir_create_pages(); |
|
71 | - geodir_set_default_widgets(); |
|
72 | - gd_install_theme_compat(); |
|
73 | - |
|
74 | - update_option('geodir_default_data_installed', 1); |
|
75 | - |
|
76 | - } |
|
77 | - |
|
78 | - if (!get_option('geodir_default_data_installed_1.2.8')) { |
|
79 | - //geodir_create_tables(); // in admin db install.php |
|
80 | - update_option('geodir_default_data_installed_1.2.8', 1); |
|
81 | - } |
|
82 | - |
|
83 | - geodir_installation_end(); |
|
84 | - /** |
|
85 | - * Called after the GD installation scripts have run. |
|
86 | - * |
|
87 | - * @since 1.0.0 |
|
88 | - * @see 'geodir_installation_start' |
|
89 | - */ |
|
90 | - do_action('geodir_installation_end'); |
|
53 | + global $geodir_settings; |
|
54 | + |
|
55 | + /** |
|
56 | + * Called before the GD installation scripts have run. |
|
57 | + * |
|
58 | + * @since 1.0.0 |
|
59 | + * @see 'geodir_installation_end' |
|
60 | + */ |
|
61 | + do_action('geodir_installation_start'); |
|
62 | + |
|
63 | + // Do install |
|
64 | + if (!get_option('geodir_default_data_installed')) { |
|
65 | + geodir_create_tables(); // in admin db install.php |
|
66 | + geodir_register_defaults(); // geodir_functions/ taxonomy_functions.php |
|
67 | + geodir_create_default_fields(); |
|
68 | + //geodir_default_taxonomies(); |
|
69 | + geodir_set_default_options(); |
|
70 | + geodir_create_pages(); |
|
71 | + geodir_set_default_widgets(); |
|
72 | + gd_install_theme_compat(); |
|
73 | + |
|
74 | + update_option('geodir_default_data_installed', 1); |
|
75 | + |
|
76 | + } |
|
77 | + |
|
78 | + if (!get_option('geodir_default_data_installed_1.2.8')) { |
|
79 | + //geodir_create_tables(); // in admin db install.php |
|
80 | + update_option('geodir_default_data_installed_1.2.8', 1); |
|
81 | + } |
|
82 | + |
|
83 | + geodir_installation_end(); |
|
84 | + /** |
|
85 | + * Called after the GD installation scripts have run. |
|
86 | + * |
|
87 | + * @since 1.0.0 |
|
88 | + * @see 'geodir_installation_start' |
|
89 | + */ |
|
90 | + do_action('geodir_installation_end'); |
|
91 | 91 | |
92 | 92 | |
93 | 93 | } |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | function geodir_create_pages() |
105 | 105 | { |
106 | 106 | |
107 | - //geodir_create_page( esc_sql( _x('home-map', 'page_slug', 'geodirectory') ), 'geodir_home_map_page', __('Home Map', 'geodirectory'), '',0,'publish' ); |
|
108 | - geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), ''); |
|
109 | - geodir_create_page(esc_sql(_x('add-listing', 'page_slug', 'geodirectory')), 'geodir_add_listing_page', __('Add Listing', 'geodirectory'), ''); |
|
110 | - geodir_create_page(esc_sql(_x('listing-preview', 'page_slug', 'geodirectory')), 'geodir_preview_page', __('Listing Preview', 'geodirectory'), ''); |
|
111 | - geodir_create_page(esc_sql(_x('listing-success', 'page_slug', 'geodirectory')), 'geodir_success_page', __('Listing Success', 'geodirectory'), ''); |
|
112 | - geodir_create_page(esc_sql(_x('location', 'page_slug', 'geodirectory')), 'geodir_location_page', __('Location', 'geodirectory'), ''); |
|
107 | + //geodir_create_page( esc_sql( _x('home-map', 'page_slug', 'geodirectory') ), 'geodir_home_map_page', __('Home Map', 'geodirectory'), '',0,'publish' ); |
|
108 | + geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), ''); |
|
109 | + geodir_create_page(esc_sql(_x('add-listing', 'page_slug', 'geodirectory')), 'geodir_add_listing_page', __('Add Listing', 'geodirectory'), ''); |
|
110 | + geodir_create_page(esc_sql(_x('listing-preview', 'page_slug', 'geodirectory')), 'geodir_preview_page', __('Listing Preview', 'geodirectory'), ''); |
|
111 | + geodir_create_page(esc_sql(_x('listing-success', 'page_slug', 'geodirectory')), 'geodir_success_page', __('Listing Success', 'geodirectory'), ''); |
|
112 | + geodir_create_page(esc_sql(_x('location', 'page_slug', 'geodirectory')), 'geodir_location_page', __('Location', 'geodirectory'), ''); |
|
113 | 113 | |
114 | - //New since 1.5.3 |
|
115 | - geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), ''); |
|
116 | - geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), ''); |
|
114 | + //New since 1.5.3 |
|
115 | + geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), ''); |
|
116 | + geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), ''); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | } |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | */ |
130 | 130 | function geodir_installation_end() |
131 | 131 | { |
132 | - //update_option( "geodir_db_version", GEODIRECTORY_VERSION ); |
|
132 | + //update_option( "geodir_db_version", GEODIRECTORY_VERSION ); |
|
133 | 133 | |
134 | - update_option("geodir_installed", 1); |
|
135 | - update_option("geodir_installation_redirect", 1); |
|
136 | - update_option('skip_install_geodir_pages', 0); |
|
134 | + update_option("geodir_installed", 1); |
|
135 | + update_option("geodir_installation_redirect", 1); |
|
136 | + update_option('skip_install_geodir_pages', 0); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -147,45 +147,45 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function geodir_set_default_options() |
149 | 149 | { |
150 | - global $geodir_settings; |
|
151 | - /** |
|
152 | - * Contains settings array for general tab. |
|
153 | - * |
|
154 | - * @since 1.0.0 |
|
155 | - * @package GeoDirectory |
|
156 | - */ |
|
157 | - include_once("option-pages/general_settings_array.php"); |
|
158 | - /** |
|
159 | - * Contains settings array for design tab. |
|
160 | - * |
|
161 | - * @since 1.0.0 |
|
162 | - * @package GeoDirectory |
|
163 | - */ |
|
164 | - include_once("option-pages/design_settings_array.php"); |
|
165 | - /** |
|
166 | - * Contains settings array for notifications tab. |
|
167 | - * |
|
168 | - * @since 1.0.0 |
|
169 | - * @package GeoDirectory |
|
170 | - */ |
|
171 | - include_once("option-pages/notifications_settings_array.php"); |
|
172 | - /** |
|
173 | - * Contains settings array for permalink tab. |
|
174 | - * |
|
175 | - * @since 1.0.0 |
|
176 | - * @package GeoDirectory |
|
177 | - */ |
|
178 | - include_once("option-pages/permalink_settings_array.php"); |
|
179 | - /** |
|
180 | - * Contains settings array for title / meta tab. |
|
181 | - * |
|
182 | - * @since 1.5.4 |
|
183 | - * @package GeoDirectory |
|
184 | - */ |
|
185 | - include_once("option-pages/title_meta_settings_array.php"); |
|
186 | - foreach ($geodir_settings as $value) { |
|
187 | - geodir_update_options($value, true); |
|
188 | - } |
|
150 | + global $geodir_settings; |
|
151 | + /** |
|
152 | + * Contains settings array for general tab. |
|
153 | + * |
|
154 | + * @since 1.0.0 |
|
155 | + * @package GeoDirectory |
|
156 | + */ |
|
157 | + include_once("option-pages/general_settings_array.php"); |
|
158 | + /** |
|
159 | + * Contains settings array for design tab. |
|
160 | + * |
|
161 | + * @since 1.0.0 |
|
162 | + * @package GeoDirectory |
|
163 | + */ |
|
164 | + include_once("option-pages/design_settings_array.php"); |
|
165 | + /** |
|
166 | + * Contains settings array for notifications tab. |
|
167 | + * |
|
168 | + * @since 1.0.0 |
|
169 | + * @package GeoDirectory |
|
170 | + */ |
|
171 | + include_once("option-pages/notifications_settings_array.php"); |
|
172 | + /** |
|
173 | + * Contains settings array for permalink tab. |
|
174 | + * |
|
175 | + * @since 1.0.0 |
|
176 | + * @package GeoDirectory |
|
177 | + */ |
|
178 | + include_once("option-pages/permalink_settings_array.php"); |
|
179 | + /** |
|
180 | + * Contains settings array for title / meta tab. |
|
181 | + * |
|
182 | + * @since 1.5.4 |
|
183 | + * @package GeoDirectory |
|
184 | + */ |
|
185 | + include_once("option-pages/title_meta_settings_array.php"); |
|
186 | + foreach ($geodir_settings as $value) { |
|
187 | + geodir_update_options($value, true); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | |
@@ -199,103 +199,103 @@ discard block |
||
199 | 199 | function geodir_set_default_widgets() |
200 | 200 | { |
201 | 201 | |
202 | - $widget_option_list = array(); |
|
203 | - $widgetinfo = array(); |
|
204 | - $sidebarvalue_array = array(); |
|
205 | - $sidebars_widgets = array(); |
|
202 | + $widget_option_list = array(); |
|
203 | + $widgetinfo = array(); |
|
204 | + $sidebarvalue_array = array(); |
|
205 | + $sidebars_widgets = array(); |
|
206 | 206 | |
207 | - /*===========================*/ |
|
208 | - /* Widgets ON HOME PAGE */ |
|
209 | - /*===========================*/ |
|
207 | + /*===========================*/ |
|
208 | + /* Widgets ON HOME PAGE */ |
|
209 | + /*===========================*/ |
|
210 | 210 | |
211 | - $widget_option_list['geodir_home_top'] = |
|
212 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), |
|
213 | - 'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'), |
|
214 | - 'geodir_advance_search' => array()); |
|
211 | + $widget_option_list['geodir_home_top'] = |
|
212 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), |
|
213 | + 'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'), |
|
214 | + 'geodir_advance_search' => array()); |
|
215 | 215 | |
216 | - $widget_option_list['geodir_home_content'] = |
|
217 | - array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1')); |
|
216 | + $widget_option_list['geodir_home_content'] = |
|
217 | + array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1')); |
|
218 | 218 | |
219 | - $widget_option_list['geodir_home_right'] = |
|
220 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), |
|
221 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); |
|
219 | + $widget_option_list['geodir_home_right'] = |
|
220 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), |
|
221 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); |
|
222 | 222 | |
223 | - /*===========================*/ |
|
224 | - /* Widgets ON LISTING PAGE */ |
|
225 | - /*===========================*/ |
|
223 | + /*===========================*/ |
|
224 | + /* Widgets ON LISTING PAGE */ |
|
225 | + /*===========================*/ |
|
226 | 226 | |
227 | - $widget_option_list['geodir_listing_top'] = |
|
228 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), |
|
229 | - 'geodir_advance_search' => array()); |
|
227 | + $widget_option_list['geodir_listing_top'] = |
|
228 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), |
|
229 | + 'geodir_advance_search' => array()); |
|
230 | 230 | |
231 | - $widget_option_list['geodir_listing_right_sidebar'] = |
|
232 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), |
|
233 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), |
|
234 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); |
|
231 | + $widget_option_list['geodir_listing_right_sidebar'] = |
|
232 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), |
|
233 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), |
|
234 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); |
|
235 | 235 | |
236 | 236 | |
237 | - /*===========================*/ |
|
238 | - /* Widgets ON SEARCH PAGE */ |
|
239 | - /*===========================*/ |
|
237 | + /*===========================*/ |
|
238 | + /* Widgets ON SEARCH PAGE */ |
|
239 | + /*===========================*/ |
|
240 | 240 | |
241 | - $widget_option_list['geodir_search_top'] = |
|
242 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), |
|
243 | - 'geodir_advance_search' => array()); |
|
241 | + $widget_option_list['geodir_search_top'] = |
|
242 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')), |
|
243 | + 'geodir_advance_search' => array()); |
|
244 | 244 | |
245 | - $widget_option_list['geodir_search_right_sidebar'] = |
|
246 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), |
|
247 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), |
|
248 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); |
|
245 | + $widget_option_list['geodir_search_right_sidebar'] = |
|
246 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), |
|
247 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), |
|
248 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); |
|
249 | 249 | |
250 | - /*===========================*/ |
|
251 | - /* Widgets ON DETAIL/SINGLE PAGE */ |
|
252 | - /*===========================*/ |
|
250 | + /*===========================*/ |
|
251 | + /* Widgets ON DETAIL/SINGLE PAGE */ |
|
252 | + /*===========================*/ |
|
253 | 253 | |
254 | - $widget_option_list['geodir_detail_sidebar'] = |
|
255 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), |
|
256 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), |
|
257 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); |
|
254 | + $widget_option_list['geodir_detail_sidebar'] = |
|
255 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')), |
|
256 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1), |
|
257 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1')); |
|
258 | 258 | |
259 | 259 | |
260 | - /*===========================*/ |
|
261 | - /* Widgets ON AUTHOR PAGE */ |
|
262 | - /*===========================*/ |
|
260 | + /*===========================*/ |
|
261 | + /* Widgets ON AUTHOR PAGE */ |
|
262 | + /*===========================*/ |
|
263 | 263 | |
264 | 264 | |
265 | - $widget_option_list['geodir_author_right_sidebar'] = |
|
266 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory'))); |
|
265 | + $widget_option_list['geodir_author_right_sidebar'] = |
|
266 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory'))); |
|
267 | 267 | |
268 | 268 | |
269 | - $sidebars_widgets = get_option('sidebars_widgets'); |
|
269 | + $sidebars_widgets = get_option('sidebars_widgets'); |
|
270 | 270 | |
271 | - foreach ($widget_option_list as $key => $widget_options) { |
|
271 | + foreach ($widget_option_list as $key => $widget_options) { |
|
272 | 272 | |
273 | - foreach ($widget_options as $key2 => $widget_options_obj) { |
|
274 | - $widgetid = 'widget_' . $key2; |
|
273 | + foreach ($widget_options as $key2 => $widget_options_obj) { |
|
274 | + $widgetid = 'widget_' . $key2; |
|
275 | 275 | |
276 | - $widgetinfo[$widgetid][] = $widget_options_obj; |
|
276 | + $widgetinfo[$widgetid][] = $widget_options_obj; |
|
277 | 277 | |
278 | - $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
278 | + $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
279 | 279 | |
280 | - $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
|
280 | + $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
|
281 | 281 | |
282 | - } |
|
282 | + } |
|
283 | 283 | |
284 | - if (!empty($sidebarvalue_array[$key])) { |
|
284 | + if (!empty($sidebarvalue_array[$key])) { |
|
285 | 285 | |
286 | - $sidebars_widgets = get_option('sidebars_widgets'); |
|
287 | - $sidebars_widgets[$key] = $sidebarvalue_array[$key]; |
|
288 | - update_option('sidebars_widgets', $sidebars_widgets); |
|
286 | + $sidebars_widgets = get_option('sidebars_widgets'); |
|
287 | + $sidebars_widgets[$key] = $sidebarvalue_array[$key]; |
|
288 | + update_option('sidebars_widgets', $sidebars_widgets); |
|
289 | 289 | |
290 | - foreach ($widget_update as $key => $value) { |
|
290 | + foreach ($widget_update as $key => $value) { |
|
291 | 291 | |
292 | - update_option($key, $value); |
|
292 | + update_option($key, $value); |
|
293 | 293 | |
294 | - } |
|
294 | + } |
|
295 | 295 | |
296 | - } |
|
296 | + } |
|
297 | 297 | |
298 | - } |
|
298 | + } |
|
299 | 299 | |
300 | 300 | |
301 | 301 | } |
@@ -271,11 +271,11 @@ |
||
271 | 271 | foreach ($widget_option_list as $key => $widget_options) { |
272 | 272 | |
273 | 273 | foreach ($widget_options as $key2 => $widget_options_obj) { |
274 | - $widgetid = 'widget_' . $key2; |
|
274 | + $widgetid = 'widget_'.$key2; |
|
275 | 275 | |
276 | 276 | $widgetinfo[$widgetid][] = $widget_options_obj; |
277 | 277 | |
278 | - $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
278 | + $sidebarvalue_array[$key][] = $key2."-".(count($widgetinfo[$widgetid])); |
|
279 | 279 | |
280 | 280 | $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
281 | 281 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | global $gd_session; |
13 | 13 | |
14 | 14 | if (!isset($_REQUEST['backandedit'])) { |
15 | - $gd_session->un_set('listing'); |
|
15 | + $gd_session->un_set('listing'); |
|
16 | 16 | } |
17 | 17 | // call header |
18 | 18 | get_header(); |
@@ -80,7 +80,10 @@ discard block |
||
80 | 80 | echo ' geodir-listview '; |
81 | 81 | } ?> <?php if ($post_view_class) { |
82 | 82 | echo $post_view_class; |
83 | - } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing |
|
83 | + } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
84 | + echo "style='width:{$listing_width}%;'"; |
|
85 | + } |
|
86 | + // Width for widget listing |
|
84 | 87 | |
85 | 88 | echo " data-post-id='$post->ID' "; |
86 | 89 | /** |
@@ -402,8 +405,10 @@ discard block |
||
402 | 405 | */ |
403 | 406 | do_action('geodir_after_listing_post_listview'); |
404 | 407 | |
405 | - else: |
|
406 | - $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
|
408 | + else { |
|
409 | + : |
|
410 | + $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
|
411 | + } |
|
407 | 412 | |
408 | 413 | /** |
409 | 414 | * Called inside the `ul` of the listings template, when no listing found. |
@@ -44,57 +44,57 @@ discard block |
||
44 | 44 | |
45 | 45 | <?php if (have_posts()) : |
46 | 46 | |
47 | - /** |
|
48 | - * Called inside the `ul` of the listings template, but before any `li` elements. |
|
49 | - * |
|
50 | - * When used by the widget view template then it will only show if there are listings to be shown. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * @see 'geodir_after_listing_post_listview' |
|
54 | - */ |
|
55 | - do_action('geodir_before_listing_post_listview'); |
|
56 | - |
|
57 | - while (have_posts()) : the_post(); |
|
58 | - global $post, $wpdb, $preview; |
|
59 | - |
|
60 | - /** |
|
61 | - * Add a class to the `li` element of the listings list template. |
|
62 | - * |
|
63 | - * @since 1.0.0 |
|
64 | - * @param string $class The extra class for the `li` element, default empty. |
|
65 | - */ |
|
66 | - $post_view_class = apply_filters('geodir_post_view_extra_class', ''); |
|
67 | - |
|
68 | - /** |
|
69 | - * Add a class to the `article` tag inside the `li` element on the listings list template. |
|
70 | - * |
|
71 | - * @since 1.0.0 |
|
72 | - * @param string $class The extra class for the `article` element, default empty. |
|
73 | - */ |
|
74 | - $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
75 | - ?> |
|
47 | + /** |
|
48 | + * Called inside the `ul` of the listings template, but before any `li` elements. |
|
49 | + * |
|
50 | + * When used by the widget view template then it will only show if there are listings to be shown. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * @see 'geodir_after_listing_post_listview' |
|
54 | + */ |
|
55 | + do_action('geodir_before_listing_post_listview'); |
|
56 | + |
|
57 | + while (have_posts()) : the_post(); |
|
58 | + global $post, $wpdb, $preview; |
|
59 | + |
|
60 | + /** |
|
61 | + * Add a class to the `li` element of the listings list template. |
|
62 | + * |
|
63 | + * @since 1.0.0 |
|
64 | + * @param string $class The extra class for the `li` element, default empty. |
|
65 | + */ |
|
66 | + $post_view_class = apply_filters('geodir_post_view_extra_class', ''); |
|
67 | + |
|
68 | + /** |
|
69 | + * Add a class to the `article` tag inside the `li` element on the listings list template. |
|
70 | + * |
|
71 | + * @since 1.0.0 |
|
72 | + * @param string $class The extra class for the `article` element, default empty. |
|
73 | + */ |
|
74 | + $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
75 | + ?> |
|
76 | 76 | |
77 | 77 | <li class="clearfix <?php if ($grid_view_class) { |
78 | - echo 'geodir-gridview ' . $grid_view_class; |
|
79 | - } else { |
|
80 | - echo ' geodir-listview '; |
|
81 | - } ?> <?php if ($post_view_class) { |
|
82 | - echo $post_view_class; |
|
83 | - } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing |
|
84 | - |
|
85 | - echo " data-post-id='$post->ID' "; |
|
86 | - /** |
|
87 | - * Called inside the `<li>` tag for listing outputs. |
|
88 | - * |
|
89 | - * @since 1.5.9 |
|
90 | - * @param object $post The post object. |
|
91 | - * @param string $string If called on the listing or widget template. |
|
92 | - */ |
|
93 | - do_action('geodir_listview_inside_li', $post, 'listing'); |
|
94 | - ?> > |
|
78 | + echo 'geodir-gridview ' . $grid_view_class; |
|
79 | + } else { |
|
80 | + echo ' geodir-listview '; |
|
81 | + } ?> <?php if ($post_view_class) { |
|
82 | + echo $post_view_class; |
|
83 | + } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing |
|
84 | + |
|
85 | + echo " data-post-id='$post->ID' "; |
|
86 | + /** |
|
87 | + * Called inside the `<li>` tag for listing outputs. |
|
88 | + * |
|
89 | + * @since 1.5.9 |
|
90 | + * @param object $post The post object. |
|
91 | + * @param string $string If called on the listing or widget template. |
|
92 | + */ |
|
93 | + do_action('geodir_listview_inside_li', $post, 'listing'); |
|
94 | + ?> > |
|
95 | 95 | <article class="geodir-category-listing <?php if ($post_view_article_class) { |
96 | - echo $post_view_article_class; |
|
97 | - } ?>"> |
|
96 | + echo $post_view_article_class; |
|
97 | + } ?>"> |
|
98 | 98 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'listing'); ?>"> |
99 | 99 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?> |
100 | 100 | |
@@ -102,37 +102,37 @@ discard block |
||
102 | 102 | <?php echo $fimage; ?> |
103 | 103 | </a> |
104 | 104 | <?php |
105 | - /** |
|
106 | - * Called before badges are output. |
|
107 | - * |
|
108 | - * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output. |
|
109 | - * |
|
110 | - * @since 1.0.0 |
|
111 | - * @param object $post The post object. |
|
112 | - * @see 'geodir_after_badge_on_image' |
|
113 | - */ |
|
114 | - do_action('geodir_before_badge_on_image', $post); |
|
115 | - if (isset($post->is_featured) && $post->is_featured) { |
|
116 | - echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
117 | - } |
|
118 | - |
|
119 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
120 | - |
|
121 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
122 | - echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Called after badges are output. |
|
127 | - * |
|
128 | - * Called on the listings template after the image and badges like `new` or `featured` have been output. |
|
129 | - * |
|
130 | - * @since 1.0.0 |
|
131 | - * @param object $post The post object. |
|
132 | - * @see 'geodir_before_badge_on_image' |
|
133 | - */ |
|
134 | - do_action('geodir_after_badge_on_image', $post); |
|
135 | - ?> |
|
105 | + /** |
|
106 | + * Called before badges are output. |
|
107 | + * |
|
108 | + * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output. |
|
109 | + * |
|
110 | + * @since 1.0.0 |
|
111 | + * @param object $post The post object. |
|
112 | + * @see 'geodir_after_badge_on_image' |
|
113 | + */ |
|
114 | + do_action('geodir_before_badge_on_image', $post); |
|
115 | + if (isset($post->is_featured) && $post->is_featured) { |
|
116 | + echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
117 | + } |
|
118 | + |
|
119 | + $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
120 | + |
|
121 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
122 | + echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Called after badges are output. |
|
127 | + * |
|
128 | + * Called on the listings template after the image and badges like `new` or `featured` have been output. |
|
129 | + * |
|
130 | + * @since 1.0.0 |
|
131 | + * @param object $post The post object. |
|
132 | + * @see 'geodir_before_badge_on_image' |
|
133 | + */ |
|
134 | + do_action('geodir_after_badge_on_image', $post); |
|
135 | + ?> |
|
136 | 136 | |
137 | 137 | |
138 | 138 | <?php } ?> |
@@ -142,15 +142,15 @@ discard block |
||
142 | 142 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'listing'); ?>"> |
143 | 143 | |
144 | 144 | <?php |
145 | - /** |
|
146 | - * Called before the post title on the listings view template. |
|
147 | - * |
|
148 | - * @since 1.0.0 |
|
149 | - * @param string $type The template type, default 'listview'. |
|
150 | - * @param object $post The post object. |
|
151 | - * @see 'geodir_after_listing_post_title' |
|
152 | - */ |
|
153 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
145 | + /** |
|
146 | + * Called before the post title on the listings view template. |
|
147 | + * |
|
148 | + * @since 1.0.0 |
|
149 | + * @param string $type The template type, default 'listview'. |
|
150 | + * @param object $post The post object. |
|
151 | + * @see 'geodir_after_listing_post_title' |
|
152 | + */ |
|
153 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
154 | 154 | |
155 | 155 | <header class="geodir-entry-header"><h2 class="geodir-entry-title"> |
156 | 156 | <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> |
@@ -162,225 +162,225 @@ discard block |
||
162 | 162 | <!-- .entry-header --> |
163 | 163 | |
164 | 164 | <?php |
165 | - /** |
|
166 | - * Called after the post title on the listings view template. |
|
167 | - * |
|
168 | - * @since 1.0.0 |
|
169 | - * @param string $type The template type, default 'listview'. |
|
170 | - * @param object $post The post object. |
|
171 | - * @see 'geodir_before_listing_post_title' |
|
172 | - */ |
|
173 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
165 | + /** |
|
166 | + * Called after the post title on the listings view template. |
|
167 | + * |
|
168 | + * @since 1.0.0 |
|
169 | + * @param string $type The template type, default 'listview'. |
|
170 | + * @param object $post The post object. |
|
171 | + * @see 'geodir_before_listing_post_title' |
|
172 | + */ |
|
173 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
174 | 174 | |
175 | 175 | <?php /// Print Distance |
176 | - if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
177 | - if ( $related_nearest && $related_parent_lat ) { |
|
178 | - $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
179 | - } else { |
|
180 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
181 | - } |
|
182 | - |
|
183 | - $endLat = $post->post_latitude; |
|
184 | - $endLon = $post->post_longitude; |
|
185 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
186 | - $uom = get_option('geodir_search_dist_1'); |
|
187 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?> |
|
176 | + if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
177 | + if ( $related_nearest && $related_parent_lat ) { |
|
178 | + $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
179 | + } else { |
|
180 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
181 | + } |
|
182 | + |
|
183 | + $endLat = $post->post_latitude; |
|
184 | + $endLon = $post->post_longitude; |
|
185 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
186 | + $uom = get_option('geodir_search_dist_1'); |
|
187 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?> |
|
188 | 188 | <h3> |
189 | 189 | <?php |
190 | 190 | |
191 | - if (round($distance, 2) == 0) { |
|
192 | - $uom = get_option('geodir_search_dist_2'); |
|
193 | - |
|
194 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
195 | - if ($uom == 'feet') { |
|
196 | - $uom = __('feet', 'geodirectory'); |
|
197 | - } else { |
|
198 | - $uom = __('meters', 'geodirectory'); |
|
199 | - } |
|
200 | - echo round($distance) . ' ' . $uom . '<br />'; |
|
201 | - } else { |
|
202 | - if ($uom == 'miles') { |
|
203 | - $uom = __('miles', 'geodirectory'); |
|
204 | - } else { |
|
205 | - $uom = __('km', 'geodirectory'); |
|
206 | - } |
|
207 | - echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
208 | - } |
|
209 | - ?> |
|
191 | + if (round($distance, 2) == 0) { |
|
192 | + $uom = get_option('geodir_search_dist_2'); |
|
193 | + |
|
194 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
195 | + if ($uom == 'feet') { |
|
196 | + $uom = __('feet', 'geodirectory'); |
|
197 | + } else { |
|
198 | + $uom = __('meters', 'geodirectory'); |
|
199 | + } |
|
200 | + echo round($distance) . ' ' . $uom . '<br />'; |
|
201 | + } else { |
|
202 | + if ($uom == 'miles') { |
|
203 | + $uom = __('miles', 'geodirectory'); |
|
204 | + } else { |
|
205 | + $uom = __('km', 'geodirectory'); |
|
206 | + } |
|
207 | + echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
208 | + } |
|
209 | + ?> |
|
210 | 210 | </h3> |
211 | 211 | <?php } ?> |
212 | 212 | |
213 | 213 | |
214 | 214 | <?php |
215 | - /** |
|
216 | - * Called before the post excerpt on the listings view template. |
|
217 | - * |
|
218 | - * @since 1.0.0 |
|
219 | - * @param object $post The post object. |
|
220 | - * @see 'geodir_after_listing_post_excerpt' |
|
221 | - */ |
|
222 | - do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
215 | + /** |
|
216 | + * Called before the post excerpt on the listings view template. |
|
217 | + * |
|
218 | + * @since 1.0.0 |
|
219 | + * @param object $post The post object. |
|
220 | + * @see 'geodir_after_listing_post_excerpt' |
|
221 | + */ |
|
222 | + do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
223 | 223 | <?php echo geodir_show_listing_info('listing'); ?> |
224 | 224 | <div class="geodir-entry-content"> |
225 | 225 | |
226 | 226 | <?php |
227 | - /** |
|
228 | - * Filter to hide the listing excerpt |
|
229 | - * |
|
230 | - * @since 1.5.3 |
|
231 | - * @param bool $display Display the excerpt or not. Default true. |
|
232 | - * @param string $view The view type, default 'listview'. |
|
233 | - * @param object $post The post object. |
|
234 | - */ |
|
235 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
|
236 | - if ($show_listing_excerpt) { |
|
237 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
238 | - $content_out = geodir_max_excerpt( $character_count ); |
|
239 | - } else { |
|
240 | - $content_out = get_the_excerpt(); |
|
241 | - } |
|
242 | - if ( ! empty( $content_out ) ) { |
|
243 | - echo "<p>" . $content_out . "</p>"; |
|
244 | - } |
|
245 | - } |
|
246 | - ?></div> |
|
227 | + /** |
|
228 | + * Filter to hide the listing excerpt |
|
229 | + * |
|
230 | + * @since 1.5.3 |
|
231 | + * @param bool $display Display the excerpt or not. Default true. |
|
232 | + * @param string $view The view type, default 'listview'. |
|
233 | + * @param object $post The post object. |
|
234 | + */ |
|
235 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
|
236 | + if ($show_listing_excerpt) { |
|
237 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
238 | + $content_out = geodir_max_excerpt( $character_count ); |
|
239 | + } else { |
|
240 | + $content_out = get_the_excerpt(); |
|
241 | + } |
|
242 | + if ( ! empty( $content_out ) ) { |
|
243 | + echo "<p>" . $content_out . "</p>"; |
|
244 | + } |
|
245 | + } |
|
246 | + ?></div> |
|
247 | 247 | |
248 | 248 | <?php |
249 | - /** |
|
250 | - * Called after the post excerpt on the listings view template. |
|
251 | - * |
|
252 | - * @since 1.0.0 |
|
253 | - * @param object $post The post object. |
|
254 | - * @see 'geodir_before_listing_post_excerpt' |
|
255 | - */ |
|
256 | - do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
249 | + /** |
|
250 | + * Called after the post excerpt on the listings view template. |
|
251 | + * |
|
252 | + * @since 1.0.0 |
|
253 | + * @param object $post The post object. |
|
254 | + * @see 'geodir_before_listing_post_excerpt' |
|
255 | + */ |
|
256 | + do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
257 | 257 | </div> |
258 | 258 | <!-- gd-content ends here--> |
259 | 259 | <?php |
260 | - /** |
|
261 | - * Called after printing listing content. |
|
262 | - * |
|
263 | - * @since 1.5.3 |
|
264 | - * @param object $post The post object. |
|
265 | - * @param string $view The view type, default 'listing'. |
|
266 | - */ |
|
267 | - do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
260 | + /** |
|
261 | + * Called after printing listing content. |
|
262 | + * |
|
263 | + * @since 1.5.3 |
|
264 | + * @param object $post The post object. |
|
265 | + * @param string $view The view type, default 'listing'. |
|
266 | + */ |
|
267 | + do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
268 | 268 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>"> |
269 | 269 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>"> |
270 | 270 | |
271 | 271 | <?php |
272 | - /** |
|
273 | - * Called before printing review stars html. |
|
274 | - * |
|
275 | - * @since 1.5.3 |
|
276 | - * @param object $post The post object. |
|
277 | - * @param string $view The view type, default 'listing'. |
|
278 | - */ |
|
279 | - do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
280 | - |
|
281 | - $review_show = geodir_is_reviews_show('listview'); |
|
282 | - |
|
283 | - if ($review_show) { |
|
284 | - |
|
285 | - if (!$preview) { |
|
286 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
287 | - /** |
|
288 | - * Called before the rating stars are output on the listings view template. |
|
289 | - * |
|
290 | - * @since 1.0.0 |
|
291 | - * @param float $post_avgratings The average rating for the post. |
|
292 | - * @param int $post->ID The post ID. |
|
293 | - * @see 'geodir_after_review_rating_stars_on_listview' |
|
294 | - */ |
|
295 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
296 | - |
|
297 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
298 | - |
|
299 | - /** |
|
300 | - * Called after the rating stars are output on the listings view template. |
|
301 | - * |
|
302 | - * @since 1.0.0 |
|
303 | - * @param float $post_avgratings The average rating for the post. |
|
304 | - * @param int $post->ID The post ID. |
|
305 | - * @see 'geodir_before_review_rating_stars_on_listview' |
|
306 | - */ |
|
307 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
308 | - } |
|
309 | - ?> |
|
272 | + /** |
|
273 | + * Called before printing review stars html. |
|
274 | + * |
|
275 | + * @since 1.5.3 |
|
276 | + * @param object $post The post object. |
|
277 | + * @param string $view The view type, default 'listing'. |
|
278 | + */ |
|
279 | + do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
280 | + |
|
281 | + $review_show = geodir_is_reviews_show('listview'); |
|
282 | + |
|
283 | + if ($review_show) { |
|
284 | + |
|
285 | + if (!$preview) { |
|
286 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
287 | + /** |
|
288 | + * Called before the rating stars are output on the listings view template. |
|
289 | + * |
|
290 | + * @since 1.0.0 |
|
291 | + * @param float $post_avgratings The average rating for the post. |
|
292 | + * @param int $post->ID The post ID. |
|
293 | + * @see 'geodir_after_review_rating_stars_on_listview' |
|
294 | + */ |
|
295 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
296 | + |
|
297 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
298 | + |
|
299 | + /** |
|
300 | + * Called after the rating stars are output on the listings view template. |
|
301 | + * |
|
302 | + * @since 1.0.0 |
|
303 | + * @param float $post_avgratings The average rating for the post. |
|
304 | + * @param int $post->ID The post ID. |
|
305 | + * @see 'geodir_before_review_rating_stars_on_listview' |
|
306 | + */ |
|
307 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
308 | + } |
|
309 | + ?> |
|
310 | 310 | <a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
311 | 311 | class="fas fa-comments"></i> |
312 | 312 | <?php geodir_comments_number($post->rating_count); ?></a> |
313 | 313 | <?php |
314 | - } |
|
314 | + } |
|
315 | 315 | |
316 | 316 | |
317 | - /** |
|
318 | - * Called after printing favorite html. |
|
319 | - * |
|
320 | - * @since 1.0.0 |
|
321 | - */ |
|
322 | - do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
317 | + /** |
|
318 | + * Called after printing favorite html. |
|
319 | + * |
|
320 | + * @since 1.0.0 |
|
321 | + */ |
|
322 | + do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
323 | 323 | |
324 | 324 | |
325 | - /** |
|
326 | - * Called after printing map pin point. |
|
327 | - * |
|
328 | - * @since 1.0.0 |
|
329 | - * @since 1.5.9 Added $post as second param. |
|
330 | - * @param int $post->ID The post id. |
|
331 | - * @param object $post The post object. |
|
332 | - */ |
|
333 | - do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
325 | + /** |
|
326 | + * Called after printing map pin point. |
|
327 | + * |
|
328 | + * @since 1.0.0 |
|
329 | + * @since 1.5.9 Added $post as second param. |
|
330 | + * @param int $post->ID The post id. |
|
331 | + * @param object $post The post object. |
|
332 | + */ |
|
333 | + do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
334 | 334 | |
335 | - if ($post->post_author == get_current_user_id()) { ?> |
|
335 | + if ($post->post_author == get_current_user_id()) { ?> |
|
336 | 336 | <?php |
337 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
338 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
339 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
337 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
338 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
339 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
340 | 340 | |
341 | - $ajaxlink = geodir_get_ajax_url(); |
|
342 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
341 | + $ajaxlink = geodir_get_ajax_url(); |
|
342 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
343 | 343 | |
344 | - ?> |
|
344 | + ?> |
|
345 | 345 | |
346 | 346 | <span class="geodir-authorlink clearfix"> |
347 | 347 | |
348 | 348 | <?php if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
349 | - /** |
|
350 | - * Called before the edit post link on the listings view template used on the author page. |
|
351 | - * |
|
352 | - * @since 1.0.0 |
|
353 | - * @see 'geodir_after_edit_post_link_on_listing' |
|
354 | - */ |
|
355 | - do_action('geodir_before_edit_post_link_on_listing'); |
|
356 | - ?> |
|
349 | + /** |
|
350 | + * Called before the edit post link on the listings view template used on the author page. |
|
351 | + * |
|
352 | + * @since 1.0.0 |
|
353 | + * @see 'geodir_after_edit_post_link_on_listing' |
|
354 | + */ |
|
355 | + do_action('geodir_before_edit_post_link_on_listing'); |
|
356 | + ?> |
|
357 | 357 | |
358 | 358 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
359 | 359 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
360 | 360 | <?php |
361 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
|
362 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
363 | - ?> |
|
361 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
|
362 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
363 | + ?> |
|
364 | 364 | <?php _e('Edit', 'geodirectory'); ?> |
365 | 365 | </a> |
366 | 366 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
367 | 367 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
368 | 368 | <?php |
369 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
|
370 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
371 | - ?> |
|
369 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
|
370 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
371 | + ?> |
|
372 | 372 | <?php _e('Delete', 'geodirectory'); ?> |
373 | 373 | </a> |
374 | 374 | <?php |
375 | 375 | |
376 | - /** |
|
377 | - * Called after the edit post link on the listings view template used on the author page. |
|
378 | - * |
|
379 | - * @since 1.0.0 |
|
380 | - * @see 'geodir_before_edit_post_link_on_listing' |
|
381 | - */ |
|
382 | - do_action('geodir_after_edit_post_link_on_listing'); |
|
383 | - } ?> |
|
376 | + /** |
|
377 | + * Called after the edit post link on the listings view template used on the author page. |
|
378 | + * |
|
379 | + * @since 1.0.0 |
|
380 | + * @see 'geodir_before_edit_post_link_on_listing' |
|
381 | + */ |
|
382 | + do_action('geodir_after_edit_post_link_on_listing'); |
|
383 | + } ?> |
|
384 | 384 | </span> |
385 | 385 | |
386 | 386 | <?php } ?> |
@@ -393,32 +393,32 @@ discard block |
||
393 | 393 | </li> |
394 | 394 | |
395 | 395 | <?php |
396 | - endwhile; |
|
397 | - |
|
398 | - /** |
|
399 | - * Called inside the `ul` of the listings template, but after all `li` elements. |
|
400 | - * |
|
401 | - * When used by the widget view template then it will only show if there are listings to be shown. |
|
402 | - * |
|
403 | - * @since 1.0.0 |
|
404 | - * @see 'geodir_before_listing_post_listview' |
|
405 | - */ |
|
406 | - do_action('geodir_after_listing_post_listview'); |
|
407 | - |
|
408 | - else: |
|
396 | + endwhile; |
|
397 | + |
|
398 | + /** |
|
399 | + * Called inside the `ul` of the listings template, but after all `li` elements. |
|
400 | + * |
|
401 | + * When used by the widget view template then it will only show if there are listings to be shown. |
|
402 | + * |
|
403 | + * @since 1.0.0 |
|
404 | + * @see 'geodir_before_listing_post_listview' |
|
405 | + */ |
|
406 | + do_action('geodir_after_listing_post_listview'); |
|
407 | + |
|
408 | + else: |
|
409 | 409 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
410 | 410 | |
411 | 411 | /** |
412 | - * Called inside the `ul` of the listings template, when no listing found. |
|
413 | - * |
|
414 | - * @since 1.5.5 |
|
412 | + * Called inside the `ul` of the listings template, when no listing found. |
|
413 | + * |
|
414 | + * @since 1.5.5 |
|
415 | 415 | * @param string 'listing-listview' Listing listview template. |
416 | 416 | * @param bool $favorite Are favorite listings results? |
417 | - */ |
|
418 | - do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite); |
|
419 | - endif; |
|
417 | + */ |
|
418 | + do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite); |
|
419 | + endif; |
|
420 | 420 | |
421 | - ?> |
|
421 | + ?> |
|
422 | 422 | </ul> <!-- geodir_category_list_view ends here--> |
423 | 423 | |
424 | 424 | <div class="clear"></div> |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ?> |
76 | 76 | |
77 | 77 | <li class="clearfix <?php if ($grid_view_class) { |
78 | - echo 'geodir-gridview ' . $grid_view_class; |
|
78 | + echo 'geodir-gridview '.$grid_view_class; |
|
79 | 79 | } else { |
80 | 80 | echo ' geodir-listview '; |
81 | 81 | } ?> <?php if ($post_view_class) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
117 | 117 | } |
118 | 118 | |
119 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
119 | + $geodir_days_new = (int) get_option('geodir_listing_new_days'); |
|
120 | 120 | |
121 | 121 | if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
122 | 122 | echo geodir_show_badges_on_image('new', $post, get_permalink()); |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
174 | 174 | |
175 | 175 | <?php /// Print Distance |
176 | - if ( ( isset( $_REQUEST['sgeo_lat'] ) && $_REQUEST['sgeo_lat'] != '' ) || ( $related_nearest && $related_parent_lat ) ) { |
|
177 | - if ( $related_nearest && $related_parent_lat ) { |
|
176 | + if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || ($related_nearest && $related_parent_lat)) { |
|
177 | + if ($related_nearest && $related_parent_lat) { |
|
178 | 178 | $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
179 | 179 | } else { |
180 | 180 | $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | } else { |
198 | 198 | $uom = __('meters', 'geodirectory'); |
199 | 199 | } |
200 | - echo round($distance) . ' ' . $uom . '<br />'; |
|
200 | + echo round($distance).' '.$uom.'<br />'; |
|
201 | 201 | } else { |
202 | 202 | if ($uom == 'miles') { |
203 | 203 | $uom = __('miles', 'geodirectory'); |
204 | 204 | } else { |
205 | 205 | $uom = __('km', 'geodirectory'); |
206 | 206 | } |
207 | - echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
207 | + echo round($distance, 2).' '.$uom.'<br />'; |
|
208 | 208 | } |
209 | 209 | ?> |
210 | 210 | </h3> |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | */ |
235 | 235 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
236 | 236 | if ($show_listing_excerpt) { |
237 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
238 | - $content_out = geodir_max_excerpt( $character_count ); |
|
237 | + if (isset($character_count) && ($character_count || $character_count == '0')) { |
|
238 | + $content_out = geodir_max_excerpt($character_count); |
|
239 | 239 | } else { |
240 | 240 | $content_out = get_the_excerpt(); |
241 | 241 | } |
242 | - if ( ! empty( $content_out ) ) { |
|
243 | - echo "<p>" . $content_out . "</p>"; |
|
242 | + if (!empty($content_out)) { |
|
243 | + echo "<p>".$content_out."</p>"; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | ?></div> |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param object $post The post object. |
265 | 265 | * @param string $view The view type, default 'listing'. |
266 | 266 | */ |
267 | - do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
267 | + do_action('geodir_after_listing_content', $post, 'listing'); ?> |
|
268 | 268 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>"> |
269 | 269 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>"> |
270 | 270 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @param object $post The post object. |
277 | 277 | * @param string $view The view type, default 'listing'. |
278 | 278 | */ |
279 | - do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
279 | + do_action('geodir_before_review_html', $post, 'listing'); |
|
280 | 280 | |
281 | 281 | $review_show = geodir_is_reviews_show('listview'); |
282 | 282 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * |
320 | 320 | * @since 1.0.0 |
321 | 321 | */ |
322 | - do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
322 | + do_action('geodir_after_favorite_html', $post->ID, 'listing'); |
|
323 | 323 | |
324 | 324 | |
325 | 325 | /** |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @param int $post->ID The post id. |
331 | 331 | * @param object $post The post object. |
332 | 332 | */ |
333 | - do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
333 | + do_action('geodir_listing_after_pinpoint', $post->ID, $post); |
|
334 | 334 | |
335 | 335 | if ($post->post_author == get_current_user_id()) { ?> |
336 | 336 | <?php |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
360 | 360 | <?php |
361 | 361 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fas fa-edit'); |
362 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
362 | + echo '<i class="'.$geodir_listing_edit_icon.'"></i>'; |
|
363 | 363 | ?> |
364 | 364 | <?php _e('Edit', 'geodirectory'); ?> |
365 | 365 | </a> |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
368 | 368 | <?php |
369 | 369 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fas fa-times'); |
370 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
370 | + echo '<i class="'.$geodir_listing_delete_icon.'"></i>'; |
|
371 | 371 | ?> |
372 | 372 | <?php _e('Delete', 'geodirectory'); ?> |
373 | 373 | </a> |
@@ -1,69 +1,69 @@ |
||
1 | 1 | <?php |
2 | 2 | class CheckMaps extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + } |
|
8 | 8 | |
9 | - public function testCheckHomeMap() |
|
10 | - { |
|
11 | - $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
|
12 | - $this->assertContains( 'geodir-map-home-page', $output ); |
|
13 | - } |
|
9 | + public function testCheckHomeMap() |
|
10 | + { |
|
11 | + $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
|
12 | + $this->assertContains( 'geodir-map-home-page', $output ); |
|
13 | + } |
|
14 | 14 | |
15 | - public function testListingsPageMap() |
|
16 | - { |
|
17 | - $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
|
18 | - $this->assertContains( 'geodir-map-listing-page', $output ); |
|
19 | - } |
|
15 | + public function testListingsPageMap() |
|
16 | + { |
|
17 | + $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
|
18 | + $this->assertContains( 'geodir-map-listing-page', $output ); |
|
19 | + } |
|
20 | 20 | |
21 | - public function testDetailPageMap() |
|
22 | - { |
|
21 | + public function testDetailPageMap() |
|
22 | + { |
|
23 | 23 | |
24 | - $query_args = array( |
|
25 | - 'post_status' => 'publish', |
|
26 | - 'post_type' => 'gd_place', |
|
27 | - 'posts_per_page' => 1, |
|
28 | - ); |
|
24 | + $query_args = array( |
|
25 | + 'post_status' => 'publish', |
|
26 | + 'post_type' => 'gd_place', |
|
27 | + 'posts_per_page' => 1, |
|
28 | + ); |
|
29 | 29 | |
30 | - $all_posts = new WP_Query( $query_args ); |
|
31 | - $post_id = null; |
|
32 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
33 | - $post_id = get_the_ID(); |
|
34 | - global $post; |
|
35 | - $post = geodir_get_post_info($post_id); |
|
36 | - setup_postdata($post); |
|
30 | + $all_posts = new WP_Query( $query_args ); |
|
31 | + $post_id = null; |
|
32 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
33 | + $post_id = get_the_ID(); |
|
34 | + global $post; |
|
35 | + $post = geodir_get_post_info($post_id); |
|
36 | + setup_postdata($post); |
|
37 | 37 | |
38 | - $map_args = array(); |
|
39 | - $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
40 | - $map_args['width'] = '600'; |
|
41 | - $map_args['height'] = '300'; |
|
42 | - if ($post->post_mapzoom) { |
|
43 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
44 | - } |
|
45 | - $map_args['autozoom'] = false; |
|
46 | - $map_args['child_collapse'] = '0'; |
|
47 | - $map_args['enable_cat_filters'] = false; |
|
48 | - $map_args['enable_text_search'] = false; |
|
49 | - $map_args['enable_post_type_filters'] = false; |
|
50 | - $map_args['enable_location_filters'] = false; |
|
51 | - $map_args['enable_jason_on_load'] = true; |
|
52 | - $map_args['enable_map_direction'] = true; |
|
53 | - $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
54 | - $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
55 | - ob_start(); |
|
56 | - geodir_draw_map($map_args); |
|
57 | - $output = ob_get_clean(); |
|
58 | - $this->assertContains( 'geodir-map-detail-page', $output ); |
|
59 | - endwhile; |
|
38 | + $map_args = array(); |
|
39 | + $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
40 | + $map_args['width'] = '600'; |
|
41 | + $map_args['height'] = '300'; |
|
42 | + if ($post->post_mapzoom) { |
|
43 | + $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
44 | + } |
|
45 | + $map_args['autozoom'] = false; |
|
46 | + $map_args['child_collapse'] = '0'; |
|
47 | + $map_args['enable_cat_filters'] = false; |
|
48 | + $map_args['enable_text_search'] = false; |
|
49 | + $map_args['enable_post_type_filters'] = false; |
|
50 | + $map_args['enable_location_filters'] = false; |
|
51 | + $map_args['enable_jason_on_load'] = true; |
|
52 | + $map_args['enable_map_direction'] = true; |
|
53 | + $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
54 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
55 | + ob_start(); |
|
56 | + geodir_draw_map($map_args); |
|
57 | + $output = ob_get_clean(); |
|
58 | + $this->assertContains( 'geodir-map-detail-page', $output ); |
|
59 | + endwhile; |
|
60 | 60 | |
61 | 61 | |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | - public function tearDown() |
|
65 | - { |
|
66 | - parent::tearDown(); |
|
67 | - } |
|
64 | + public function tearDown() |
|
65 | + { |
|
66 | + parent::tearDown(); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | ?> |
70 | 70 | \ No newline at end of file |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | public function testCheckHomeMap() |
10 | 10 | { |
11 | 11 | $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
12 | - $this->assertContains( 'geodir-map-home-page', $output ); |
|
12 | + $this->assertContains('geodir-map-home-page', $output); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | public function testListingsPageMap() |
16 | 16 | { |
17 | 17 | $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
18 | - $this->assertContains( 'geodir-map-listing-page', $output ); |
|
18 | + $this->assertContains('geodir-map-listing-page', $output); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function testDetailPageMap() |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | 'posts_per_page' => 1, |
28 | 28 | ); |
29 | 29 | |
30 | - $all_posts = new WP_Query( $query_args ); |
|
30 | + $all_posts = new WP_Query($query_args); |
|
31 | 31 | $post_id = null; |
32 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
32 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
33 | 33 | $post_id = get_the_ID(); |
34 | 34 | global $post; |
35 | - $post = geodir_get_post_info($post_id); |
|
35 | + $post = geodir_get_post_info($post_id); |
|
36 | 36 | setup_postdata($post); |
37 | 37 | |
38 | 38 | $map_args = array(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $map_args['width'] = '600'; |
41 | 41 | $map_args['height'] = '300'; |
42 | 42 | if ($post->post_mapzoom) { |
43 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
43 | + $map_args['zoom'] = ''.$post->post_mapzoom.''; |
|
44 | 44 | } |
45 | 45 | $map_args['autozoom'] = false; |
46 | 46 | $map_args['child_collapse'] = '0'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ob_start(); |
56 | 56 | geodir_draw_map($map_args); |
57 | 57 | $output = ob_get_clean(); |
58 | - $this->assertContains( 'geodir-map-detail-page', $output ); |
|
58 | + $this->assertContains('geodir-map-detail-page', $output); |
|
59 | 59 | endwhile; |
60 | 60 | |
61 | 61 |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | class CheckPinpoint extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + } |
|
8 | 8 | |
9 | - public function testCheckPinpoint() |
|
10 | - { |
|
9 | + public function testCheckPinpoint() |
|
10 | + { |
|
11 | 11 | |
12 | - } |
|
12 | + } |
|
13 | 13 | |
14 | - public function tearDown() |
|
15 | - { |
|
16 | - parent::tearDown(); |
|
17 | - } |
|
14 | + public function tearDown() |
|
15 | + { |
|
16 | + parent::tearDown(); |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | ?> |
20 | 20 | \ No newline at end of file |