@@ -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="fa 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 |
@@ -190,10 +190,11 @@ discard block |
||
190 | 190 | $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
191 | 191 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
192 | 192 | $instance['character_count'] = $new_instance['character_count']; |
193 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
194 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | - else |
|
196 | - $instance['add_location_filter'] = '0'; |
|
193 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
194 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | + } else { |
|
196 | + $instance['add_location_filter'] = '0'; |
|
197 | + } |
|
197 | 198 | |
198 | 199 | $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
199 | 200 | $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
@@ -319,8 +320,9 @@ discard block |
||
319 | 320 | |
320 | 321 | $all_postypes = geodir_get_posttypes(); |
321 | 322 | |
322 | - if (!in_array($post_type, $all_postypes)) |
|
323 | - $post_type = 'gd_place'; |
|
323 | + if (!in_array($post_type, $all_postypes)) { |
|
324 | + $post_type = 'gd_place'; |
|
325 | + } |
|
324 | 326 | |
325 | 327 | $category_taxonomy = geodir_get_taxonomies($post_type); |
326 | 328 | $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
@@ -335,8 +337,9 @@ discard block |
||
335 | 337 | } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
336 | 338 | <?php foreach ($categories as $category_obj) { |
337 | 339 | $selected = ''; |
338 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
339 | - echo $selected = 'selected="selected"'; |
|
340 | + if (is_array($category) && in_array($category_obj->term_id, $category)) { |
|
341 | + echo $selected = 'selected="selected"'; |
|
342 | + } |
|
340 | 343 | |
341 | 344 | ?> |
342 | 345 | |
@@ -350,7 +353,12 @@ discard block |
||
350 | 353 | |
351 | 354 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
352 | 355 | id="<?php echo $this->get_field_id('category_title'); ?>" |
353 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
356 | + value="<?php if ($category_title != '') { |
|
357 | + echo $category_title; |
|
358 | +} else { |
|
359 | + echo __('All', 'geodirectory'); |
|
360 | +} |
|
361 | +?>"/> |
|
354 | 362 | |
355 | 363 | </label> |
356 | 364 | </p> |
@@ -453,7 +461,10 @@ discard block |
||
453 | 461 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
454 | 462 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
455 | 463 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
456 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
464 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
465 | + echo 'checked="checked"'; |
|
466 | +} |
|
467 | +?> |
|
457 | 468 | value="1"/> |
458 | 469 | </label> |
459 | 470 | </p> |
@@ -461,7 +472,10 @@ discard block |
||
461 | 472 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
462 | 473 | <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
463 | 474 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
464 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
475 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
476 | + echo 'checked="checked"'; |
|
477 | +} |
|
478 | +?> |
|
465 | 479 | value="1"/> |
466 | 480 | </label> |
467 | 481 | </p> |
@@ -469,7 +483,10 @@ discard block |
||
469 | 483 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
470 | 484 | <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
471 | 485 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
472 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
486 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) { |
|
487 | + echo 'checked="checked"'; |
|
488 | +} |
|
489 | +?> |
|
473 | 490 | value="1"/> |
474 | 491 | </label> |
475 | 492 | </p> |
@@ -477,7 +494,10 @@ discard block |
||
477 | 494 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
478 | 495 | <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
479 | 496 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
480 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
497 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) { |
|
498 | + echo 'checked="checked"'; |
|
499 | +} |
|
500 | +?> |
|
481 | 501 | value="1"/> |
482 | 502 | </label> |
483 | 503 | </p> |
@@ -485,7 +505,10 @@ discard block |
||
485 | 505 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
486 | 506 | <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
487 | 507 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
488 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
508 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) { |
|
509 | + echo 'checked="checked"'; |
|
510 | +} |
|
511 | +?> |
|
489 | 512 | value="1"/> |
490 | 513 | </label> |
491 | 514 | </p> |
@@ -14,83 +14,83 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_popular_post_category extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
18 | - * Register the popular post category widget. |
|
19 | - * |
|
20 | - * @since 1.0.0 |
|
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'popular_post_category', // Base ID |
|
27 | - __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Front-end display content for popular post category widget. |
|
34 | - * |
|
35 | - * @since 1.0.0 |
|
36 | - * @since 1.5.1 Declare function public. |
|
37 | - * |
|
38 | - * @param array $args Widget arguments. |
|
39 | - * @param array $instance Saved values from database. |
|
40 | - */ |
|
41 | - public function widget($args, $instance) |
|
42 | - { |
|
43 | - geodir_popular_post_category_output($args, $instance); |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Sanitize popular post category widget form values as they are saved. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * @since 1.5.1 Declare function public. |
|
51 | - * @since 1.5.1 Added default_post_type parameter. |
|
52 | - * @since 1.6.9 Added parent_only parameter. |
|
53 | - * |
|
54 | - * @param array $new_instance Values just sent to be saved. |
|
55 | - * @param array $old_instance Previously saved values from database. |
|
56 | - * |
|
57 | - * @return array Updated safe values to be saved. |
|
58 | - */ |
|
59 | - public function update($new_instance, $old_instance) |
|
60 | - { |
|
61 | - //save the widget |
|
62 | - $instance = $old_instance; |
|
63 | - $instance['title'] = strip_tags($new_instance['title']); |
|
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
65 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | - $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | - $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | - return $instance; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Back-end popular post category widget settings form. |
|
73 | - * |
|
74 | - * @since 1.0.0 |
|
75 | - * @since 1.5.1 Declare function public. |
|
76 | - * @since 1.5.1 Added option to set default post type. |
|
77 | - * @since 1.6.9 Added option to show parent categories only. |
|
78 | - * |
|
79 | - * @param array $instance Previously saved values from database. |
|
80 | - */ |
|
81 | - public function form($instance) |
|
82 | - { |
|
83 | - //widgetform in backend |
|
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | - |
|
86 | - $title = strip_tags($instance['title']); |
|
87 | - $category_limit = (int)$instance['category_limit']; |
|
88 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | - $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
17 | + /** |
|
18 | + * Register the popular post category widget. |
|
19 | + * |
|
20 | + * @since 1.0.0 |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'popular_post_category', // Base ID |
|
27 | + __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Front-end display content for popular post category widget. |
|
34 | + * |
|
35 | + * @since 1.0.0 |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | + * |
|
38 | + * @param array $args Widget arguments. |
|
39 | + * @param array $instance Saved values from database. |
|
40 | + */ |
|
41 | + public function widget($args, $instance) |
|
42 | + { |
|
43 | + geodir_popular_post_category_output($args, $instance); |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Sanitize popular post category widget form values as they are saved. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Added default_post_type parameter. |
|
52 | + * @since 1.6.9 Added parent_only parameter. |
|
53 | + * |
|
54 | + * @param array $new_instance Values just sent to be saved. |
|
55 | + * @param array $old_instance Previously saved values from database. |
|
56 | + * |
|
57 | + * @return array Updated safe values to be saved. |
|
58 | + */ |
|
59 | + public function update($new_instance, $old_instance) |
|
60 | + { |
|
61 | + //save the widget |
|
62 | + $instance = $old_instance; |
|
63 | + $instance['title'] = strip_tags($new_instance['title']); |
|
64 | + $category_limit = (int)$new_instance['category_limit']; |
|
65 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | + $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | + $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | + return $instance; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Back-end popular post category widget settings form. |
|
73 | + * |
|
74 | + * @since 1.0.0 |
|
75 | + * @since 1.5.1 Declare function public. |
|
76 | + * @since 1.5.1 Added option to set default post type. |
|
77 | + * @since 1.6.9 Added option to show parent categories only. |
|
78 | + * |
|
79 | + * @param array $instance Previously saved values from database. |
|
80 | + */ |
|
81 | + public function form($instance) |
|
82 | + { |
|
83 | + //widgetform in backend |
|
84 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | + |
|
86 | + $title = strip_tags($instance['title']); |
|
87 | + $category_limit = (int)$instance['category_limit']; |
|
88 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | + $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | + $parent_only = !empty($instance['parent_only']) ? true: false; |
|
91 | 91 | |
92 | - $post_type_options = geodir_get_posttypes('options'); |
|
93 | - ?> |
|
92 | + $post_type_options = geodir_get_posttypes('options'); |
|
93 | + ?> |
|
94 | 94 | <p> |
95 | 95 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
96 | 96 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
117 | 117 | </p> |
118 | 118 | <?php |
119 | - } |
|
119 | + } |
|
120 | 120 | } // class geodir_popular_post_category |
121 | 121 | |
122 | 122 | register_widget('geodir_popular_post_category'); |
@@ -130,40 +130,40 @@ discard block |
||
130 | 130 | class geodir_popular_postview extends WP_Widget |
131 | 131 | { |
132 | 132 | |
133 | - /** |
|
133 | + /** |
|
134 | 134 | * Register the popular posts widget. |
135 | 135 | * |
136 | 136 | * @since 1.0.0 |
137 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
137 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
138 | 138 | */ |
139 | - public function __construct() { |
|
140 | - $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | - parent::__construct( |
|
142 | - 'popular_post_view', // Base ID |
|
143 | - __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | - $widget_ops// Args |
|
145 | - ); |
|
146 | - } |
|
139 | + public function __construct() { |
|
140 | + $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | + parent::__construct( |
|
142 | + 'popular_post_view', // Base ID |
|
143 | + __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | + $widget_ops// Args |
|
145 | + ); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Front-end display content for popular posts widget. |
150 | 150 | * |
151 | 151 | * @since 1.0.0 |
152 | - * @since 1.5.1 Declare function public. |
|
152 | + * @since 1.5.1 Declare function public. |
|
153 | 153 | * |
154 | 154 | * @param array $args Widget arguments. |
155 | 155 | * @param array $instance Saved values from database. |
156 | 156 | */ |
157 | 157 | public function widget($args, $instance) |
158 | - { |
|
159 | - geodir_popular_postview_output($args, $instance); |
|
160 | - } |
|
158 | + { |
|
159 | + geodir_popular_postview_output($args, $instance); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Sanitize popular posts widget form values as they are saved. |
164 | 164 | * |
165 | 165 | * @since 1.0.0 |
166 | - * @since 1.5.1 Declare function public. |
|
166 | + * @since 1.5.1 Declare function public. |
|
167 | 167 | * |
168 | 168 | * @param array $new_instance Values just sent to be saved. |
169 | 169 | * @param array $old_instance Previously saved values from database. |
@@ -171,102 +171,102 @@ discard block |
||
171 | 171 | * @return array Updated safe values to be saved. |
172 | 172 | */ |
173 | 173 | public function update($new_instance, $old_instance) |
174 | - { |
|
175 | - //save the widget |
|
176 | - $instance = $old_instance; |
|
177 | - |
|
178 | - if ($new_instance['title'] == '') { |
|
179 | - $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | - //$instance['title'] = $title; |
|
181 | - } |
|
182 | - $instance['title'] = strip_tags($new_instance['title']); |
|
183 | - |
|
184 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | - //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | - $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | - $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | - $instance['character_count'] = $new_instance['character_count']; |
|
193 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
194 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | - else |
|
196 | - $instance['add_location_filter'] = '0'; |
|
197 | - |
|
198 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
199 | - $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
200 | - $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
201 | - $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
202 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
203 | - $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0; |
|
204 | - |
|
205 | - return $instance; |
|
206 | - } |
|
174 | + { |
|
175 | + //save the widget |
|
176 | + $instance = $old_instance; |
|
177 | + |
|
178 | + if ($new_instance['title'] == '') { |
|
179 | + $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | + //$instance['title'] = $title; |
|
181 | + } |
|
182 | + $instance['title'] = strip_tags($new_instance['title']); |
|
183 | + |
|
184 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | + //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | + $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | + $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | + $instance['character_count'] = $new_instance['character_count']; |
|
193 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
194 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | + else |
|
196 | + $instance['add_location_filter'] = '0'; |
|
197 | + |
|
198 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
199 | + $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
200 | + $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
201 | + $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
202 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
203 | + $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0; |
|
204 | + |
|
205 | + return $instance; |
|
206 | + } |
|
207 | 207 | |
208 | 208 | /** |
209 | 209 | * Back-end popular posts widget settings form. |
210 | 210 | * |
211 | 211 | * @since 1.0.0 |
212 | - * @since 1.5.1 Declare function public. |
|
212 | + * @since 1.5.1 Declare function public. |
|
213 | 213 | * |
214 | 214 | * @param array $instance Previously saved values from database. |
215 | 215 | */ |
216 | 216 | public function form($instance) |
217 | - { |
|
218 | - //widgetform in backend |
|
219 | - $instance = wp_parse_args((array)$instance, |
|
220 | - array('title' => '', |
|
221 | - 'post_type' => '', |
|
222 | - 'category' => array(), |
|
223 | - 'category_title' => '', |
|
224 | - 'list_sort' => '', |
|
225 | - 'list_order' => '', |
|
226 | - 'post_number' => '5', |
|
227 | - 'layout' => 'gridview_onehalf', |
|
228 | - 'listing_width' => '', |
|
229 | - 'add_location_filter' => '1', |
|
230 | - 'character_count' => '20', |
|
231 | - 'show_featured_only' => '', |
|
232 | - 'show_special_only' => '', |
|
233 | - 'with_pics_only' => '', |
|
234 | - 'with_videos_only' => '', |
|
235 | - 'use_viewing_post_type' => '', |
|
236 | - 'hide_if_empty' => '' |
|
237 | - ) |
|
238 | - ); |
|
217 | + { |
|
218 | + //widgetform in backend |
|
219 | + $instance = wp_parse_args((array)$instance, |
|
220 | + array('title' => '', |
|
221 | + 'post_type' => '', |
|
222 | + 'category' => array(), |
|
223 | + 'category_title' => '', |
|
224 | + 'list_sort' => '', |
|
225 | + 'list_order' => '', |
|
226 | + 'post_number' => '5', |
|
227 | + 'layout' => 'gridview_onehalf', |
|
228 | + 'listing_width' => '', |
|
229 | + 'add_location_filter' => '1', |
|
230 | + 'character_count' => '20', |
|
231 | + 'show_featured_only' => '', |
|
232 | + 'show_special_only' => '', |
|
233 | + 'with_pics_only' => '', |
|
234 | + 'with_videos_only' => '', |
|
235 | + 'use_viewing_post_type' => '', |
|
236 | + 'hide_if_empty' => '' |
|
237 | + ) |
|
238 | + ); |
|
239 | 239 | |
240 | - $title = strip_tags($instance['title']); |
|
240 | + $title = strip_tags($instance['title']); |
|
241 | 241 | |
242 | - $post_type = strip_tags($instance['post_type']); |
|
242 | + $post_type = strip_tags($instance['post_type']); |
|
243 | 243 | |
244 | - $category = $instance['category']; |
|
244 | + $category = $instance['category']; |
|
245 | 245 | |
246 | - $category_title = strip_tags($instance['category_title']); |
|
246 | + $category_title = strip_tags($instance['category_title']); |
|
247 | 247 | |
248 | - $list_sort = strip_tags($instance['list_sort']); |
|
248 | + $list_sort = strip_tags($instance['list_sort']); |
|
249 | 249 | |
250 | - $list_order = strip_tags($instance['list_order']); |
|
250 | + $list_order = strip_tags($instance['list_order']); |
|
251 | 251 | |
252 | - $post_number = strip_tags($instance['post_number']); |
|
252 | + $post_number = strip_tags($instance['post_number']); |
|
253 | 253 | |
254 | - $layout = strip_tags($instance['layout']); |
|
254 | + $layout = strip_tags($instance['layout']); |
|
255 | 255 | |
256 | - $listing_width = strip_tags($instance['listing_width']); |
|
256 | + $listing_width = strip_tags($instance['listing_width']); |
|
257 | 257 | |
258 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
258 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
259 | 259 | |
260 | - $character_count = $instance['character_count']; |
|
260 | + $character_count = $instance['character_count']; |
|
261 | 261 | |
262 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
263 | - $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
264 | - $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
265 | - $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
266 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
267 | - $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false; |
|
262 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
263 | + $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
264 | + $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
265 | + $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
266 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
267 | + $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false; |
|
268 | 268 | |
269 | - ?> |
|
269 | + ?> |
|
270 | 270 | <p> |
271 | 271 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
272 | 272 | <small>(%posttype_singular_label% , |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | <?php foreach ($postypes as $postypes_obj) { ?> |
301 | 301 | |
302 | 302 | <option <?php if ($post_type == $postypes_obj) { |
303 | - echo 'selected="selected"'; |
|
304 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
305 | - echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
303 | + echo 'selected="selected"'; |
|
304 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
305 | + echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
306 | 306 | |
307 | 307 | <?php } ?> |
308 | 308 | |
@@ -317,30 +317,30 @@ discard block |
||
317 | 317 | |
318 | 318 | <?php |
319 | 319 | |
320 | - $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
320 | + $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
321 | 321 | |
322 | - $all_postypes = geodir_get_posttypes(); |
|
322 | + $all_postypes = geodir_get_posttypes(); |
|
323 | 323 | |
324 | - if (!in_array($post_type, $all_postypes)) |
|
325 | - $post_type = 'gd_place'; |
|
324 | + if (!in_array($post_type, $all_postypes)) |
|
325 | + $post_type = 'gd_place'; |
|
326 | 326 | |
327 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
328 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
327 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
328 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
329 | 329 | |
330 | - ?> |
|
330 | + ?> |
|
331 | 331 | |
332 | 332 | <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]" |
333 | 333 | onchange="geodir_popular_widget_cat_title(this)"> |
334 | 334 | |
335 | 335 | <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) { |
336 | - echo 'selected="selected"'; |
|
337 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
336 | + echo 'selected="selected"'; |
|
337 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
338 | 338 | <?php foreach ($categories as $category_obj) { |
339 | - $selected = ''; |
|
340 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
341 | - echo $selected = 'selected="selected"'; |
|
339 | + $selected = ''; |
|
340 | + if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
341 | + echo $selected = 'selected="selected"'; |
|
342 | 342 | |
343 | - ?> |
|
343 | + ?> |
|
344 | 344 | |
345 | 345 | <option <?php echo $selected; ?> |
346 | 346 | value="<?php echo $category_obj->term_id; ?>"><?php echo geodir_utf8_ucfirst($category_obj->name); ?></option> |
@@ -361,32 +361,32 @@ discard block |
||
361 | 361 | <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
362 | 362 | |
363 | 363 | <?php |
364 | - $list_sort_arr = array( |
|
365 | - "az" => __('A-Z', 'geodirectory'), |
|
366 | - "latest" => __('Latest', 'geodirectory'), |
|
367 | - "featured" => __('Featured', 'geodirectory'), |
|
368 | - "high_review" => __('Review', 'geodirectory'), |
|
369 | - "high_rating" => __('Rating', 'geodirectory'), |
|
370 | - "random" => __('Random', 'geodirectory'), |
|
371 | - ); |
|
372 | - |
|
373 | - /** |
|
374 | - * Filter the Popular post view widget sorting options. |
|
375 | - * |
|
376 | - * @since 1.6.22 |
|
377 | - * @param array $list_sort_arr The array of key value pairs of settings. |
|
378 | - * @param array $instance The array of widget settings. |
|
379 | - */ |
|
380 | - $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
381 | - ?> |
|
364 | + $list_sort_arr = array( |
|
365 | + "az" => __('A-Z', 'geodirectory'), |
|
366 | + "latest" => __('Latest', 'geodirectory'), |
|
367 | + "featured" => __('Featured', 'geodirectory'), |
|
368 | + "high_review" => __('Review', 'geodirectory'), |
|
369 | + "high_rating" => __('Rating', 'geodirectory'), |
|
370 | + "random" => __('Random', 'geodirectory'), |
|
371 | + ); |
|
372 | + |
|
373 | + /** |
|
374 | + * Filter the Popular post view widget sorting options. |
|
375 | + * |
|
376 | + * @since 1.6.22 |
|
377 | + * @param array $list_sort_arr The array of key value pairs of settings. |
|
378 | + * @param array $instance The array of widget settings. |
|
379 | + */ |
|
380 | + $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
381 | + ?> |
|
382 | 382 | |
383 | 383 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
384 | 384 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
385 | 385 | <?php |
386 | - foreach($list_sort_arr as $sort_val => $sort_title){ |
|
387 | - echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
388 | - } |
|
389 | - ?> |
|
386 | + foreach($list_sort_arr as $sort_val => $sort_title){ |
|
387 | + echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
388 | + } |
|
389 | + ?> |
|
390 | 390 | </select> |
391 | 391 | </label> |
392 | 392 | </p> |
@@ -408,24 +408,24 @@ discard block |
||
408 | 408 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
409 | 409 | name="<?php echo $this->get_field_name('layout'); ?>"> |
410 | 410 | <option <?php if ($layout == 'gridview_onehalf') { |
411 | - echo 'selected="selected"'; |
|
412 | - } ?> |
|
411 | + echo 'selected="selected"'; |
|
412 | + } ?> |
|
413 | 413 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
414 | 414 | <option <?php if ($layout == 'gridview_onethird') { |
415 | - echo 'selected="selected"'; |
|
416 | - } ?> |
|
415 | + echo 'selected="selected"'; |
|
416 | + } ?> |
|
417 | 417 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
418 | 418 | <option <?php if ($layout == 'gridview_onefourth') { |
419 | - echo 'selected="selected"'; |
|
420 | - } ?> |
|
419 | + echo 'selected="selected"'; |
|
420 | + } ?> |
|
421 | 421 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
422 | 422 | <option <?php if ($layout == 'gridview_onefifth') { |
423 | - echo 'selected="selected"'; |
|
424 | - } ?> |
|
423 | + echo 'selected="selected"'; |
|
424 | + } ?> |
|
425 | 425 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
426 | 426 | <option <?php if ($layout == 'list') { |
427 | - echo 'selected="selected"'; |
|
428 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
427 | + echo 'selected="selected"'; |
|
428 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
429 | 429 | |
430 | 430 | </select> |
431 | 431 | </label> |
@@ -495,8 +495,8 @@ discard block |
||
495 | 495 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
496 | 496 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
497 | 497 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
498 | - echo 'checked="checked"'; |
|
499 | - } ?> value="1"/> |
|
498 | + echo 'checked="checked"'; |
|
499 | + } ?> value="1"/> |
|
500 | 500 | </label> |
501 | 501 | </p> |
502 | 502 | <p> |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | </script> |
545 | 545 | |
546 | 546 | <?php |
547 | - } |
|
547 | + } |
|
548 | 548 | } // class geodir_popular_postview |
549 | 549 | |
550 | 550 | register_widget('geodir_popular_postview'); |
551 | 551 | \ No newline at end of file |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //save the widget |
62 | 62 | $instance = $old_instance; |
63 | 63 | $instance['title'] = strip_tags($new_instance['title']); |
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
64 | + $category_limit = (int) $new_instance['category_limit']; |
|
65 | 65 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
66 | 66 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
67 | 67 | $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | public function form($instance) |
82 | 82 | { |
83 | 83 | //widgetform in backend |
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
84 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | 85 | |
86 | 86 | $title = strip_tags($instance['title']); |
87 | - $category_limit = (int)$instance['category_limit']; |
|
87 | + $category_limit = (int) $instance['category_limit']; |
|
88 | 88 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
89 | 89 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
90 | 90 | $parent_only = !empty($instance['parent_only']) ? true: false; |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | </label> |
98 | 98 | </p> |
99 | 99 | <p> |
100 | - <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?> |
|
100 | + <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?> |
|
101 | 101 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>"> |
102 | 102 | <?php foreach ($post_type_options as $name => $title) { ?> |
103 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
103 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
104 | 104 | <?php } ?> |
105 | 105 | </select> |
106 | 106 | </label> |
107 | 107 | </p> |
108 | 108 | <p> |
109 | 109 | <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?> |
110 | - <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/> |
|
110 | + <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/> |
|
111 | 111 | <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p> |
112 | 112 | </label> |
113 | 113 | </p> |
114 | 114 | <p> |
115 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" /> |
|
116 | - <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
|
115 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" /> |
|
116 | + <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label> |
|
117 | 117 | </p> |
118 | 118 | <?php |
119 | 119 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | public function form($instance) |
217 | 217 | { |
218 | 218 | //widgetform in backend |
219 | - $instance = wp_parse_args((array)$instance, |
|
219 | + $instance = wp_parse_args((array) $instance, |
|
220 | 220 | array('title' => '', |
221 | 221 | 'post_type' => '', |
222 | 222 | 'category' => array(), |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | |
269 | 269 | ?> |
270 | 270 | <p> |
271 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
271 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
272 | 272 | <small>(%posttype_singular_label% , |
273 | - %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>) |
|
273 | + %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>) |
|
274 | 274 | </small> |
275 | 275 | |
276 | 276 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | <p> |
283 | 283 | <label |
284 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
284 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
285 | 285 | |
286 | 286 | <?php $postypes = geodir_get_posttypes(); |
287 | 287 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | <p id="post_type_cats"> |
315 | 315 | <label |
316 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
316 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
317 | 317 | |
318 | 318 | <?php |
319 | 319 | |
@@ -352,13 +352,13 @@ discard block |
||
352 | 352 | |
353 | 353 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
354 | 354 | id="<?php echo $this->get_field_id('category_title'); ?>" |
355 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
355 | + value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/> |
|
356 | 356 | |
357 | 357 | </label> |
358 | 358 | </p> |
359 | 359 | |
360 | 360 | <p> |
361 | - <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
361 | + <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
362 | 362 | |
363 | 363 | <?php |
364 | 364 | $list_sort_arr = array( |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | * @param array $list_sort_arr The array of key value pairs of settings. |
378 | 378 | * @param array $instance The array of widget settings. |
379 | 379 | */ |
380 | - $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance); |
|
380 | + $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort', $list_sort_arr, $instance); |
|
381 | 381 | ?> |
382 | 382 | |
383 | 383 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
384 | 384 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
385 | 385 | <?php |
386 | - foreach($list_sort_arr as $sort_val => $sort_title){ |
|
387 | - echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>"; |
|
386 | + foreach ($list_sort_arr as $sort_val => $sort_title) { |
|
387 | + echo "<option value='$sort_val' ".selected($list_sort, $sort_val)." >$sort_title</option>"; |
|
388 | 388 | } |
389 | 389 | ?> |
390 | 390 | </select> |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | <p> |
395 | 395 | |
396 | 396 | <label |
397 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
397 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
398 | 398 | |
399 | 399 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
400 | 400 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | <p> |
406 | 406 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
407 | - <?php _e('Layout:', 'geodirectory');?> |
|
407 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
408 | 408 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
409 | 409 | name="<?php echo $this->get_field_name('layout'); ?>"> |
410 | 410 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | <p> |
435 | 435 | <label |
436 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
436 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
437 | 437 | |
438 | 438 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
439 | 439 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | |
444 | 444 | <p> |
445 | 445 | <label |
446 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
446 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
447 | 447 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
448 | 448 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
449 | 449 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -452,41 +452,41 @@ discard block |
||
452 | 452 | |
453 | 453 | <p> |
454 | 454 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
455 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
455 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
456 | 456 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
457 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
457 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
458 | 458 | value="1"/> |
459 | 459 | </label> |
460 | 460 | </p> |
461 | 461 | <p> |
462 | 462 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
463 | - <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
|
463 | + <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" |
|
464 | 464 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
465 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
465 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
466 | 466 | value="1"/> |
467 | 467 | </label> |
468 | 468 | </p> |
469 | 469 | <p> |
470 | 470 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
471 | - <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
|
471 | + <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox" |
|
472 | 472 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
473 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
473 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?> |
|
474 | 474 | value="1"/> |
475 | 475 | </label> |
476 | 476 | </p> |
477 | 477 | <p> |
478 | 478 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
479 | - <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
|
479 | + <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox" |
|
480 | 480 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
481 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
481 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?> |
|
482 | 482 | value="1"/> |
483 | 483 | </label> |
484 | 484 | </p> |
485 | 485 | <p> |
486 | 486 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
487 | - <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
|
487 | + <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox" |
|
488 | 488 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
489 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
489 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?> |
|
490 | 490 | value="1"/> |
491 | 491 | </label> |
492 | 492 | </p> |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | } |
538 | 538 | |
539 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
539 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
540 | 540 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
541 | 541 | |
542 | 542 | <?php } ?> |
@@ -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 |
@@ -16,28 +16,28 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function jupiter_action_calls() |
18 | 18 | { |
19 | - // REMOVE BREADCRUMB |
|
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | - |
|
27 | - // REMOVE PAGE TITLES |
|
28 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
29 | - remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
30 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
31 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
32 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
33 | - |
|
34 | - |
|
35 | - // CAHNGE PAGE TITLES |
|
36 | - remove_action('page_title', 'mk_page_title'); |
|
37 | - add_action('page_title', 'gd_mk_page_title'); |
|
38 | - // CHANGE BREADCRUMS FOR GD PAGES |
|
39 | - remove_action('theme_breadcrumbs', 'mk_theme_breadcrumbs'); |
|
40 | - add_action('theme_breadcrumbs', 'gd_mk_theme_breadcrumbs'); |
|
19 | + // REMOVE BREADCRUMB |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | + |
|
27 | + // REMOVE PAGE TITLES |
|
28 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
29 | + remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
30 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
31 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
32 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
33 | + |
|
34 | + |
|
35 | + // CAHNGE PAGE TITLES |
|
36 | + remove_action('page_title', 'mk_page_title'); |
|
37 | + add_action('page_title', 'gd_mk_page_title'); |
|
38 | + // CHANGE BREADCRUMS FOR GD PAGES |
|
39 | + remove_action('theme_breadcrumbs', 'mk_theme_breadcrumbs'); |
|
40 | + add_action('theme_breadcrumbs', 'gd_mk_theme_breadcrumbs'); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | } |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | function gd_mk_theme_breadcrumbs() |
53 | 53 | { |
54 | 54 | |
55 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
56 | - jupiter_geodir_breadcrumb(); |
|
57 | - } elseif (geodir_is_page('listing')) { |
|
58 | - jupiter_geodir_breadcrumb(); |
|
59 | - } elseif (geodir_is_page('detail')) { |
|
60 | - jupiter_geodir_breadcrumb(); |
|
61 | - } elseif (geodir_is_page('search')) { |
|
62 | - jupiter_geodir_breadcrumb(); |
|
63 | - } elseif (geodir_is_page('author')) { |
|
64 | - jupiter_geodir_breadcrumb(); |
|
65 | - } else { |
|
66 | - mk_theme_breadcrumbs(); |
|
67 | - } |
|
55 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
56 | + jupiter_geodir_breadcrumb(); |
|
57 | + } elseif (geodir_is_page('listing')) { |
|
58 | + jupiter_geodir_breadcrumb(); |
|
59 | + } elseif (geodir_is_page('detail')) { |
|
60 | + jupiter_geodir_breadcrumb(); |
|
61 | + } elseif (geodir_is_page('search')) { |
|
62 | + jupiter_geodir_breadcrumb(); |
|
63 | + } elseif (geodir_is_page('author')) { |
|
64 | + jupiter_geodir_breadcrumb(); |
|
65 | + } else { |
|
66 | + mk_theme_breadcrumbs(); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -76,35 +76,35 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function gd_mk_page_title() |
78 | 78 | { |
79 | - global $wp; |
|
80 | - |
|
81 | - |
|
82 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
83 | - jupiter_geodir_page_title(); |
|
84 | - } elseif (geodir_is_page('listing')) { |
|
85 | - ob_start(); // Start buffering; |
|
86 | - geodir_action_listings_title(); |
|
87 | - $gd_title = ob_get_clean(); |
|
88 | - $title_p = explode('">', $gd_title); |
|
89 | - $title = str_replace('</h1></header>', "", $title_p[2]); |
|
90 | - jupiter_geodir_page_title($title); |
|
91 | - } elseif (geodir_is_page('search')) { |
|
92 | - ob_start(); // Start buffering; |
|
93 | - geodir_action_listings_title(); |
|
94 | - $gd_title = ob_get_clean(); |
|
95 | - $title_p = explode('">', $gd_title); |
|
96 | - $title = str_replace('</h1></header>', "", $title_p[2]); |
|
97 | - jupiter_geodir_page_title($title); |
|
98 | - } elseif (geodir_is_page('author')) { |
|
99 | - ob_start(); // Start buffering; |
|
100 | - geodir_action_author_page_title(); |
|
101 | - $gd_title = ob_get_clean(); |
|
102 | - $gd_title = str_replace('<h1>', "", $gd_title); |
|
103 | - $gd_title = str_replace('</h1>', "", $gd_title); |
|
104 | - jupiter_geodir_page_title($gd_title); |
|
105 | - } else { |
|
106 | - mk_page_title(); |
|
107 | - } |
|
79 | + global $wp; |
|
80 | + |
|
81 | + |
|
82 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
83 | + jupiter_geodir_page_title(); |
|
84 | + } elseif (geodir_is_page('listing')) { |
|
85 | + ob_start(); // Start buffering; |
|
86 | + geodir_action_listings_title(); |
|
87 | + $gd_title = ob_get_clean(); |
|
88 | + $title_p = explode('">', $gd_title); |
|
89 | + $title = str_replace('</h1></header>', "", $title_p[2]); |
|
90 | + jupiter_geodir_page_title($title); |
|
91 | + } elseif (geodir_is_page('search')) { |
|
92 | + ob_start(); // Start buffering; |
|
93 | + geodir_action_listings_title(); |
|
94 | + $gd_title = ob_get_clean(); |
|
95 | + $title_p = explode('">', $gd_title); |
|
96 | + $title = str_replace('</h1></header>', "", $title_p[2]); |
|
97 | + jupiter_geodir_page_title($title); |
|
98 | + } elseif (geodir_is_page('author')) { |
|
99 | + ob_start(); // Start buffering; |
|
100 | + geodir_action_author_page_title(); |
|
101 | + $gd_title = ob_get_clean(); |
|
102 | + $gd_title = str_replace('<h1>', "", $gd_title); |
|
103 | + $gd_title = str_replace('</h1>', "", $gd_title); |
|
104 | + jupiter_geodir_page_title($gd_title); |
|
105 | + } else { |
|
106 | + mk_page_title(); |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | 110 | } |
@@ -119,48 +119,48 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function jupiter_geodir_breadcrumb() |
121 | 121 | { |
122 | - $item = ''; |
|
123 | - ob_start(); // Start buffering; |
|
124 | - geodir_breadcrumb(); |
|
125 | - $gd_crums = ob_get_clean(); |
|
126 | - if ($gd_crums) { |
|
127 | - $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); |
|
128 | - $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); |
|
129 | - $gd_crums = str_replace(' > ', " > ", $gd_crums); |
|
130 | - $gd_crums = str_replace('</li><li>', "", $gd_crums); |
|
131 | - $gd_crums = explode(" > ", $gd_crums); |
|
132 | - $trail_end = array_pop($gd_crums); |
|
133 | - $gd_crums['trail_end'] = $trail_end; |
|
134 | - //print_r($gd_crums);exit; |
|
135 | - //print_r($trail); |
|
136 | - $item = $gd_crums; |
|
137 | - |
|
138 | - } |
|
139 | - if (!$item) { |
|
140 | - return; |
|
141 | - } |
|
142 | - global $mk_options, $post; |
|
143 | - $post_id = global_get_post_id(); |
|
144 | - |
|
145 | - if ($post_id) { |
|
146 | - $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); |
|
147 | - $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); |
|
148 | - if ($local_skining == 'true' && !empty($breadcrumb_skin)) { |
|
149 | - $breadcrumb_skin_class = $breadcrumb_skin; |
|
150 | - } else { |
|
151 | - $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
152 | - } |
|
153 | - } else { |
|
154 | - $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - $delimiter = ' / '; |
|
159 | - |
|
160 | - echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
161 | - |
|
162 | - echo implode($delimiter, $item); |
|
163 | - echo "</div></div>"; |
|
122 | + $item = ''; |
|
123 | + ob_start(); // Start buffering; |
|
124 | + geodir_breadcrumb(); |
|
125 | + $gd_crums = ob_get_clean(); |
|
126 | + if ($gd_crums) { |
|
127 | + $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); |
|
128 | + $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); |
|
129 | + $gd_crums = str_replace(' > ', " > ", $gd_crums); |
|
130 | + $gd_crums = str_replace('</li><li>', "", $gd_crums); |
|
131 | + $gd_crums = explode(" > ", $gd_crums); |
|
132 | + $trail_end = array_pop($gd_crums); |
|
133 | + $gd_crums['trail_end'] = $trail_end; |
|
134 | + //print_r($gd_crums);exit; |
|
135 | + //print_r($trail); |
|
136 | + $item = $gd_crums; |
|
137 | + |
|
138 | + } |
|
139 | + if (!$item) { |
|
140 | + return; |
|
141 | + } |
|
142 | + global $mk_options, $post; |
|
143 | + $post_id = global_get_post_id(); |
|
144 | + |
|
145 | + if ($post_id) { |
|
146 | + $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); |
|
147 | + $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); |
|
148 | + if ($local_skining == 'true' && !empty($breadcrumb_skin)) { |
|
149 | + $breadcrumb_skin_class = $breadcrumb_skin; |
|
150 | + } else { |
|
151 | + $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
152 | + } |
|
153 | + } else { |
|
154 | + $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + $delimiter = ' / '; |
|
159 | + |
|
160 | + echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
161 | + |
|
162 | + echo implode($delimiter, $item); |
|
163 | + echo "</div></div>"; |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
@@ -174,41 +174,41 @@ discard block |
||
174 | 174 | */ |
175 | 175 | function jupiter_geodir_page_title($title = '', $subtitle = '') |
176 | 176 | { |
177 | - global $mk_options; |
|
178 | - |
|
179 | - $post_id = global_get_post_id(); |
|
180 | - $shadow_css = ''; |
|
181 | - if ($mk_options['page_title_shadow'] == 'true') { |
|
182 | - $shadow_css = 'mk-drop-shadow'; |
|
183 | - } |
|
184 | - |
|
185 | - $align = !empty($align) ? $align : 'left'; |
|
186 | - |
|
187 | - //$title = 'xxxx'; |
|
188 | - echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
189 | - echo '<div class="mk-grid">'; |
|
190 | - if (!empty($title)) { |
|
191 | - echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
192 | - |
|
193 | - } |
|
194 | - |
|
195 | - if (!empty($subtitle)) { |
|
196 | - echo '<div class="page-introduce-subtitle">'; |
|
197 | - echo $subtitle; |
|
198 | - echo '</div>'; |
|
199 | - } |
|
200 | - if ($mk_options['disable_breadcrumb'] == 'true') { |
|
201 | - if (get_post_meta($post_id, '_disable_breadcrumb', true) != 'false') { |
|
202 | - /** |
|
203 | - * Calls the theme breadcrumbs for Jupiter theme. |
|
204 | - * |
|
205 | - * @since 1.4.0 |
|
206 | - */ |
|
207 | - do_action('theme_breadcrumbs', $post_id); |
|
208 | - } |
|
209 | - } |
|
210 | - |
|
211 | - echo '<div class="clearboth"></div></div></section>'; |
|
177 | + global $mk_options; |
|
178 | + |
|
179 | + $post_id = global_get_post_id(); |
|
180 | + $shadow_css = ''; |
|
181 | + if ($mk_options['page_title_shadow'] == 'true') { |
|
182 | + $shadow_css = 'mk-drop-shadow'; |
|
183 | + } |
|
184 | + |
|
185 | + $align = !empty($align) ? $align : 'left'; |
|
186 | + |
|
187 | + //$title = 'xxxx'; |
|
188 | + echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
189 | + echo '<div class="mk-grid">'; |
|
190 | + if (!empty($title)) { |
|
191 | + echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
192 | + |
|
193 | + } |
|
194 | + |
|
195 | + if (!empty($subtitle)) { |
|
196 | + echo '<div class="page-introduce-subtitle">'; |
|
197 | + echo $subtitle; |
|
198 | + echo '</div>'; |
|
199 | + } |
|
200 | + if ($mk_options['disable_breadcrumb'] == 'true') { |
|
201 | + if (get_post_meta($post_id, '_disable_breadcrumb', true) != 'false') { |
|
202 | + /** |
|
203 | + * Calls the theme breadcrumbs for Jupiter theme. |
|
204 | + * |
|
205 | + * @since 1.4.0 |
|
206 | + */ |
|
207 | + do_action('theme_breadcrumbs', $post_id); |
|
208 | + } |
|
209 | + } |
|
210 | + |
|
211 | + echo '<div class="clearboth"></div></div></section>'; |
|
212 | 212 | |
213 | 213 | |
214 | 214 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $delimiter = ' / '; |
159 | 159 | |
160 | - echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
160 | + echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner '.$breadcrumb_skin_class.'-skin">'; |
|
161 | 161 | |
162 | 162 | echo implode($delimiter, $item); |
163 | 163 | echo "</div></div>"; |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | $align = !empty($align) ? $align : 'left'; |
186 | 186 | |
187 | 187 | //$title = 'xxxx'; |
188 | - echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
188 | + echo '<section id="mk-page-introduce" class="intro-'.$align.'">'; |
|
189 | 189 | echo '<div class="mk-grid">'; |
190 | 190 | if (!empty($title)) { |
191 | - echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
191 | + echo '<h1 class="page-introduce-title '.$shadow_css.'">'.$title.'</h1>'; |
|
192 | 192 | |
193 | 193 | } |
194 | 194 |
@@ -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(); |
@@ -198,7 +198,9 @@ discard block |
||
198 | 198 | $mapview = $maptype; |
199 | 199 | } |
200 | 200 | |
201 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
201 | + if (empty($mapzoom)) { |
|
202 | + $mapzoom = $zoom; |
|
203 | + } |
|
202 | 204 | |
203 | 205 | // Set default map options |
204 | 206 | $map_args['ajax_url'] = geodir_get_ajax_url(); |
@@ -326,8 +328,9 @@ discard block |
||
326 | 328 | |
327 | 329 | foreach ($map_zoom_level as $level) { |
328 | 330 | $selected = ''; |
329 | - if ($level == $zoom) |
|
330 | - $selected = 'selected="selected"'; |
|
331 | + if ($level == $zoom) { |
|
332 | + $selected = 'selected="selected"'; |
|
333 | + } |
|
331 | 334 | |
332 | 335 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
333 | 336 |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function init_listing_map_script() |
20 | 20 | { |
21 | - global $list_map_json; |
|
21 | + global $list_map_json; |
|
22 | 22 | |
23 | - $list_map_json = array(); |
|
23 | + $list_map_json = array(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function create_list_jsondata($post) |
37 | 37 | { |
38 | - global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | - |
|
40 | - if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | - /** |
|
42 | - * Filter the json data for search listing map. |
|
43 | - * |
|
44 | - * @since 1.5.7 |
|
45 | - * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | - * @param object $post The post object. |
|
47 | - */ |
|
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | - } |
|
38 | + global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | + |
|
40 | + if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | + /** |
|
42 | + * Filter the json data for search listing map. |
|
43 | + * |
|
44 | + * @since 1.5.7 |
|
45 | + * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | + * @param object $post The post object. |
|
47 | + */ |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,29 +59,29 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function show_listing_widget_map() |
61 | 61 | { |
62 | - global $list_map_json; |
|
62 | + global $list_map_json; |
|
63 | 63 | |
64 | - if (!empty($list_map_json)) { |
|
65 | - $list_map_json = array_unique($list_map_json); |
|
66 | - $cat_content_info[] = implode(',', $list_map_json); |
|
67 | - } |
|
64 | + if (!empty($list_map_json)) { |
|
65 | + $list_map_json = array_unique($list_map_json); |
|
66 | + $cat_content_info[] = implode(',', $list_map_json); |
|
67 | + } |
|
68 | 68 | |
69 | - $totalcount = count(array_unique($list_map_json)); |
|
69 | + $totalcount = count(array_unique($list_map_json)); |
|
70 | 70 | |
71 | 71 | |
72 | - if (!empty($cat_content_info)) { |
|
73 | - $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | - } else { |
|
78 | - $list_json = '[{"totalcount":"0"}]'; |
|
79 | - } |
|
72 | + if (!empty($cat_content_info)) { |
|
73 | + $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | + $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | + } else { |
|
78 | + $list_json = '[{"totalcount":"0"}]'; |
|
79 | + } |
|
80 | 80 | |
81 | - $listing_map_args = array('list_json' => $list_json); |
|
81 | + $listing_map_args = array('list_json' => $list_json); |
|
82 | 82 | |
83 | - // Pass the json data in listing map script |
|
84 | - wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
83 | + // Pass the json data in listing map script |
|
84 | + wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -93,196 +93,196 @@ discard block |
||
93 | 93 | class geodir_map_listingpage extends WP_Widget |
94 | 94 | { |
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * Register the listing page map widget. |
98 | 98 | * |
99 | 99 | * @since 1.0.0 |
100 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
100 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
101 | 101 | */ |
102 | - public function __construct() { |
|
103 | - $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | - parent::__construct( |
|
105 | - 'geodir_map_v3_listing_map', // Base ID |
|
106 | - __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | - $widget_ops// Args |
|
108 | - ); |
|
102 | + public function __construct() { |
|
103 | + $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | + parent::__construct( |
|
105 | + 'geodir_map_v3_listing_map', // Base ID |
|
106 | + __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | + $widget_ops// Args |
|
108 | + ); |
|
109 | 109 | |
110 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
110 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
111 | 111 | |
112 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
112 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
113 | 113 | |
114 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | - } |
|
114 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | + } |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Front-end display content for listing page map widget. |
119 | 119 | * |
120 | 120 | * @since 1.0.0 |
121 | - * @since 1.5.1 Declare function public. |
|
121 | + * @since 1.5.1 Declare function public. |
|
122 | + * |
|
123 | + * @global object $post The current post object. |
|
122 | 124 | * |
123 | - * @global object $post The current post object. |
|
124 | - * |
|
125 | 125 | * @param array $args Widget arguments. |
126 | 126 | * @param array $instance Saved values from database. |
127 | 127 | */ |
128 | - public function widget($args, $instance) |
|
129 | - { |
|
130 | - |
|
131 | - if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | - || geodir_is_page('detail') |
|
133 | - ) : |
|
134 | - |
|
135 | - extract($args, EXTR_SKIP); |
|
136 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | - $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | - $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | - /** |
|
147 | - * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | - * |
|
149 | - * @since 1.0.0 |
|
150 | - * @param bool $sticky True if should be sticky, false if not |
|
151 | - */ |
|
152 | - $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | - $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
128 | + public function widget($args, $instance) |
|
129 | + { |
|
130 | + |
|
131 | + if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | + || geodir_is_page('detail') |
|
133 | + ) : |
|
134 | + |
|
135 | + extract($args, EXTR_SKIP); |
|
136 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | + $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | + $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | + /** |
|
147 | + * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | + * |
|
149 | + * @since 1.0.0 |
|
150 | + * @param bool $sticky True if should be sticky, false if not |
|
151 | + */ |
|
152 | + $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | + $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
156 | 156 | |
157 | 157 | /** |
158 | - * Filter the listing map should to be displayed or not. |
|
159 | - * |
|
160 | - * @since 1.4.6 |
|
158 | + * Filter the listing map should to be displayed or not. |
|
159 | + * |
|
160 | + * @since 1.4.6 |
|
161 | 161 | * |
162 | - * @param bool $display true if map should be displayed, false if not. |
|
163 | - */ |
|
162 | + * @param bool $display true if map should be displayed, false if not. |
|
163 | + */ |
|
164 | 164 | $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
165 | 165 | if ( !$show_map ) { |
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - $map_args = array(); |
|
170 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | - $map_args['width'] = $width; |
|
172 | - $map_args['height'] = $height; |
|
173 | - |
|
174 | - $map_args['scrollwheel'] = $scrollwheel; |
|
175 | - $map_args['showall'] = $showall; |
|
176 | - $map_args['child_collapse'] = '0'; |
|
177 | - $map_args['sticky'] = $sticky; |
|
178 | - $map_args['enable_cat_filters'] = false; |
|
179 | - $map_args['enable_text_search'] = false; |
|
180 | - $map_args['enable_post_type_filters'] = false; |
|
181 | - $map_args['enable_location_filters'] = false; |
|
182 | - $map_args['enable_jason_on_load'] = true; |
|
169 | + $map_args = array(); |
|
170 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | + $map_args['width'] = $width; |
|
172 | + $map_args['height'] = $height; |
|
173 | + |
|
174 | + $map_args['scrollwheel'] = $scrollwheel; |
|
175 | + $map_args['showall'] = $showall; |
|
176 | + $map_args['child_collapse'] = '0'; |
|
177 | + $map_args['sticky'] = $sticky; |
|
178 | + $map_args['enable_cat_filters'] = false; |
|
179 | + $map_args['enable_text_search'] = false; |
|
180 | + $map_args['enable_post_type_filters'] = false; |
|
181 | + $map_args['enable_location_filters'] = false; |
|
182 | + $map_args['enable_jason_on_load'] = true; |
|
183 | 183 | |
184 | - if (is_single()) { |
|
185 | - |
|
186 | - global $post; |
|
187 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | - $mapview = $post->post_mapview; |
|
190 | - $mapzoom = $post->post_mapzoom; |
|
191 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
192 | - |
|
193 | - } else { |
|
194 | - $default_location = geodir_get_default_location(); |
|
195 | - |
|
196 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | - $mapview = $maptype; |
|
200 | - } |
|
201 | - |
|
202 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
203 | - |
|
204 | - // Set default map options |
|
205 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
206 | - $map_args['latitude'] = $map_default_lat; |
|
207 | - $map_args['longitude'] = $map_default_lng; |
|
208 | - $map_args['zoom'] = $zoom; |
|
209 | - //$map_args['scrollwheel'] = true; |
|
210 | - $map_args['scrollwheel'] = $scrollwheel; |
|
211 | - $map_args['showall'] = $showall; |
|
212 | - $map_args['streetViewControl'] = true; |
|
213 | - $map_args['maptype'] = $maptype; |
|
214 | - $map_args['showPreview'] = '0'; |
|
215 | - $map_args['maxZoom'] = 21; |
|
216 | - $map_args['autozoom'] = $autozoom; |
|
217 | - $map_args['bubble_size'] = 'small'; |
|
218 | - |
|
219 | - $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
184 | + if (is_single()) { |
|
185 | + |
|
186 | + global $post; |
|
187 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | + $mapview = $post->post_mapview; |
|
190 | + $mapzoom = $post->post_mapzoom; |
|
191 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
192 | + |
|
193 | + } else { |
|
194 | + $default_location = geodir_get_default_location(); |
|
195 | + |
|
196 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | + $mapview = $maptype; |
|
200 | + } |
|
220 | 201 | |
221 | - // on near search change default location to searched place |
|
222 | - if(isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search']=='1'){ |
|
223 | - if(isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon']) && is_float(floatval($_REQUEST['sgeo_lat'])) && is_float(floatval($_REQUEST['sgeo_lon'])) ){ |
|
224 | - $map_args['latitude'] = sanitize_text_field(floatval($_REQUEST['sgeo_lat'])); |
|
225 | - $map_args['longitude'] = sanitize_text_field(floatval($_REQUEST['sgeo_lon'])); |
|
226 | - } |
|
227 | - } |
|
202 | + if (empty($mapzoom)) $mapzoom = $zoom; |
|
203 | + |
|
204 | + // Set default map options |
|
205 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
206 | + $map_args['latitude'] = $map_default_lat; |
|
207 | + $map_args['longitude'] = $map_default_lng; |
|
208 | + $map_args['zoom'] = $zoom; |
|
209 | + //$map_args['scrollwheel'] = true; |
|
210 | + $map_args['scrollwheel'] = $scrollwheel; |
|
211 | + $map_args['showall'] = $showall; |
|
212 | + $map_args['streetViewControl'] = true; |
|
213 | + $map_args['maptype'] = $maptype; |
|
214 | + $map_args['showPreview'] = '0'; |
|
215 | + $map_args['maxZoom'] = 21; |
|
216 | + $map_args['autozoom'] = $autozoom; |
|
217 | + $map_args['bubble_size'] = 'small'; |
|
218 | + |
|
219 | + $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
220 | + |
|
221 | + // on near search change default location to searched place |
|
222 | + if(isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search']=='1'){ |
|
223 | + if(isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon']) && is_float(floatval($_REQUEST['sgeo_lat'])) && is_float(floatval($_REQUEST['sgeo_lon'])) ){ |
|
224 | + $map_args['latitude'] = sanitize_text_field(floatval($_REQUEST['sgeo_lat'])); |
|
225 | + $map_args['longitude'] = sanitize_text_field(floatval($_REQUEST['sgeo_lon'])); |
|
226 | + } |
|
227 | + } |
|
228 | 228 | |
229 | 229 | |
230 | - echo $before_widget; |
|
231 | - geodir_draw_map($map_args); |
|
232 | - echo $after_widget; |
|
230 | + echo $before_widget; |
|
231 | + geodir_draw_map($map_args); |
|
232 | + echo $after_widget; |
|
233 | 233 | |
234 | - endif; |
|
235 | - } |
|
234 | + endif; |
|
235 | + } |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Sanitize listing page map widget form values as they are saved. |
239 | 239 | * |
240 | 240 | * @since 1.0.0 |
241 | - * @since 1.5.1 Declare function public. |
|
241 | + * @since 1.5.1 Declare function public. |
|
242 | 242 | * |
243 | 243 | * @param array $new_instance Values just sent to be saved. |
244 | 244 | * @param array $old_instance Previously saved values from database. |
245 | 245 | * |
246 | 246 | * @return array Updated safe values to be saved. |
247 | 247 | */ |
248 | - public function update($new_instance, $old_instance) { |
|
249 | - //save the widget |
|
250 | - $instance = $old_instance; |
|
251 | - $instance['width'] = strip_tags($new_instance['width']); |
|
252 | - $instance['heigh'] = ($new_instance['heigh']); |
|
253 | - $instance['maptype'] = ($new_instance['maptype']); |
|
254 | - $instance['zoom'] = ($new_instance['zoom']); |
|
255 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
256 | - $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
257 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
258 | - $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
259 | - $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
260 | - |
|
261 | - return $instance; |
|
262 | - } |
|
248 | + public function update($new_instance, $old_instance) { |
|
249 | + //save the widget |
|
250 | + $instance = $old_instance; |
|
251 | + $instance['width'] = strip_tags($new_instance['width']); |
|
252 | + $instance['heigh'] = ($new_instance['heigh']); |
|
253 | + $instance['maptype'] = ($new_instance['maptype']); |
|
254 | + $instance['zoom'] = ($new_instance['zoom']); |
|
255 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
256 | + $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
257 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
258 | + $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
259 | + $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
260 | + |
|
261 | + return $instance; |
|
262 | + } |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * Back-end listing page map widget settings form. |
266 | 266 | * |
267 | 267 | * @since 1.0.0 |
268 | - * @since 1.5.1 Declare function public. |
|
268 | + * @since 1.5.1 Declare function public. |
|
269 | 269 | * |
270 | 270 | * @param array $instance Previously saved values from database. |
271 | 271 | */ |
272 | - public function form($instance) { |
|
273 | - // widget form in backend |
|
274 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
272 | + public function form($instance) { |
|
273 | + // widget form in backend |
|
274 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
275 | 275 | |
276 | - $width = strip_tags($instance['width']); |
|
277 | - $heigh = strip_tags($instance['heigh']); |
|
278 | - $maptype = strip_tags($instance['maptype']); |
|
279 | - $zoom = strip_tags($instance['zoom']); |
|
280 | - $autozoom = strip_tags($instance['autozoom']); |
|
281 | - $sticky = strip_tags($instance['sticky']); |
|
282 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
283 | - $showall = strip_tags($instance['showall']); |
|
284 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
285 | - ?> |
|
276 | + $width = strip_tags($instance['width']); |
|
277 | + $heigh = strip_tags($instance['heigh']); |
|
278 | + $maptype = strip_tags($instance['maptype']); |
|
279 | + $zoom = strip_tags($instance['zoom']); |
|
280 | + $autozoom = strip_tags($instance['autozoom']); |
|
281 | + $sticky = strip_tags($instance['sticky']); |
|
282 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
283 | + $showall = strip_tags($instance['showall']); |
|
284 | + $marker_cluster = (int)$instance['marker_cluster']; |
|
285 | + ?> |
|
286 | 286 | <p> |
287 | 287 | <label |
288 | 288 | for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?> |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | name="<?php echo $this->get_field_name('maptype'); ?>"> |
312 | 312 | |
313 | 313 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') { |
314 | - echo 'selected="selected"'; |
|
315 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
314 | + echo 'selected="selected"'; |
|
315 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
316 | 316 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') { |
317 | - echo 'selected="selected"'; |
|
318 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
317 | + echo 'selected="selected"'; |
|
318 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
319 | 319 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
320 | - echo 'selected="selected"'; |
|
321 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
320 | + echo 'selected="selected"'; |
|
321 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
322 | 322 | <option <?php selected($maptype, 'TERRAIN');?> |
323 | 323 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
324 | 324 | </select> |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | </p> |
327 | 327 | |
328 | 328 | <?php |
329 | - $map_zoom_level = geodir_map_zoom_level(); |
|
330 | - ?> |
|
329 | + $map_zoom_level = geodir_map_zoom_level(); |
|
330 | + ?> |
|
331 | 331 | |
332 | 332 | <p> |
333 | 333 | <label |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>" |
338 | 338 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php |
339 | 339 | |
340 | - foreach ($map_zoom_level as $level) { |
|
341 | - $selected = ''; |
|
342 | - if ($level == $zoom) |
|
343 | - $selected = 'selected="selected"'; |
|
340 | + foreach ($map_zoom_level as $level) { |
|
341 | + $selected = ''; |
|
342 | + if ($level == $zoom) |
|
343 | + $selected = 'selected="selected"'; |
|
344 | 344 | |
345 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
345 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
346 | 346 | |
347 | - } ?> |
|
347 | + } ?> |
|
348 | 348 | |
349 | 349 | </select> |
350 | 350 | |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | for="<?php echo $this->get_field_id('autozoom'); ?>"> |
357 | 357 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>" |
358 | 358 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) { |
359 | - echo 'checked="checked"'; |
|
360 | - } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
359 | + echo 'checked="checked"'; |
|
360 | + } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
361 | 361 | </p> |
362 | 362 | |
363 | 363 | <p> |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | for="<?php echo $this->get_field_id('sticky'); ?>"> |
366 | 366 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>" |
367 | 367 | name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) { |
368 | - echo 'checked="checked"'; |
|
369 | - } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
368 | + echo 'checked="checked"'; |
|
369 | + } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
370 | 370 | </label> |
371 | 371 | </p> |
372 | 372 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | </p> --> |
393 | 393 | |
394 | 394 | <?php |
395 | - } |
|
395 | + } |
|
396 | 396 | } // class geodir_map_listingpage |
397 | 397 | |
398 | 398 | register_widget('geodir_map_listingpage'); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $post->marker_json JSON representation of the post marker info. |
46 | 46 | * @param object $post The post object. |
47 | 47 | */ |
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $json_content = substr(implode(',', $cat_content_info), 1); |
74 | 74 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
75 | 75 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
76 | + $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']'; |
|
77 | 77 | } else { |
78 | 78 | $list_json = '[{"totalcount":"0"}]'; |
79 | 79 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @param bool $display true if map should be displayed, false if not. |
163 | 163 | */ |
164 | - $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
|
165 | - if ( !$show_map ) { |
|
164 | + $show_map = apply_filters('geodir_show_map_listing', $display = true); |
|
165 | + if (!$show_map) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
220 | 220 | |
221 | 221 | // on near search change default location to searched place |
222 | - if(isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search']=='1'){ |
|
223 | - if(isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon']) && is_float(floatval($_REQUEST['sgeo_lat'])) && is_float(floatval($_REQUEST['sgeo_lon'])) ){ |
|
222 | + if (isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] == '1') { |
|
223 | + if (isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon']) && is_float(floatval($_REQUEST['sgeo_lat'])) && is_float(floatval($_REQUEST['sgeo_lon']))) { |
|
224 | 224 | $map_args['latitude'] = sanitize_text_field(floatval($_REQUEST['sgeo_lat'])); |
225 | 225 | $map_args['longitude'] = sanitize_text_field(floatval($_REQUEST['sgeo_lon'])); |
226 | 226 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function form($instance) { |
273 | 273 | // widget form in backend |
274 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
274 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
275 | 275 | |
276 | 276 | $width = strip_tags($instance['width']); |
277 | 277 | $heigh = strip_tags($instance['heigh']); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $sticky = strip_tags($instance['sticky']); |
282 | 282 | $scrollwheel = strip_tags($instance['scrollwheel']); |
283 | 283 | $showall = strip_tags($instance['showall']); |
284 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
284 | + $marker_cluster = (int) $instance['marker_cluster']; |
|
285 | 285 | ?> |
286 | 286 | <p> |
287 | 287 | <label |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
320 | 320 | echo 'selected="selected"'; |
321 | 321 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
322 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
322 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
323 | 323 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
324 | 324 | </select> |
325 | 325 | </label> |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | if ($level == $zoom) |
343 | 343 | $selected = 'selected="selected"'; |
344 | 344 | |
345 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
345 | + echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>'; |
|
346 | 346 | |
347 | 347 | } ?> |
348 | 348 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | for="<?php echo $this->get_field_id('scrollwheel'); ?>"> |
376 | 376 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>" |
377 | 377 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1" |
378 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
378 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
379 | 379 | </label> |
380 | 380 | </p> |
381 | 381 | <?php if (defined('GDCLUSTER_VERSION')) { ?> |
@@ -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. |
@@ -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()); |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | } else { |
195 | 195 | $uom = __('meters', 'geodirectory'); |
196 | 196 | } |
197 | - echo round($distance) . ' ' . $uom . '<br />'; |
|
197 | + echo round($distance).' '.$uom.'<br />'; |
|
198 | 198 | } else { |
199 | 199 | if ($uom == 'miles') { |
200 | 200 | $uom = __('miles', 'geodirectory'); |
201 | 201 | } else { |
202 | 202 | $uom = __('km', 'geodirectory'); |
203 | 203 | } |
204 | - echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
204 | + echo round($distance, 2).' '.$uom.'<br />'; |
|
205 | 205 | } |
206 | 206 | ?> |
207 | 207 | </h3> |
@@ -231,13 +231,13 @@ discard block |
||
231 | 231 | */ |
232 | 232 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
233 | 233 | if ($show_listing_excerpt) { |
234 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
235 | - $content_out = geodir_max_excerpt( $character_count ); |
|
234 | + if (isset($character_count) && ($character_count || $character_count == '0')) { |
|
235 | + $content_out = geodir_max_excerpt($character_count); |
|
236 | 236 | } else { |
237 | 237 | $content_out = get_the_excerpt(); |
238 | 238 | } |
239 | - if ( ! empty( $content_out ) ) { |
|
240 | - echo "<p>" . $content_out . "</p>"; |
|
239 | + if (!empty($content_out)) { |
|
240 | + echo "<p>".$content_out."</p>"; |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | ?></div> |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @param object $post The post object. |
262 | 262 | * @param string $view The view type, default 'listing'. |
263 | 263 | */ |
264 | - do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
264 | + do_action('geodir_after_listing_content', $post, 'listing'); ?> |
|
265 | 265 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>"> |
266 | 266 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>"> |
267 | 267 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @param object $post The post object. |
274 | 274 | * @param string $view The view type, default 'listing'. |
275 | 275 | */ |
276 | - do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
276 | + do_action('geodir_before_review_html', $post, 'listing'); |
|
277 | 277 | |
278 | 278 | $review_show = geodir_is_reviews_show('listview'); |
279 | 279 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @since 1.0.0 |
318 | 318 | */ |
319 | - do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
319 | + do_action('geodir_after_favorite_html', $post->ID, 'listing'); |
|
320 | 320 | |
321 | 321 | |
322 | 322 | /** |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @param int $post->ID The post id. |
328 | 328 | * @param object $post The post object. |
329 | 329 | */ |
330 | - do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
330 | + do_action('geodir_listing_after_pinpoint', $post->ID, $post); |
|
331 | 331 | |
332 | 332 | if ($post->post_author == get_current_user_id()) { ?> |
333 | 333 | <?php |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
357 | 357 | <?php |
358 | 358 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
359 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
359 | + echo '<i class="'.$geodir_listing_edit_icon.'"></i>'; |
|
360 | 360 | ?> |
361 | 361 | <?php _e('Edit', 'geodirectory'); ?> |
362 | 362 | </a> |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
365 | 365 | <?php |
366 | 366 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
367 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
367 | + echo '<i class="'.$geodir_listing_delete_icon.'"></i>'; |
|
368 | 368 | ?> |
369 | 369 | <?php _e('Delete', 'geodirectory'); ?> |
370 | 370 | </a> |
@@ -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"><h3 class="geodir-entry-title"> |
156 | 156 | <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> |
@@ -162,226 +162,226 @@ 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) { |
|
177 | - |
|
178 | - if ($related_nearest) { |
|
179 | - $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
180 | - } else { |
|
181 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
182 | - } |
|
183 | - |
|
184 | - $endLat = $post->post_latitude; |
|
185 | - $endLon = $post->post_longitude; |
|
186 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
187 | - $uom = get_option('geodir_search_dist_1'); |
|
188 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?> |
|
176 | + if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || $related_nearest) { |
|
177 | + |
|
178 | + if ($related_nearest) { |
|
179 | + $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
180 | + } else { |
|
181 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
182 | + } |
|
183 | + |
|
184 | + $endLat = $post->post_latitude; |
|
185 | + $endLon = $post->post_longitude; |
|
186 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
187 | + $uom = get_option('geodir_search_dist_1'); |
|
188 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?> |
|
189 | 189 | <h3> |
190 | 190 | <?php |
191 | 191 | |
192 | - if (round($distance, 2) == 0) { |
|
193 | - $uom = get_option('geodir_search_dist_2'); |
|
194 | - |
|
195 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
196 | - if ($uom == 'feet') { |
|
197 | - $uom = __('feet', 'geodirectory'); |
|
198 | - } else { |
|
199 | - $uom = __('meters', 'geodirectory'); |
|
200 | - } |
|
201 | - echo round($distance) . ' ' . $uom . '<br />'; |
|
202 | - } else { |
|
203 | - if ($uom == 'miles') { |
|
204 | - $uom = __('miles', 'geodirectory'); |
|
205 | - } else { |
|
206 | - $uom = __('km', 'geodirectory'); |
|
207 | - } |
|
208 | - echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
209 | - } |
|
210 | - ?> |
|
192 | + if (round($distance, 2) == 0) { |
|
193 | + $uom = get_option('geodir_search_dist_2'); |
|
194 | + |
|
195 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
196 | + if ($uom == 'feet') { |
|
197 | + $uom = __('feet', 'geodirectory'); |
|
198 | + } else { |
|
199 | + $uom = __('meters', 'geodirectory'); |
|
200 | + } |
|
201 | + echo round($distance) . ' ' . $uom . '<br />'; |
|
202 | + } else { |
|
203 | + if ($uom == 'miles') { |
|
204 | + $uom = __('miles', 'geodirectory'); |
|
205 | + } else { |
|
206 | + $uom = __('km', 'geodirectory'); |
|
207 | + } |
|
208 | + echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
209 | + } |
|
210 | + ?> |
|
211 | 211 | </h3> |
212 | 212 | <?php } ?> |
213 | 213 | |
214 | 214 | |
215 | 215 | <?php |
216 | - /** |
|
217 | - * Called before the post excerpt on the listings view template. |
|
218 | - * |
|
219 | - * @since 1.0.0 |
|
220 | - * @param object $post The post object. |
|
221 | - * @see 'geodir_after_listing_post_excerpt' |
|
222 | - */ |
|
223 | - do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
216 | + /** |
|
217 | + * Called before the post excerpt on the listings view template. |
|
218 | + * |
|
219 | + * @since 1.0.0 |
|
220 | + * @param object $post The post object. |
|
221 | + * @see 'geodir_after_listing_post_excerpt' |
|
222 | + */ |
|
223 | + do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
224 | 224 | <?php echo geodir_show_listing_info('listing'); ?> |
225 | 225 | <div class="geodir-entry-content"> |
226 | 226 | |
227 | 227 | <?php |
228 | - /** |
|
229 | - * Filter to hide the listing excerpt |
|
230 | - * |
|
231 | - * @since 1.5.3 |
|
232 | - * @param bool $display Display the excerpt or not. Default true. |
|
233 | - * @param string $view The view type, default 'listview'. |
|
234 | - * @param object $post The post object. |
|
235 | - */ |
|
236 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
|
237 | - if ($show_listing_excerpt) { |
|
238 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
239 | - $content_out = geodir_max_excerpt( $character_count ); |
|
240 | - } else { |
|
241 | - $content_out = get_the_excerpt(); |
|
242 | - } |
|
243 | - if ( ! empty( $content_out ) ) { |
|
244 | - echo "<p>" . $content_out . "</p>"; |
|
245 | - } |
|
246 | - } |
|
247 | - ?></div> |
|
228 | + /** |
|
229 | + * Filter to hide the listing excerpt |
|
230 | + * |
|
231 | + * @since 1.5.3 |
|
232 | + * @param bool $display Display the excerpt or not. Default true. |
|
233 | + * @param string $view The view type, default 'listview'. |
|
234 | + * @param object $post The post object. |
|
235 | + */ |
|
236 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
|
237 | + if ($show_listing_excerpt) { |
|
238 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
239 | + $content_out = geodir_max_excerpt( $character_count ); |
|
240 | + } else { |
|
241 | + $content_out = get_the_excerpt(); |
|
242 | + } |
|
243 | + if ( ! empty( $content_out ) ) { |
|
244 | + echo "<p>" . $content_out . "</p>"; |
|
245 | + } |
|
246 | + } |
|
247 | + ?></div> |
|
248 | 248 | |
249 | 249 | <?php |
250 | - /** |
|
251 | - * Called after the post excerpt on the listings view template. |
|
252 | - * |
|
253 | - * @since 1.0.0 |
|
254 | - * @param object $post The post object. |
|
255 | - * @see 'geodir_before_listing_post_excerpt' |
|
256 | - */ |
|
257 | - do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
250 | + /** |
|
251 | + * Called after the post excerpt on the listings view template. |
|
252 | + * |
|
253 | + * @since 1.0.0 |
|
254 | + * @param object $post The post object. |
|
255 | + * @see 'geodir_before_listing_post_excerpt' |
|
256 | + */ |
|
257 | + do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
258 | 258 | </div> |
259 | 259 | <!-- gd-content ends here--> |
260 | 260 | <?php |
261 | - /** |
|
262 | - * Called after printing listing content. |
|
263 | - * |
|
264 | - * @since 1.5.3 |
|
265 | - * @param object $post The post object. |
|
266 | - * @param string $view The view type, default 'listing'. |
|
267 | - */ |
|
268 | - do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
261 | + /** |
|
262 | + * Called after printing listing content. |
|
263 | + * |
|
264 | + * @since 1.5.3 |
|
265 | + * @param object $post The post object. |
|
266 | + * @param string $view The view type, default 'listing'. |
|
267 | + */ |
|
268 | + do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
269 | 269 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>"> |
270 | 270 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>"> |
271 | 271 | |
272 | 272 | <?php |
273 | - /** |
|
274 | - * Called before printing review stars html. |
|
275 | - * |
|
276 | - * @since 1.5.3 |
|
277 | - * @param object $post The post object. |
|
278 | - * @param string $view The view type, default 'listing'. |
|
279 | - */ |
|
280 | - do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
281 | - |
|
282 | - $review_show = geodir_is_reviews_show('listview'); |
|
283 | - |
|
284 | - if ($review_show) { |
|
285 | - |
|
286 | - if (!$preview) { |
|
287 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
288 | - /** |
|
289 | - * Called before the rating stars are output on the listings view template. |
|
290 | - * |
|
291 | - * @since 1.0.0 |
|
292 | - * @param float $post_avgratings The average rating for the post. |
|
293 | - * @param int $post->ID The post ID. |
|
294 | - * @see 'geodir_after_review_rating_stars_on_listview' |
|
295 | - */ |
|
296 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
297 | - |
|
298 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
299 | - |
|
300 | - /** |
|
301 | - * Called after the rating stars are output on the listings view template. |
|
302 | - * |
|
303 | - * @since 1.0.0 |
|
304 | - * @param float $post_avgratings The average rating for the post. |
|
305 | - * @param int $post->ID The post ID. |
|
306 | - * @see 'geodir_before_review_rating_stars_on_listview' |
|
307 | - */ |
|
308 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
309 | - } |
|
310 | - ?> |
|
273 | + /** |
|
274 | + * Called before printing review stars html. |
|
275 | + * |
|
276 | + * @since 1.5.3 |
|
277 | + * @param object $post The post object. |
|
278 | + * @param string $view The view type, default 'listing'. |
|
279 | + */ |
|
280 | + do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
281 | + |
|
282 | + $review_show = geodir_is_reviews_show('listview'); |
|
283 | + |
|
284 | + if ($review_show) { |
|
285 | + |
|
286 | + if (!$preview) { |
|
287 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
288 | + /** |
|
289 | + * Called before the rating stars are output on the listings view template. |
|
290 | + * |
|
291 | + * @since 1.0.0 |
|
292 | + * @param float $post_avgratings The average rating for the post. |
|
293 | + * @param int $post->ID The post ID. |
|
294 | + * @see 'geodir_after_review_rating_stars_on_listview' |
|
295 | + */ |
|
296 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
297 | + |
|
298 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
299 | + |
|
300 | + /** |
|
301 | + * Called after the rating stars are output on the listings view template. |
|
302 | + * |
|
303 | + * @since 1.0.0 |
|
304 | + * @param float $post_avgratings The average rating for the post. |
|
305 | + * @param int $post->ID The post ID. |
|
306 | + * @see 'geodir_before_review_rating_stars_on_listview' |
|
307 | + */ |
|
308 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
309 | + } |
|
310 | + ?> |
|
311 | 311 | <a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
312 | 312 | class="fa fa-comments"></i> |
313 | 313 | <?php geodir_comments_number($post->rating_count); ?></a> |
314 | 314 | <?php |
315 | - } |
|
315 | + } |
|
316 | 316 | |
317 | 317 | |
318 | - /** |
|
319 | - * Called after printing favorite html. |
|
320 | - * |
|
321 | - * @since 1.0.0 |
|
322 | - */ |
|
323 | - do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
318 | + /** |
|
319 | + * Called after printing favorite html. |
|
320 | + * |
|
321 | + * @since 1.0.0 |
|
322 | + */ |
|
323 | + do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
324 | 324 | |
325 | 325 | |
326 | - /** |
|
327 | - * Called after printing map pin point. |
|
328 | - * |
|
329 | - * @since 1.0.0 |
|
330 | - * @since 1.5.9 Added $post as second param. |
|
331 | - * @param int $post->ID The post id. |
|
332 | - * @param object $post The post object. |
|
333 | - */ |
|
334 | - do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
326 | + /** |
|
327 | + * Called after printing map pin point. |
|
328 | + * |
|
329 | + * @since 1.0.0 |
|
330 | + * @since 1.5.9 Added $post as second param. |
|
331 | + * @param int $post->ID The post id. |
|
332 | + * @param object $post The post object. |
|
333 | + */ |
|
334 | + do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
335 | 335 | |
336 | - if ($post->post_author == get_current_user_id()) { ?> |
|
336 | + if ($post->post_author == get_current_user_id()) { ?> |
|
337 | 337 | <?php |
338 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
339 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
340 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
338 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
339 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
340 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
341 | 341 | |
342 | - $ajaxlink = geodir_get_ajax_url(); |
|
343 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
342 | + $ajaxlink = geodir_get_ajax_url(); |
|
343 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
344 | 344 | |
345 | - ?> |
|
345 | + ?> |
|
346 | 346 | |
347 | 347 | <span class="geodir-authorlink clearfix"> |
348 | 348 | |
349 | 349 | <?php if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
350 | - /** |
|
351 | - * Called before the edit post link on the listings view template used on the author page. |
|
352 | - * |
|
353 | - * @since 1.0.0 |
|
354 | - * @see 'geodir_after_edit_post_link_on_listing' |
|
355 | - */ |
|
356 | - do_action('geodir_before_edit_post_link_on_listing'); |
|
357 | - ?> |
|
350 | + /** |
|
351 | + * Called before the edit post link on the listings view template used on the author page. |
|
352 | + * |
|
353 | + * @since 1.0.0 |
|
354 | + * @see 'geodir_after_edit_post_link_on_listing' |
|
355 | + */ |
|
356 | + do_action('geodir_before_edit_post_link_on_listing'); |
|
357 | + ?> |
|
358 | 358 | |
359 | 359 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
360 | 360 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
361 | 361 | <?php |
362 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
|
363 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
364 | - ?> |
|
362 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
|
363 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
364 | + ?> |
|
365 | 365 | <?php _e('Edit', 'geodirectory'); ?> |
366 | 366 | </a> |
367 | 367 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
368 | 368 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
369 | 369 | <?php |
370 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
371 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
372 | - ?> |
|
370 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
371 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
372 | + ?> |
|
373 | 373 | <?php _e('Delete', 'geodirectory'); ?> |
374 | 374 | </a> |
375 | 375 | <?php |
376 | 376 | |
377 | - /** |
|
378 | - * Called after the edit post link on the listings view template used on the author page. |
|
379 | - * |
|
380 | - * @since 1.0.0 |
|
381 | - * @see 'geodir_before_edit_post_link_on_listing' |
|
382 | - */ |
|
383 | - do_action('geodir_after_edit_post_link_on_listing'); |
|
384 | - } ?> |
|
377 | + /** |
|
378 | + * Called after the edit post link on the listings view template used on the author page. |
|
379 | + * |
|
380 | + * @since 1.0.0 |
|
381 | + * @see 'geodir_before_edit_post_link_on_listing' |
|
382 | + */ |
|
383 | + do_action('geodir_after_edit_post_link_on_listing'); |
|
384 | + } ?> |
|
385 | 385 | </span> |
386 | 386 | |
387 | 387 | <?php } ?> |
@@ -394,32 +394,32 @@ discard block |
||
394 | 394 | </li> |
395 | 395 | |
396 | 396 | <?php |
397 | - endwhile; |
|
398 | - |
|
399 | - /** |
|
400 | - * Called inside the `ul` of the listings template, but after all `li` elements. |
|
401 | - * |
|
402 | - * When used by the widget view template then it will only show if there are listings to be shown. |
|
403 | - * |
|
404 | - * @since 1.0.0 |
|
405 | - * @see 'geodir_before_listing_post_listview' |
|
406 | - */ |
|
407 | - do_action('geodir_after_listing_post_listview'); |
|
408 | - |
|
409 | - else: |
|
397 | + endwhile; |
|
398 | + |
|
399 | + /** |
|
400 | + * Called inside the `ul` of the listings template, but after all `li` elements. |
|
401 | + * |
|
402 | + * When used by the widget view template then it will only show if there are listings to be shown. |
|
403 | + * |
|
404 | + * @since 1.0.0 |
|
405 | + * @see 'geodir_before_listing_post_listview' |
|
406 | + */ |
|
407 | + do_action('geodir_after_listing_post_listview'); |
|
408 | + |
|
409 | + else: |
|
410 | 410 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
411 | 411 | |
412 | 412 | /** |
413 | - * Called inside the `ul` of the listings template, when no listing found. |
|
414 | - * |
|
415 | - * @since 1.5.5 |
|
413 | + * Called inside the `ul` of the listings template, when no listing found. |
|
414 | + * |
|
415 | + * @since 1.5.5 |
|
416 | 416 | * @param string 'listing-listview' Listing listview template. |
417 | 417 | * @param bool $favorite Are favorite listings results? |
418 | - */ |
|
419 | - do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite); |
|
420 | - endif; |
|
418 | + */ |
|
419 | + do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite); |
|
420 | + endif; |
|
421 | 421 | |
422 | - ?> |
|
422 | + ?> |
|
423 | 423 | </ul> <!-- geodir_category_list_view ends here--> |
424 | 424 | |
425 | 425 | <div class="clear"></div> |