@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
31 | 31 | do_action('geodir_before_listing_post_listview'); |
32 | 32 | $all_postypes = geodir_get_posttypes(); |
33 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
33 | + $geodir_days_new = (int) get_option('geodir_listing_new_days'); |
|
34 | 34 | foreach ($widget_listings as $widget_listing) { |
35 | 35 | global $gd_widget_listing_type; |
36 | 36 | $post = $widget_listing; |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | */ |
146 | 146 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
147 | 147 | if ($show_listing_excerpt) { |
148 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
149 | - $content_out = geodir_max_excerpt( $character_count ); |
|
148 | + if (isset($character_count) && ($character_count || $character_count == '0')) { |
|
149 | + $content_out = geodir_max_excerpt($character_count); |
|
150 | 150 | } else { |
151 | 151 | $content_out = get_the_excerpt(); |
152 | 152 | } |
153 | - if ( ! empty( $content_out ) ) { |
|
153 | + if (!empty($content_out)) { |
|
154 | 154 | echo "<p>" . $content_out . "</p>"; |
155 | 155 | } |
156 | 156 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param object $post The post object. |
171 | 171 | * @param string $view The view type, default 'widget'. |
172 | 172 | */ |
173 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
173 | + do_action('geodir_after_listing_content', $post, 'widget'); ?> |
|
174 | 174 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>"> |
175 | 175 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>"> |
176 | 176 | <?php |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param object $post The post object. |
182 | 182 | * @param string $view The view type, default 'widget'. |
183 | 183 | */ |
184 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
184 | + do_action('geodir_before_review_html', $post, 'widget'); |
|
185 | 185 | $review_show = geodir_is_reviews_show('listview'); |
186 | 186 | if ($review_show) { |
187 | 187 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @since 1.0.0 |
208 | 208 | */ |
209 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
209 | + do_action('geodir_after_favorite_html', $post->ID, 'widget'); |
|
210 | 210 | |
211 | 211 | if ($post->post_author == get_current_user_id()) { |
212 | 212 | $addplacelink = get_permalink(geodir_add_listing_page_id()); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
228 | 228 | <?php |
229 | 229 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
230 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
230 | + echo '<i class="' . $geodir_listing_edit_icon . '"></i>'; |
|
231 | 231 | ?> |
232 | 232 | <?php _e('Edit', 'geodirectory'); ?> |
233 | 233 | </a> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
236 | 236 | <?php |
237 | 237 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
238 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
238 | + echo '<i class="' . $geodir_listing_delete_icon . '"></i>'; |
|
239 | 239 | ?> |
240 | 240 | <?php _e('Delete', 'geodirectory'); ?> |
241 | 241 | </a> |
@@ -20,67 +20,67 @@ discard block |
||
20 | 20 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
21 | 21 | $grid_view_class = apply_filters('geodir_grid_view_widget_columns', $gridview_columns_widget); |
22 | 22 | if ($gd_session->get('gd_listing_view') && !isset($before_widget)) { |
23 | - $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view')); |
|
23 | + $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view')); |
|
24 | 24 | } |
25 | 25 | ?> |
26 | 26 | <ul class="geodir_category_list_view clearfix <?php echo apply_filters('geodir_listing_listview_ul_extra_class', '', 'widget'); ?>"> |
27 | 27 | <?php |
28 | - if (!empty($widget_listings)) { |
|
29 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
30 | - do_action('geodir_before_listing_post_listview'); |
|
31 | - $all_postypes = geodir_get_posttypes(); |
|
32 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
33 | - foreach ($widget_listings as $widget_listing) { |
|
34 | - global $gd_widget_listing_type; |
|
35 | - $post = $widget_listing; |
|
28 | + if (!empty($widget_listings)) { |
|
29 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
30 | + do_action('geodir_before_listing_post_listview'); |
|
31 | + $all_postypes = geodir_get_posttypes(); |
|
32 | + $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
33 | + foreach ($widget_listings as $widget_listing) { |
|
34 | + global $gd_widget_listing_type; |
|
35 | + $post = $widget_listing; |
|
36 | 36 | |
37 | - $GLOBALS['post'] = $post; |
|
38 | - setup_postdata($post); |
|
37 | + $GLOBALS['post'] = $post; |
|
38 | + setup_postdata($post); |
|
39 | 39 | |
40 | - $gd_widget_listing_type = $post->post_type; |
|
40 | + $gd_widget_listing_type = $post->post_type; |
|
41 | 41 | |
42 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
43 | - $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes); |
|
42 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
43 | + $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes); |
|
44 | 44 | |
45 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
46 | - $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
47 | - ?> |
|
45 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
46 | + $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
47 | + ?> |
|
48 | 48 | <li class="clearfix <?php if ($grid_view_class) { |
49 | - echo 'geodir-gridview ' . $grid_view_class; |
|
50 | - } else { |
|
51 | - echo ' geodir-listview '; |
|
52 | - } ?> <?php if ($post_view_class) { |
|
53 | - echo $post_view_class; |
|
54 | - } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
55 | - echo "style='width:{$listing_width}%;'"; |
|
56 | - } ?>> |
|
49 | + echo 'geodir-gridview ' . $grid_view_class; |
|
50 | + } else { |
|
51 | + echo ' geodir-listview '; |
|
52 | + } ?> <?php if ($post_view_class) { |
|
53 | + echo $post_view_class; |
|
54 | + } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
55 | + echo "style='width:{$listing_width}%;'"; |
|
56 | + } ?>> |
|
57 | 57 | <article class="geodir-category-listing <?php if ($post_view_article_class) { |
58 | - echo $post_view_article_class; |
|
59 | - } ?>"> |
|
58 | + echo $post_view_article_class; |
|
59 | + } ?>"> |
|
60 | 60 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'widget'); ?>"> |
61 | 61 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?> |
62 | 62 | <a href="<?php the_permalink(); ?>"><?php echo $fimage; ?></a> |
63 | 63 | <?php |
64 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
65 | - do_action('geodir_before_badge_on_image', $post); |
|
66 | - if ($post->is_featured) { |
|
67 | - echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
68 | - } |
|
64 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
65 | + do_action('geodir_before_badge_on_image', $post); |
|
66 | + if ($post->is_featured) { |
|
67 | + echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
72 | - echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
73 | - } |
|
71 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
72 | + echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
73 | + } |
|
74 | 74 | |
75 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
76 | - do_action('geodir_after_badge_on_image', $post); |
|
77 | - } |
|
78 | - ?> |
|
75 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
76 | + do_action('geodir_after_badge_on_image', $post); |
|
77 | + } |
|
78 | + ?> |
|
79 | 79 | </div> |
80 | 80 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'widget'); ?>"> |
81 | 81 | <?php |
82 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
83 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
82 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
83 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
84 | 84 | <header class="geodir-entry-header"> |
85 | 85 | <h3 class="geodir-entry-title"> |
86 | 86 | <a href="<?php the_permalink(); ?>" |
@@ -89,158 +89,158 @@ discard block |
||
89 | 89 | </header> |
90 | 90 | <!-- .entry-header --> |
91 | 91 | <?php |
92 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
93 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
92 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
93 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
94 | 94 | <?php /// Print Distance |
95 | - if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') { |
|
96 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
95 | + if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') { |
|
96 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
97 | 97 | |
98 | - $endLat = $post->post_latitude; |
|
99 | - $endLon = $post->post_longitude; |
|
100 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
101 | - $uom = get_option('geodir_search_dist_1'); |
|
102 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
103 | - ?> |
|
98 | + $endLat = $post->post_latitude; |
|
99 | + $endLon = $post->post_longitude; |
|
100 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
101 | + $uom = get_option('geodir_search_dist_1'); |
|
102 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
103 | + ?> |
|
104 | 104 | <h3> |
105 | 105 | <?php |
106 | - if (round($distance, 2) == 0) { |
|
107 | - $uom = get_option('geodir_search_dist_2'); |
|
108 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
109 | - if ($uom == 'feet') { |
|
110 | - $uom = __('feet', 'geodirectory'); |
|
111 | - } else { |
|
112 | - $uom = __('meters', 'geodirectory'); |
|
113 | - } |
|
114 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
106 | + if (round($distance, 2) == 0) { |
|
107 | + $uom = get_option('geodir_search_dist_2'); |
|
108 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
109 | + if ($uom == 'feet') { |
|
110 | + $uom = __('feet', 'geodirectory'); |
|
111 | + } else { |
|
112 | + $uom = __('meters', 'geodirectory'); |
|
113 | + } |
|
114 | + echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
115 | 115 | <br /> |
116 | 116 | '; |
117 | - } else { |
|
118 | - if ($uom == 'miles') { |
|
119 | - $uom = __('miles', 'geodirectory'); |
|
120 | - } else { |
|
121 | - $uom = __('km', 'geodirectory'); |
|
122 | - } |
|
123 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
117 | + } else { |
|
118 | + if ($uom == 'miles') { |
|
119 | + $uom = __('miles', 'geodirectory'); |
|
120 | + } else { |
|
121 | + $uom = __('km', 'geodirectory'); |
|
122 | + } |
|
123 | + echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
124 | 124 | <br /> |
125 | 125 | '; |
126 | - } |
|
127 | - ?> |
|
126 | + } |
|
127 | + ?> |
|
128 | 128 | </h3> |
129 | 129 | <?php } ?> |
130 | 130 | <?php |
131 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
132 | - do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
131 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
132 | + do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
133 | 133 | <?php echo geodir_show_listing_info('listing'); ?> |
134 | 134 | <?php if (isset($character_count) && $character_count == '0') { |
135 | - } else { ?> |
|
135 | + } else { ?> |
|
136 | 136 | <div class="geodir-entry-content"> |
137 | 137 | <?php |
138 | - /** |
|
139 | - * Filter to hide the listing excerpt |
|
140 | - * |
|
141 | - * @since 1.5.3 |
|
142 | - * @param bool $display Display the excerpt or not. Default true. |
|
143 | - * @param object $post The post object. |
|
144 | - */ |
|
145 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
|
146 | - if ($show_listing_excerpt) { |
|
147 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
148 | - $content_out = geodir_max_excerpt( $character_count ); |
|
149 | - } else { |
|
150 | - $content_out = get_the_excerpt(); |
|
151 | - } |
|
152 | - if ( ! empty( $content_out ) ) { |
|
153 | - echo "<p>" . $content_out . "</p>"; |
|
154 | - } |
|
155 | - } |
|
156 | - ?> |
|
138 | + /** |
|
139 | + * Filter to hide the listing excerpt |
|
140 | + * |
|
141 | + * @since 1.5.3 |
|
142 | + * @param bool $display Display the excerpt or not. Default true. |
|
143 | + * @param object $post The post object. |
|
144 | + */ |
|
145 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
|
146 | + if ($show_listing_excerpt) { |
|
147 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
148 | + $content_out = geodir_max_excerpt( $character_count ); |
|
149 | + } else { |
|
150 | + $content_out = get_the_excerpt(); |
|
151 | + } |
|
152 | + if ( ! empty( $content_out ) ) { |
|
153 | + echo "<p>" . $content_out . "</p>"; |
|
154 | + } |
|
155 | + } |
|
156 | + ?> |
|
157 | 157 | </div> |
158 | 158 | <?php } ?> |
159 | 159 | <?php |
160 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
161 | - do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
160 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
161 | + do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
162 | 162 | </div> |
163 | 163 | <!-- gd-content ends here--> |
164 | 164 | <?php |
165 | - /** |
|
166 | - * Called after printing listing content. |
|
167 | - * |
|
168 | - * @since 1.5.3 |
|
169 | - * @param object $post The post object. |
|
170 | - * @param string $view The view type, default 'widget'. |
|
171 | - */ |
|
172 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
165 | + /** |
|
166 | + * Called after printing listing content. |
|
167 | + * |
|
168 | + * @since 1.5.3 |
|
169 | + * @param object $post The post object. |
|
170 | + * @param string $view The view type, default 'widget'. |
|
171 | + */ |
|
172 | + do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
173 | 173 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>"> |
174 | 174 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>"> |
175 | 175 | <?php |
176 | - /** |
|
177 | - * Called before printing review stars html. |
|
178 | - * |
|
179 | - * @since 1.5.3 |
|
180 | - * @param object $post The post object. |
|
181 | - * @param string $view The view type, default 'widget'. |
|
182 | - */ |
|
183 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
184 | - $review_show = geodir_is_reviews_show('listview'); |
|
185 | - if ($review_show) { |
|
176 | + /** |
|
177 | + * Called before printing review stars html. |
|
178 | + * |
|
179 | + * @since 1.5.3 |
|
180 | + * @param object $post The post object. |
|
181 | + * @param string $view The view type, default 'widget'. |
|
182 | + */ |
|
183 | + do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
184 | + $review_show = geodir_is_reviews_show('listview'); |
|
185 | + if ($review_show) { |
|
186 | 186 | |
187 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
187 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
188 | 188 | |
189 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
190 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
189 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
190 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
191 | 191 | |
192 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
192 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
193 | 193 | |
194 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
195 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
196 | - ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
194 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
195 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
196 | + ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
197 | 197 | class="fa fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?> |
198 | 198 | </a> |
199 | 199 | <?php |
200 | - } |
|
201 | - geodir_favourite_html($post->post_author, $post->ID); |
|
200 | + } |
|
201 | + geodir_favourite_html($post->post_author, $post->ID); |
|
202 | 202 | |
203 | - /** |
|
204 | - * Called after printing favorite html. |
|
205 | - * |
|
206 | - * @since 1.0.0 |
|
207 | - */ |
|
208 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
203 | + /** |
|
204 | + * Called after printing favorite html. |
|
205 | + * |
|
206 | + * @since 1.0.0 |
|
207 | + */ |
|
208 | + do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
209 | 209 | |
210 | - if ($post->post_author == get_current_user_id()) { |
|
211 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
212 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
213 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
210 | + if ($post->post_author == get_current_user_id()) { |
|
211 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
212 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
213 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
214 | 214 | |
215 | - $ajaxlink = geodir_get_ajax_url(); |
|
216 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
217 | - ?> |
|
215 | + $ajaxlink = geodir_get_ajax_url(); |
|
216 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
217 | + ?> |
|
218 | 218 | <span class="geodir-authorlink clearfix"> |
219 | 219 | <?php |
220 | - if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
|
221 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
222 | - do_action('geodir_before_edit_post_link_on_listing'); |
|
223 | - ?> |
|
220 | + if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
|
221 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
222 | + do_action('geodir_before_edit_post_link_on_listing'); |
|
223 | + ?> |
|
224 | 224 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
225 | 225 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
226 | 226 | <?php |
227 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
|
228 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
229 | - ?> |
|
227 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
|
228 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
229 | + ?> |
|
230 | 230 | <?php _e('Edit', 'geodirectory'); ?> |
231 | 231 | </a> |
232 | 232 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
233 | 233 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
234 | 234 | <?php |
235 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
236 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
237 | - ?> |
|
235 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
236 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
237 | + ?> |
|
238 | 238 | <?php _e('Delete', 'geodirectory'); ?> |
239 | 239 | </a> |
240 | 240 | <?php |
241 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
242 | - do_action('geodir_after_edit_post_link_on_listing'); |
|
243 | - } ?> |
|
241 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
242 | + do_action('geodir_after_edit_post_link_on_listing'); |
|
243 | + } ?> |
|
244 | 244 | </span> |
245 | 245 | <?php } ?> |
246 | 246 | </div> |
@@ -250,17 +250,17 @@ discard block |
||
250 | 250 | </article> |
251 | 251 | </li> |
252 | 252 | <?php |
253 | - unset($gd_widget_listing_type); |
|
254 | - } |
|
255 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
256 | - do_action('geodir_after_listing_post_listview'); |
|
257 | - } else { |
|
253 | + unset($gd_widget_listing_type); |
|
254 | + } |
|
255 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
256 | + do_action('geodir_after_listing_post_listview'); |
|
257 | + } else { |
|
258 | 258 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
259 | 259 | |
260 | 260 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
261 | - do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite); |
|
262 | - } |
|
263 | - ?> |
|
261 | + do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite); |
|
262 | + } |
|
263 | + ?> |
|
264 | 264 | </ul> <!-- geodir_category_list_view ends here--> |
265 | 265 | <div class="clear"></div> |
266 | 266 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $output = geodir_cpt_categories_output($params); |
147 | 147 | |
148 | 148 | echo $args['before_widget']; |
149 | - if ( $params['title'] ) { |
|
149 | + if ($params['title']) { |
|
150 | 150 | echo '<div class="geodir_list_heading clearfix">'; |
151 | 151 | echo $args['before_title'] . $params['title'] . $args['after_title']; |
152 | 152 | echo '</div>'; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @param array $instance Previously saved values from database. |
192 | 192 | */ |
193 | 193 | public function form($instance) { |
194 | - $instance = wp_parse_args( (array)$instance, |
|
194 | + $instance = wp_parse_args((array) $instance, |
|
195 | 195 | array( |
196 | 196 | 'title' => '', |
197 | 197 | 'post_type' => array(), // NULL for all |
@@ -221,42 +221,42 @@ discard block |
||
221 | 221 | <p> |
222 | 222 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label> |
223 | 223 | <select name="<?php echo $this->get_field_name('post_type'); ?>[]" id="<?php echo $this->get_field_id('post_type'); ?>" class="widefat" multiple="multiple"> |
224 | - <option value="0" <?php selected( (empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
224 | + <option value="0" <?php selected((empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
225 | 225 | <?php foreach ($post_type_options as $name => $title) { ?> |
226 | - <option value="<?php echo $name;?>" <?php selected( is_array($post_type) && in_array($name, $post_type), true ); ?>><?php echo $title; ?></option> |
|
226 | + <option value="<?php echo $name; ?>" <?php selected(is_array($post_type) && in_array($name, $post_type), true); ?>><?php echo $title; ?></option> |
|
227 | 227 | <?php } ?> |
228 | 228 | </select> |
229 | 229 | </p> |
230 | - <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked( $hide_empty ); ?> value="1" /> |
|
231 | - <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e( 'Hide empty categories', 'geodirectory' ); ?></label><br /> |
|
232 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked( $show_count ); ?> value="1" /> |
|
233 | - <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e( 'Show category count' ); ?></label> <small><?php _e( '( Enabling will slow down page loading for big directories. )', 'geodirectory' ); ?></small><br /> |
|
234 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked( $hide_icon ); ?> value="1" /> |
|
235 | - <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e( 'Hide category icon', 'geodirectory' ); ?></label><br /> |
|
236 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked( $cpt_left ); ?> value="1" /> |
|
237 | - <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e( 'Show CPT on same line', 'geodirectory' ); ?></label> |
|
230 | + <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked($hide_empty); ?> value="1" /> |
|
231 | + <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e('Hide empty categories', 'geodirectory'); ?></label><br /> |
|
232 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked($show_count); ?> value="1" /> |
|
233 | + <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e('Show category count'); ?></label> <small><?php _e('( Enabling will slow down page loading for big directories. )', 'geodirectory'); ?></small><br /> |
|
234 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked($hide_icon); ?> value="1" /> |
|
235 | + <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e('Hide category icon', 'geodirectory'); ?></label><br /> |
|
236 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked($cpt_left); ?> value="1" /> |
|
237 | + <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e('Show CPT on same line', 'geodirectory'); ?></label> |
|
238 | 238 | <p> |
239 | 239 | <label for="<?php echo $this->get_field_id('sort_by'); ?>"><?php _e('Sort by:', 'geodirectory'); ?></label> |
240 | 240 | <select name="<?php echo $this->get_field_name('sort_by'); ?>" id="<?php echo $this->get_field_id('sort_by'); ?>" class="widefat"> |
241 | - <option value="az" <?php selected( $sort_by, 'az' ); ?>><?php _e('A-Z', 'geodirectory'); ?></option> |
|
242 | - <option value="count" <?php selected( $sort_by, 'count' ); ?>><?php _e('Count', 'geodirectory'); ?></option> |
|
241 | + <option value="az" <?php selected($sort_by, 'az'); ?>><?php _e('A-Z', 'geodirectory'); ?></option> |
|
242 | + <option value="count" <?php selected($sort_by, 'count'); ?>><?php _e('Count', 'geodirectory'); ?></option> |
|
243 | 243 | </select> |
244 | 244 | </p> |
245 | 245 | <p> |
246 | 246 | <label for="<?php echo $this->get_field_id('max_count'); ?>"><?php _e('Max no of sub-categories:', 'geodirectory'); ?></label> |
247 | 247 | <select name="<?php echo $this->get_field_name('max_count'); ?>" id="<?php echo $this->get_field_id('max_count'); ?>" class="widefat"> |
248 | - <option value="all" <?php selected( $max_count, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
248 | + <option value="all" <?php selected($max_count, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
249 | 249 | <?php for ($n = 10; $n >= 0; $n--) { ?> |
250 | - <option value="<?php echo $n;?>" <?php selected( $max_count, $n ); ?>><?php echo $n; ?></option> |
|
250 | + <option value="<?php echo $n; ?>" <?php selected($max_count, $n); ?>><?php echo $n; ?></option> |
|
251 | 251 | <?php } ?> |
252 | 252 | </select> |
253 | 253 | </p> |
254 | 254 | <p> |
255 | 255 | <label for="<?php echo $this->get_field_id('max_level'); ?>"><?php _e('Show max sub-categories depth:', 'geodirectory'); ?></label> |
256 | 256 | <select name="<?php echo $this->get_field_name('max_level'); ?>" id="<?php echo $this->get_field_id('max_level'); ?>" class="widefat"> |
257 | - <option value="all" <?php selected( $max_level, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
257 | + <option value="all" <?php selected($max_level, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
258 | 258 | <?php for ($n = 0; $n <= 10; $n++) { ?> |
259 | - <option value="<?php echo $n;?>" <?php selected( $max_level, $n ); ?>><?php echo $n; ?></option> |
|
259 | + <option value="<?php echo $n; ?>" <?php selected($max_level, $n); ?>><?php echo $n; ?></option> |
|
260 | 260 | <?php } ?> |
261 | 261 | </select> |
262 | 262 | </p> |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @return string CPT categories content. |
276 | 276 | */ |
277 | 277 | function geodir_cpt_categories_output($params) { |
278 | - $args = wp_parse_args((array)$params, |
|
278 | + $args = wp_parse_args((array) $params, |
|
279 | 279 | array( |
280 | 280 | 'title' => '', |
281 | 281 | 'post_type' => array(), // NULL for all |
@@ -345,15 +345,15 @@ discard block |
||
345 | 345 | $hide_empty = !empty($args['hide_empty']) ? true : false; |
346 | 346 | $max_count = strip_tags($args['max_count']); |
347 | 347 | $all_childs = $max_count == 'all' ? true : false; |
348 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
348 | + $max_count = $max_count > 0 ? (int) $max_count : 0; |
|
349 | 349 | $max_level = strip_tags($args['max_level']); |
350 | 350 | $show_count = !empty($args['show_count']) ? true : false; |
351 | 351 | $hide_icon = !empty($args['hide_icon']) ? true : false; |
352 | 352 | $cpt_left = !empty($args['cpt_left']) ? true : false; |
353 | 353 | |
354 | - if(!$cpt_left){ |
|
354 | + if (!$cpt_left) { |
|
355 | 355 | $cpt_left = "gd-cpt-flat"; |
356 | - }else{ |
|
356 | + } else { |
|
357 | 357 | $cpt_left = ''; |
358 | 358 | } |
359 | 359 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | if ($is_listing) { |
384 | 384 | $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
385 | 385 | } |
386 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
386 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' ' . $cpt_left . '">'; |
|
387 | 387 | |
388 | 388 | if ($is_category) { |
389 | 389 | $term_info = get_term($current_term_id, $cat_taxonomy); |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
401 | 401 | $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
402 | 402 | |
403 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
403 | + $term_link = get_term_link($category, $category->taxonomy); |
|
404 | 404 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
405 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
405 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
406 | 406 | |
407 | - $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
407 | + $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent ' . $cpt_left . '">'; |
|
408 | 408 | $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
409 | 409 | $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
410 | - $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
411 | - if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
410 | + $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></h3>'; |
|
411 | + if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int) $max_level > 0)) { |
|
412 | 412 | $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
413 | 413 | } |
414 | 414 | $cpt_row .= '</li>'; |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $order = 'ASC'; |
450 | 450 | } |
451 | 451 | |
452 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
452 | + if ($max_level != 'all' && $depth > (int) $max_level) { |
|
453 | 453 | return ''; |
454 | 454 | } |
455 | 455 | |
@@ -471,9 +471,9 @@ discard block |
||
471 | 471 | foreach ($child_cats as $category) { |
472 | 472 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
473 | 473 | $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
474 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
474 | + $term_link = get_term_link($category, $category->taxonomy); |
|
475 | 475 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
476 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
476 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
477 | 477 | $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
478 | 478 | |
479 | 479 | $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
@@ -353,7 +353,7 @@ |
||
353 | 353 | |
354 | 354 | if(!$cpt_left){ |
355 | 355 | $cpt_left = "gd-cpt-flat"; |
356 | - }else{ |
|
356 | + } else{ |
|
357 | 357 | $cpt_left = ''; |
358 | 358 | } |
359 | 359 |
@@ -13,210 +13,210 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class geodir_cpt_categories_widget extends WP_Widget { |
15 | 15 | |
16 | - /** |
|
17 | - * Register the cpt categories with WordPress. |
|
18 | - * |
|
19 | - * @since 1.5.4 |
|
20 | - */ |
|
21 | - public function __construct() { |
|
22 | - $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory')); |
|
23 | - parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops); |
|
24 | - } |
|
25 | - |
|
26 | - /** |
|
27 | - * Front-end display content for cpt categories widget. |
|
28 | - * |
|
29 | - * @since 1.5.4 |
|
30 | - * |
|
31 | - * @param array $args Widget arguments. |
|
32 | - * @param array $instance Saved values from database. |
|
33 | - */ |
|
34 | - public function widget($args, $instance) { |
|
35 | - $params = array(); |
|
36 | - /** |
|
37 | - * Filter the widget title. |
|
38 | - * |
|
39 | - * @since 1.5.4 |
|
40 | - * |
|
41 | - * @param string $title The widget title. Default empty. |
|
42 | - * @param array $instance An array of the widget's settings. |
|
43 | - * @param mixed $id_base The widget ID. |
|
44 | - */ |
|
45 | - $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
46 | - |
|
47 | - /** |
|
48 | - * Filter the widget setting post type. |
|
49 | - * |
|
50 | - * @since 1.5.4 |
|
51 | - * |
|
52 | - * @param array $post_type The post types to display categories. |
|
53 | - * @param array $instance An array of the widget's settings. |
|
54 | - * @param mixed $id_base The widget ID. |
|
55 | - */ |
|
56 | - $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base); |
|
57 | - |
|
58 | - /** |
|
59 | - * Filter the widget setting to hide empty categories. |
|
60 | - * |
|
61 | - * @since 1.5.4 |
|
62 | - * |
|
63 | - * @param bool $hide_empty If true then empty category will be not displayed. |
|
64 | - * @param array $instance An array of the widget's settings. |
|
65 | - * @param mixed $id_base The widget ID. |
|
66 | - */ |
|
67 | - $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base); |
|
68 | - |
|
69 | - /** |
|
70 | - * Filter the widget setting to show/hide category count. |
|
71 | - * |
|
72 | - * @since 1.5.4 |
|
73 | - * |
|
74 | - * @param bool $show_count If true then category count will be displayed. |
|
75 | - * @param array $instance An array of the widget's settings. |
|
76 | - * @param mixed $id_base The widget ID. |
|
77 | - */ |
|
78 | - $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base); |
|
79 | - |
|
80 | - /** |
|
81 | - * Filter the widget setting to show/hide category icon. |
|
82 | - * |
|
83 | - * @since 1.5.4 |
|
84 | - * |
|
85 | - * @param bool $hide_icon If true then category icon will be not displayed. |
|
86 | - * @param array $instance An array of the widget's settings. |
|
87 | - * @param mixed $id_base The widget ID. |
|
88 | - */ |
|
89 | - $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base); |
|
90 | - |
|
91 | - /** |
|
92 | - * Filter the widget setting to show CPT inline or not. |
|
93 | - * |
|
94 | - * @since 1.5.4 |
|
95 | - * |
|
96 | - * @param bool $cpt_left If true then CPT will be displayed inline. |
|
97 | - * @param array $instance An array of the widget's settings. |
|
98 | - * @param mixed $id_base The widget ID. |
|
99 | - */ |
|
100 | - $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base); |
|
101 | - |
|
102 | - /** |
|
103 | - * Filter the widget categories sorting order settings. |
|
104 | - * |
|
105 | - * @since 1.5.4 |
|
106 | - * |
|
107 | - * @param string $max_count Widget max no of sub-categories count. Default 'count'. |
|
108 | - * @param array $instance An array of the widget's settings. |
|
109 | - * @param mixed $id_base The widget ID. |
|
110 | - */ |
|
111 | - $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base); |
|
112 | - |
|
113 | - /** |
|
114 | - * Filter the widget max no of sub-categories count. |
|
115 | - * |
|
116 | - * @since 1.5.4 |
|
117 | - * |
|
118 | - * @param bool|string $max_count Widget max no of sub-categories count. |
|
119 | - * @param array $instance An array of the widget's settings. |
|
120 | - * @param mixed $id_base The widget ID. |
|
121 | - */ |
|
122 | - $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base); |
|
123 | - |
|
124 | - /** |
|
125 | - * Filter the widget max sub-categories depth. |
|
126 | - * |
|
127 | - * @since 1.5.4 |
|
128 | - * |
|
129 | - * @param bool|string $max_level Widget max sub-categories depth. |
|
130 | - * @param array $instance An array of the widget's settings. |
|
131 | - * @param mixed $id_base The widget ID. |
|
132 | - */ |
|
133 | - $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base); |
|
134 | - |
|
135 | - /** |
|
136 | - * Filter the widget parameters. |
|
137 | - * |
|
138 | - * @since 1.5.4 |
|
139 | - * |
|
140 | - * @param array $params The widget parameters. |
|
141 | - * @param array $instance An array of the widget's settings. |
|
142 | - * @param mixed $id_base The widget ID. |
|
143 | - */ |
|
144 | - $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base); |
|
145 | - |
|
146 | - $output = geodir_cpt_categories_output($params); |
|
147 | - |
|
148 | - echo $args['before_widget']; |
|
149 | - if ( $params['title'] ) { |
|
150 | - echo '<div class="geodir_list_heading clearfix">'; |
|
151 | - echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
152 | - echo '</div>'; |
|
153 | - } |
|
154 | - echo '<div class="gd-cptcats-widget">'; |
|
155 | - echo $output; |
|
156 | - echo '</div>'; |
|
157 | - echo $args['after_widget']; |
|
158 | - } |
|
159 | - |
|
160 | - /** |
|
161 | - * Sanitize cpt categories widget values as they are saved. |
|
162 | - * |
|
163 | - * @since 1.5.4 |
|
164 | - * |
|
165 | - * @param array $new_instance Values just sent to be saved. |
|
166 | - * @param array $old_instance Previously saved values from database. |
|
167 | - * |
|
168 | - * @return array Updated safe values to be saved. |
|
169 | - */ |
|
170 | - public function update($new_instance, $old_instance) { |
|
171 | - $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type']; |
|
172 | - $instance = $old_instance; |
|
173 | - $instance['title'] = strip_tags($new_instance['title']); |
|
174 | - $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0'); |
|
175 | - $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0; |
|
176 | - $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0; |
|
177 | - $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0; |
|
178 | - $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0; |
|
179 | - $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count'; |
|
180 | - $instance['max_count'] = strip_tags($new_instance['max_count']); |
|
181 | - $instance['max_level'] = strip_tags($new_instance['max_level']); |
|
182 | - |
|
183 | - return $instance; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * Back-end cpt categories settings form. |
|
188 | - * |
|
189 | - * @since 1.5.4 |
|
190 | - * |
|
191 | - * @param array $instance Previously saved values from database. |
|
192 | - */ |
|
193 | - public function form($instance) { |
|
194 | - $instance = wp_parse_args( (array)$instance, |
|
195 | - array( |
|
196 | - 'title' => '', |
|
197 | - 'post_type' => array(), // NULL for all |
|
198 | - 'hide_empty' => '', |
|
199 | - 'show_count' => '', |
|
200 | - 'hide_icon' => '', |
|
201 | - 'cpt_left' => '', |
|
202 | - 'sort_by' => 'count', |
|
203 | - 'max_count' => 'all', |
|
204 | - 'max_level' => '1' |
|
205 | - ) |
|
206 | - ); |
|
207 | - |
|
208 | - $title = strip_tags($instance['title']); |
|
209 | - $post_type = $instance['post_type']; |
|
210 | - $hide_empty = !empty($instance['hide_empty']) ? true : false; |
|
211 | - $show_count = !empty($instance['show_count']) ? true : false; |
|
212 | - $hide_icon = !empty($instance['hide_icon']) ? true : false; |
|
213 | - $cpt_left = !empty($instance['cpt_left']) ? true : false; |
|
214 | - $max_count = strip_tags($instance['max_count']); |
|
215 | - $max_level = strip_tags($instance['max_level']); |
|
216 | - $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count'; |
|
217 | - |
|
218 | - $post_type_options = geodir_get_posttypes('options'); |
|
219 | - ?> |
|
16 | + /** |
|
17 | + * Register the cpt categories with WordPress. |
|
18 | + * |
|
19 | + * @since 1.5.4 |
|
20 | + */ |
|
21 | + public function __construct() { |
|
22 | + $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory')); |
|
23 | + parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops); |
|
24 | + } |
|
25 | + |
|
26 | + /** |
|
27 | + * Front-end display content for cpt categories widget. |
|
28 | + * |
|
29 | + * @since 1.5.4 |
|
30 | + * |
|
31 | + * @param array $args Widget arguments. |
|
32 | + * @param array $instance Saved values from database. |
|
33 | + */ |
|
34 | + public function widget($args, $instance) { |
|
35 | + $params = array(); |
|
36 | + /** |
|
37 | + * Filter the widget title. |
|
38 | + * |
|
39 | + * @since 1.5.4 |
|
40 | + * |
|
41 | + * @param string $title The widget title. Default empty. |
|
42 | + * @param array $instance An array of the widget's settings. |
|
43 | + * @param mixed $id_base The widget ID. |
|
44 | + */ |
|
45 | + $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
46 | + |
|
47 | + /** |
|
48 | + * Filter the widget setting post type. |
|
49 | + * |
|
50 | + * @since 1.5.4 |
|
51 | + * |
|
52 | + * @param array $post_type The post types to display categories. |
|
53 | + * @param array $instance An array of the widget's settings. |
|
54 | + * @param mixed $id_base The widget ID. |
|
55 | + */ |
|
56 | + $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base); |
|
57 | + |
|
58 | + /** |
|
59 | + * Filter the widget setting to hide empty categories. |
|
60 | + * |
|
61 | + * @since 1.5.4 |
|
62 | + * |
|
63 | + * @param bool $hide_empty If true then empty category will be not displayed. |
|
64 | + * @param array $instance An array of the widget's settings. |
|
65 | + * @param mixed $id_base The widget ID. |
|
66 | + */ |
|
67 | + $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base); |
|
68 | + |
|
69 | + /** |
|
70 | + * Filter the widget setting to show/hide category count. |
|
71 | + * |
|
72 | + * @since 1.5.4 |
|
73 | + * |
|
74 | + * @param bool $show_count If true then category count will be displayed. |
|
75 | + * @param array $instance An array of the widget's settings. |
|
76 | + * @param mixed $id_base The widget ID. |
|
77 | + */ |
|
78 | + $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base); |
|
79 | + |
|
80 | + /** |
|
81 | + * Filter the widget setting to show/hide category icon. |
|
82 | + * |
|
83 | + * @since 1.5.4 |
|
84 | + * |
|
85 | + * @param bool $hide_icon If true then category icon will be not displayed. |
|
86 | + * @param array $instance An array of the widget's settings. |
|
87 | + * @param mixed $id_base The widget ID. |
|
88 | + */ |
|
89 | + $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base); |
|
90 | + |
|
91 | + /** |
|
92 | + * Filter the widget setting to show CPT inline or not. |
|
93 | + * |
|
94 | + * @since 1.5.4 |
|
95 | + * |
|
96 | + * @param bool $cpt_left If true then CPT will be displayed inline. |
|
97 | + * @param array $instance An array of the widget's settings. |
|
98 | + * @param mixed $id_base The widget ID. |
|
99 | + */ |
|
100 | + $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base); |
|
101 | + |
|
102 | + /** |
|
103 | + * Filter the widget categories sorting order settings. |
|
104 | + * |
|
105 | + * @since 1.5.4 |
|
106 | + * |
|
107 | + * @param string $max_count Widget max no of sub-categories count. Default 'count'. |
|
108 | + * @param array $instance An array of the widget's settings. |
|
109 | + * @param mixed $id_base The widget ID. |
|
110 | + */ |
|
111 | + $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base); |
|
112 | + |
|
113 | + /** |
|
114 | + * Filter the widget max no of sub-categories count. |
|
115 | + * |
|
116 | + * @since 1.5.4 |
|
117 | + * |
|
118 | + * @param bool|string $max_count Widget max no of sub-categories count. |
|
119 | + * @param array $instance An array of the widget's settings. |
|
120 | + * @param mixed $id_base The widget ID. |
|
121 | + */ |
|
122 | + $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base); |
|
123 | + |
|
124 | + /** |
|
125 | + * Filter the widget max sub-categories depth. |
|
126 | + * |
|
127 | + * @since 1.5.4 |
|
128 | + * |
|
129 | + * @param bool|string $max_level Widget max sub-categories depth. |
|
130 | + * @param array $instance An array of the widget's settings. |
|
131 | + * @param mixed $id_base The widget ID. |
|
132 | + */ |
|
133 | + $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base); |
|
134 | + |
|
135 | + /** |
|
136 | + * Filter the widget parameters. |
|
137 | + * |
|
138 | + * @since 1.5.4 |
|
139 | + * |
|
140 | + * @param array $params The widget parameters. |
|
141 | + * @param array $instance An array of the widget's settings. |
|
142 | + * @param mixed $id_base The widget ID. |
|
143 | + */ |
|
144 | + $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base); |
|
145 | + |
|
146 | + $output = geodir_cpt_categories_output($params); |
|
147 | + |
|
148 | + echo $args['before_widget']; |
|
149 | + if ( $params['title'] ) { |
|
150 | + echo '<div class="geodir_list_heading clearfix">'; |
|
151 | + echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
152 | + echo '</div>'; |
|
153 | + } |
|
154 | + echo '<div class="gd-cptcats-widget">'; |
|
155 | + echo $output; |
|
156 | + echo '</div>'; |
|
157 | + echo $args['after_widget']; |
|
158 | + } |
|
159 | + |
|
160 | + /** |
|
161 | + * Sanitize cpt categories widget values as they are saved. |
|
162 | + * |
|
163 | + * @since 1.5.4 |
|
164 | + * |
|
165 | + * @param array $new_instance Values just sent to be saved. |
|
166 | + * @param array $old_instance Previously saved values from database. |
|
167 | + * |
|
168 | + * @return array Updated safe values to be saved. |
|
169 | + */ |
|
170 | + public function update($new_instance, $old_instance) { |
|
171 | + $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type']; |
|
172 | + $instance = $old_instance; |
|
173 | + $instance['title'] = strip_tags($new_instance['title']); |
|
174 | + $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0'); |
|
175 | + $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0; |
|
176 | + $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0; |
|
177 | + $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0; |
|
178 | + $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0; |
|
179 | + $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count'; |
|
180 | + $instance['max_count'] = strip_tags($new_instance['max_count']); |
|
181 | + $instance['max_level'] = strip_tags($new_instance['max_level']); |
|
182 | + |
|
183 | + return $instance; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * Back-end cpt categories settings form. |
|
188 | + * |
|
189 | + * @since 1.5.4 |
|
190 | + * |
|
191 | + * @param array $instance Previously saved values from database. |
|
192 | + */ |
|
193 | + public function form($instance) { |
|
194 | + $instance = wp_parse_args( (array)$instance, |
|
195 | + array( |
|
196 | + 'title' => '', |
|
197 | + 'post_type' => array(), // NULL for all |
|
198 | + 'hide_empty' => '', |
|
199 | + 'show_count' => '', |
|
200 | + 'hide_icon' => '', |
|
201 | + 'cpt_left' => '', |
|
202 | + 'sort_by' => 'count', |
|
203 | + 'max_count' => 'all', |
|
204 | + 'max_level' => '1' |
|
205 | + ) |
|
206 | + ); |
|
207 | + |
|
208 | + $title = strip_tags($instance['title']); |
|
209 | + $post_type = $instance['post_type']; |
|
210 | + $hide_empty = !empty($instance['hide_empty']) ? true : false; |
|
211 | + $show_count = !empty($instance['show_count']) ? true : false; |
|
212 | + $hide_icon = !empty($instance['hide_icon']) ? true : false; |
|
213 | + $cpt_left = !empty($instance['cpt_left']) ? true : false; |
|
214 | + $max_count = strip_tags($instance['max_count']); |
|
215 | + $max_level = strip_tags($instance['max_level']); |
|
216 | + $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count'; |
|
217 | + |
|
218 | + $post_type_options = geodir_get_posttypes('options'); |
|
219 | + ?> |
|
220 | 220 | <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?></label> <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); ?>" /></p> |
221 | 221 | <p> |
222 | 222 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label> |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | </select> |
262 | 262 | </p> |
263 | 263 | <?php |
264 | - } |
|
264 | + } |
|
265 | 265 | } // class geodir_cpt_categories_widget |
266 | 266 | |
267 | 267 | register_widget('geodir_cpt_categories_widget'); |
@@ -275,152 +275,152 @@ discard block |
||
275 | 275 | * @return string CPT categories content. |
276 | 276 | */ |
277 | 277 | function geodir_cpt_categories_output($params) { |
278 | - $args = wp_parse_args((array)$params, |
|
279 | - array( |
|
280 | - 'title' => '', |
|
281 | - 'post_type' => array(), // NULL for all |
|
282 | - 'hide_empty' => '', |
|
283 | - 'show_count' => '', |
|
284 | - 'hide_icon' => '', |
|
285 | - 'cpt_left' => '', |
|
286 | - 'sort_by' => 'count', |
|
287 | - 'max_count' => 'all', |
|
288 | - 'max_level' => '1', |
|
289 | - ) |
|
290 | - ); |
|
291 | - |
|
292 | - $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count'; |
|
293 | - |
|
294 | - $gd_post_types = geodir_get_posttypes('array'); |
|
295 | - |
|
296 | - $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type']; |
|
297 | - $current_posttype = geodir_get_current_posttype(); |
|
298 | - |
|
299 | - $is_listing = false; |
|
300 | - $is_category = false; |
|
301 | - if (geodir_is_page('listing')) { |
|
302 | - $current_posttype = geodir_get_current_posttype(); |
|
303 | - |
|
304 | - if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
|
305 | - $is_listing = true; |
|
306 | - |
|
307 | - if (is_tax()) { // category page |
|
308 | - $current_term_id = get_queried_object_id(); |
|
309 | - $current_taxonomy = get_query_var('taxonomy'); |
|
310 | - $current_posttype = geodir_get_current_posttype(); |
|
311 | - |
|
312 | - if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
313 | - $is_category = true; |
|
314 | - } |
|
315 | - } |
|
316 | - } |
|
317 | - } |
|
318 | - |
|
319 | - $parent_category = 0; |
|
320 | - if ($is_listing) { |
|
321 | - $post_type_arr = array($current_posttype); |
|
322 | - |
|
323 | - if ($is_category) { |
|
324 | - $parent_category = $current_term_id; |
|
325 | - } |
|
326 | - } |
|
327 | - |
|
328 | - $post_types = array(); |
|
329 | - if (!empty($post_type_arr)) { |
|
330 | - if (in_array('0', $post_type_arr)) { |
|
331 | - $post_types = $gd_post_types; |
|
332 | - } else { |
|
333 | - foreach ($post_type_arr as $cpt) { |
|
334 | - if (isset($gd_post_types[$cpt])) { |
|
335 | - $post_types[$cpt] = $gd_post_types[$cpt]; |
|
336 | - } |
|
337 | - } |
|
338 | - } |
|
339 | - } |
|
340 | - |
|
341 | - if (empty($post_type_arr)) { |
|
342 | - $post_types = $gd_post_types; |
|
343 | - } |
|
344 | - |
|
345 | - $hide_empty = !empty($args['hide_empty']) ? true : false; |
|
346 | - $max_count = strip_tags($args['max_count']); |
|
347 | - $all_childs = $max_count == 'all' ? true : false; |
|
348 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
349 | - $max_level = strip_tags($args['max_level']); |
|
350 | - $show_count = !empty($args['show_count']) ? true : false; |
|
351 | - $hide_icon = !empty($args['hide_icon']) ? true : false; |
|
352 | - $cpt_left = !empty($args['cpt_left']) ? true : false; |
|
353 | - |
|
354 | - if(!$cpt_left){ |
|
355 | - $cpt_left = "gd-cpt-flat"; |
|
356 | - }else{ |
|
357 | - $cpt_left = ''; |
|
358 | - } |
|
359 | - |
|
360 | - $orderby = 'count'; |
|
361 | - $order = 'DESC'; |
|
362 | - if ($sort_by == 'az') { |
|
363 | - $orderby = 'name'; |
|
364 | - $order = 'ASC'; |
|
365 | - } |
|
366 | - |
|
367 | - $output = ''; |
|
368 | - if (!empty($post_types)) { |
|
369 | - foreach ($post_types as $cpt => $cpt_info) { |
|
370 | - $cat_taxonomy = $cpt . 'category'; |
|
371 | - $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
|
372 | - if ($hide_empty) { |
|
373 | - $categories = geodir_filter_empty_terms($categories); |
|
374 | - } |
|
375 | - if ($sort_by == 'count') { |
|
376 | - $categories = geodir_sort_terms($categories, 'count'); |
|
377 | - } |
|
378 | - |
|
379 | - if (!empty($categories)) { |
|
380 | - $term_icons = !$hide_icon ? geodir_get_term_icon() : array(); |
|
381 | - $row_class = ''; |
|
382 | - |
|
383 | - if ($is_listing) { |
|
384 | - $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
|
385 | - } |
|
386 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
387 | - |
|
388 | - if ($is_category) { |
|
389 | - $term_info = get_term($current_term_id, $cat_taxonomy); |
|
390 | - |
|
391 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
|
392 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
393 | - |
|
394 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
395 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
396 | - } else { |
|
397 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
398 | - } |
|
399 | - foreach ($categories as $category) { |
|
400 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
401 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
402 | - |
|
403 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
404 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
405 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
406 | - |
|
407 | - $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
408 | - $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
|
409 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
410 | - $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
411 | - if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
412 | - $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
|
413 | - } |
|
414 | - $cpt_row .= '</li>'; |
|
415 | - $cpt_row .= '</ul>'; |
|
416 | - } |
|
417 | - $cpt_row .= '</ul></div>'; |
|
418 | - |
|
419 | - $output .= $cpt_row; |
|
420 | - } |
|
421 | - } |
|
422 | - } |
|
423 | - return $output; |
|
278 | + $args = wp_parse_args((array)$params, |
|
279 | + array( |
|
280 | + 'title' => '', |
|
281 | + 'post_type' => array(), // NULL for all |
|
282 | + 'hide_empty' => '', |
|
283 | + 'show_count' => '', |
|
284 | + 'hide_icon' => '', |
|
285 | + 'cpt_left' => '', |
|
286 | + 'sort_by' => 'count', |
|
287 | + 'max_count' => 'all', |
|
288 | + 'max_level' => '1', |
|
289 | + ) |
|
290 | + ); |
|
291 | + |
|
292 | + $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count'; |
|
293 | + |
|
294 | + $gd_post_types = geodir_get_posttypes('array'); |
|
295 | + |
|
296 | + $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type']; |
|
297 | + $current_posttype = geodir_get_current_posttype(); |
|
298 | + |
|
299 | + $is_listing = false; |
|
300 | + $is_category = false; |
|
301 | + if (geodir_is_page('listing')) { |
|
302 | + $current_posttype = geodir_get_current_posttype(); |
|
303 | + |
|
304 | + if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
|
305 | + $is_listing = true; |
|
306 | + |
|
307 | + if (is_tax()) { // category page |
|
308 | + $current_term_id = get_queried_object_id(); |
|
309 | + $current_taxonomy = get_query_var('taxonomy'); |
|
310 | + $current_posttype = geodir_get_current_posttype(); |
|
311 | + |
|
312 | + if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
313 | + $is_category = true; |
|
314 | + } |
|
315 | + } |
|
316 | + } |
|
317 | + } |
|
318 | + |
|
319 | + $parent_category = 0; |
|
320 | + if ($is_listing) { |
|
321 | + $post_type_arr = array($current_posttype); |
|
322 | + |
|
323 | + if ($is_category) { |
|
324 | + $parent_category = $current_term_id; |
|
325 | + } |
|
326 | + } |
|
327 | + |
|
328 | + $post_types = array(); |
|
329 | + if (!empty($post_type_arr)) { |
|
330 | + if (in_array('0', $post_type_arr)) { |
|
331 | + $post_types = $gd_post_types; |
|
332 | + } else { |
|
333 | + foreach ($post_type_arr as $cpt) { |
|
334 | + if (isset($gd_post_types[$cpt])) { |
|
335 | + $post_types[$cpt] = $gd_post_types[$cpt]; |
|
336 | + } |
|
337 | + } |
|
338 | + } |
|
339 | + } |
|
340 | + |
|
341 | + if (empty($post_type_arr)) { |
|
342 | + $post_types = $gd_post_types; |
|
343 | + } |
|
344 | + |
|
345 | + $hide_empty = !empty($args['hide_empty']) ? true : false; |
|
346 | + $max_count = strip_tags($args['max_count']); |
|
347 | + $all_childs = $max_count == 'all' ? true : false; |
|
348 | + $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
349 | + $max_level = strip_tags($args['max_level']); |
|
350 | + $show_count = !empty($args['show_count']) ? true : false; |
|
351 | + $hide_icon = !empty($args['hide_icon']) ? true : false; |
|
352 | + $cpt_left = !empty($args['cpt_left']) ? true : false; |
|
353 | + |
|
354 | + if(!$cpt_left){ |
|
355 | + $cpt_left = "gd-cpt-flat"; |
|
356 | + }else{ |
|
357 | + $cpt_left = ''; |
|
358 | + } |
|
359 | + |
|
360 | + $orderby = 'count'; |
|
361 | + $order = 'DESC'; |
|
362 | + if ($sort_by == 'az') { |
|
363 | + $orderby = 'name'; |
|
364 | + $order = 'ASC'; |
|
365 | + } |
|
366 | + |
|
367 | + $output = ''; |
|
368 | + if (!empty($post_types)) { |
|
369 | + foreach ($post_types as $cpt => $cpt_info) { |
|
370 | + $cat_taxonomy = $cpt . 'category'; |
|
371 | + $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
|
372 | + if ($hide_empty) { |
|
373 | + $categories = geodir_filter_empty_terms($categories); |
|
374 | + } |
|
375 | + if ($sort_by == 'count') { |
|
376 | + $categories = geodir_sort_terms($categories, 'count'); |
|
377 | + } |
|
378 | + |
|
379 | + if (!empty($categories)) { |
|
380 | + $term_icons = !$hide_icon ? geodir_get_term_icon() : array(); |
|
381 | + $row_class = ''; |
|
382 | + |
|
383 | + if ($is_listing) { |
|
384 | + $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
|
385 | + } |
|
386 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
387 | + |
|
388 | + if ($is_category) { |
|
389 | + $term_info = get_term($current_term_id, $cat_taxonomy); |
|
390 | + |
|
391 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
|
392 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
393 | + |
|
394 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
395 | + $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
396 | + } else { |
|
397 | + $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
398 | + } |
|
399 | + foreach ($categories as $category) { |
|
400 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
401 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
402 | + |
|
403 | + $term_link = get_term_link( $category, $category->taxonomy ); |
|
404 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
405 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
406 | + |
|
407 | + $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
408 | + $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
|
409 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
410 | + $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
411 | + if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
412 | + $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
|
413 | + } |
|
414 | + $cpt_row .= '</li>'; |
|
415 | + $cpt_row .= '</ul>'; |
|
416 | + } |
|
417 | + $cpt_row .= '</ul></div>'; |
|
418 | + |
|
419 | + $output .= $cpt_row; |
|
420 | + } |
|
421 | + } |
|
422 | + } |
|
423 | + return $output; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -440,49 +440,49 @@ discard block |
||
440 | 440 | * @return string Html content. |
441 | 441 | */ |
442 | 442 | function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) { |
443 | - $cat_taxonomy = $cpt . 'category'; |
|
444 | - |
|
445 | - $orderby = 'count'; |
|
446 | - $order = 'DESC'; |
|
447 | - if ($sort_by == 'az') { |
|
448 | - $orderby = 'name'; |
|
449 | - $order = 'ASC'; |
|
450 | - } |
|
451 | - |
|
452 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
453 | - return ''; |
|
454 | - } |
|
455 | - |
|
456 | - $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count)); |
|
457 | - if ($hide_empty) { |
|
458 | - $child_cats = geodir_filter_empty_terms($child_cats); |
|
459 | - } |
|
460 | - |
|
461 | - if (empty($child_cats)) { |
|
462 | - return ''; |
|
463 | - } |
|
464 | - |
|
465 | - if ($sort_by == 'count') { |
|
466 | - $child_cats = geodir_sort_terms($child_cats, 'count'); |
|
467 | - } |
|
468 | - |
|
469 | - $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
470 | - $depth++; |
|
471 | - foreach ($child_cats as $category) { |
|
472 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
473 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
474 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
475 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
476 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
477 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
478 | - |
|
479 | - $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
|
480 | - $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
481 | - $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
|
482 | - } |
|
483 | - $content .= '</li></ul>'; |
|
484 | - |
|
485 | - return $content; |
|
443 | + $cat_taxonomy = $cpt . 'category'; |
|
444 | + |
|
445 | + $orderby = 'count'; |
|
446 | + $order = 'DESC'; |
|
447 | + if ($sort_by == 'az') { |
|
448 | + $orderby = 'name'; |
|
449 | + $order = 'ASC'; |
|
450 | + } |
|
451 | + |
|
452 | + if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
453 | + return ''; |
|
454 | + } |
|
455 | + |
|
456 | + $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count)); |
|
457 | + if ($hide_empty) { |
|
458 | + $child_cats = geodir_filter_empty_terms($child_cats); |
|
459 | + } |
|
460 | + |
|
461 | + if (empty($child_cats)) { |
|
462 | + return ''; |
|
463 | + } |
|
464 | + |
|
465 | + if ($sort_by == 'count') { |
|
466 | + $child_cats = geodir_sort_terms($child_cats, 'count'); |
|
467 | + } |
|
468 | + |
|
469 | + $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
470 | + $depth++; |
|
471 | + foreach ($child_cats as $category) { |
|
472 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
473 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
474 | + $term_link = get_term_link( $category, $category->taxonomy ); |
|
475 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
476 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
477 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
478 | + |
|
479 | + $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
|
480 | + $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
481 | + $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
|
482 | + } |
|
483 | + $content .= '</li></ul>'; |
|
484 | + |
|
485 | + return $content; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | /** |
@@ -494,16 +494,16 @@ discard block |
||
494 | 494 | * @return array Terms. |
495 | 495 | */ |
496 | 496 | function geodir_filter_empty_terms($terms) { |
497 | - if (empty($terms)) { |
|
498 | - return $terms; |
|
499 | - } |
|
500 | - |
|
501 | - $return = array(); |
|
502 | - foreach ($terms as $term) { |
|
503 | - if (isset($term->count) && $term->count > 0) { |
|
504 | - $return[] = $term; |
|
505 | - } |
|
506 | - } |
|
507 | - return $return; |
|
497 | + if (empty($terms)) { |
|
498 | + return $terms; |
|
499 | + } |
|
500 | + |
|
501 | + $return = array(); |
|
502 | + foreach ($terms as $term) { |
|
503 | + if (isset($term->count) && $term->count > 0) { |
|
504 | + $return[] = $term; |
|
505 | + } |
|
506 | + } |
|
507 | + return $return; |
|
508 | 508 | } |
509 | 509 | ?> |
510 | 510 | \ No newline at end of file |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | |
92 | 92 | //widgetform in backend |
93 | - $instance = wp_parse_args((array)$instance, |
|
93 | + $instance = wp_parse_args((array) $instance, |
|
94 | 94 | array('title' => '', |
95 | 95 | 'post_type' => '', |
96 | 96 | 'category' => '', |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | ?> |
147 | 147 | |
148 | 148 | <p> |
149 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
149 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
150 | 150 | |
151 | 151 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
152 | 152 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | <p> |
158 | 158 | <label |
159 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
159 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
160 | 160 | |
161 | 161 | <?php $postypes = geodir_get_posttypes(); ?> |
162 | 162 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | <p> |
182 | 182 | <label |
183 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
183 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
184 | 184 | |
185 | 185 | <?php |
186 | 186 | $category_taxonomy = geodir_get_taxonomies('gd_place'); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | </p> |
218 | 218 | <p> |
219 | 219 | <label |
220 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory');?> |
|
220 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory'); ?> |
|
221 | 221 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
222 | 222 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
223 | 223 | value="<?php echo esc_attr($post_number); ?>"/> |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | <p> |
228 | 228 | <label |
229 | - for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory');?> |
|
229 | + for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory'); ?> |
|
230 | 230 | <input class="widefat" id="<?php echo $this->get_field_id('max_show'); ?>" |
231 | 231 | name="<?php echo $this->get_field_name('max_show'); ?>" type="text" |
232 | 232 | value="<?php echo esc_attr($max_show); ?>"/> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | <p> |
237 | 237 | <label |
238 | - for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory');?> |
|
238 | + for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory'); ?> |
|
239 | 239 | <input class="widefat" id="<?php echo $this->get_field_id('slide_width'); ?>" |
240 | 240 | name="<?php echo $this->get_field_name('slide_width'); ?>" type="text" |
241 | 241 | value="<?php echo esc_attr($slide_width); ?>"/> |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | <p> |
246 | 246 | <label |
247 | - for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory');?> |
|
247 | + for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory'); ?> |
|
248 | 248 | |
249 | 249 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>" |
250 | 250 | name="<?php echo $this->get_field_name('animation'); ?>"> |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | <p> |
264 | 264 | <label |
265 | - for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory');?> |
|
265 | + for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory'); ?> |
|
266 | 266 | |
267 | 267 | <input class="widefat" id="<?php echo $this->get_field_id('slideshowSpeed'); ?>" |
268 | 268 | name="<?php echo $this->get_field_name('slideshowSpeed'); ?>" type="text" |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | <p> |
274 | 274 | <label |
275 | - for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory');?> |
|
275 | + for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory'); ?> |
|
276 | 276 | |
277 | 277 | <input class="widefat" id="<?php echo $this->get_field_id('animationSpeed'); ?>" |
278 | 278 | name="<?php echo $this->get_field_name('animationSpeed'); ?>" type="text" |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | <p> |
284 | 284 | <label |
285 | - for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?> |
|
285 | + for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory'); ?> |
|
286 | 286 | |
287 | 287 | <input type="checkbox" <?php if ($slideshow) { |
288 | 288 | echo 'checked="checked"'; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | <p> |
296 | 296 | <label |
297 | - for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?> |
|
297 | + for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory'); ?> |
|
298 | 298 | |
299 | 299 | <input type="checkbox" <?php if ($animationLoop) { |
300 | 300 | echo 'checked="checked"'; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | <p> |
308 | 308 | <label |
309 | - for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?> |
|
309 | + for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory'); ?> |
|
310 | 310 | |
311 | 311 | <input type="checkbox" <?php if ($directionNav) { |
312 | 312 | echo 'checked="checked"'; |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | <p> |
321 | 321 | <label |
322 | - for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?> |
|
322 | + for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory'); ?> |
|
323 | 323 | |
324 | 324 | <input type="checkbox" <?php if ($show_title) { |
325 | 325 | echo 'checked="checked"'; |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | |
354 | 354 | } |
355 | 355 | |
356 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
356 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
357 | 357 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
358 | 358 | |
359 | - geodir_change_category_list(post_type, '<?php echo $category;?>'); |
|
359 | + geodir_change_category_list(post_type, '<?php echo $category; ?>'); |
|
360 | 360 | <?php } ?> |
361 | 361 | |
362 | 362 | </script> |
@@ -332,7 +332,10 @@ |
||
332 | 332 | <label |
333 | 333 | for="<?php echo $this->get_field_id('show_featured_only'); ?>"><?php _e('Show only featured listings:', 'geodirectory'); ?> |
334 | 334 | <input type="checkbox" id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
335 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
335 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
336 | + echo 'checked="checked"'; |
|
337 | +} |
|
338 | +?> |
|
336 | 339 | value="1"/> |
337 | 340 | </label> |
338 | 341 | </p> |
@@ -15,40 +15,40 @@ discard block |
||
15 | 15 | class geodir_listing_slider_widget extends WP_Widget |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * Register the listing slider widget. |
20 | 20 | * |
21 | 21 | * @since 1.0.0 |
22 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
23 | 23 | */ |
24 | - public function __construct() { |
|
25 | - $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory')); |
|
26 | - parent::__construct( |
|
27 | - 'listing_slider_view', // Base ID |
|
28 | - __('GD > Listing Slider', 'geodirectory'), // Name |
|
29 | - $widget_ops// Args |
|
30 | - ); |
|
31 | - } |
|
24 | + public function __construct() { |
|
25 | + $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory')); |
|
26 | + parent::__construct( |
|
27 | + 'listing_slider_view', // Base ID |
|
28 | + __('GD > Listing Slider', 'geodirectory'), // Name |
|
29 | + $widget_ops// Args |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Front-end display content for listing slider widget. |
35 | 35 | * |
36 | 36 | * @since 1.0.0 |
37 | - * @since 1.5.1 Declare function public. |
|
37 | + * @since 1.5.1 Declare function public. |
|
38 | 38 | * |
39 | 39 | * @param array $args Widget arguments. |
40 | 40 | * @param array $instance Saved values from database. |
41 | 41 | */ |
42 | - public function widget($args, $instance) |
|
43 | - { |
|
44 | - geodir_listing_slider_widget_output($args, $instance); |
|
45 | - } |
|
42 | + public function widget($args, $instance) |
|
43 | + { |
|
44 | + geodir_listing_slider_widget_output($args, $instance); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Sanitize listing slider widget form values as they are saved. |
49 | 49 | * |
50 | 50 | * @since 1.0.0 |
51 | - * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Declare function public. |
|
52 | 52 | * |
53 | 53 | * @param array $new_instance Values just sent to be saved. |
54 | 54 | * @param array $old_instance Previously saved values from database. |
@@ -56,94 +56,94 @@ discard block |
||
56 | 56 | * @return array Updated safe values to be saved. |
57 | 57 | */ |
58 | 58 | public function update($new_instance, $old_instance) |
59 | - { |
|
60 | - //save the widget |
|
61 | - $instance = $old_instance; |
|
62 | - $instance['title'] = strip_tags($new_instance['title']); |
|
63 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
64 | - $instance['category'] = strip_tags($new_instance['category']); |
|
65 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
66 | - $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
67 | - $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
68 | - $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
69 | - $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
70 | - $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
71 | - $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
72 | - $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
73 | - $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
74 | - $instance['animation'] = $new_instance['animation']; |
|
75 | - $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
76 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
77 | - |
|
78 | - return $instance; |
|
79 | - } |
|
59 | + { |
|
60 | + //save the widget |
|
61 | + $instance = $old_instance; |
|
62 | + $instance['title'] = strip_tags($new_instance['title']); |
|
63 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
64 | + $instance['category'] = strip_tags($new_instance['category']); |
|
65 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
66 | + $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
67 | + $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
68 | + $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
69 | + $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
70 | + $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
71 | + $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
72 | + $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
73 | + $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
74 | + $instance['animation'] = $new_instance['animation']; |
|
75 | + $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
76 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
77 | + |
|
78 | + return $instance; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Back-end listing slider widget settings form. |
83 | 83 | * |
84 | 84 | * @since 1.0.0 |
85 | - * @since 1.5.1 Declare function public. |
|
85 | + * @since 1.5.1 Declare function public. |
|
86 | 86 | * |
87 | 87 | * @param array $instance Previously saved values from database. |
88 | 88 | */ |
89 | 89 | public function form($instance) |
90 | - { |
|
90 | + { |
|
91 | 91 | |
92 | - //widgetform in backend |
|
93 | - $instance = wp_parse_args((array)$instance, |
|
94 | - array('title' => '', |
|
95 | - 'post_type' => '', |
|
96 | - 'category' => '', |
|
97 | - 'post_number' => '5', |
|
98 | - 'max_show' => '1', |
|
99 | - 'slide_width' => '', |
|
100 | - 'show_title' => '', |
|
101 | - 'slideshow' => '', |
|
102 | - 'animationLoop' => '', |
|
103 | - 'directionNav' => '', |
|
104 | - 'slideshowSpeed' => 5000, |
|
105 | - 'animationSpeed' => 600, |
|
106 | - 'animation' => '', |
|
107 | - 'list_sort' => 'latest', |
|
108 | - 'show_featured_only' => '', |
|
109 | - ) |
|
110 | - ); |
|
92 | + //widgetform in backend |
|
93 | + $instance = wp_parse_args((array)$instance, |
|
94 | + array('title' => '', |
|
95 | + 'post_type' => '', |
|
96 | + 'category' => '', |
|
97 | + 'post_number' => '5', |
|
98 | + 'max_show' => '1', |
|
99 | + 'slide_width' => '', |
|
100 | + 'show_title' => '', |
|
101 | + 'slideshow' => '', |
|
102 | + 'animationLoop' => '', |
|
103 | + 'directionNav' => '', |
|
104 | + 'slideshowSpeed' => 5000, |
|
105 | + 'animationSpeed' => 600, |
|
106 | + 'animation' => '', |
|
107 | + 'list_sort' => 'latest', |
|
108 | + 'show_featured_only' => '', |
|
109 | + ) |
|
110 | + ); |
|
111 | 111 | |
112 | - $title = strip_tags($instance['title']); |
|
112 | + $title = strip_tags($instance['title']); |
|
113 | 113 | |
114 | - $post_type = strip_tags($instance['post_type']); |
|
114 | + $post_type = strip_tags($instance['post_type']); |
|
115 | 115 | |
116 | - $category = strip_tags($instance['category']); |
|
116 | + $category = strip_tags($instance['category']); |
|
117 | 117 | |
118 | - $post_number = strip_tags($instance['post_number']); |
|
118 | + $post_number = strip_tags($instance['post_number']); |
|
119 | 119 | |
120 | - $max_show = strip_tags($instance['max_show']); |
|
120 | + $max_show = strip_tags($instance['max_show']); |
|
121 | 121 | |
122 | - $slide_width = strip_tags($instance['slide_width']); |
|
122 | + $slide_width = strip_tags($instance['slide_width']); |
|
123 | 123 | |
124 | - $show_title = $instance['show_title']; |
|
124 | + $show_title = $instance['show_title']; |
|
125 | 125 | |
126 | - $slideshow = $instance['slideshow']; |
|
126 | + $slideshow = $instance['slideshow']; |
|
127 | 127 | |
128 | - $animationLoop = $instance['animationLoop']; |
|
128 | + $animationLoop = $instance['animationLoop']; |
|
129 | 129 | |
130 | - $directionNav = $instance['directionNav']; |
|
130 | + $directionNav = $instance['directionNav']; |
|
131 | 131 | |
132 | - $slideshowSpeed = $instance['slideshowSpeed']; |
|
132 | + $slideshowSpeed = $instance['slideshowSpeed']; |
|
133 | 133 | |
134 | - $animationSpeed = $instance['animationSpeed']; |
|
134 | + $animationSpeed = $instance['animationSpeed']; |
|
135 | 135 | |
136 | - $animation = $instance['animation']; |
|
137 | - $list_sort = $instance['list_sort']; |
|
138 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
136 | + $animation = $instance['animation']; |
|
137 | + $list_sort = $instance['list_sort']; |
|
138 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
139 | 139 | |
140 | - $sort_fields = array(); |
|
141 | - $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory')); |
|
142 | - $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory')); |
|
143 | - $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory')); |
|
144 | - $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory')); |
|
145 | - $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory')); |
|
146 | - ?> |
|
140 | + $sort_fields = array(); |
|
141 | + $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory')); |
|
142 | + $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory')); |
|
143 | + $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory')); |
|
144 | + $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory')); |
|
145 | + $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory')); |
|
146 | + ?> |
|
147 | 147 | |
148 | 148 | <p> |
149 | 149 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | <?php foreach ($postypes as $postypes_obj) { ?> |
168 | 168 | |
169 | 169 | <option <?php if ($post_type == $postypes_obj) { |
170 | - echo 'selected="selected"'; |
|
171 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
172 | - echo ucfirst($extvalue[1]); ?></option> |
|
170 | + echo 'selected="selected"'; |
|
171 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
172 | + echo ucfirst($extvalue[1]); ?></option> |
|
173 | 173 | |
174 | 174 | <?php } ?> |
175 | 175 | |
@@ -183,20 +183,20 @@ discard block |
||
183 | 183 | for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
184 | 184 | |
185 | 185 | <?php |
186 | - $category_taxonomy = geodir_get_taxonomies('gd_place'); |
|
187 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
188 | - ?> |
|
186 | + $category_taxonomy = geodir_get_taxonomies('gd_place'); |
|
187 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
188 | + ?> |
|
189 | 189 | |
190 | 190 | <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" |
191 | 191 | name="<?php echo $this->get_field_name('category'); ?>"> |
192 | 192 | <option <?php if ($category == '0') { |
193 | - echo 'selected="selected"'; |
|
194 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
193 | + echo 'selected="selected"'; |
|
194 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
195 | 195 | <?php foreach ($categories as $category_obj) { ?> |
196 | 196 | |
197 | 197 | <option <?php if ($category == $category_obj->term_id) { |
198 | - echo 'selected="selected"'; |
|
199 | - } ?> |
|
198 | + echo 'selected="selected"'; |
|
199 | + } ?> |
|
200 | 200 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
201 | 201 | |
202 | 202 | <?php } ?> |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>" |
250 | 250 | name="<?php echo $this->get_field_name('animation'); ?>"> |
251 | 251 | <option <?php if ($animation == 'slide') { |
252 | - echo 'selected="selected"'; |
|
253 | - } ?> value="slide">Slide |
|
252 | + echo 'selected="selected"'; |
|
253 | + } ?> value="slide">Slide |
|
254 | 254 | </option> |
255 | 255 | <option <?php if ($animation == 'fade') { |
256 | - echo 'selected="selected"'; |
|
257 | - } ?> value="fade">Fade |
|
256 | + echo 'selected="selected"'; |
|
257 | + } ?> value="fade">Fade |
|
258 | 258 | </option> |
259 | 259 | </select> |
260 | 260 | </label> |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?> |
286 | 286 | |
287 | 287 | <input type="checkbox" <?php if ($slideshow) { |
288 | - echo 'checked="checked"'; |
|
289 | - } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1" |
|
288 | + echo 'checked="checked"'; |
|
289 | + } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1" |
|
290 | 290 | name="<?php echo $this->get_field_name('slideshow'); ?>"/> |
291 | 291 | |
292 | 292 | </label> |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?> |
298 | 298 | |
299 | 299 | <input type="checkbox" <?php if ($animationLoop) { |
300 | - echo 'checked="checked"'; |
|
301 | - } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1" |
|
300 | + echo 'checked="checked"'; |
|
301 | + } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1" |
|
302 | 302 | name="<?php echo $this->get_field_name('animationLoop'); ?>"/> |
303 | 303 | |
304 | 304 | </label> |
@@ -309,8 +309,8 @@ discard block |
||
309 | 309 | for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?> |
310 | 310 | |
311 | 311 | <input type="checkbox" <?php if ($directionNav) { |
312 | - echo 'checked="checked"'; |
|
313 | - } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1" |
|
312 | + echo 'checked="checked"'; |
|
313 | + } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1" |
|
314 | 314 | name="<?php echo $this->get_field_name('directionNav'); ?>"/> |
315 | 315 | |
316 | 316 | </label> |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?> |
323 | 323 | |
324 | 324 | <input type="checkbox" <?php if ($show_title) { |
325 | - echo 'checked="checked"'; |
|
326 | - } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1" |
|
325 | + echo 'checked="checked"'; |
|
326 | + } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1" |
|
327 | 327 | name="<?php echo $this->get_field_name('show_title'); ?>"/> |
328 | 328 | |
329 | 329 | </label> |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | |
364 | 364 | |
365 | 365 | <?php |
366 | - } |
|
366 | + } |
|
367 | 367 | } // class geodir_listing_slider_widget |
368 | 368 | |
369 | 369 | register_widget('geodir_listing_slider_widget'); |
370 | 370 | \ No newline at end of file |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | //save the widget |
61 | 61 | $instance = $old_instance; |
62 | 62 | $instance['title'] = strip_tags($new_instance['title']); |
63 | - $category_limit = (int)$new_instance['category_limit']; |
|
63 | + $category_limit = (int) $new_instance['category_limit']; |
|
64 | 64 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
65 | 65 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
66 | 66 | return $instance; |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | public function form($instance) |
79 | 79 | { |
80 | 80 | //widgetform in backend |
81 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '')); |
|
81 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '')); |
|
82 | 82 | |
83 | 83 | $title = strip_tags($instance['title']); |
84 | - $category_limit = (int)$instance['category_limit']; |
|
84 | + $category_limit = (int) $instance['category_limit']; |
|
85 | 85 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
86 | 86 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
87 | 87 | |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | </p> |
97 | 97 | <p> |
98 | 98 | <label for="<?php echo $this->get_field_id('post_type'); ?>"> |
99 | - <?php _e('Default post type to use (if not set by page)', 'geodirectory');?> |
|
99 | + <?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?> |
|
100 | 100 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>"> |
101 | 101 | <?php foreach ($post_type_options as $name => $title) { ?> |
102 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
102 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
103 | 103 | <?php } ?> |
104 | 104 | </select> |
105 | 105 | </label> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?> |
110 | 110 | <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" |
111 | 111 | name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" |
112 | - value="<?php echo (int)esc_attr($category_limit); ?>"/> |
|
112 | + value="<?php echo (int) esc_attr($category_limit); ?>"/> |
|
113 | 113 | |
114 | 114 | <p class="description" |
115 | 115 | 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> |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | public function form($instance) |
216 | 216 | { |
217 | 217 | //widgetform in backend |
218 | - $instance = wp_parse_args((array)$instance, |
|
218 | + $instance = wp_parse_args((array) $instance, |
|
219 | 219 | array('title' => '', |
220 | 220 | 'post_type' => '', |
221 | 221 | 'category' => array(), |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | ?> |
267 | 267 | |
268 | 268 | <p> |
269 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
269 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
270 | 270 | <small>(%posttype_singular_label% , |
271 | - %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>) |
|
271 | + %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>) |
|
272 | 272 | </small> |
273 | 273 | |
274 | 274 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | <p> |
281 | 281 | <label |
282 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
282 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
283 | 283 | |
284 | 284 | <?php $postypes = geodir_get_posttypes(); |
285 | 285 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | <p id="post_type_cats"> |
313 | 313 | <label |
314 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
314 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
315 | 315 | |
316 | 316 | <?php |
317 | 317 | |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | |
351 | 351 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
352 | 352 | id="<?php echo $this->get_field_id('category_title'); ?>" |
353 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
353 | + value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/> |
|
354 | 354 | |
355 | 355 | </label> |
356 | 356 | </p> |
357 | 357 | |
358 | 358 | <p> |
359 | 359 | <label |
360 | - for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
360 | + for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
361 | 361 | |
362 | 362 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
363 | 363 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | <p> |
394 | 394 | |
395 | 395 | <label |
396 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
396 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
397 | 397 | |
398 | 398 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
399 | 399 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | <p> |
405 | 405 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
406 | - <?php _e('Layout:', 'geodirectory');?> |
|
406 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
407 | 407 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
408 | 408 | name="<?php echo $this->get_field_name('layout'); ?>"> |
409 | 409 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | |
433 | 433 | <p> |
434 | 434 | <label |
435 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
435 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
436 | 436 | |
437 | 437 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
438 | 438 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | <p> |
444 | 444 | <label |
445 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
445 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
446 | 446 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
447 | 447 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
448 | 448 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -451,41 +451,41 @@ discard block |
||
451 | 451 | |
452 | 452 | <p> |
453 | 453 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
454 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
454 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
455 | 455 | <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"';?> |
|
456 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
457 | 457 | value="1"/> |
458 | 458 | </label> |
459 | 459 | </p> |
460 | 460 | <p> |
461 | 461 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
462 | - <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
|
462 | + <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" |
|
463 | 463 | 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"';?> |
|
464 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
465 | 465 | value="1"/> |
466 | 466 | </label> |
467 | 467 | </p> |
468 | 468 | <p> |
469 | 469 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
470 | - <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
|
470 | + <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox" |
|
471 | 471 | 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"';?> |
|
472 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?> |
|
473 | 473 | value="1"/> |
474 | 474 | </label> |
475 | 475 | </p> |
476 | 476 | <p> |
477 | 477 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
478 | - <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
|
478 | + <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox" |
|
479 | 479 | 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"';?> |
|
480 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?> |
|
481 | 481 | value="1"/> |
482 | 482 | </label> |
483 | 483 | </p> |
484 | 484 | <p> |
485 | 485 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
486 | - <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
|
486 | + <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox" |
|
487 | 487 | 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"';?> |
|
488 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?> |
|
489 | 489 | value="1"/> |
490 | 490 | </label> |
491 | 491 | </p> |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | } |
533 | 533 | |
534 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
534 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
535 | 535 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
536 | 536 | |
537 | 537 | <?php } ?> |
@@ -14,41 +14,41 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_popular_post_category extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * Register the popular post category 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_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 | - } |
|
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 | 31 | |
32 | 32 | /** |
33 | 33 | * Front-end display content for popular post category 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 | - geodir_popular_post_category_output($args, $instance); |
|
44 | - } |
|
42 | + { |
|
43 | + geodir_popular_post_category_output($args, $instance); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Sanitize popular post category widget form values as they are saved. |
48 | 48 | * |
49 | 49 | * @since 1.0.0 |
50 | - * @since 1.5.1 Declare function public. |
|
51 | - * @since 1.5.1 Added default_post_type parameter. |
|
50 | + * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Added default_post_type parameter. |
|
52 | 52 | * |
53 | 53 | * @param array $new_instance Values just sent to be saved. |
54 | 54 | * @param array $old_instance Previously saved values from database. |
@@ -56,37 +56,37 @@ discard block |
||
56 | 56 | * @return array Updated safe values to be saved. |
57 | 57 | */ |
58 | 58 | public function update($new_instance, $old_instance) |
59 | - { |
|
60 | - //save the widget |
|
61 | - $instance = $old_instance; |
|
62 | - $instance['title'] = strip_tags($new_instance['title']); |
|
63 | - $category_limit = (int)$new_instance['category_limit']; |
|
64 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
59 | + { |
|
60 | + //save the widget |
|
61 | + $instance = $old_instance; |
|
62 | + $instance['title'] = strip_tags($new_instance['title']); |
|
63 | + $category_limit = (int)$new_instance['category_limit']; |
|
64 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
65 | 65 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
66 | - return $instance; |
|
67 | - } |
|
66 | + return $instance; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Back-end popular post category widget settings form. |
71 | 71 | * |
72 | 72 | * @since 1.0.0 |
73 | - * @since 1.5.1 Declare function public. |
|
74 | - * @since 1.5.1 Added option to set default post type. |
|
73 | + * @since 1.5.1 Declare function public. |
|
74 | + * @since 1.5.1 Added option to set default post type. |
|
75 | 75 | * |
76 | 76 | * @param array $instance Previously saved values from database. |
77 | 77 | */ |
78 | 78 | public function form($instance) |
79 | - { |
|
80 | - //widgetform in backend |
|
81 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '')); |
|
79 | + { |
|
80 | + //widgetform in backend |
|
81 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '')); |
|
82 | 82 | |
83 | - $title = strip_tags($instance['title']); |
|
84 | - $category_limit = (int)$instance['category_limit']; |
|
85 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
83 | + $title = strip_tags($instance['title']); |
|
84 | + $category_limit = (int)$instance['category_limit']; |
|
85 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
86 | 86 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
87 | 87 | |
88 | 88 | $post_type_options = geodir_get_posttypes('options'); |
89 | - ?> |
|
89 | + ?> |
|
90 | 90 | <p> |
91 | 91 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
92 | 92 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | </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,99 +171,99 @@ 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 | - |
|
204 | - return $instance; |
|
205 | - } |
|
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 | + |
|
204 | + return $instance; |
|
205 | + } |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Back-end popular posts widget settings form. |
209 | 209 | * |
210 | 210 | * @since 1.0.0 |
211 | - * @since 1.5.1 Declare function public. |
|
211 | + * @since 1.5.1 Declare function public. |
|
212 | 212 | * |
213 | 213 | * @param array $instance Previously saved values from database. |
214 | 214 | */ |
215 | 215 | public function form($instance) |
216 | - { |
|
217 | - //widgetform in backend |
|
218 | - $instance = wp_parse_args((array)$instance, |
|
219 | - array('title' => '', |
|
220 | - 'post_type' => '', |
|
221 | - 'category' => array(), |
|
222 | - 'category_title' => '', |
|
223 | - 'list_sort' => '', |
|
224 | - 'list_order' => '', |
|
225 | - 'post_number' => '5', |
|
226 | - 'layout' => 'gridview_onehalf', |
|
227 | - 'listing_width' => '', |
|
228 | - 'add_location_filter' => '1', |
|
229 | - 'character_count' => '20', |
|
230 | - 'show_featured_only' => '', |
|
231 | - 'show_special_only' => '', |
|
232 | - 'with_pics_only' => '', |
|
233 | - 'with_videos_only' => '', |
|
234 | - 'use_viewing_post_type' => '' |
|
235 | - ) |
|
236 | - ); |
|
216 | + { |
|
217 | + //widgetform in backend |
|
218 | + $instance = wp_parse_args((array)$instance, |
|
219 | + array('title' => '', |
|
220 | + 'post_type' => '', |
|
221 | + 'category' => array(), |
|
222 | + 'category_title' => '', |
|
223 | + 'list_sort' => '', |
|
224 | + 'list_order' => '', |
|
225 | + 'post_number' => '5', |
|
226 | + 'layout' => 'gridview_onehalf', |
|
227 | + 'listing_width' => '', |
|
228 | + 'add_location_filter' => '1', |
|
229 | + 'character_count' => '20', |
|
230 | + 'show_featured_only' => '', |
|
231 | + 'show_special_only' => '', |
|
232 | + 'with_pics_only' => '', |
|
233 | + 'with_videos_only' => '', |
|
234 | + 'use_viewing_post_type' => '' |
|
235 | + ) |
|
236 | + ); |
|
237 | 237 | |
238 | - $title = strip_tags($instance['title']); |
|
238 | + $title = strip_tags($instance['title']); |
|
239 | 239 | |
240 | - $post_type = strip_tags($instance['post_type']); |
|
240 | + $post_type = strip_tags($instance['post_type']); |
|
241 | 241 | |
242 | - $category = $instance['category']; |
|
242 | + $category = $instance['category']; |
|
243 | 243 | |
244 | - $category_title = strip_tags($instance['category_title']); |
|
244 | + $category_title = strip_tags($instance['category_title']); |
|
245 | 245 | |
246 | - $list_sort = strip_tags($instance['list_sort']); |
|
246 | + $list_sort = strip_tags($instance['list_sort']); |
|
247 | 247 | |
248 | - $list_order = strip_tags($instance['list_order']); |
|
248 | + $list_order = strip_tags($instance['list_order']); |
|
249 | 249 | |
250 | - $post_number = strip_tags($instance['post_number']); |
|
250 | + $post_number = strip_tags($instance['post_number']); |
|
251 | 251 | |
252 | - $layout = strip_tags($instance['layout']); |
|
252 | + $layout = strip_tags($instance['layout']); |
|
253 | 253 | |
254 | - $listing_width = strip_tags($instance['listing_width']); |
|
254 | + $listing_width = strip_tags($instance['listing_width']); |
|
255 | 255 | |
256 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
256 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
257 | 257 | |
258 | - $character_count = $instance['character_count']; |
|
258 | + $character_count = $instance['character_count']; |
|
259 | 259 | |
260 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
261 | - $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
262 | - $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
263 | - $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
264 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
260 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
261 | + $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
262 | + $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
263 | + $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
264 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
265 | 265 | |
266 | - ?> |
|
266 | + ?> |
|
267 | 267 | |
268 | 268 | <p> |
269 | 269 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | <?php foreach ($postypes as $postypes_obj) { ?> |
299 | 299 | |
300 | 300 | <option <?php if ($post_type == $postypes_obj) { |
301 | - echo 'selected="selected"'; |
|
302 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
303 | - echo ucfirst($extvalue[1]); ?></option> |
|
301 | + echo 'selected="selected"'; |
|
302 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
303 | + echo ucfirst($extvalue[1]); ?></option> |
|
304 | 304 | |
305 | 305 | <?php } ?> |
306 | 306 | |
@@ -315,30 +315,30 @@ discard block |
||
315 | 315 | |
316 | 316 | <?php |
317 | 317 | |
318 | - $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
318 | + $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
319 | 319 | |
320 | - $all_postypes = geodir_get_posttypes(); |
|
320 | + $all_postypes = geodir_get_posttypes(); |
|
321 | 321 | |
322 | - if (!in_array($post_type, $all_postypes)) |
|
323 | - $post_type = 'gd_place'; |
|
322 | + if (!in_array($post_type, $all_postypes)) |
|
323 | + $post_type = 'gd_place'; |
|
324 | 324 | |
325 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
326 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
325 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
326 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
327 | 327 | |
328 | - ?> |
|
328 | + ?> |
|
329 | 329 | |
330 | 330 | <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]" |
331 | 331 | onchange="geodir_popular_widget_cat_title(this)"> |
332 | 332 | |
333 | 333 | <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) { |
334 | - echo 'selected="selected"'; |
|
335 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
334 | + echo 'selected="selected"'; |
|
335 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
336 | 336 | <?php foreach ($categories as $category_obj) { |
337 | - $selected = ''; |
|
338 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
339 | - echo $selected = 'selected="selected"'; |
|
337 | + $selected = ''; |
|
338 | + if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
339 | + echo $selected = 'selected="selected"'; |
|
340 | 340 | |
341 | - ?> |
|
341 | + ?> |
|
342 | 342 | |
343 | 343 | <option <?php echo $selected; ?> |
344 | 344 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
@@ -363,28 +363,28 @@ discard block |
||
363 | 363 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
364 | 364 | |
365 | 365 | <option <?php if ($list_sort == 'az') { |
366 | - echo 'selected="selected"'; |
|
367 | - } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option> |
|
366 | + echo 'selected="selected"'; |
|
367 | + } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option> |
|
368 | 368 | |
369 | 369 | <option <?php if ($list_sort == 'latest') { |
370 | - echo 'selected="selected"'; |
|
371 | - } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
370 | + echo 'selected="selected"'; |
|
371 | + } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
372 | 372 | |
373 | 373 | <option <?php if ($list_sort == 'featured') { |
374 | - echo 'selected="selected"'; |
|
375 | - } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
374 | + echo 'selected="selected"'; |
|
375 | + } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
376 | 376 | |
377 | 377 | <option <?php if ($list_sort == 'high_review') { |
378 | - echo 'selected="selected"'; |
|
379 | - } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
378 | + echo 'selected="selected"'; |
|
379 | + } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
380 | 380 | |
381 | 381 | <option <?php if ($list_sort == 'high_rating') { |
382 | - echo 'selected="selected"'; |
|
383 | - } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
382 | + echo 'selected="selected"'; |
|
383 | + } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
384 | 384 | |
385 | 385 | <option <?php if ($list_sort == 'random') { |
386 | - echo 'selected="selected"'; |
|
387 | - } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
386 | + echo 'selected="selected"'; |
|
387 | + } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
388 | 388 | |
389 | 389 | </select> |
390 | 390 | </label> |
@@ -407,24 +407,24 @@ discard block |
||
407 | 407 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
408 | 408 | name="<?php echo $this->get_field_name('layout'); ?>"> |
409 | 409 | <option <?php if ($layout == 'gridview_onehalf') { |
410 | - echo 'selected="selected"'; |
|
411 | - } ?> |
|
410 | + echo 'selected="selected"'; |
|
411 | + } ?> |
|
412 | 412 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
413 | 413 | <option <?php if ($layout == 'gridview_onethird') { |
414 | - echo 'selected="selected"'; |
|
415 | - } ?> |
|
414 | + echo 'selected="selected"'; |
|
415 | + } ?> |
|
416 | 416 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
417 | 417 | <option <?php if ($layout == 'gridview_onefourth') { |
418 | - echo 'selected="selected"'; |
|
419 | - } ?> |
|
418 | + echo 'selected="selected"'; |
|
419 | + } ?> |
|
420 | 420 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
421 | 421 | <option <?php if ($layout == 'gridview_onefifth') { |
422 | - echo 'selected="selected"'; |
|
423 | - } ?> |
|
422 | + echo 'selected="selected"'; |
|
423 | + } ?> |
|
424 | 424 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
425 | 425 | <option <?php if ($layout == 'list') { |
426 | - echo 'selected="selected"'; |
|
427 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
426 | + echo 'selected="selected"'; |
|
427 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
428 | 428 | |
429 | 429 | </select> |
430 | 430 | </label> |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
495 | 495 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
496 | 496 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
497 | - echo 'checked="checked"'; |
|
498 | - } ?> value="1"/> |
|
497 | + echo 'checked="checked"'; |
|
498 | + } ?> value="1"/> |
|
499 | 499 | </label> |
500 | 500 | </p> |
501 | 501 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | </script> |
540 | 540 | |
541 | 541 | <?php |
542 | - } |
|
542 | + } |
|
543 | 543 | } // class geodir_popular_postview |
544 | 544 | |
545 | 545 | register_widget('geodir_popular_postview'); |
546 | 546 | \ 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> |
@@ -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" |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | </p> |
179 | 179 | <p> |
180 | 180 | <label |
181 | - for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
181 | + for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
182 | 182 | |
183 | 183 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
184 | 184 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | </p> |
209 | 209 | <p> |
210 | 210 | <label |
211 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
211 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
212 | 212 | |
213 | 213 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
214 | 214 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | </p> |
218 | 218 | <p> |
219 | 219 | <label for="<?php echo $this->get_field_id('relate_to'); ?>"> |
220 | - <?php _e('Relate to:', 'geodirectory');?> |
|
220 | + <?php _e('Relate to:', 'geodirectory'); ?> |
|
221 | 221 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
222 | 222 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
223 | 223 | <option <?php if ($relate_to == 'category') { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | <p> |
233 | 233 | <p> |
234 | 234 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
235 | - <?php _e('Layout:', 'geodirectory');?> |
|
235 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
236 | 236 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
237 | 237 | name="<?php echo $this->get_field_name('layout'); ?>"> |
238 | 238 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | </p> |
261 | 261 | <p> |
262 | 262 | <label |
263 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
263 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
264 | 264 | |
265 | 265 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
266 | 266 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | </p> |
270 | 270 | <p> |
271 | 271 | <label |
272 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
272 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
273 | 273 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
274 | 274 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
275 | 275 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | </p> |
278 | 278 | <p> |
279 | 279 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
280 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
280 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
281 | 281 | <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"';?> |
|
282 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
283 | 283 | value="1"/> |
284 | 284 | </label> |
285 | 285 | </p> |
@@ -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> |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * GeoDirectory Related Listing Widget |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * |
|
7 | - * @package GeoDirectory |
|
8 | - */ |
|
3 | + * GeoDirectory Related Listing Widget |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * |
|
7 | + * @package GeoDirectory |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * GeoDirectory related listing widget class. |
@@ -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 | |
@@ -184,24 +184,24 @@ discard block |
||
184 | 184 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
185 | 185 | |
186 | 186 | <option <?php if ($list_sort == 'latest') { |
187 | - echo 'selected="selected"'; |
|
188 | - } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
187 | + echo 'selected="selected"'; |
|
188 | + } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
189 | 189 | |
190 | 190 | <option <?php if ($list_sort == 'featured') { |
191 | - echo 'selected="selected"'; |
|
192 | - } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
191 | + echo 'selected="selected"'; |
|
192 | + } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
193 | 193 | |
194 | 194 | <option <?php if ($list_sort == 'high_review') { |
195 | - echo 'selected="selected"'; |
|
196 | - } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
195 | + echo 'selected="selected"'; |
|
196 | + } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
197 | 197 | |
198 | 198 | <option <?php if ($list_sort == 'high_rating') { |
199 | - echo 'selected="selected"'; |
|
200 | - } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
199 | + echo 'selected="selected"'; |
|
200 | + } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
201 | 201 | |
202 | 202 | <option <?php if ($list_sort == 'random') { |
203 | - echo 'selected="selected"'; |
|
204 | - } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
203 | + echo 'selected="selected"'; |
|
204 | + } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
205 | 205 | |
206 | 206 | </select> |
207 | 207 | </label> |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
222 | 222 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
223 | 223 | <option <?php if ($relate_to == 'category') { |
224 | - echo 'selected="selected"'; |
|
225 | - } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option> |
|
224 | + echo 'selected="selected"'; |
|
225 | + } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option> |
|
226 | 226 | <option <?php if ($relate_to == 'tags') { |
227 | - echo 'selected="selected"'; |
|
228 | - } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option> |
|
227 | + echo 'selected="selected"'; |
|
228 | + } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option> |
|
229 | 229 | </select> |
230 | 230 | </label> |
231 | 231 | </p> |
@@ -236,24 +236,24 @@ discard block |
||
236 | 236 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
237 | 237 | name="<?php echo $this->get_field_name('layout'); ?>"> |
238 | 238 | <option <?php if ($layout == 'gridview_onehalf') { |
239 | - echo 'selected="selected"'; |
|
240 | - } ?> |
|
239 | + echo 'selected="selected"'; |
|
240 | + } ?> |
|
241 | 241 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
242 | 242 | <option <?php if ($layout == 'gridview_onethird') { |
243 | - echo 'selected="selected"'; |
|
244 | - } ?> |
|
243 | + echo 'selected="selected"'; |
|
244 | + } ?> |
|
245 | 245 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
246 | 246 | <option <?php if ($layout == 'gridview_onefourth') { |
247 | - echo 'selected="selected"'; |
|
248 | - } ?> |
|
247 | + echo 'selected="selected"'; |
|
248 | + } ?> |
|
249 | 249 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
250 | 250 | <option <?php if ($layout == 'gridview_onefifth') { |
251 | - echo 'selected="selected"'; |
|
252 | - } ?> |
|
251 | + echo 'selected="selected"'; |
|
252 | + } ?> |
|
253 | 253 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
254 | 254 | <option <?php if ($layout == 'list') { |
255 | - echo 'selected="selected"'; |
|
256 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
255 | + echo 'selected="selected"'; |
|
256 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
257 | 257 | |
258 | 258 | </select> |
259 | 259 | </label> |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | </p> |
286 | 286 | |
287 | 287 | <?php |
288 | - } |
|
288 | + } |
|
289 | 289 | } // class geodir_related_listing_postview |
290 | 290 | |
291 | 291 | register_widget('geodir_related_listing_postview'); |
292 | 292 | \ No newline at end of file |
@@ -118,7 +118,7 @@ |
||
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 | ?> |
@@ -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 |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | { |
129 | 129 | //widgetform in backend |
130 | 130 | |
131 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0')); |
|
131 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0')); |
|
132 | 132 | $width = strip_tags($instance['width']); |
133 | 133 | $heigh = strip_tags($instance['heigh']); |
134 | 134 | $maptype = strip_tags($instance['maptype']); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
174 | 174 | echo 'selected="selected"'; |
175 | 175 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
176 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
176 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
177 | 177 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
178 | 178 | </select> |
179 | 179 | </label> |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | : |
221 | 221 | <input id="<?php echo $this->get_field_id('child_collapse'); ?>" |
222 | 222 | name="<?php echo $this->get_field_name('child_collapse'); ?>" type="checkbox" value="1" |
223 | - <?php if ($child_collapse){ ?>checked="checked" <?php } ?> /> |
|
223 | + <?php if ($child_collapse) { ?>checked="checked" <?php } ?> /> |
|
224 | 224 | </label> |
225 | 225 | </p> |
226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | : |
231 | 231 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>" |
232 | 232 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1" |
233 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> |
|
233 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> |
|
234 | 234 | </label> |
235 | 235 | </p> |
236 | 236 |
@@ -192,8 +192,9 @@ |
||
192 | 192 | |
193 | 193 | foreach ($map_zoom_level as $level) { |
194 | 194 | $selected = ''; |
195 | - if ($level == $zoom) |
|
196 | - $selected = 'selected="selected"'; |
|
195 | + if ($level == $zoom) { |
|
196 | + $selected = 'selected="selected"'; |
|
197 | + } |
|
197 | 198 | |
198 | 199 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
199 | 200 |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * GeoDirectory GMap - Home page Widget |
|
4 | - * |
|
5 | - * This will display Google map on home page with use of Google Map Api V3. |
|
6 | - * |
|
7 | - * @since 1.0.0 |
|
8 | - * |
|
9 | - * @package GeoDirectory |
|
10 | - */ |
|
3 | + * GeoDirectory GMap - Home page Widget |
|
4 | + * |
|
5 | + * This will display Google map on home page with use of Google Map Api V3. |
|
6 | + * |
|
7 | + * @since 1.0.0 |
|
8 | + * |
|
9 | + * @package GeoDirectory |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * GeoDirectory home page map widget class. |
@@ -16,126 +16,126 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class geodir_homepage_map extends WP_Widget |
18 | 18 | { |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * Register the home page map widget. |
21 | 21 | * |
22 | 22 | * @since 1.0.0 |
23 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
23 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
24 | 24 | */ |
25 | - public function __construct() { |
|
26 | - $widget_ops = array('classname' => 'widget Google Map in Home page', 'description' => __('Google Map in Home page. It will show you google map V3 for Home page with category checkbox selection.', 'geodirectory')); |
|
27 | - parent::__construct( |
|
28 | - 'geodir_map_v3_home_map', // Base ID |
|
29 | - __('GD > GMap - Home page', 'geodirectory'), // Name |
|
30 | - $widget_ops// Args |
|
31 | - ); |
|
32 | - } |
|
25 | + public function __construct() { |
|
26 | + $widget_ops = array('classname' => 'widget Google Map in Home page', 'description' => __('Google Map in Home page. It will show you google map V3 for Home page with category checkbox selection.', 'geodirectory')); |
|
27 | + parent::__construct( |
|
28 | + 'geodir_map_v3_home_map', // Base ID |
|
29 | + __('GD > GMap - Home page', 'geodirectory'), // Name |
|
30 | + $widget_ops// Args |
|
31 | + ); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Front-end display content for home page map widget. |
36 | 36 | * |
37 | 37 | * @since 1.0.0 |
38 | - * @since 1.5.1 Declare function public. |
|
38 | + * @since 1.5.1 Declare function public. |
|
39 | 39 | * |
40 | 40 | * @param array $args Widget arguments. |
41 | 41 | * @param array $instance Saved values from database. |
42 | 42 | */ |
43 | - public function widget($args, $instance) |
|
44 | - { |
|
45 | - extract($args, EXTR_SKIP); |
|
46 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
47 | - $width = empty($instance['width']) ? '100%' : apply_filters('widget_width', $instance['width']); |
|
48 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
49 | - $height = empty($instance['heigh']) ? '425' : apply_filters('widget_heigh', $instance['heigh']); |
|
50 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
51 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
52 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
53 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
54 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
55 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
56 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
57 | - $child_collapse = empty($instance['child_collapse']) ? '0' : apply_filters('widget_child_collapse', $instance['child_collapse']); |
|
58 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
59 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
43 | + public function widget($args, $instance) |
|
44 | + { |
|
45 | + extract($args, EXTR_SKIP); |
|
46 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
47 | + $width = empty($instance['width']) ? '100%' : apply_filters('widget_width', $instance['width']); |
|
48 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
49 | + $height = empty($instance['heigh']) ? '425' : apply_filters('widget_heigh', $instance['heigh']); |
|
50 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
51 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
52 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
53 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
54 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
55 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
56 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
57 | + $child_collapse = empty($instance['child_collapse']) ? '0' : apply_filters('widget_child_collapse', $instance['child_collapse']); |
|
58 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
59 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
60 | 60 | |
61 | - $map_args = array(); |
|
62 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); //'home_map_canvas'.$str ; |
|
63 | - $map_args['width'] = $width; |
|
64 | - $map_args['height'] = $height; |
|
65 | - $map_args['maptype'] = $maptype; |
|
66 | - $map_args['scrollwheel'] = $scrollwheel; |
|
67 | - $map_args['zoom'] = $zoom; |
|
68 | - $map_args['autozoom'] = $autozoom; |
|
69 | - $map_args['child_collapse'] = $child_collapse; |
|
70 | - $map_args['enable_cat_filters'] = true; |
|
71 | - $map_args['enable_text_search'] = true; |
|
72 | - $map_args['enable_post_type_filters'] = true; |
|
73 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
74 | - $map_args['enable_location_filters'] = apply_filters('geodir_home_map_enable_location_filters', false); |
|
75 | - $map_args['enable_jason_on_load'] = false; |
|
76 | - $map_args['enable_marker_cluster'] = false; |
|
77 | - $map_args['enable_map_resize_button'] = true; |
|
78 | - $map_args['map_class_name'] = 'geodir-map-home-page'; |
|
61 | + $map_args = array(); |
|
62 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); //'home_map_canvas'.$str ; |
|
63 | + $map_args['width'] = $width; |
|
64 | + $map_args['height'] = $height; |
|
65 | + $map_args['maptype'] = $maptype; |
|
66 | + $map_args['scrollwheel'] = $scrollwheel; |
|
67 | + $map_args['zoom'] = $zoom; |
|
68 | + $map_args['autozoom'] = $autozoom; |
|
69 | + $map_args['child_collapse'] = $child_collapse; |
|
70 | + $map_args['enable_cat_filters'] = true; |
|
71 | + $map_args['enable_text_search'] = true; |
|
72 | + $map_args['enable_post_type_filters'] = true; |
|
73 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
74 | + $map_args['enable_location_filters'] = apply_filters('geodir_home_map_enable_location_filters', false); |
|
75 | + $map_args['enable_jason_on_load'] = false; |
|
76 | + $map_args['enable_marker_cluster'] = false; |
|
77 | + $map_args['enable_map_resize_button'] = true; |
|
78 | + $map_args['map_class_name'] = 'geodir-map-home-page'; |
|
79 | 79 | |
80 | - $is_geodir_home_map_widget = true; |
|
81 | - $map_args['is_geodir_home_map_widget'] = $is_geodir_home_map_widget; |
|
80 | + $is_geodir_home_map_widget = true; |
|
81 | + $map_args['is_geodir_home_map_widget'] = $is_geodir_home_map_widget; |
|
82 | 82 | |
83 | - geodir_draw_map($map_args); |
|
83 | + geodir_draw_map($map_args); |
|
84 | 84 | |
85 | - /* home map post type slider */ |
|
86 | - if ($is_geodir_home_map_widget) { |
|
87 | - add_action('wp_footer', array($this, 'geodir_home_map_add_script'), 100); |
|
88 | - } |
|
85 | + /* home map post type slider */ |
|
86 | + if ($is_geodir_home_map_widget) { |
|
87 | + add_action('wp_footer', array($this, 'geodir_home_map_add_script'), 100); |
|
88 | + } |
|
89 | 89 | |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Sanitize home page map widget form values as they are saved. |
94 | 94 | * |
95 | 95 | * @since 1.0.0 |
96 | - * @since 1.5.1 Declare function public. |
|
96 | + * @since 1.5.1 Declare function public. |
|
97 | 97 | * |
98 | 98 | * @param array $new_instance Values just sent to be saved. |
99 | 99 | * @param array $old_instance Previously saved values from database. |
100 | 100 | * |
101 | 101 | * @return array Updated safe values to be saved. |
102 | 102 | */ |
103 | - public function update($new_instance, $old_instance) |
|
104 | - { |
|
105 | - //save the widget |
|
106 | - $instance = $old_instance; |
|
107 | - $instance['width'] = strip_tags($new_instance['width']); |
|
108 | - $instance['heigh'] = ($new_instance['heigh']); |
|
109 | - $instance['maptype'] = ($new_instance['maptype']); |
|
110 | - $instance['zoom'] = ($new_instance['zoom']); |
|
111 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
112 | - $instance['child_collapse'] = isset($new_instance['child_collapse']) ? ($new_instance['child_collapse']) : ''; |
|
113 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
103 | + public function update($new_instance, $old_instance) |
|
104 | + { |
|
105 | + //save the widget |
|
106 | + $instance = $old_instance; |
|
107 | + $instance['width'] = strip_tags($new_instance['width']); |
|
108 | + $instance['heigh'] = ($new_instance['heigh']); |
|
109 | + $instance['maptype'] = ($new_instance['maptype']); |
|
110 | + $instance['zoom'] = ($new_instance['zoom']); |
|
111 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
112 | + $instance['child_collapse'] = isset($new_instance['child_collapse']) ? ($new_instance['child_collapse']) : ''; |
|
113 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
114 | 114 | |
115 | - return $instance; |
|
116 | - } |
|
115 | + return $instance; |
|
116 | + } |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Back-end home page map widget settings form. |
120 | 120 | * |
121 | 121 | * @since 1.0.0 |
122 | - * @since 1.5.1 Declare function public. |
|
122 | + * @since 1.5.1 Declare function public. |
|
123 | 123 | * |
124 | 124 | * @param array $instance Previously saved values from database. |
125 | 125 | */ |
126 | - public function form($instance) |
|
127 | - { |
|
128 | - //widgetform in backend |
|
126 | + public function form($instance) |
|
127 | + { |
|
128 | + //widgetform in backend |
|
129 | 129 | |
130 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0')); |
|
131 | - $width = strip_tags($instance['width']); |
|
132 | - $heigh = strip_tags($instance['heigh']); |
|
133 | - $maptype = strip_tags($instance['maptype']); |
|
134 | - $zoom = strip_tags($instance['zoom']); |
|
135 | - $autozoom = strip_tags($instance['autozoom']); |
|
136 | - $child_collapse = strip_tags($instance['child_collapse']); |
|
137 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
138 | - ?> |
|
130 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0')); |
|
131 | + $width = strip_tags($instance['width']); |
|
132 | + $heigh = strip_tags($instance['heigh']); |
|
133 | + $maptype = strip_tags($instance['maptype']); |
|
134 | + $zoom = strip_tags($instance['zoom']); |
|
135 | + $autozoom = strip_tags($instance['autozoom']); |
|
136 | + $child_collapse = strip_tags($instance['child_collapse']); |
|
137 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
138 | + ?> |
|
139 | 139 | |
140 | 140 | <p> |
141 | 141 | <label |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | name="<?php echo $this->get_field_name('maptype'); ?>"> |
165 | 165 | |
166 | 166 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') { |
167 | - echo 'selected="selected"'; |
|
168 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
167 | + echo 'selected="selected"'; |
|
168 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
169 | 169 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') { |
170 | - echo 'selected="selected"'; |
|
171 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
170 | + echo 'selected="selected"'; |
|
171 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
172 | 172 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
173 | - echo 'selected="selected"'; |
|
174 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
173 | + echo 'selected="selected"'; |
|
174 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
175 | 175 | <option <?php selected($maptype, 'TERRAIN');?> |
176 | 176 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
177 | 177 | </select> |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | </p> |
180 | 180 | |
181 | 181 | <?php |
182 | - $map_zoom_level = geodir_map_zoom_level(); |
|
183 | - ?> |
|
182 | + $map_zoom_level = geodir_map_zoom_level(); |
|
183 | + ?> |
|
184 | 184 | |
185 | 185 | <p> |
186 | 186 | <label |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>" |
190 | 190 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php |
191 | 191 | |
192 | - foreach ($map_zoom_level as $level) { |
|
193 | - $selected = ''; |
|
194 | - if ($level == $zoom) |
|
195 | - $selected = 'selected="selected"'; |
|
192 | + foreach ($map_zoom_level as $level) { |
|
193 | + $selected = ''; |
|
194 | + if ($level == $zoom) |
|
195 | + $selected = 'selected="selected"'; |
|
196 | 196 | |
197 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
197 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
198 | 198 | |
199 | - } ?> |
|
199 | + } ?> |
|
200 | 200 | |
201 | 201 | </select> |
202 | 202 | </label> |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | : |
210 | 210 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>" |
211 | 211 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) { |
212 | - echo 'checked="checked"'; |
|
213 | - } ?> /></label> |
|
212 | + echo 'checked="checked"'; |
|
213 | + } ?> /></label> |
|
214 | 214 | </p> |
215 | 215 | |
216 | 216 | <p> |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | </p> |
235 | 235 | |
236 | 236 | <?php |
237 | - } |
|
237 | + } |
|
238 | 238 | |
239 | - /** |
|
239 | + /** |
|
240 | 240 | * Adds the javascript in the footer for home page map widget. |
241 | 241 | * |
242 | 242 | * @since 1.0.0 |
243 | - * @since 1.5.1 Declare function public. |
|
243 | + * @since 1.5.1 Declare function public. |
|
244 | 244 | */ |
245 | - public function geodir_home_map_add_script() |
|
246 | - { |
|
247 | - ?> |
|
245 | + public function geodir_home_map_add_script() |
|
246 | + { |
|
247 | + ?> |
|
248 | 248 | <script type="text/javascript"> |
249 | 249 | jQuery(document).ready(function () { |
250 | 250 | geoDirMapSlide(); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | </script> |
319 | 319 | <?php |
320 | - } |
|
320 | + } |
|
321 | 321 | } // class geodir_homepage_map |
322 | 322 | |
323 | 323 | register_widget('geodir_homepage_map'); |
@@ -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 | } |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @param bool $display true if map should be displayed, false if not. |
159 | 159 | */ |
160 | - $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
|
161 | - if ( !$show_map ) { |
|
160 | + $show_map = apply_filters('geodir_show_map_listing', $display = true); |
|
161 | + if (!$show_map) { |
|
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | public function form($instance) |
258 | 258 | { |
259 | 259 | //widgetform in backend |
260 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0')); |
|
260 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0')); |
|
261 | 261 | $width = strip_tags($instance['width']); |
262 | 262 | $heigh = strip_tags($instance['heigh']); |
263 | 263 | $maptype = strip_tags($instance['maptype']); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
304 | 304 | echo 'selected="selected"'; |
305 | 305 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
306 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
306 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
307 | 307 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
308 | 308 | </select> |
309 | 309 | </label> |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | : |
362 | 362 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>" |
363 | 363 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1" |
364 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> |
|
364 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> |
|
365 | 365 | </label> |
366 | 366 | </p> |
367 | 367 |
@@ -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,28 +59,28 @@ 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); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
76 | - } else { |
|
77 | - $list_json = '[{"totalcount":"0"}]'; |
|
78 | - } |
|
72 | + if (!empty($cat_content_info)) { |
|
73 | + $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | + $json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | + $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
76 | + } else { |
|
77 | + $list_json = '[{"totalcount":"0"}]'; |
|
78 | + } |
|
79 | 79 | |
80 | - $listing_map_args = array('list_json' => $list_json); |
|
80 | + $listing_map_args = array('list_json' => $list_json); |
|
81 | 81 | |
82 | - // Pass the json data in listing map script |
|
83 | - wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
82 | + // Pass the json data in listing map script |
|
83 | + wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | |
@@ -92,184 +92,184 @@ discard block |
||
92 | 92 | class geodir_map_listingpage extends WP_Widget |
93 | 93 | { |
94 | 94 | |
95 | - /** |
|
95 | + /** |
|
96 | 96 | * Register the listing page map widget. |
97 | 97 | * |
98 | 98 | * @since 1.0.0 |
99 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
99 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
100 | 100 | */ |
101 | - public function __construct() { |
|
102 | - $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')); |
|
103 | - parent::__construct( |
|
104 | - 'geodir_map_v3_listing_map', // Base ID |
|
105 | - __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
106 | - $widget_ops// Args |
|
107 | - ); |
|
101 | + public function __construct() { |
|
102 | + $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')); |
|
103 | + parent::__construct( |
|
104 | + 'geodir_map_v3_listing_map', // Base ID |
|
105 | + __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
106 | + $widget_ops// Args |
|
107 | + ); |
|
108 | 108 | |
109 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
109 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
110 | 110 | |
111 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
111 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
112 | 112 | |
113 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
114 | - } |
|
113 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
114 | + } |
|
115 | 115 | |
116 | 116 | /** |
117 | 117 | * Front-end display content for listing page map widget. |
118 | 118 | * |
119 | 119 | * @since 1.0.0 |
120 | - * @since 1.5.1 Declare function public. |
|
120 | + * @since 1.5.1 Declare function public. |
|
121 | + * |
|
122 | + * @global object $post The current post object. |
|
121 | 123 | * |
122 | - * @global object $post The current post object. |
|
123 | - * |
|
124 | 124 | * @param array $args Widget arguments. |
125 | 125 | * @param array $instance Saved values from database. |
126 | 126 | */ |
127 | - public function widget($args, $instance) |
|
128 | - { |
|
129 | - |
|
130 | - if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
131 | - || geodir_is_page('detail') |
|
132 | - ) : |
|
133 | - |
|
134 | - extract($args, EXTR_SKIP); |
|
135 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
136 | - $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
137 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
138 | - $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
139 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
140 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
141 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
142 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
143 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
144 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
145 | - /** |
|
146 | - * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
147 | - * |
|
148 | - * @since 1.0.0 |
|
149 | - * @param bool $sticky True if should be sticky, false if not |
|
150 | - */ |
|
151 | - $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
152 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
153 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
154 | - $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
127 | + public function widget($args, $instance) |
|
128 | + { |
|
129 | + |
|
130 | + if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
131 | + || geodir_is_page('detail') |
|
132 | + ) : |
|
133 | + |
|
134 | + extract($args, EXTR_SKIP); |
|
135 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
136 | + $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
137 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
138 | + $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
139 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
140 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
141 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
142 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
143 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
144 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
145 | + /** |
|
146 | + * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
147 | + * |
|
148 | + * @since 1.0.0 |
|
149 | + * @param bool $sticky True if should be sticky, false if not |
|
150 | + */ |
|
151 | + $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
152 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
153 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
154 | + $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
155 | 155 | |
156 | 156 | /** |
157 | - * Filter the listing map should to be displayed or not. |
|
158 | - * |
|
159 | - * @since 1.4.6 |
|
157 | + * Filter the listing map should to be displayed or not. |
|
160 | 158 | * |
161 | - * @param bool $display true if map should be displayed, false if not. |
|
162 | - */ |
|
159 | + * @since 1.4.6 |
|
160 | + * |
|
161 | + * @param bool $display true if map should be displayed, false if not. |
|
162 | + */ |
|
163 | 163 | $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
164 | 164 | if ( !$show_map ) { |
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | - $map_args = array(); |
|
169 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
170 | - $map_args['width'] = $width; |
|
171 | - $map_args['height'] = $height; |
|
172 | - |
|
173 | - $map_args['scrollwheel'] = $scrollwheel; |
|
174 | - $map_args['showall'] = $showall; |
|
175 | - $map_args['child_collapse'] = '0'; |
|
176 | - $map_args['sticky'] = $sticky; |
|
177 | - $map_args['enable_cat_filters'] = false; |
|
178 | - $map_args['enable_text_search'] = false; |
|
179 | - $map_args['enable_post_type_filters'] = false; |
|
180 | - $map_args['enable_location_filters'] = false; |
|
181 | - $map_args['enable_jason_on_load'] = true; |
|
168 | + $map_args = array(); |
|
169 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
170 | + $map_args['width'] = $width; |
|
171 | + $map_args['height'] = $height; |
|
172 | + |
|
173 | + $map_args['scrollwheel'] = $scrollwheel; |
|
174 | + $map_args['showall'] = $showall; |
|
175 | + $map_args['child_collapse'] = '0'; |
|
176 | + $map_args['sticky'] = $sticky; |
|
177 | + $map_args['enable_cat_filters'] = false; |
|
178 | + $map_args['enable_text_search'] = false; |
|
179 | + $map_args['enable_post_type_filters'] = false; |
|
180 | + $map_args['enable_location_filters'] = false; |
|
181 | + $map_args['enable_jason_on_load'] = true; |
|
182 | 182 | |
183 | - if (is_single()) { |
|
184 | - |
|
185 | - global $post; |
|
186 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
187 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
188 | - $mapview = $post->post_mapview; |
|
189 | - $mapzoom = $post->post_mapzoom; |
|
190 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
191 | - |
|
192 | - } else { |
|
193 | - $default_location = geodir_get_default_location(); |
|
194 | - |
|
195 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
196 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
197 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
198 | - $mapview = $maptype; |
|
199 | - } |
|
200 | - |
|
201 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
202 | - |
|
203 | - // Set default map options |
|
204 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
205 | - $map_args['latitude'] = $map_default_lat; |
|
206 | - $map_args['longitude'] = $map_default_lng; |
|
207 | - $map_args['zoom'] = $zoom; |
|
208 | - //$map_args['scrollwheel'] = true; |
|
209 | - $map_args['scrollwheel'] = $scrollwheel; |
|
210 | - $map_args['showall'] = $showall; |
|
211 | - $map_args['streetViewControl'] = true; |
|
212 | - $map_args['maptype'] = $maptype; |
|
213 | - $map_args['showPreview'] = '0'; |
|
214 | - $map_args['maxZoom'] = 21; |
|
215 | - $map_args['autozoom'] = $autozoom; |
|
216 | - $map_args['bubble_size'] = 'small'; |
|
217 | - |
|
218 | - echo $before_widget; |
|
219 | - geodir_draw_map($map_args); |
|
220 | - echo $after_widget; |
|
221 | - |
|
222 | - endif; |
|
223 | - } |
|
183 | + if (is_single()) { |
|
184 | + |
|
185 | + global $post; |
|
186 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
187 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
188 | + $mapview = $post->post_mapview; |
|
189 | + $mapzoom = $post->post_mapzoom; |
|
190 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
191 | + |
|
192 | + } else { |
|
193 | + $default_location = geodir_get_default_location(); |
|
194 | + |
|
195 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
196 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
197 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
198 | + $mapview = $maptype; |
|
199 | + } |
|
200 | + |
|
201 | + if (empty($mapzoom)) $mapzoom = $zoom; |
|
202 | + |
|
203 | + // Set default map options |
|
204 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
205 | + $map_args['latitude'] = $map_default_lat; |
|
206 | + $map_args['longitude'] = $map_default_lng; |
|
207 | + $map_args['zoom'] = $zoom; |
|
208 | + //$map_args['scrollwheel'] = true; |
|
209 | + $map_args['scrollwheel'] = $scrollwheel; |
|
210 | + $map_args['showall'] = $showall; |
|
211 | + $map_args['streetViewControl'] = true; |
|
212 | + $map_args['maptype'] = $maptype; |
|
213 | + $map_args['showPreview'] = '0'; |
|
214 | + $map_args['maxZoom'] = 21; |
|
215 | + $map_args['autozoom'] = $autozoom; |
|
216 | + $map_args['bubble_size'] = 'small'; |
|
217 | + |
|
218 | + echo $before_widget; |
|
219 | + geodir_draw_map($map_args); |
|
220 | + echo $after_widget; |
|
221 | + |
|
222 | + endif; |
|
223 | + } |
|
224 | 224 | |
225 | 225 | /** |
226 | 226 | * Sanitize listing page map widget form values as they are saved. |
227 | 227 | * |
228 | 228 | * @since 1.0.0 |
229 | - * @since 1.5.1 Declare function public. |
|
229 | + * @since 1.5.1 Declare function public. |
|
230 | 230 | * |
231 | 231 | * @param array $new_instance Values just sent to be saved. |
232 | 232 | * @param array $old_instance Previously saved values from database. |
233 | 233 | * |
234 | 234 | * @return array Updated safe values to be saved. |
235 | 235 | */ |
236 | - public function update($new_instance, $old_instance) |
|
237 | - { |
|
238 | - //save the widget |
|
239 | - $instance = $old_instance; |
|
240 | - $instance['width'] = strip_tags($new_instance['width']); |
|
241 | - $instance['heigh'] = ($new_instance['heigh']); |
|
242 | - $instance['maptype'] = ($new_instance['maptype']); |
|
243 | - $instance['zoom'] = ($new_instance['zoom']); |
|
244 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
245 | - $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
246 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
247 | - $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
248 | - |
|
249 | - return $instance; |
|
250 | - } |
|
236 | + public function update($new_instance, $old_instance) |
|
237 | + { |
|
238 | + //save the widget |
|
239 | + $instance = $old_instance; |
|
240 | + $instance['width'] = strip_tags($new_instance['width']); |
|
241 | + $instance['heigh'] = ($new_instance['heigh']); |
|
242 | + $instance['maptype'] = ($new_instance['maptype']); |
|
243 | + $instance['zoom'] = ($new_instance['zoom']); |
|
244 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
245 | + $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
246 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
247 | + $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
248 | + |
|
249 | + return $instance; |
|
250 | + } |
|
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Back-end listing page map widget settings form. |
254 | 254 | * |
255 | 255 | * @since 1.0.0 |
256 | - * @since 1.5.1 Declare function public. |
|
256 | + * @since 1.5.1 Declare function public. |
|
257 | 257 | * |
258 | 258 | * @param array $instance Previously saved values from database. |
259 | 259 | */ |
260 | - public function form($instance) |
|
261 | - { |
|
262 | - //widgetform in backend |
|
263 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0')); |
|
264 | - $width = strip_tags($instance['width']); |
|
265 | - $heigh = strip_tags($instance['heigh']); |
|
266 | - $maptype = strip_tags($instance['maptype']); |
|
267 | - $zoom = strip_tags($instance['zoom']); |
|
268 | - $autozoom = strip_tags($instance['autozoom']); |
|
269 | - $sticky = strip_tags($instance['sticky']); |
|
270 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
271 | - $showall = strip_tags($instance['showall']); |
|
272 | - ?> |
|
260 | + public function form($instance) |
|
261 | + { |
|
262 | + //widgetform in backend |
|
263 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0')); |
|
264 | + $width = strip_tags($instance['width']); |
|
265 | + $heigh = strip_tags($instance['heigh']); |
|
266 | + $maptype = strip_tags($instance['maptype']); |
|
267 | + $zoom = strip_tags($instance['zoom']); |
|
268 | + $autozoom = strip_tags($instance['autozoom']); |
|
269 | + $sticky = strip_tags($instance['sticky']); |
|
270 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
271 | + $showall = strip_tags($instance['showall']); |
|
272 | + ?> |
|
273 | 273 | <p> |
274 | 274 | <label |
275 | 275 | for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?> |
@@ -298,14 +298,14 @@ discard block |
||
298 | 298 | name="<?php echo $this->get_field_name('maptype'); ?>"> |
299 | 299 | |
300 | 300 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') { |
301 | - echo 'selected="selected"'; |
|
302 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
301 | + echo 'selected="selected"'; |
|
302 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
303 | 303 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') { |
304 | - echo 'selected="selected"'; |
|
305 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
304 | + echo 'selected="selected"'; |
|
305 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
306 | 306 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
307 | - echo 'selected="selected"'; |
|
308 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
307 | + echo 'selected="selected"'; |
|
308 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
309 | 309 | <option <?php selected($maptype, 'TERRAIN');?> |
310 | 310 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
311 | 311 | </select> |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | </p> |
314 | 314 | |
315 | 315 | <?php |
316 | - $map_zoom_level = geodir_map_zoom_level(); |
|
317 | - ?> |
|
316 | + $map_zoom_level = geodir_map_zoom_level(); |
|
317 | + ?> |
|
318 | 318 | |
319 | 319 | <p> |
320 | 320 | <label |
@@ -324,14 +324,14 @@ discard block |
||
324 | 324 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>" |
325 | 325 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php |
326 | 326 | |
327 | - foreach ($map_zoom_level as $level) { |
|
328 | - $selected = ''; |
|
329 | - if ($level == $zoom) |
|
330 | - $selected = 'selected="selected"'; |
|
327 | + foreach ($map_zoom_level as $level) { |
|
328 | + $selected = ''; |
|
329 | + if ($level == $zoom) |
|
330 | + $selected = 'selected="selected"'; |
|
331 | 331 | |
332 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
332 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
333 | 333 | |
334 | - } ?> |
|
334 | + } ?> |
|
335 | 335 | |
336 | 336 | </select> |
337 | 337 | |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | : |
345 | 345 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>" |
346 | 346 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) { |
347 | - echo 'checked="checked"'; |
|
348 | - } ?> /></label> |
|
347 | + echo 'checked="checked"'; |
|
348 | + } ?> /></label> |
|
349 | 349 | </p> |
350 | 350 | |
351 | 351 | <p> |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | : |
355 | 355 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>" |
356 | 356 | name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) { |
357 | - echo 'checked="checked"'; |
|
358 | - } ?> /> </label> |
|
357 | + echo 'checked="checked"'; |
|
358 | + } ?> /> </label> |
|
359 | 359 | </p> |
360 | 360 | |
361 | 361 | <p> |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | </p> --> |
376 | 376 | |
377 | 377 | <?php |
378 | - } |
|
378 | + } |
|
379 | 379 | } // class geodir_map_listingpage |
380 | 380 | |
381 | 381 | register_widget('geodir_map_listingpage'); |
@@ -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 |
@@ -113,7 +113,7 @@ |
||
113 | 113 | * @since 1.0.0 |
114 | 114 | * @package GeoDirectory |
115 | 115 | * @param array $classes Class array. |
116 | - * @return array Modified class array. |
|
116 | + * @return string[] Modified class array. |
|
117 | 117 | */ |
118 | 118 | function geodir_x_body_class($classes) |
119 | 119 | { |
@@ -1,100 +1,100 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Enfold theme compatibility functions. |
|
4 | - * |
|
5 | - * This file lets the GeoDirectory Plugin use the Enfold theme HTML wrappers to fit and work perfectly. |
|
6 | - * |
|
7 | - * @since 1.0.0 |
|
8 | - * @package GeoDirectory |
|
9 | - */ |
|
3 | + * Enfold theme compatibility functions. |
|
4 | + * |
|
5 | + * This file lets the GeoDirectory Plugin use the Enfold theme HTML wrappers to fit and work perfectly. |
|
6 | + * |
|
7 | + * @since 1.0.0 |
|
8 | + * @package GeoDirectory |
|
9 | + */ |
|
10 | 10 | add_action('after_setup_theme', 'enfold_action_calls', 11); |
11 | 11 | /** |
12 | - * Action calls for enfold theme compatibility. |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * @package GeoDirectory |
|
16 | - */ |
|
12 | + * Action calls for enfold theme compatibility. |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * @package GeoDirectory |
|
16 | + */ |
|
17 | 17 | function enfold_action_calls() |
18 | 18 | { |
19 | 19 | |
20 | - /* ACTIONS |
|
20 | + /* ACTIONS |
|
21 | 21 | ****************************************************************************************/ |
22 | 22 | |
23 | - // Add body class for styling purposes |
|
24 | - add_filter('body_class', 'wpgeo_enfold_body_class'); |
|
23 | + // Add body class for styling purposes |
|
24 | + add_filter('body_class', 'wpgeo_enfold_body_class'); |
|
25 | 25 | |
26 | - // Pages using the page-builder shouldn't redirect on successful payment |
|
27 | - if (isset($_REQUEST['pay_action'])) { |
|
28 | - add_action('init', 'geodir_allow_payment_urls_enfold', 15); |
|
29 | - } |
|
26 | + // Pages using the page-builder shouldn't redirect on successful payment |
|
27 | + if (isset($_REQUEST['pay_action'])) { |
|
28 | + add_action('init', 'geodir_allow_payment_urls_enfold', 15); |
|
29 | + } |
|
30 | 30 | |
31 | - // LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search |
|
32 | - if (function_exists('geodir_location_menu_items')) { |
|
33 | - remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110); |
|
34 | - add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2); |
|
35 | - } |
|
36 | - // GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search |
|
37 | - remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100); |
|
38 | - add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2); |
|
31 | + // LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search |
|
32 | + if (function_exists('geodir_location_menu_items')) { |
|
33 | + remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110); |
|
34 | + add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2); |
|
35 | + } |
|
36 | + // GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search |
|
37 | + remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100); |
|
38 | + add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2); |
|
39 | 39 | |
40 | - // HOME TOP SIDEBAR |
|
41 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
42 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
43 | - //add_action( 'ava_after_main_container', 'enfold_home_sidebar' ); |
|
40 | + // HOME TOP SIDEBAR |
|
41 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
42 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
43 | + //add_action( 'ava_after_main_container', 'enfold_home_sidebar' ); |
|
44 | 44 | |
45 | 45 | |
46 | - // WRAPPER OPEN ACTIONS |
|
47 | - remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10); |
|
48 | - add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9); |
|
49 | - add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE |
|
46 | + // WRAPPER OPEN ACTIONS |
|
47 | + remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10); |
|
48 | + add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9); |
|
49 | + add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE |
|
50 | 50 | |
51 | 51 | |
52 | - // WRAPPER CONTENT OPEN ACTIONS |
|
53 | - remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10); |
|
54 | - add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3); |
|
52 | + // WRAPPER CONTENT OPEN ACTIONS |
|
53 | + remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10); |
|
54 | + add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3); |
|
55 | 55 | |
56 | 56 | |
57 | - // SIDEBAR RIGHT OPEN ACTIONS |
|
58 | - remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10); |
|
59 | - add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4); |
|
57 | + // SIDEBAR RIGHT OPEN ACTIONS |
|
58 | + remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10); |
|
59 | + add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4); |
|
60 | 60 | |
61 | - // SIDEBAR LEFT OPEN ACTIONS |
|
62 | - remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10); |
|
63 | - add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4); |
|
61 | + // SIDEBAR LEFT OPEN ACTIONS |
|
62 | + remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10); |
|
63 | + add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4); |
|
64 | 64 | |
65 | 65 | |
66 | - // HOME PAGE BREADCRUMBS |
|
67 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
68 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
66 | + // HOME PAGE BREADCRUMBS |
|
67 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
68 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
69 | 69 | |
70 | - // LISTINGS PAGE BREADCRUMBS & TITLES |
|
71 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
72 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
70 | + // LISTINGS PAGE BREADCRUMBS & TITLES |
|
71 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
72 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
73 | 73 | |
74 | - // DETAILS PAGE BREADCRUMBS & TITLES |
|
75 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
76 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
74 | + // DETAILS PAGE BREADCRUMBS & TITLES |
|
75 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
76 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
77 | 77 | |
78 | - // SEARCH PAGE BREADCRUMBS & TITLES |
|
79 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
80 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
78 | + // SEARCH PAGE BREADCRUMBS & TITLES |
|
79 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
80 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
81 | 81 | |
82 | - // AUTHOR PAGE BREADCRUMBS & TITLES |
|
83 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
84 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
82 | + // AUTHOR PAGE BREADCRUMBS & TITLES |
|
83 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
84 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
85 | 85 | |
86 | - // DISABLE ENFOLD MAPS CALL |
|
87 | - add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1); |
|
86 | + // DISABLE ENFOLD MAPS CALL |
|
87 | + add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1); |
|
88 | 88 | |
89 | - // make top section wide |
|
90 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
91 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
92 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
93 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
94 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
95 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
89 | + // make top section wide |
|
90 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
91 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
92 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
93 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
94 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
95 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
96 | 96 | |
97 | - add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5); |
|
97 | + add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5); |
|
98 | 98 | |
99 | 99 | } // Close enfold_action_calls |
100 | 100 | |
@@ -108,17 +108,17 @@ discard block |
||
108 | 108 | function gd_enfold_compat_add_top_section_back() |
109 | 109 | { |
110 | 110 | |
111 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
112 | - add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8); |
|
113 | - } elseif (geodir_is_page('listing')) { |
|
114 | - add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8); |
|
115 | - } elseif (geodir_is_page('detail')) { |
|
116 | - add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8); |
|
117 | - } elseif (geodir_is_page('search')) { |
|
118 | - add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8); |
|
119 | - } elseif (geodir_is_page('author')) { |
|
120 | - add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8); |
|
121 | - } |
|
111 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
112 | + add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8); |
|
113 | + } elseif (geodir_is_page('listing')) { |
|
114 | + add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8); |
|
115 | + } elseif (geodir_is_page('detail')) { |
|
116 | + add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8); |
|
117 | + } elseif (geodir_is_page('search')) { |
|
118 | + add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8); |
|
119 | + } elseif (geodir_is_page('author')) { |
|
120 | + add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8); |
|
121 | + } |
|
122 | 122 | |
123 | 123 | |
124 | 124 | } |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | */ |
138 | 138 | function wpgeo_enfold_body_class($classes) |
139 | 139 | { |
140 | - $classes[] = 'wpgeo-enfold'; |
|
141 | - return $classes; |
|
140 | + $classes[] = 'wpgeo-enfold'; |
|
141 | + return $classes; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | */ |
150 | 150 | function geodir_allow_payment_urls_enfold() |
151 | 151 | { |
152 | - global $builder; |
|
153 | - remove_action('template_redirect', array($builder, 'template_redirect'), 1000); |
|
152 | + global $builder; |
|
153 | + remove_action('template_redirect', array($builder, 'template_redirect'), 1000); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | function enfold_action_wrapper_open() |
164 | 164 | { |
165 | - echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>"; |
|
166 | - echo "<div class='container template-blog '>"; |
|
165 | + echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>"; |
|
166 | + echo "<div class='container template-blog '>"; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -177,38 +177,38 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function enfold_detail_title($page, $class) |
179 | 179 | { |
180 | - //echo '###'.$page; |
|
181 | - global $wp; |
|
182 | - if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) { |
|
183 | - add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
184 | - echo avia_title(); |
|
185 | - } elseif ($page == 'details-page') { |
|
186 | - add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
187 | - echo avia_title(); |
|
188 | - } elseif ($page == 'listings-page' || $page == 'search-page') { |
|
189 | - add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
190 | - ob_start(); // Start buffering; |
|
191 | - geodir_action_listings_title(); |
|
192 | - $gd_title = ob_get_clean(); |
|
193 | - $title_p = explode('">', $gd_title); |
|
194 | - $title = str_replace('</h1></header>', "", $title_p[2]); |
|
195 | - //print_r($title_p); |
|
196 | - echo avia_title(array('title' => $title)); |
|
197 | - } elseif ($page == 'author-page') { |
|
198 | - add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
199 | - ob_start(); // Start buffering; |
|
200 | - geodir_action_author_page_title(); |
|
201 | - $gd_title = ob_get_clean(); |
|
202 | - $gd_title = str_replace('<h1>', "", $gd_title); |
|
203 | - $gd_title = str_replace('</h1>', "", $gd_title); |
|
204 | - echo avia_title(array('title' => $gd_title)); |
|
205 | - } elseif ($page == 'add-listing-page') { |
|
206 | - add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
207 | - echo avia_title(); |
|
208 | - } elseif ($page == 'add-listing-page') { |
|
209 | - add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
210 | - echo avia_title(); |
|
211 | - } |
|
180 | + //echo '###'.$page; |
|
181 | + global $wp; |
|
182 | + if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) { |
|
183 | + add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
184 | + echo avia_title(); |
|
185 | + } elseif ($page == 'details-page') { |
|
186 | + add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
187 | + echo avia_title(); |
|
188 | + } elseif ($page == 'listings-page' || $page == 'search-page') { |
|
189 | + add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
190 | + ob_start(); // Start buffering; |
|
191 | + geodir_action_listings_title(); |
|
192 | + $gd_title = ob_get_clean(); |
|
193 | + $title_p = explode('">', $gd_title); |
|
194 | + $title = str_replace('</h1></header>', "", $title_p[2]); |
|
195 | + //print_r($title_p); |
|
196 | + echo avia_title(array('title' => $title)); |
|
197 | + } elseif ($page == 'author-page') { |
|
198 | + add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
199 | + ob_start(); // Start buffering; |
|
200 | + geodir_action_author_page_title(); |
|
201 | + $gd_title = ob_get_clean(); |
|
202 | + $gd_title = str_replace('<h1>', "", $gd_title); |
|
203 | + $gd_title = str_replace('</h1>', "", $gd_title); |
|
204 | + echo avia_title(array('title' => $gd_title)); |
|
205 | + } elseif ($page == 'add-listing-page') { |
|
206 | + add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
207 | + echo avia_title(); |
|
208 | + } elseif ($page == 'add-listing-page') { |
|
209 | + add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2); |
|
210 | + echo avia_title(); |
|
211 | + } |
|
212 | 212 | |
213 | 213 | } |
214 | 214 | |
@@ -223,22 +223,22 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function enfold_detail_breadcrum($trail, $args) |
225 | 225 | { |
226 | - ob_start(); // Start buffering; |
|
227 | - geodir_breadcrumb(); |
|
228 | - $gd_crums = ob_get_clean(); |
|
229 | - if ($gd_crums) { |
|
230 | - $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); |
|
231 | - $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); |
|
232 | - $gd_crums = str_replace(' > ', " > ", $gd_crums); |
|
233 | - $gd_crums = str_replace('</li><li>', "", $gd_crums); |
|
234 | - $gd_crums = explode(" > ", $gd_crums); |
|
235 | - $trail_end = array_pop($gd_crums); |
|
236 | - $gd_crums['trail_end'] = $trail_end; |
|
237 | - //print_r($gd_crums); |
|
238 | - //print_r($trail); |
|
239 | - $trail = $gd_crums; |
|
240 | - } |
|
241 | - return $trail; |
|
226 | + ob_start(); // Start buffering; |
|
227 | + geodir_breadcrumb(); |
|
228 | + $gd_crums = ob_get_clean(); |
|
229 | + if ($gd_crums) { |
|
230 | + $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); |
|
231 | + $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); |
|
232 | + $gd_crums = str_replace(' > ', " > ", $gd_crums); |
|
233 | + $gd_crums = str_replace('</li><li>', "", $gd_crums); |
|
234 | + $gd_crums = explode(" > ", $gd_crums); |
|
235 | + $trail_end = array_pop($gd_crums); |
|
236 | + $gd_crums['trail_end'] = $trail_end; |
|
237 | + //print_r($gd_crums); |
|
238 | + //print_r($trail); |
|
239 | + $trail = $gd_crums; |
|
240 | + } |
|
241 | + return $trail; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | */ |
254 | 254 | function enfold_action_wrapper_content_open($type = '', $id = '', $class = '') |
255 | 255 | { |
256 | - if (geodir_is_page('login')) { |
|
257 | - echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; |
|
258 | - } else { |
|
259 | - echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; |
|
260 | - } |
|
261 | - echo '<div class="entry-content-wrapper">'; |
|
256 | + if (geodir_is_page('login')) { |
|
257 | + echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; |
|
258 | + } else { |
|
259 | + echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">"; |
|
260 | + } |
|
261 | + echo '<div class="entry-content-wrapper">'; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | */ |
275 | 275 | function enfold_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '') |
276 | 276 | { |
277 | - $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; |
|
278 | - echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; |
|
279 | - echo "<div class='inner_sidebar extralight-border'>"; |
|
277 | + $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; |
|
278 | + echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; |
|
279 | + echo "<div class='inner_sidebar extralight-border'>"; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | */ |
292 | 292 | function enfold_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '') |
293 | 293 | { |
294 | - $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; |
|
295 | - echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; |
|
296 | - echo "<div class='inner_sidebar extralight-border'>"; |
|
294 | + $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : ""; |
|
295 | + echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">"; |
|
296 | + echo "<div class='inner_sidebar extralight-border'>"; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | function gd_enfold_remove_maps_api($call) |
309 | 309 | { |
310 | - return false; |
|
310 | + return false; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 |