@@ -12,7 +12,7 @@ |
||
12 | 12 | global $gd_session; |
13 | 13 | |
14 | 14 | if (!isset($_REQUEST['backandedit'])) { |
15 | - $gd_session->un_set('listing'); |
|
15 | + $gd_session->un_set('listing'); |
|
16 | 16 | } |
17 | 17 | // call header |
18 | 18 | get_header(); |
@@ -198,7 +198,9 @@ discard block |
||
198 | 198 | $mapview = $maptype; |
199 | 199 | } |
200 | 200 | |
201 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
201 | + if (empty($mapzoom)) { |
|
202 | + $mapzoom = $zoom; |
|
203 | + } |
|
202 | 204 | |
203 | 205 | // Set default map options |
204 | 206 | $map_args['ajax_url'] = geodir_get_ajax_url(); |
@@ -326,8 +328,9 @@ discard block |
||
326 | 328 | |
327 | 329 | foreach ($map_zoom_level as $level) { |
328 | 330 | $selected = ''; |
329 | - if ($level == $zoom) |
|
330 | - $selected = 'selected="selected"'; |
|
331 | + if ($level == $zoom) { |
|
332 | + $selected = 'selected="selected"'; |
|
333 | + } |
|
331 | 334 | |
332 | 335 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
333 | 336 |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function init_listing_map_script() |
20 | 20 | { |
21 | - global $list_map_json; |
|
21 | + global $list_map_json; |
|
22 | 22 | |
23 | - $list_map_json = array(); |
|
23 | + $list_map_json = array(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function create_list_jsondata($post) |
37 | 37 | { |
38 | - global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | - |
|
40 | - if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | - /** |
|
42 | - * Filter the json data for search listing map. |
|
43 | - * |
|
44 | - * @since 1.5.7 |
|
45 | - * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | - * @param object $post The post object. |
|
47 | - */ |
|
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | - } |
|
38 | + global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
39 | + |
|
40 | + if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') { |
|
41 | + /** |
|
42 | + * Filter the json data for search listing map. |
|
43 | + * |
|
44 | + * @since 1.5.7 |
|
45 | + * @param string $post->marker_json JSON representation of the post marker info. |
|
46 | + * @param object $post The post object. |
|
47 | + */ |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,29 +59,29 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function show_listing_widget_map() |
61 | 61 | { |
62 | - global $list_map_json; |
|
62 | + global $list_map_json; |
|
63 | 63 | |
64 | - if (!empty($list_map_json)) { |
|
65 | - $list_map_json = array_unique($list_map_json); |
|
66 | - $cat_content_info[] = implode(',', $list_map_json); |
|
67 | - } |
|
64 | + if (!empty($list_map_json)) { |
|
65 | + $list_map_json = array_unique($list_map_json); |
|
66 | + $cat_content_info[] = implode(',', $list_map_json); |
|
67 | + } |
|
68 | 68 | |
69 | - $totalcount = count(array_unique($list_map_json)); |
|
69 | + $totalcount = count(array_unique($list_map_json)); |
|
70 | 70 | |
71 | 71 | |
72 | - if (!empty($cat_content_info)) { |
|
73 | - $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | - } else { |
|
78 | - $list_json = '[{"totalcount":"0"}]'; |
|
79 | - } |
|
72 | + if (!empty($cat_content_info)) { |
|
73 | + $json_content = substr(implode(',', $cat_content_info), 1); |
|
74 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
|
75 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
76 | + $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
77 | + } else { |
|
78 | + $list_json = '[{"totalcount":"0"}]'; |
|
79 | + } |
|
80 | 80 | |
81 | - $listing_map_args = array('list_json' => $list_json); |
|
81 | + $listing_map_args = array('list_json' => $list_json); |
|
82 | 82 | |
83 | - // Pass the json data in listing map script |
|
84 | - wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
83 | + // Pass the json data in listing map script |
|
84 | + wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -93,187 +93,187 @@ discard block |
||
93 | 93 | class geodir_map_listingpage extends WP_Widget |
94 | 94 | { |
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * Register the listing page map widget. |
98 | 98 | * |
99 | 99 | * @since 1.0.0 |
100 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
100 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
101 | 101 | */ |
102 | - public function __construct() { |
|
103 | - $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | - parent::__construct( |
|
105 | - 'geodir_map_v3_listing_map', // Base ID |
|
106 | - __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | - $widget_ops// Args |
|
108 | - ); |
|
102 | + public function __construct() { |
|
103 | + $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory')); |
|
104 | + parent::__construct( |
|
105 | + 'geodir_map_v3_listing_map', // Base ID |
|
106 | + __('GD > GMap - Listing page', 'geodirectory'), // Name |
|
107 | + $widget_ops// Args |
|
108 | + ); |
|
109 | 109 | |
110 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
110 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
111 | 111 | |
112 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
112 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
113 | 113 | |
114 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | - } |
|
114 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
115 | + } |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Front-end display content for listing page map widget. |
119 | 119 | * |
120 | 120 | * @since 1.0.0 |
121 | - * @since 1.5.1 Declare function public. |
|
121 | + * @since 1.5.1 Declare function public. |
|
122 | + * |
|
123 | + * @global object $post The current post object. |
|
122 | 124 | * |
123 | - * @global object $post The current post object. |
|
124 | - * |
|
125 | 125 | * @param array $args Widget arguments. |
126 | 126 | * @param array $instance Saved values from database. |
127 | 127 | */ |
128 | - public function widget($args, $instance) |
|
129 | - { |
|
130 | - |
|
131 | - if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | - || geodir_is_page('detail') |
|
133 | - ) : |
|
134 | - |
|
135 | - extract($args, EXTR_SKIP); |
|
136 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | - $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | - $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | - /** |
|
147 | - * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | - * |
|
149 | - * @since 1.0.0 |
|
150 | - * @param bool $sticky True if should be sticky, false if not |
|
151 | - */ |
|
152 | - $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | - $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
128 | + public function widget($args, $instance) |
|
129 | + { |
|
130 | + |
|
131 | + if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') |
|
132 | + || geodir_is_page('detail') |
|
133 | + ) : |
|
134 | + |
|
135 | + extract($args, EXTR_SKIP); |
|
136 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
137 | + $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']); |
|
138 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
139 | + $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']); |
|
140 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
141 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
142 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
143 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
144 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
145 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
146 | + /** |
|
147 | + * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
148 | + * |
|
149 | + * @since 1.0.0 |
|
150 | + * @param bool $sticky True if should be sticky, false if not |
|
151 | + */ |
|
152 | + $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']); |
|
153 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
154 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
155 | + $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']); |
|
156 | 156 | |
157 | 157 | /** |
158 | - * Filter the listing map should to be displayed or not. |
|
159 | - * |
|
160 | - * @since 1.4.6 |
|
158 | + * Filter the listing map should to be displayed or not. |
|
161 | 159 | * |
162 | - * @param bool $display true if map should be displayed, false if not. |
|
163 | - */ |
|
160 | + * @since 1.4.6 |
|
161 | + * |
|
162 | + * @param bool $display true if map should be displayed, false if not. |
|
163 | + */ |
|
164 | 164 | $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
165 | 165 | if ( !$show_map ) { |
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - $map_args = array(); |
|
170 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | - $map_args['width'] = $width; |
|
172 | - $map_args['height'] = $height; |
|
173 | - |
|
174 | - $map_args['scrollwheel'] = $scrollwheel; |
|
175 | - $map_args['showall'] = $showall; |
|
176 | - $map_args['child_collapse'] = '0'; |
|
177 | - $map_args['sticky'] = $sticky; |
|
178 | - $map_args['enable_cat_filters'] = false; |
|
179 | - $map_args['enable_text_search'] = false; |
|
180 | - $map_args['enable_post_type_filters'] = false; |
|
181 | - $map_args['enable_location_filters'] = false; |
|
182 | - $map_args['enable_jason_on_load'] = true; |
|
169 | + $map_args = array(); |
|
170 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); |
|
171 | + $map_args['width'] = $width; |
|
172 | + $map_args['height'] = $height; |
|
173 | + |
|
174 | + $map_args['scrollwheel'] = $scrollwheel; |
|
175 | + $map_args['showall'] = $showall; |
|
176 | + $map_args['child_collapse'] = '0'; |
|
177 | + $map_args['sticky'] = $sticky; |
|
178 | + $map_args['enable_cat_filters'] = false; |
|
179 | + $map_args['enable_text_search'] = false; |
|
180 | + $map_args['enable_post_type_filters'] = false; |
|
181 | + $map_args['enable_location_filters'] = false; |
|
182 | + $map_args['enable_jason_on_load'] = true; |
|
183 | 183 | |
184 | - if (is_single()) { |
|
185 | - |
|
186 | - global $post; |
|
187 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | - $mapview = $post->post_mapview; |
|
190 | - $mapzoom = $post->post_mapzoom; |
|
191 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
192 | - |
|
193 | - } else { |
|
194 | - $default_location = geodir_get_default_location(); |
|
195 | - |
|
196 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | - $mapview = $maptype; |
|
200 | - } |
|
201 | - |
|
202 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
203 | - |
|
204 | - // Set default map options |
|
205 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
206 | - $map_args['latitude'] = $map_default_lat; |
|
207 | - $map_args['longitude'] = $map_default_lng; |
|
208 | - $map_args['zoom'] = $zoom; |
|
209 | - //$map_args['scrollwheel'] = true; |
|
210 | - $map_args['scrollwheel'] = $scrollwheel; |
|
211 | - $map_args['showall'] = $showall; |
|
212 | - $map_args['streetViewControl'] = true; |
|
213 | - $map_args['maptype'] = $maptype; |
|
214 | - $map_args['showPreview'] = '0'; |
|
215 | - $map_args['maxZoom'] = 21; |
|
216 | - $map_args['autozoom'] = $autozoom; |
|
217 | - $map_args['bubble_size'] = 'small'; |
|
184 | + if (is_single()) { |
|
185 | + |
|
186 | + global $post; |
|
187 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
188 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
189 | + $mapview = $post->post_mapview; |
|
190 | + $mapzoom = $post->post_mapzoom; |
|
191 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
192 | + |
|
193 | + } else { |
|
194 | + $default_location = geodir_get_default_location(); |
|
195 | + |
|
196 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
197 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
198 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
199 | + $mapview = $maptype; |
|
200 | + } |
|
201 | + |
|
202 | + if (empty($mapzoom)) $mapzoom = $zoom; |
|
203 | + |
|
204 | + // Set default map options |
|
205 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
206 | + $map_args['latitude'] = $map_default_lat; |
|
207 | + $map_args['longitude'] = $map_default_lng; |
|
208 | + $map_args['zoom'] = $zoom; |
|
209 | + //$map_args['scrollwheel'] = true; |
|
210 | + $map_args['scrollwheel'] = $scrollwheel; |
|
211 | + $map_args['showall'] = $showall; |
|
212 | + $map_args['streetViewControl'] = true; |
|
213 | + $map_args['maptype'] = $maptype; |
|
214 | + $map_args['showPreview'] = '0'; |
|
215 | + $map_args['maxZoom'] = 21; |
|
216 | + $map_args['autozoom'] = $autozoom; |
|
217 | + $map_args['bubble_size'] = 'small'; |
|
218 | 218 | |
219 | - $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
219 | + $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false; |
|
220 | 220 | |
221 | - echo $before_widget; |
|
222 | - geodir_draw_map($map_args); |
|
223 | - echo $after_widget; |
|
221 | + echo $before_widget; |
|
222 | + geodir_draw_map($map_args); |
|
223 | + echo $after_widget; |
|
224 | 224 | |
225 | - endif; |
|
226 | - } |
|
225 | + endif; |
|
226 | + } |
|
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Sanitize listing page map widget form values as they are saved. |
230 | 230 | * |
231 | 231 | * @since 1.0.0 |
232 | - * @since 1.5.1 Declare function public. |
|
232 | + * @since 1.5.1 Declare function public. |
|
233 | 233 | * |
234 | 234 | * @param array $new_instance Values just sent to be saved. |
235 | 235 | * @param array $old_instance Previously saved values from database. |
236 | 236 | * |
237 | 237 | * @return array Updated safe values to be saved. |
238 | 238 | */ |
239 | - public function update($new_instance, $old_instance) { |
|
240 | - //save the widget |
|
241 | - $instance = $old_instance; |
|
242 | - $instance['width'] = strip_tags($new_instance['width']); |
|
243 | - $instance['heigh'] = ($new_instance['heigh']); |
|
244 | - $instance['maptype'] = ($new_instance['maptype']); |
|
245 | - $instance['zoom'] = ($new_instance['zoom']); |
|
246 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
247 | - $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
248 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
249 | - $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
250 | - $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
251 | - |
|
252 | - return $instance; |
|
253 | - } |
|
239 | + public function update($new_instance, $old_instance) { |
|
240 | + //save the widget |
|
241 | + $instance = $old_instance; |
|
242 | + $instance['width'] = strip_tags($new_instance['width']); |
|
243 | + $instance['heigh'] = ($new_instance['heigh']); |
|
244 | + $instance['maptype'] = ($new_instance['maptype']); |
|
245 | + $instance['zoom'] = ($new_instance['zoom']); |
|
246 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
247 | + $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
248 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
249 | + $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
250 | + $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : ''; |
|
251 | + |
|
252 | + return $instance; |
|
253 | + } |
|
254 | 254 | |
255 | 255 | /** |
256 | 256 | * Back-end listing page map widget settings form. |
257 | 257 | * |
258 | 258 | * @since 1.0.0 |
259 | - * @since 1.5.1 Declare function public. |
|
259 | + * @since 1.5.1 Declare function public. |
|
260 | 260 | * |
261 | 261 | * @param array $instance Previously saved values from database. |
262 | 262 | */ |
263 | - public function form($instance) { |
|
264 | - // widget form in backend |
|
265 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
263 | + public function form($instance) { |
|
264 | + // widget form in backend |
|
265 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
266 | 266 | |
267 | - $width = strip_tags($instance['width']); |
|
268 | - $heigh = strip_tags($instance['heigh']); |
|
269 | - $maptype = strip_tags($instance['maptype']); |
|
270 | - $zoom = strip_tags($instance['zoom']); |
|
271 | - $autozoom = strip_tags($instance['autozoom']); |
|
272 | - $sticky = strip_tags($instance['sticky']); |
|
273 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
274 | - $showall = strip_tags($instance['showall']); |
|
275 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
276 | - ?> |
|
267 | + $width = strip_tags($instance['width']); |
|
268 | + $heigh = strip_tags($instance['heigh']); |
|
269 | + $maptype = strip_tags($instance['maptype']); |
|
270 | + $zoom = strip_tags($instance['zoom']); |
|
271 | + $autozoom = strip_tags($instance['autozoom']); |
|
272 | + $sticky = strip_tags($instance['sticky']); |
|
273 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
274 | + $showall = strip_tags($instance['showall']); |
|
275 | + $marker_cluster = (int)$instance['marker_cluster']; |
|
276 | + ?> |
|
277 | 277 | <p> |
278 | 278 | <label |
279 | 279 | for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?> |
@@ -302,14 +302,14 @@ discard block |
||
302 | 302 | name="<?php echo $this->get_field_name('maptype'); ?>"> |
303 | 303 | |
304 | 304 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') { |
305 | - echo 'selected="selected"'; |
|
306 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
305 | + echo 'selected="selected"'; |
|
306 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
307 | 307 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') { |
308 | - echo 'selected="selected"'; |
|
309 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
308 | + echo 'selected="selected"'; |
|
309 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
310 | 310 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
311 | - echo 'selected="selected"'; |
|
312 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
311 | + echo 'selected="selected"'; |
|
312 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
313 | 313 | <option <?php selected($maptype, 'TERRAIN');?> |
314 | 314 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
315 | 315 | </select> |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | </p> |
318 | 318 | |
319 | 319 | <?php |
320 | - $map_zoom_level = geodir_map_zoom_level(); |
|
321 | - ?> |
|
320 | + $map_zoom_level = geodir_map_zoom_level(); |
|
321 | + ?> |
|
322 | 322 | |
323 | 323 | <p> |
324 | 324 | <label |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>" |
329 | 329 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php |
330 | 330 | |
331 | - foreach ($map_zoom_level as $level) { |
|
332 | - $selected = ''; |
|
333 | - if ($level == $zoom) |
|
334 | - $selected = 'selected="selected"'; |
|
331 | + foreach ($map_zoom_level as $level) { |
|
332 | + $selected = ''; |
|
333 | + if ($level == $zoom) |
|
334 | + $selected = 'selected="selected"'; |
|
335 | 335 | |
336 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
336 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
337 | 337 | |
338 | - } ?> |
|
338 | + } ?> |
|
339 | 339 | |
340 | 340 | </select> |
341 | 341 | |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | for="<?php echo $this->get_field_id('autozoom'); ?>"> |
348 | 348 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>" |
349 | 349 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) { |
350 | - echo 'checked="checked"'; |
|
351 | - } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
350 | + echo 'checked="checked"'; |
|
351 | + } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label> |
|
352 | 352 | </p> |
353 | 353 | |
354 | 354 | <p> |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | for="<?php echo $this->get_field_id('sticky'); ?>"> |
357 | 357 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>" |
358 | 358 | name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) { |
359 | - echo 'checked="checked"'; |
|
360 | - } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
359 | + echo 'checked="checked"'; |
|
360 | + } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?> |
|
361 | 361 | </label> |
362 | 362 | </p> |
363 | 363 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | </p> --> |
384 | 384 | |
385 | 385 | <?php |
386 | - } |
|
386 | + } |
|
387 | 387 | } // class geodir_map_listingpage |
388 | 388 | |
389 | 389 | register_widget('geodir_map_listingpage'); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $post->marker_json JSON representation of the post marker info. |
46 | 46 | * @param object $post The post object. |
47 | 47 | */ |
48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post); |
|
48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $json_content = substr(implode(',', $cat_content_info), 1); |
74 | 74 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
75 | 75 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
76 | + $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']'; |
|
77 | 77 | } else { |
78 | 78 | $list_json = '[{"totalcount":"0"}]'; |
79 | 79 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @param bool $display true if map should be displayed, false if not. |
163 | 163 | */ |
164 | - $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
|
165 | - if ( !$show_map ) { |
|
164 | + $show_map = apply_filters('geodir_show_map_listing', $display = true); |
|
165 | + if (!$show_map) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function form($instance) { |
264 | 264 | // widget form in backend |
265 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
265 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0')); |
|
266 | 266 | |
267 | 267 | $width = strip_tags($instance['width']); |
268 | 268 | $heigh = strip_tags($instance['heigh']); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $sticky = strip_tags($instance['sticky']); |
273 | 273 | $scrollwheel = strip_tags($instance['scrollwheel']); |
274 | 274 | $showall = strip_tags($instance['showall']); |
275 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
275 | + $marker_cluster = (int) $instance['marker_cluster']; |
|
276 | 276 | ?> |
277 | 277 | <p> |
278 | 278 | <label |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
311 | 311 | echo 'selected="selected"'; |
312 | 312 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
313 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
313 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
314 | 314 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
315 | 315 | </select> |
316 | 316 | </label> |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | if ($level == $zoom) |
334 | 334 | $selected = 'selected="selected"'; |
335 | 335 | |
336 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
336 | + echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>'; |
|
337 | 337 | |
338 | 338 | } ?> |
339 | 339 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | for="<?php echo $this->get_field_id('scrollwheel'); ?>"> |
367 | 367 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>" |
368 | 368 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1" |
369 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
369 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?> |
|
370 | 370 | </label> |
371 | 371 | </p> |
372 | 372 | <?php if (defined('GDCLUSTER_VERSION')) { ?> |
@@ -80,7 +80,10 @@ discard block |
||
80 | 80 | echo ' geodir-listview '; |
81 | 81 | } ?> <?php if ($post_view_class) { |
82 | 82 | echo $post_view_class; |
83 | - } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing |
|
83 | + } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
84 | + echo "style='width:{$listing_width}%;'"; |
|
85 | + } |
|
86 | + // Width for widget listing |
|
84 | 87 | |
85 | 88 | echo " data-post-id='$post->ID' "; |
86 | 89 | /** |
@@ -402,8 +405,10 @@ discard block |
||
402 | 405 | */ |
403 | 406 | do_action('geodir_after_listing_post_listview'); |
404 | 407 | |
405 | - else: |
|
406 | - $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
|
408 | + else { |
|
409 | + : |
|
410 | + $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
|
411 | + } |
|
407 | 412 | |
408 | 413 | /** |
409 | 414 | * Called inside the `ul` of the listings template, when no listing found. |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ?> |
76 | 76 | |
77 | 77 | <li class="clearfix <?php if ($grid_view_class) { |
78 | - echo 'geodir-gridview ' . $grid_view_class; |
|
78 | + echo 'geodir-gridview '.$grid_view_class; |
|
79 | 79 | } else { |
80 | 80 | echo ' geodir-listview '; |
81 | 81 | } ?> <?php if ($post_view_class) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
117 | 117 | } |
118 | 118 | |
119 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
119 | + $geodir_days_new = (int) get_option('geodir_listing_new_days'); |
|
120 | 120 | |
121 | 121 | if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
122 | 122 | echo geodir_show_badges_on_image('new', $post, get_permalink()); |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | } else { |
195 | 195 | $uom = __('meters', 'geodirectory'); |
196 | 196 | } |
197 | - echo round($distance) . ' ' . $uom . '<br />'; |
|
197 | + echo round($distance).' '.$uom.'<br />'; |
|
198 | 198 | } else { |
199 | 199 | if ($uom == 'miles') { |
200 | 200 | $uom = __('miles', 'geodirectory'); |
201 | 201 | } else { |
202 | 202 | $uom = __('km', 'geodirectory'); |
203 | 203 | } |
204 | - echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
204 | + echo round($distance, 2).' '.$uom.'<br />'; |
|
205 | 205 | } |
206 | 206 | ?> |
207 | 207 | </h3> |
@@ -231,13 +231,13 @@ discard block |
||
231 | 231 | */ |
232 | 232 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
233 | 233 | if ($show_listing_excerpt) { |
234 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
235 | - $content_out = geodir_max_excerpt( $character_count ); |
|
234 | + if (isset($character_count) && ($character_count || $character_count == '0')) { |
|
235 | + $content_out = geodir_max_excerpt($character_count); |
|
236 | 236 | } else { |
237 | 237 | $content_out = get_the_excerpt(); |
238 | 238 | } |
239 | - if ( ! empty( $content_out ) ) { |
|
240 | - echo "<p>" . $content_out . "</p>"; |
|
239 | + if (!empty($content_out)) { |
|
240 | + echo "<p>".$content_out."</p>"; |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | ?></div> |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @param object $post The post object. |
262 | 262 | * @param string $view The view type, default 'listing'. |
263 | 263 | */ |
264 | - do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
264 | + do_action('geodir_after_listing_content', $post, 'listing'); ?> |
|
265 | 265 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>"> |
266 | 266 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>"> |
267 | 267 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @param object $post The post object. |
274 | 274 | * @param string $view The view type, default 'listing'. |
275 | 275 | */ |
276 | - do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
276 | + do_action('geodir_before_review_html', $post, 'listing'); |
|
277 | 277 | |
278 | 278 | $review_show = geodir_is_reviews_show('listview'); |
279 | 279 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @since 1.0.0 |
318 | 318 | */ |
319 | - do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
319 | + do_action('geodir_after_favorite_html', $post->ID, 'listing'); |
|
320 | 320 | |
321 | 321 | |
322 | 322 | /** |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @param int $post->ID The post id. |
328 | 328 | * @param object $post The post object. |
329 | 329 | */ |
330 | - do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
330 | + do_action('geodir_listing_after_pinpoint', $post->ID, $post); |
|
331 | 331 | |
332 | 332 | if ($post->post_author == get_current_user_id()) { ?> |
333 | 333 | <?php |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
357 | 357 | <?php |
358 | 358 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
359 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
359 | + echo '<i class="'.$geodir_listing_edit_icon.'"></i>'; |
|
360 | 360 | ?> |
361 | 361 | <?php _e('Edit', 'geodirectory'); ?> |
362 | 362 | </a> |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
365 | 365 | <?php |
366 | 366 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
367 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
367 | + echo '<i class="'.$geodir_listing_delete_icon.'"></i>'; |
|
368 | 368 | ?> |
369 | 369 | <?php _e('Delete', 'geodirectory'); ?> |
370 | 370 | </a> |
@@ -44,57 +44,57 @@ discard block |
||
44 | 44 | |
45 | 45 | <?php if (have_posts()) : |
46 | 46 | |
47 | - /** |
|
48 | - * Called inside the `ul` of the listings template, but before any `li` elements. |
|
49 | - * |
|
50 | - * When used by the widget view template then it will only show if there are listings to be shown. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * @see 'geodir_after_listing_post_listview' |
|
54 | - */ |
|
55 | - do_action('geodir_before_listing_post_listview'); |
|
56 | - |
|
57 | - while (have_posts()) : the_post(); |
|
58 | - global $post, $wpdb, $preview; |
|
59 | - |
|
60 | - /** |
|
61 | - * Add a class to the `li` element of the listings list template. |
|
62 | - * |
|
63 | - * @since 1.0.0 |
|
64 | - * @param string $class The extra class for the `li` element, default empty. |
|
65 | - */ |
|
66 | - $post_view_class = apply_filters('geodir_post_view_extra_class', ''); |
|
67 | - |
|
68 | - /** |
|
69 | - * Add a class to the `article` tag inside the `li` element on the listings list template. |
|
70 | - * |
|
71 | - * @since 1.0.0 |
|
72 | - * @param string $class The extra class for the `article` element, default empty. |
|
73 | - */ |
|
74 | - $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
75 | - ?> |
|
47 | + /** |
|
48 | + * Called inside the `ul` of the listings template, but before any `li` elements. |
|
49 | + * |
|
50 | + * When used by the widget view template then it will only show if there are listings to be shown. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * @see 'geodir_after_listing_post_listview' |
|
54 | + */ |
|
55 | + do_action('geodir_before_listing_post_listview'); |
|
56 | + |
|
57 | + while (have_posts()) : the_post(); |
|
58 | + global $post, $wpdb, $preview; |
|
59 | + |
|
60 | + /** |
|
61 | + * Add a class to the `li` element of the listings list template. |
|
62 | + * |
|
63 | + * @since 1.0.0 |
|
64 | + * @param string $class The extra class for the `li` element, default empty. |
|
65 | + */ |
|
66 | + $post_view_class = apply_filters('geodir_post_view_extra_class', ''); |
|
67 | + |
|
68 | + /** |
|
69 | + * Add a class to the `article` tag inside the `li` element on the listings list template. |
|
70 | + * |
|
71 | + * @since 1.0.0 |
|
72 | + * @param string $class The extra class for the `article` element, default empty. |
|
73 | + */ |
|
74 | + $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
|
75 | + ?> |
|
76 | 76 | |
77 | 77 | <li class="clearfix <?php if ($grid_view_class) { |
78 | - echo 'geodir-gridview ' . $grid_view_class; |
|
79 | - } else { |
|
80 | - echo ' geodir-listview '; |
|
81 | - } ?> <?php if ($post_view_class) { |
|
82 | - echo $post_view_class; |
|
83 | - } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing |
|
84 | - |
|
85 | - echo " data-post-id='$post->ID' "; |
|
86 | - /** |
|
87 | - * Called inside the `<li>` tag for listing outputs. |
|
88 | - * |
|
89 | - * @since 1.5.9 |
|
90 | - * @param object $post The post object. |
|
91 | - * @param string $string If called on the listing or widget template. |
|
92 | - */ |
|
93 | - do_action('geodir_listview_inside_li', $post, 'listing'); |
|
94 | - ?> > |
|
78 | + echo 'geodir-gridview ' . $grid_view_class; |
|
79 | + } else { |
|
80 | + echo ' geodir-listview '; |
|
81 | + } ?> <?php if ($post_view_class) { |
|
82 | + echo $post_view_class; |
|
83 | + } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing |
|
84 | + |
|
85 | + echo " data-post-id='$post->ID' "; |
|
86 | + /** |
|
87 | + * Called inside the `<li>` tag for listing outputs. |
|
88 | + * |
|
89 | + * @since 1.5.9 |
|
90 | + * @param object $post The post object. |
|
91 | + * @param string $string If called on the listing or widget template. |
|
92 | + */ |
|
93 | + do_action('geodir_listview_inside_li', $post, 'listing'); |
|
94 | + ?> > |
|
95 | 95 | <article class="geodir-category-listing <?php if ($post_view_article_class) { |
96 | - echo $post_view_article_class; |
|
97 | - } ?>"> |
|
96 | + echo $post_view_article_class; |
|
97 | + } ?>"> |
|
98 | 98 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'listing'); ?>"> |
99 | 99 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?> |
100 | 100 | |
@@ -102,37 +102,37 @@ discard block |
||
102 | 102 | <?php echo $fimage; ?> |
103 | 103 | </a> |
104 | 104 | <?php |
105 | - /** |
|
106 | - * Called before badges are output. |
|
107 | - * |
|
108 | - * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output. |
|
109 | - * |
|
110 | - * @since 1.0.0 |
|
111 | - * @param object $post The post object. |
|
112 | - * @see 'geodir_after_badge_on_image' |
|
113 | - */ |
|
114 | - do_action('geodir_before_badge_on_image', $post); |
|
115 | - if (isset($post->is_featured) && $post->is_featured) { |
|
116 | - echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
117 | - } |
|
118 | - |
|
119 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
120 | - |
|
121 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
122 | - echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Called after badges are output. |
|
127 | - * |
|
128 | - * Called on the listings template after the image and badges like `new` or `featured` have been output. |
|
129 | - * |
|
130 | - * @since 1.0.0 |
|
131 | - * @param object $post The post object. |
|
132 | - * @see 'geodir_before_badge_on_image' |
|
133 | - */ |
|
134 | - do_action('geodir_after_badge_on_image', $post); |
|
135 | - ?> |
|
105 | + /** |
|
106 | + * Called before badges are output. |
|
107 | + * |
|
108 | + * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output. |
|
109 | + * |
|
110 | + * @since 1.0.0 |
|
111 | + * @param object $post The post object. |
|
112 | + * @see 'geodir_after_badge_on_image' |
|
113 | + */ |
|
114 | + do_action('geodir_before_badge_on_image', $post); |
|
115 | + if (isset($post->is_featured) && $post->is_featured) { |
|
116 | + echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
117 | + } |
|
118 | + |
|
119 | + $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
120 | + |
|
121 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
122 | + echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Called after badges are output. |
|
127 | + * |
|
128 | + * Called on the listings template after the image and badges like `new` or `featured` have been output. |
|
129 | + * |
|
130 | + * @since 1.0.0 |
|
131 | + * @param object $post The post object. |
|
132 | + * @see 'geodir_before_badge_on_image' |
|
133 | + */ |
|
134 | + do_action('geodir_after_badge_on_image', $post); |
|
135 | + ?> |
|
136 | 136 | |
137 | 137 | |
138 | 138 | <?php } ?> |
@@ -142,15 +142,15 @@ discard block |
||
142 | 142 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'listing'); ?>"> |
143 | 143 | |
144 | 144 | <?php |
145 | - /** |
|
146 | - * Called before the post title on the listings view template. |
|
147 | - * |
|
148 | - * @since 1.0.0 |
|
149 | - * @param string $type The template type, default 'listview'. |
|
150 | - * @param object $post The post object. |
|
151 | - * @see 'geodir_after_listing_post_title' |
|
152 | - */ |
|
153 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
145 | + /** |
|
146 | + * Called before the post title on the listings view template. |
|
147 | + * |
|
148 | + * @since 1.0.0 |
|
149 | + * @param string $type The template type, default 'listview'. |
|
150 | + * @param object $post The post object. |
|
151 | + * @see 'geodir_after_listing_post_title' |
|
152 | + */ |
|
153 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
154 | 154 | |
155 | 155 | <header class="geodir-entry-header"><h3 class="geodir-entry-title"> |
156 | 156 | <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> |
@@ -162,226 +162,226 @@ discard block |
||
162 | 162 | <!-- .entry-header --> |
163 | 163 | |
164 | 164 | <?php |
165 | - /** |
|
166 | - * Called after the post title on the listings view template. |
|
167 | - * |
|
168 | - * @since 1.0.0 |
|
169 | - * @param string $type The template type, default 'listview'. |
|
170 | - * @param object $post The post object. |
|
171 | - * @see 'geodir_before_listing_post_title' |
|
172 | - */ |
|
173 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
165 | + /** |
|
166 | + * Called after the post title on the listings view template. |
|
167 | + * |
|
168 | + * @since 1.0.0 |
|
169 | + * @param string $type The template type, default 'listview'. |
|
170 | + * @param object $post The post object. |
|
171 | + * @see 'geodir_before_listing_post_title' |
|
172 | + */ |
|
173 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
174 | 174 | |
175 | 175 | <?php /// Print Distance |
176 | - if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || $related_nearest) { |
|
177 | - |
|
178 | - if ($related_nearest) { |
|
179 | - $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
180 | - } else { |
|
181 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
182 | - } |
|
183 | - |
|
184 | - $endLat = $post->post_latitude; |
|
185 | - $endLon = $post->post_longitude; |
|
186 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
187 | - $uom = get_option('geodir_search_dist_1'); |
|
188 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?> |
|
176 | + if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || $related_nearest) { |
|
177 | + |
|
178 | + if ($related_nearest) { |
|
179 | + $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon); |
|
180 | + } else { |
|
181 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
182 | + } |
|
183 | + |
|
184 | + $endLat = $post->post_latitude; |
|
185 | + $endLon = $post->post_longitude; |
|
186 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
187 | + $uom = get_option('geodir_search_dist_1'); |
|
188 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?> |
|
189 | 189 | <h3> |
190 | 190 | <?php |
191 | 191 | |
192 | - if (round($distance, 2) == 0) { |
|
193 | - $uom = get_option('geodir_search_dist_2'); |
|
194 | - |
|
195 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
196 | - if ($uom == 'feet') { |
|
197 | - $uom = __('feet', 'geodirectory'); |
|
198 | - } else { |
|
199 | - $uom = __('meters', 'geodirectory'); |
|
200 | - } |
|
201 | - echo round($distance) . ' ' . $uom . '<br />'; |
|
202 | - } else { |
|
203 | - if ($uom == 'miles') { |
|
204 | - $uom = __('miles', 'geodirectory'); |
|
205 | - } else { |
|
206 | - $uom = __('km', 'geodirectory'); |
|
207 | - } |
|
208 | - echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
209 | - } |
|
210 | - ?> |
|
192 | + if (round($distance, 2) == 0) { |
|
193 | + $uom = get_option('geodir_search_dist_2'); |
|
194 | + |
|
195 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
196 | + if ($uom == 'feet') { |
|
197 | + $uom = __('feet', 'geodirectory'); |
|
198 | + } else { |
|
199 | + $uom = __('meters', 'geodirectory'); |
|
200 | + } |
|
201 | + echo round($distance) . ' ' . $uom . '<br />'; |
|
202 | + } else { |
|
203 | + if ($uom == 'miles') { |
|
204 | + $uom = __('miles', 'geodirectory'); |
|
205 | + } else { |
|
206 | + $uom = __('km', 'geodirectory'); |
|
207 | + } |
|
208 | + echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
209 | + } |
|
210 | + ?> |
|
211 | 211 | </h3> |
212 | 212 | <?php } ?> |
213 | 213 | |
214 | 214 | |
215 | 215 | <?php |
216 | - /** |
|
217 | - * Called before the post excerpt on the listings view template. |
|
218 | - * |
|
219 | - * @since 1.0.0 |
|
220 | - * @param object $post The post object. |
|
221 | - * @see 'geodir_after_listing_post_excerpt' |
|
222 | - */ |
|
223 | - do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
216 | + /** |
|
217 | + * Called before the post excerpt on the listings view template. |
|
218 | + * |
|
219 | + * @since 1.0.0 |
|
220 | + * @param object $post The post object. |
|
221 | + * @see 'geodir_after_listing_post_excerpt' |
|
222 | + */ |
|
223 | + do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
224 | 224 | <?php echo geodir_show_listing_info('listing'); ?> |
225 | 225 | <div class="geodir-entry-content"> |
226 | 226 | |
227 | 227 | <?php |
228 | - /** |
|
229 | - * Filter to hide the listing excerpt |
|
230 | - * |
|
231 | - * @since 1.5.3 |
|
232 | - * @param bool $display Display the excerpt or not. Default true. |
|
233 | - * @param string $view The view type, default 'listview'. |
|
234 | - * @param object $post The post object. |
|
235 | - */ |
|
236 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
|
237 | - if ($show_listing_excerpt) { |
|
238 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
239 | - $content_out = geodir_max_excerpt( $character_count ); |
|
240 | - } else { |
|
241 | - $content_out = get_the_excerpt(); |
|
242 | - } |
|
243 | - if ( ! empty( $content_out ) ) { |
|
244 | - echo "<p>" . $content_out . "</p>"; |
|
245 | - } |
|
246 | - } |
|
247 | - ?></div> |
|
228 | + /** |
|
229 | + * Filter to hide the listing excerpt |
|
230 | + * |
|
231 | + * @since 1.5.3 |
|
232 | + * @param bool $display Display the excerpt or not. Default true. |
|
233 | + * @param string $view The view type, default 'listview'. |
|
234 | + * @param object $post The post object. |
|
235 | + */ |
|
236 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post); |
|
237 | + if ($show_listing_excerpt) { |
|
238 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
239 | + $content_out = geodir_max_excerpt( $character_count ); |
|
240 | + } else { |
|
241 | + $content_out = get_the_excerpt(); |
|
242 | + } |
|
243 | + if ( ! empty( $content_out ) ) { |
|
244 | + echo "<p>" . $content_out . "</p>"; |
|
245 | + } |
|
246 | + } |
|
247 | + ?></div> |
|
248 | 248 | |
249 | 249 | <?php |
250 | - /** |
|
251 | - * Called after the post excerpt on the listings view template. |
|
252 | - * |
|
253 | - * @since 1.0.0 |
|
254 | - * @param object $post The post object. |
|
255 | - * @see 'geodir_before_listing_post_excerpt' |
|
256 | - */ |
|
257 | - do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
250 | + /** |
|
251 | + * Called after the post excerpt on the listings view template. |
|
252 | + * |
|
253 | + * @since 1.0.0 |
|
254 | + * @param object $post The post object. |
|
255 | + * @see 'geodir_before_listing_post_excerpt' |
|
256 | + */ |
|
257 | + do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
258 | 258 | </div> |
259 | 259 | <!-- gd-content ends here--> |
260 | 260 | <?php |
261 | - /** |
|
262 | - * Called after printing listing content. |
|
263 | - * |
|
264 | - * @since 1.5.3 |
|
265 | - * @param object $post The post object. |
|
266 | - * @param string $view The view type, default 'listing'. |
|
267 | - */ |
|
268 | - do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
261 | + /** |
|
262 | + * Called after printing listing content. |
|
263 | + * |
|
264 | + * @since 1.5.3 |
|
265 | + * @param object $post The post object. |
|
266 | + * @param string $view The view type, default 'listing'. |
|
267 | + */ |
|
268 | + do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
269 | 269 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>"> |
270 | 270 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>"> |
271 | 271 | |
272 | 272 | <?php |
273 | - /** |
|
274 | - * Called before printing review stars html. |
|
275 | - * |
|
276 | - * @since 1.5.3 |
|
277 | - * @param object $post The post object. |
|
278 | - * @param string $view The view type, default 'listing'. |
|
279 | - */ |
|
280 | - do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
281 | - |
|
282 | - $review_show = geodir_is_reviews_show('listview'); |
|
283 | - |
|
284 | - if ($review_show) { |
|
285 | - |
|
286 | - if (!$preview) { |
|
287 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
288 | - /** |
|
289 | - * Called before the rating stars are output on the listings view template. |
|
290 | - * |
|
291 | - * @since 1.0.0 |
|
292 | - * @param float $post_avgratings The average rating for the post. |
|
293 | - * @param int $post->ID The post ID. |
|
294 | - * @see 'geodir_after_review_rating_stars_on_listview' |
|
295 | - */ |
|
296 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
297 | - |
|
298 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
299 | - |
|
300 | - /** |
|
301 | - * Called after the rating stars are output on the listings view template. |
|
302 | - * |
|
303 | - * @since 1.0.0 |
|
304 | - * @param float $post_avgratings The average rating for the post. |
|
305 | - * @param int $post->ID The post ID. |
|
306 | - * @see 'geodir_before_review_rating_stars_on_listview' |
|
307 | - */ |
|
308 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
309 | - } |
|
310 | - ?> |
|
273 | + /** |
|
274 | + * Called before printing review stars html. |
|
275 | + * |
|
276 | + * @since 1.5.3 |
|
277 | + * @param object $post The post object. |
|
278 | + * @param string $view The view type, default 'listing'. |
|
279 | + */ |
|
280 | + do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
281 | + |
|
282 | + $review_show = geodir_is_reviews_show('listview'); |
|
283 | + |
|
284 | + if ($review_show) { |
|
285 | + |
|
286 | + if (!$preview) { |
|
287 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
288 | + /** |
|
289 | + * Called before the rating stars are output on the listings view template. |
|
290 | + * |
|
291 | + * @since 1.0.0 |
|
292 | + * @param float $post_avgratings The average rating for the post. |
|
293 | + * @param int $post->ID The post ID. |
|
294 | + * @see 'geodir_after_review_rating_stars_on_listview' |
|
295 | + */ |
|
296 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
297 | + |
|
298 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
299 | + |
|
300 | + /** |
|
301 | + * Called after the rating stars are output on the listings view template. |
|
302 | + * |
|
303 | + * @since 1.0.0 |
|
304 | + * @param float $post_avgratings The average rating for the post. |
|
305 | + * @param int $post->ID The post ID. |
|
306 | + * @see 'geodir_before_review_rating_stars_on_listview' |
|
307 | + */ |
|
308 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
309 | + } |
|
310 | + ?> |
|
311 | 311 | <a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
312 | 312 | class="fa fa-comments"></i> |
313 | 313 | <?php geodir_comments_number($post->rating_count); ?></a> |
314 | 314 | <?php |
315 | - } |
|
315 | + } |
|
316 | 316 | |
317 | 317 | |
318 | - /** |
|
319 | - * Called after printing favorite html. |
|
320 | - * |
|
321 | - * @since 1.0.0 |
|
322 | - */ |
|
323 | - do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
318 | + /** |
|
319 | + * Called after printing favorite html. |
|
320 | + * |
|
321 | + * @since 1.0.0 |
|
322 | + */ |
|
323 | + do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
324 | 324 | |
325 | 325 | |
326 | - /** |
|
327 | - * Called after printing map pin point. |
|
328 | - * |
|
329 | - * @since 1.0.0 |
|
330 | - * @since 1.5.9 Added $post as second param. |
|
331 | - * @param int $post->ID The post id. |
|
332 | - * @param object $post The post object. |
|
333 | - */ |
|
334 | - do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
326 | + /** |
|
327 | + * Called after printing map pin point. |
|
328 | + * |
|
329 | + * @since 1.0.0 |
|
330 | + * @since 1.5.9 Added $post as second param. |
|
331 | + * @param int $post->ID The post id. |
|
332 | + * @param object $post The post object. |
|
333 | + */ |
|
334 | + do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
335 | 335 | |
336 | - if ($post->post_author == get_current_user_id()) { ?> |
|
336 | + if ($post->post_author == get_current_user_id()) { ?> |
|
337 | 337 | <?php |
338 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
339 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
340 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
338 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
339 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
340 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
341 | 341 | |
342 | - $ajaxlink = geodir_get_ajax_url(); |
|
343 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
342 | + $ajaxlink = geodir_get_ajax_url(); |
|
343 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
344 | 344 | |
345 | - ?> |
|
345 | + ?> |
|
346 | 346 | |
347 | 347 | <span class="geodir-authorlink clearfix"> |
348 | 348 | |
349 | 349 | <?php if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
350 | - /** |
|
351 | - * Called before the edit post link on the listings view template used on the author page. |
|
352 | - * |
|
353 | - * @since 1.0.0 |
|
354 | - * @see 'geodir_after_edit_post_link_on_listing' |
|
355 | - */ |
|
356 | - do_action('geodir_before_edit_post_link_on_listing'); |
|
357 | - ?> |
|
350 | + /** |
|
351 | + * Called before the edit post link on the listings view template used on the author page. |
|
352 | + * |
|
353 | + * @since 1.0.0 |
|
354 | + * @see 'geodir_after_edit_post_link_on_listing' |
|
355 | + */ |
|
356 | + do_action('geodir_before_edit_post_link_on_listing'); |
|
357 | + ?> |
|
358 | 358 | |
359 | 359 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
360 | 360 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
361 | 361 | <?php |
362 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
|
363 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
364 | - ?> |
|
362 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
|
363 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
364 | + ?> |
|
365 | 365 | <?php _e('Edit', 'geodirectory'); ?> |
366 | 366 | </a> |
367 | 367 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
368 | 368 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
369 | 369 | <?php |
370 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
371 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
372 | - ?> |
|
370 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
371 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
372 | + ?> |
|
373 | 373 | <?php _e('Delete', 'geodirectory'); ?> |
374 | 374 | </a> |
375 | 375 | <?php |
376 | 376 | |
377 | - /** |
|
378 | - * Called after the edit post link on the listings view template used on the author page. |
|
379 | - * |
|
380 | - * @since 1.0.0 |
|
381 | - * @see 'geodir_before_edit_post_link_on_listing' |
|
382 | - */ |
|
383 | - do_action('geodir_after_edit_post_link_on_listing'); |
|
384 | - } ?> |
|
377 | + /** |
|
378 | + * Called after the edit post link on the listings view template used on the author page. |
|
379 | + * |
|
380 | + * @since 1.0.0 |
|
381 | + * @see 'geodir_before_edit_post_link_on_listing' |
|
382 | + */ |
|
383 | + do_action('geodir_after_edit_post_link_on_listing'); |
|
384 | + } ?> |
|
385 | 385 | </span> |
386 | 386 | |
387 | 387 | <?php } ?> |
@@ -394,32 +394,32 @@ discard block |
||
394 | 394 | </li> |
395 | 395 | |
396 | 396 | <?php |
397 | - endwhile; |
|
398 | - |
|
399 | - /** |
|
400 | - * Called inside the `ul` of the listings template, but after all `li` elements. |
|
401 | - * |
|
402 | - * When used by the widget view template then it will only show if there are listings to be shown. |
|
403 | - * |
|
404 | - * @since 1.0.0 |
|
405 | - * @see 'geodir_before_listing_post_listview' |
|
406 | - */ |
|
407 | - do_action('geodir_after_listing_post_listview'); |
|
408 | - |
|
409 | - else: |
|
397 | + endwhile; |
|
398 | + |
|
399 | + /** |
|
400 | + * Called inside the `ul` of the listings template, but after all `li` elements. |
|
401 | + * |
|
402 | + * When used by the widget view template then it will only show if there are listings to be shown. |
|
403 | + * |
|
404 | + * @since 1.0.0 |
|
405 | + * @see 'geodir_before_listing_post_listview' |
|
406 | + */ |
|
407 | + do_action('geodir_after_listing_post_listview'); |
|
408 | + |
|
409 | + else: |
|
410 | 410 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
411 | 411 | |
412 | 412 | /** |
413 | - * Called inside the `ul` of the listings template, when no listing found. |
|
414 | - * |
|
415 | - * @since 1.5.5 |
|
413 | + * Called inside the `ul` of the listings template, when no listing found. |
|
414 | + * |
|
415 | + * @since 1.5.5 |
|
416 | 416 | * @param string 'listing-listview' Listing listview template. |
417 | 417 | * @param bool $favorite Are favorite listings results? |
418 | - */ |
|
419 | - do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite); |
|
420 | - endif; |
|
418 | + */ |
|
419 | + do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite); |
|
420 | + endif; |
|
421 | 421 | |
422 | - ?> |
|
422 | + ?> |
|
423 | 423 | </ul> <!-- geodir_category_list_view ends here--> |
424 | 424 | |
425 | 425 | <div class="clear"></div> |
@@ -20,72 +20,72 @@ 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 | |
58 | - echo " data-post-id='$post->ID' "; |
|
59 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
60 | - do_action('geodir_listview_inside_li', $post, 'widget'); |
|
61 | - ?>> |
|
58 | + echo " data-post-id='$post->ID' "; |
|
59 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
60 | + do_action('geodir_listview_inside_li', $post, 'widget'); |
|
61 | + ?>> |
|
62 | 62 | <article class="geodir-category-listing <?php if ($post_view_article_class) { |
63 | - echo $post_view_article_class; |
|
64 | - } ?>"> |
|
63 | + echo $post_view_article_class; |
|
64 | + } ?>"> |
|
65 | 65 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'widget'); ?>"> |
66 | 66 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?> |
67 | 67 | <a href="<?php the_permalink(); ?>"><?php echo $fimage; ?></a> |
68 | 68 | <?php |
69 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
70 | - do_action('geodir_before_badge_on_image', $post); |
|
71 | - if ($post->is_featured) { |
|
72 | - echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
73 | - } |
|
69 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
70 | + do_action('geodir_before_badge_on_image', $post); |
|
71 | + if ($post->is_featured) { |
|
72 | + echo geodir_show_badges_on_image('featured', $post, get_permalink()); |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
77 | - echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
78 | - } |
|
76 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) { |
|
77 | + echo geodir_show_badges_on_image('new', $post, get_permalink()); |
|
78 | + } |
|
79 | 79 | |
80 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
81 | - do_action('geodir_after_badge_on_image', $post); |
|
82 | - } |
|
83 | - ?> |
|
80 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
81 | + do_action('geodir_after_badge_on_image', $post); |
|
82 | + } |
|
83 | + ?> |
|
84 | 84 | </div> |
85 | 85 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'widget'); ?>"> |
86 | 86 | <?php |
87 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
88 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
87 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
88 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?> |
|
89 | 89 | <header class="geodir-entry-header"> |
90 | 90 | <h3 class="geodir-entry-title"> |
91 | 91 | <a href="<?php the_permalink(); ?>" |
@@ -94,158 +94,158 @@ discard block |
||
94 | 94 | </header> |
95 | 95 | <!-- .entry-header --> |
96 | 96 | <?php |
97 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
98 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
97 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
98 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?> |
|
99 | 99 | <?php /// Print Distance |
100 | - if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') { |
|
101 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
100 | + if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') { |
|
101 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']); |
|
102 | 102 | |
103 | - $endLat = $post->post_latitude; |
|
104 | - $endLon = $post->post_longitude; |
|
105 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
106 | - $uom = get_option('geodir_search_dist_1'); |
|
107 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
108 | - ?> |
|
103 | + $endLat = $post->post_latitude; |
|
104 | + $endLon = $post->post_longitude; |
|
105 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon); |
|
106 | + $uom = get_option('geodir_search_dist_1'); |
|
107 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
108 | + ?> |
|
109 | 109 | <h3> |
110 | 110 | <?php |
111 | - if (round($distance, 2) == 0) { |
|
112 | - $uom = get_option('geodir_search_dist_2'); |
|
113 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
114 | - if ($uom == 'feet') { |
|
115 | - $uom = __('feet', 'geodirectory'); |
|
116 | - } else { |
|
117 | - $uom = __('meters', 'geodirectory'); |
|
118 | - } |
|
119 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
111 | + if (round($distance, 2) == 0) { |
|
112 | + $uom = get_option('geodir_search_dist_2'); |
|
113 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
114 | + if ($uom == 'feet') { |
|
115 | + $uom = __('feet', 'geodirectory'); |
|
116 | + } else { |
|
117 | + $uom = __('meters', 'geodirectory'); |
|
118 | + } |
|
119 | + echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
120 | 120 | <br /> |
121 | 121 | '; |
122 | - } else { |
|
123 | - if ($uom == 'miles') { |
|
124 | - $uom = __('miles', 'geodirectory'); |
|
125 | - } else { |
|
126 | - $uom = __('km', 'geodirectory'); |
|
127 | - } |
|
128 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
122 | + } else { |
|
123 | + if ($uom == 'miles') { |
|
124 | + $uom = __('miles', 'geodirectory'); |
|
125 | + } else { |
|
126 | + $uom = __('km', 'geodirectory'); |
|
127 | + } |
|
128 | + echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
129 | 129 | <br /> |
130 | 130 | '; |
131 | - } |
|
132 | - ?> |
|
131 | + } |
|
132 | + ?> |
|
133 | 133 | </h3> |
134 | 134 | <?php } ?> |
135 | 135 | <?php |
136 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
137 | - do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
136 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
137 | + do_action('geodir_before_listing_post_excerpt', $post); ?> |
|
138 | 138 | <?php echo geodir_show_listing_info('listing'); ?> |
139 | 139 | <?php if (isset($character_count) && $character_count == '0') { |
140 | - } else { ?> |
|
140 | + } else { ?> |
|
141 | 141 | <div class="geodir-entry-content"> |
142 | 142 | <?php |
143 | - /** |
|
144 | - * Filter to hide the listing excerpt |
|
145 | - * |
|
146 | - * @since 1.5.3 |
|
147 | - * @param bool $display Display the excerpt or not. Default true. |
|
148 | - * @param object $post The post object. |
|
149 | - */ |
|
150 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
|
151 | - if ($show_listing_excerpt) { |
|
152 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
153 | - $content_out = geodir_max_excerpt( $character_count ); |
|
154 | - } else { |
|
155 | - $content_out = get_the_excerpt(); |
|
156 | - } |
|
157 | - if ( ! empty( $content_out ) ) { |
|
158 | - echo "<p>" . $content_out . "</p>"; |
|
159 | - } |
|
160 | - } |
|
161 | - ?> |
|
143 | + /** |
|
144 | + * Filter to hide the listing excerpt |
|
145 | + * |
|
146 | + * @since 1.5.3 |
|
147 | + * @param bool $display Display the excerpt or not. Default true. |
|
148 | + * @param object $post The post object. |
|
149 | + */ |
|
150 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
|
151 | + if ($show_listing_excerpt) { |
|
152 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
153 | + $content_out = geodir_max_excerpt( $character_count ); |
|
154 | + } else { |
|
155 | + $content_out = get_the_excerpt(); |
|
156 | + } |
|
157 | + if ( ! empty( $content_out ) ) { |
|
158 | + echo "<p>" . $content_out . "</p>"; |
|
159 | + } |
|
160 | + } |
|
161 | + ?> |
|
162 | 162 | </div> |
163 | 163 | <?php } ?> |
164 | 164 | <?php |
165 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
166 | - do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
165 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
166 | + do_action('geodir_after_listing_post_excerpt', $post); ?> |
|
167 | 167 | </div> |
168 | 168 | <!-- gd-content ends here--> |
169 | 169 | <?php |
170 | - /** |
|
171 | - * Called after printing listing content. |
|
172 | - * |
|
173 | - * @since 1.5.3 |
|
174 | - * @param object $post The post object. |
|
175 | - * @param string $view The view type, default 'widget'. |
|
176 | - */ |
|
177 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
170 | + /** |
|
171 | + * Called after printing listing content. |
|
172 | + * |
|
173 | + * @since 1.5.3 |
|
174 | + * @param object $post The post object. |
|
175 | + * @param string $view The view type, default 'widget'. |
|
176 | + */ |
|
177 | + do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
178 | 178 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>"> |
179 | 179 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>"> |
180 | 180 | <?php |
181 | - /** |
|
182 | - * Called before printing review stars html. |
|
183 | - * |
|
184 | - * @since 1.5.3 |
|
185 | - * @param object $post The post object. |
|
186 | - * @param string $view The view type, default 'widget'. |
|
187 | - */ |
|
188 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
189 | - $review_show = geodir_is_reviews_show('listview'); |
|
190 | - if ($review_show) { |
|
181 | + /** |
|
182 | + * Called before printing review stars html. |
|
183 | + * |
|
184 | + * @since 1.5.3 |
|
185 | + * @param object $post The post object. |
|
186 | + * @param string $view The view type, default 'widget'. |
|
187 | + */ |
|
188 | + do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
189 | + $review_show = geodir_is_reviews_show('listview'); |
|
190 | + if ($review_show) { |
|
191 | 191 | |
192 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
192 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
193 | 193 | |
194 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
195 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
194 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
195 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
196 | 196 | |
197 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
197 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
198 | 198 | |
199 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
200 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
201 | - ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
199 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
200 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID); |
|
201 | + ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
202 | 202 | class="fa fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?> |
203 | 203 | </a> |
204 | 204 | <?php |
205 | - } |
|
205 | + } |
|
206 | 206 | |
207 | 207 | |
208 | - /** |
|
209 | - * Called after printing favorite html. |
|
210 | - * |
|
211 | - * @since 1.0.0 |
|
212 | - */ |
|
213 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
208 | + /** |
|
209 | + * Called after printing favorite html. |
|
210 | + * |
|
211 | + * @since 1.0.0 |
|
212 | + */ |
|
213 | + do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
214 | 214 | |
215 | - if ($post->post_author == get_current_user_id()) { |
|
216 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
217 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
218 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
215 | + if ($post->post_author == get_current_user_id()) { |
|
216 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
217 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false); |
|
218 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false); |
|
219 | 219 | |
220 | - $ajaxlink = geodir_get_ajax_url(); |
|
221 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
222 | - ?> |
|
220 | + $ajaxlink = geodir_get_ajax_url(); |
|
221 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false); |
|
222 | + ?> |
|
223 | 223 | <span class="geodir-authorlink clearfix"> |
224 | 224 | <?php |
225 | - if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
|
226 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
227 | - do_action('geodir_before_edit_post_link_on_listing'); |
|
228 | - ?> |
|
225 | + if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) { |
|
226 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
227 | + do_action('geodir_before_edit_post_link_on_listing'); |
|
228 | + ?> |
|
229 | 229 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
230 | 230 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
231 | 231 | <?php |
232 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
|
233 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
234 | - ?> |
|
232 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
|
233 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
234 | + ?> |
|
235 | 235 | <?php _e('Edit', 'geodirectory'); ?> |
236 | 236 | </a> |
237 | 237 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
238 | 238 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
239 | 239 | <?php |
240 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
241 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
242 | - ?> |
|
240 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
|
241 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
242 | + ?> |
|
243 | 243 | <?php _e('Delete', 'geodirectory'); ?> |
244 | 244 | </a> |
245 | 245 | <?php |
246 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
247 | - do_action('geodir_after_edit_post_link_on_listing'); |
|
248 | - } ?> |
|
246 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
247 | + do_action('geodir_after_edit_post_link_on_listing'); |
|
248 | + } ?> |
|
249 | 249 | </span> |
250 | 250 | <?php } ?> |
251 | 251 | </div> |
@@ -255,17 +255,17 @@ discard block |
||
255 | 255 | </article> |
256 | 256 | </li> |
257 | 257 | <?php |
258 | - unset($gd_widget_listing_type); |
|
259 | - } |
|
260 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
261 | - do_action('geodir_after_listing_post_listview'); |
|
262 | - } else { |
|
258 | + unset($gd_widget_listing_type); |
|
259 | + } |
|
260 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
261 | + do_action('geodir_after_listing_post_listview'); |
|
262 | + } else { |
|
263 | 263 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
264 | 264 | |
265 | 265 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
266 | - do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite); |
|
267 | - } |
|
268 | - ?> |
|
266 | + do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite); |
|
267 | + } |
|
268 | + ?> |
|
269 | 269 | </ul> <!-- geodir_category_list_view ends here--> |
270 | 270 | <div class="clear"></div> |
271 | 271 | <?php |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
30 | 30 | do_action('geodir_before_listing_post_listview'); |
31 | 31 | $all_postypes = geodir_get_posttypes(); |
32 | - $geodir_days_new = (int)get_option('geodir_listing_new_days'); |
|
32 | + $geodir_days_new = (int) get_option('geodir_listing_new_days'); |
|
33 | 33 | foreach ($widget_listings as $widget_listing) { |
34 | 34 | global $gd_widget_listing_type; |
35 | 35 | $post = $widget_listing; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', ''); |
47 | 47 | ?> |
48 | 48 | <li class="clearfix <?php if ($grid_view_class) { |
49 | - echo 'geodir-gridview ' . $grid_view_class; |
|
49 | + echo 'geodir-gridview '.$grid_view_class; |
|
50 | 50 | } else { |
51 | 51 | echo ' geodir-listview '; |
52 | 52 | } ?> <?php if ($post_view_class) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } else { |
117 | 117 | $uom = __('meters', 'geodirectory'); |
118 | 118 | } |
119 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
119 | + echo round($distance).' '.__($uom, 'geodirectory').' |
|
120 | 120 | <br /> |
121 | 121 | '; |
122 | 122 | } else { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } else { |
126 | 126 | $uom = __('km', 'geodirectory'); |
127 | 127 | } |
128 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
128 | + echo round($distance, 2).' '.__($uom, 'geodirectory').' |
|
129 | 129 | <br /> |
130 | 130 | '; |
131 | 131 | } |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | */ |
150 | 150 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post); |
151 | 151 | if ($show_listing_excerpt) { |
152 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { |
|
153 | - $content_out = geodir_max_excerpt( $character_count ); |
|
152 | + if (isset($character_count) && ($character_count || $character_count == '0')) { |
|
153 | + $content_out = geodir_max_excerpt($character_count); |
|
154 | 154 | } else { |
155 | 155 | $content_out = get_the_excerpt(); |
156 | 156 | } |
157 | - if ( ! empty( $content_out ) ) { |
|
158 | - echo "<p>" . $content_out . "</p>"; |
|
157 | + if (!empty($content_out)) { |
|
158 | + echo "<p>".$content_out."</p>"; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | ?> |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param object $post The post object. |
175 | 175 | * @param string $view The view type, default 'widget'. |
176 | 176 | */ |
177 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
177 | + do_action('geodir_after_listing_content', $post, 'widget'); ?> |
|
178 | 178 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>"> |
179 | 179 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>"> |
180 | 180 | <?php |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param object $post The post object. |
186 | 186 | * @param string $view The view type, default 'widget'. |
187 | 187 | */ |
188 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
188 | + do_action('geodir_before_review_html', $post, 'widget'); |
|
189 | 189 | $review_show = geodir_is_reviews_show('listview'); |
190 | 190 | if ($review_show) { |
191 | 191 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @since 1.0.0 |
212 | 212 | */ |
213 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
213 | + do_action('geodir_after_favorite_html', $post->ID, 'widget'); |
|
214 | 214 | |
215 | 215 | if ($post->post_author == get_current_user_id()) { |
216 | 216 | $addplacelink = get_permalink(geodir_add_listing_page_id()); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | title="<?php _e('Edit Listing', 'geodirectory'); ?>"> |
231 | 231 | <?php |
232 | 232 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit'); |
233 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
233 | + echo '<i class="'.$geodir_listing_edit_icon.'"></i>'; |
|
234 | 234 | ?> |
235 | 235 | <?php _e('Edit', 'geodirectory'); ?> |
236 | 236 | </a> |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | title="<?php _e('Delete Listing', 'geodirectory'); ?>"> |
239 | 239 | <?php |
240 | 240 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close'); |
241 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
241 | + echo '<i class="'.$geodir_listing_delete_icon.'"></i>'; |
|
242 | 242 | ?> |
243 | 243 | <?php _e('Delete', 'geodirectory'); ?> |
244 | 244 | </a> |
@@ -1,69 +1,69 @@ |
||
1 | 1 | <?php |
2 | 2 | class CheckMaps extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + } |
|
8 | 8 | |
9 | - public function testCheckHomeMap() |
|
10 | - { |
|
11 | - $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
|
12 | - $this->assertContains( 'geodir-map-home-page', $output ); |
|
13 | - } |
|
9 | + public function testCheckHomeMap() |
|
10 | + { |
|
11 | + $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
|
12 | + $this->assertContains( 'geodir-map-home-page', $output ); |
|
13 | + } |
|
14 | 14 | |
15 | - public function testListingsPageMap() |
|
16 | - { |
|
17 | - $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
|
18 | - $this->assertContains( 'geodir-map-listing-page', $output ); |
|
19 | - } |
|
15 | + public function testListingsPageMap() |
|
16 | + { |
|
17 | + $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
|
18 | + $this->assertContains( 'geodir-map-listing-page', $output ); |
|
19 | + } |
|
20 | 20 | |
21 | - public function testDetailPageMap() |
|
22 | - { |
|
21 | + public function testDetailPageMap() |
|
22 | + { |
|
23 | 23 | |
24 | - $query_args = array( |
|
25 | - 'post_status' => 'publish', |
|
26 | - 'post_type' => 'gd_place', |
|
27 | - 'posts_per_page' => 1, |
|
28 | - ); |
|
24 | + $query_args = array( |
|
25 | + 'post_status' => 'publish', |
|
26 | + 'post_type' => 'gd_place', |
|
27 | + 'posts_per_page' => 1, |
|
28 | + ); |
|
29 | 29 | |
30 | - $all_posts = new WP_Query( $query_args ); |
|
31 | - $post_id = null; |
|
32 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
33 | - $post_id = get_the_ID(); |
|
34 | - global $post; |
|
35 | - $post = geodir_get_post_info($post_id); |
|
36 | - setup_postdata($post); |
|
30 | + $all_posts = new WP_Query( $query_args ); |
|
31 | + $post_id = null; |
|
32 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
33 | + $post_id = get_the_ID(); |
|
34 | + global $post; |
|
35 | + $post = geodir_get_post_info($post_id); |
|
36 | + setup_postdata($post); |
|
37 | 37 | |
38 | - $map_args = array(); |
|
39 | - $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
40 | - $map_args['width'] = '600'; |
|
41 | - $map_args['height'] = '300'; |
|
42 | - if ($post->post_mapzoom) { |
|
43 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
44 | - } |
|
45 | - $map_args['autozoom'] = false; |
|
46 | - $map_args['child_collapse'] = '0'; |
|
47 | - $map_args['enable_cat_filters'] = false; |
|
48 | - $map_args['enable_text_search'] = false; |
|
49 | - $map_args['enable_post_type_filters'] = false; |
|
50 | - $map_args['enable_location_filters'] = false; |
|
51 | - $map_args['enable_jason_on_load'] = true; |
|
52 | - $map_args['enable_map_direction'] = true; |
|
53 | - $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
54 | - $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
55 | - ob_start(); |
|
56 | - geodir_draw_map($map_args); |
|
57 | - $output = ob_get_clean(); |
|
58 | - $this->assertContains( 'geodir-map-detail-page', $output ); |
|
59 | - endwhile; |
|
38 | + $map_args = array(); |
|
39 | + $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
40 | + $map_args['width'] = '600'; |
|
41 | + $map_args['height'] = '300'; |
|
42 | + if ($post->post_mapzoom) { |
|
43 | + $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
44 | + } |
|
45 | + $map_args['autozoom'] = false; |
|
46 | + $map_args['child_collapse'] = '0'; |
|
47 | + $map_args['enable_cat_filters'] = false; |
|
48 | + $map_args['enable_text_search'] = false; |
|
49 | + $map_args['enable_post_type_filters'] = false; |
|
50 | + $map_args['enable_location_filters'] = false; |
|
51 | + $map_args['enable_jason_on_load'] = true; |
|
52 | + $map_args['enable_map_direction'] = true; |
|
53 | + $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
54 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
55 | + ob_start(); |
|
56 | + geodir_draw_map($map_args); |
|
57 | + $output = ob_get_clean(); |
|
58 | + $this->assertContains( 'geodir-map-detail-page', $output ); |
|
59 | + endwhile; |
|
60 | 60 | |
61 | 61 | |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | - public function tearDown() |
|
65 | - { |
|
66 | - parent::tearDown(); |
|
67 | - } |
|
64 | + public function tearDown() |
|
65 | + { |
|
66 | + parent::tearDown(); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | ?> |
70 | 70 | \ No newline at end of file |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | public function testCheckHomeMap() |
10 | 10 | { |
11 | 11 | $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
12 | - $this->assertContains( 'geodir-map-home-page', $output ); |
|
12 | + $this->assertContains('geodir-map-home-page', $output); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | public function testListingsPageMap() |
16 | 16 | { |
17 | 17 | $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
18 | - $this->assertContains( 'geodir-map-listing-page', $output ); |
|
18 | + $this->assertContains('geodir-map-listing-page', $output); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function testDetailPageMap() |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | 'posts_per_page' => 1, |
28 | 28 | ); |
29 | 29 | |
30 | - $all_posts = new WP_Query( $query_args ); |
|
30 | + $all_posts = new WP_Query($query_args); |
|
31 | 31 | $post_id = null; |
32 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
32 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
33 | 33 | $post_id = get_the_ID(); |
34 | 34 | global $post; |
35 | - $post = geodir_get_post_info($post_id); |
|
35 | + $post = geodir_get_post_info($post_id); |
|
36 | 36 | setup_postdata($post); |
37 | 37 | |
38 | 38 | $map_args = array(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $map_args['width'] = '600'; |
41 | 41 | $map_args['height'] = '300'; |
42 | 42 | if ($post->post_mapzoom) { |
43 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
43 | + $map_args['zoom'] = ''.$post->post_mapzoom.''; |
|
44 | 44 | } |
45 | 45 | $map_args['autozoom'] = false; |
46 | 46 | $map_args['child_collapse'] = '0'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ob_start(); |
56 | 56 | geodir_draw_map($map_args); |
57 | 57 | $output = ob_get_clean(); |
58 | - $this->assertContains( 'geodir-map-detail-page', $output ); |
|
58 | + $this->assertContains('geodir-map-detail-page', $output); |
|
59 | 59 | endwhile; |
60 | 60 | |
61 | 61 |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | class CheckPinpoint extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + } |
|
8 | 8 | |
9 | - public function testCheckPinpoint() |
|
10 | - { |
|
9 | + public function testCheckPinpoint() |
|
10 | + { |
|
11 | 11 | |
12 | - } |
|
12 | + } |
|
13 | 13 | |
14 | - public function tearDown() |
|
15 | - { |
|
16 | - parent::tearDown(); |
|
17 | - } |
|
14 | + public function tearDown() |
|
15 | + { |
|
16 | + parent::tearDown(); |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | ?> |
20 | 20 | \ No newline at end of file |
@@ -1,63 +1,63 @@ |
||
1 | 1 | <?php |
2 | 2 | class AddReview extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + } |
|
9 | 9 | |
10 | - public function testAddReview() |
|
11 | - { |
|
12 | - $time = current_time('mysql'); |
|
10 | + public function testAddReview() |
|
11 | + { |
|
12 | + $time = current_time('mysql'); |
|
13 | 13 | |
14 | - $args = array( |
|
15 | - 'listing_type' => 'gd_place', |
|
16 | - 'post_title' => 'Test Listing Title', |
|
17 | - 'post_desc' => 'Test Desc', |
|
18 | - 'post_tags' => 'test1,test2', |
|
19 | - 'post_address' => 'New York City Hall', |
|
20 | - 'post_zip' => '10007', |
|
21 | - 'post_latitude' => '40.7127837', |
|
22 | - 'post_longitude' => '-74.00594130000002', |
|
23 | - 'post_mapview' => 'ROADMAP', |
|
24 | - 'post_mapzoom' => '10', |
|
25 | - 'geodir_timing' => '10.00 am to 6 pm every day', |
|
26 | - 'geodir_contact' => '1234567890', |
|
27 | - 'geodir_email' => '[email protected]', |
|
28 | - 'geodir_website' => 'http://test.com', |
|
29 | - 'geodir_twitter' => 'http://twitter.com/test', |
|
30 | - 'geodir_facebook' => 'http://facebook.com/test', |
|
31 | - 'geodir_special_offers' => 'Test offer' |
|
32 | - ); |
|
33 | - $post_id = geodir_save_listing($args, true); |
|
14 | + $args = array( |
|
15 | + 'listing_type' => 'gd_place', |
|
16 | + 'post_title' => 'Test Listing Title', |
|
17 | + 'post_desc' => 'Test Desc', |
|
18 | + 'post_tags' => 'test1,test2', |
|
19 | + 'post_address' => 'New York City Hall', |
|
20 | + 'post_zip' => '10007', |
|
21 | + 'post_latitude' => '40.7127837', |
|
22 | + 'post_longitude' => '-74.00594130000002', |
|
23 | + 'post_mapview' => 'ROADMAP', |
|
24 | + 'post_mapzoom' => '10', |
|
25 | + 'geodir_timing' => '10.00 am to 6 pm every day', |
|
26 | + 'geodir_contact' => '1234567890', |
|
27 | + 'geodir_email' => '[email protected]', |
|
28 | + 'geodir_website' => 'http://test.com', |
|
29 | + 'geodir_twitter' => 'http://twitter.com/test', |
|
30 | + 'geodir_facebook' => 'http://facebook.com/test', |
|
31 | + 'geodir_special_offers' => 'Test offer' |
|
32 | + ); |
|
33 | + $post_id = geodir_save_listing($args, true); |
|
34 | 34 | |
35 | - $data = array( |
|
36 | - 'comment_post_ID' => $post_id, |
|
37 | - 'comment_author' => 'admin', |
|
38 | - 'comment_author_email' => '[email protected]', |
|
39 | - 'comment_author_url' => 'http://wpgeodirectory.com', |
|
40 | - 'comment_content' => 'content here', |
|
41 | - 'comment_type' => '', |
|
42 | - 'comment_parent' => 0, |
|
43 | - 'user_id' => 1, |
|
44 | - 'comment_author_IP' => '127.0.0.1', |
|
45 | - 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', |
|
46 | - 'comment_date' => $time, |
|
47 | - 'comment_approved' => 1, |
|
48 | - ); |
|
35 | + $data = array( |
|
36 | + 'comment_post_ID' => $post_id, |
|
37 | + 'comment_author' => 'admin', |
|
38 | + 'comment_author_email' => '[email protected]', |
|
39 | + 'comment_author_url' => 'http://wpgeodirectory.com', |
|
40 | + 'comment_content' => 'content here', |
|
41 | + 'comment_type' => '', |
|
42 | + 'comment_parent' => 0, |
|
43 | + 'user_id' => 1, |
|
44 | + 'comment_author_IP' => '127.0.0.1', |
|
45 | + 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', |
|
46 | + 'comment_date' => $time, |
|
47 | + 'comment_approved' => 1, |
|
48 | + ); |
|
49 | 49 | |
50 | - $comment_id = wp_insert_comment($data); |
|
50 | + $comment_id = wp_insert_comment($data); |
|
51 | 51 | |
52 | - $_REQUEST['geodir_overallrating'] = 5.0; |
|
53 | - geodir_save_rating($comment_id); |
|
52 | + $_REQUEST['geodir_overallrating'] = 5.0; |
|
53 | + geodir_save_rating($comment_id); |
|
54 | 54 | |
55 | - $this->assertTrue(is_int($comment_id)); |
|
56 | - } |
|
55 | + $this->assertTrue(is_int($comment_id)); |
|
56 | + } |
|
57 | 57 | |
58 | - public function tearDown() |
|
59 | - { |
|
60 | - parent::tearDown(); |
|
61 | - } |
|
58 | + public function tearDown() |
|
59 | + { |
|
60 | + parent::tearDown(); |
|
61 | + } |
|
62 | 62 | } |
63 | 63 | ?> |
64 | 64 | \ No newline at end of file |
@@ -1,116 +1,116 @@ |
||
1 | 1 | <?php |
2 | 2 | class SendEnquiry extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - } |
|
8 | - |
|
9 | - public function testSendEnquiry() |
|
10 | - { |
|
11 | - $query_args = array( |
|
12 | - 'post_status' => 'publish', |
|
13 | - 'post_type' => 'gd_place', |
|
14 | - 'posts_per_page' => 1, |
|
15 | - ); |
|
16 | - |
|
17 | - $all_posts = new WP_Query( $query_args ); |
|
18 | - $post_id = null; |
|
19 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
20 | - $post_id = get_the_ID(); |
|
21 | - endwhile; |
|
22 | - |
|
23 | - $this->assertTrue(is_int($post_id)); |
|
24 | - |
|
25 | - $data = array( |
|
26 | - 'sendact' => 'send_inqury', |
|
27 | - 'pid' => (string) $post_id, |
|
28 | - 'inq_name' => 'Test User', |
|
29 | - 'inq_email' => '[email protected]', |
|
30 | - 'inq_phone' => 'Test', |
|
31 | - 'inq_msg' => 'Hi there, I would like to enquire about this place. I would like to ask more info about...', |
|
32 | - 'Send' => 'Send' |
|
33 | - ); |
|
34 | - |
|
35 | - add_filter('wp_redirect', '__return_false'); |
|
36 | - geodir_send_inquiry($data); |
|
37 | - remove_filter('wp_redirect', '__return_false'); |
|
38 | - } |
|
39 | - |
|
40 | - public function testSendToFriend() |
|
41 | - { |
|
42 | - $query_args = array( |
|
43 | - 'post_status' => 'publish', |
|
44 | - 'post_type' => 'gd_place', |
|
45 | - 'posts_per_page' => 1, |
|
46 | - ); |
|
47 | - |
|
48 | - $all_posts = new WP_Query( $query_args ); |
|
49 | - $post_id = null; |
|
50 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
51 | - $post_id = get_the_ID(); |
|
52 | - endwhile; |
|
53 | - |
|
54 | - $this->assertTrue(is_int($post_id)); |
|
55 | - |
|
56 | - $data = array( |
|
57 | - 'sendact' => 'email_frnd', |
|
58 | - 'pid' => (string) $post_id, |
|
59 | - 'yourname' => 'Test User', |
|
60 | - 'youremail' => '[email protected]', |
|
61 | - 'frnd_subject' => 'Test', |
|
62 | - 'frnd_comments' => 'Hi there, This is a comment', |
|
63 | - 'to_email' => '[email protected]', |
|
64 | - 'to_name' => 'Test User 2', |
|
65 | - 'Send' => 'Send' |
|
66 | - ); |
|
67 | - |
|
68 | - add_filter('wp_redirect', '__return_false'); |
|
69 | - geodir_send_friend($data); |
|
70 | - remove_filter('wp_redirect', '__return_false'); |
|
71 | - } |
|
72 | - |
|
73 | - public function texstSendToFriendFailure() |
|
74 | - { |
|
75 | - $query_args = array( |
|
76 | - 'post_status' => 'publish', |
|
77 | - 'post_type' => 'gd_place', |
|
78 | - 'posts_per_page' => 1, |
|
79 | - ); |
|
80 | - |
|
81 | - $all_posts = new WP_Query( $query_args ); |
|
82 | - $post_id = null; |
|
83 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
84 | - $post_id = get_the_ID(); |
|
85 | - endwhile; |
|
86 | - |
|
87 | - $this->assertTrue(is_int($post_id)); |
|
88 | - |
|
89 | - $data = array( |
|
90 | - 'sendact' => 'email_frnd', |
|
91 | - 'pid' => (string) $post_id, |
|
92 | - 'yourname' => 'Test User', |
|
93 | - 'youremail' => '[email protected]', |
|
94 | - 'frnd_subject' => 'Test', |
|
95 | - 'frnd_comments' => 'Hi there, This is a comment', |
|
96 | - 'to_email' => 'Test User 2', //incorrect email |
|
97 | - 'to_name' => '[email protected]', |
|
98 | - 'Send' => 'Send' |
|
99 | - ); |
|
100 | - |
|
101 | - add_filter('wp_redirect', '__return_false'); |
|
102 | - add_filter('wp_mail', 'print_mail'); |
|
103 | - ob_start(); |
|
104 | - geodir_send_friend($data); |
|
105 | - $output = ob_get_clean(); |
|
106 | - $this->assertContains( 'Email from GeoDirectory failed to send', $output ); |
|
107 | - remove_filter('wp_mail', 'print_mail'); |
|
108 | - remove_filter('wp_redirect', '__return_false'); |
|
109 | - } |
|
110 | - |
|
111 | - public function tearDown() |
|
112 | - { |
|
113 | - parent::tearDown(); |
|
114 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + } |
|
8 | + |
|
9 | + public function testSendEnquiry() |
|
10 | + { |
|
11 | + $query_args = array( |
|
12 | + 'post_status' => 'publish', |
|
13 | + 'post_type' => 'gd_place', |
|
14 | + 'posts_per_page' => 1, |
|
15 | + ); |
|
16 | + |
|
17 | + $all_posts = new WP_Query( $query_args ); |
|
18 | + $post_id = null; |
|
19 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
20 | + $post_id = get_the_ID(); |
|
21 | + endwhile; |
|
22 | + |
|
23 | + $this->assertTrue(is_int($post_id)); |
|
24 | + |
|
25 | + $data = array( |
|
26 | + 'sendact' => 'send_inqury', |
|
27 | + 'pid' => (string) $post_id, |
|
28 | + 'inq_name' => 'Test User', |
|
29 | + 'inq_email' => '[email protected]', |
|
30 | + 'inq_phone' => 'Test', |
|
31 | + 'inq_msg' => 'Hi there, I would like to enquire about this place. I would like to ask more info about...', |
|
32 | + 'Send' => 'Send' |
|
33 | + ); |
|
34 | + |
|
35 | + add_filter('wp_redirect', '__return_false'); |
|
36 | + geodir_send_inquiry($data); |
|
37 | + remove_filter('wp_redirect', '__return_false'); |
|
38 | + } |
|
39 | + |
|
40 | + public function testSendToFriend() |
|
41 | + { |
|
42 | + $query_args = array( |
|
43 | + 'post_status' => 'publish', |
|
44 | + 'post_type' => 'gd_place', |
|
45 | + 'posts_per_page' => 1, |
|
46 | + ); |
|
47 | + |
|
48 | + $all_posts = new WP_Query( $query_args ); |
|
49 | + $post_id = null; |
|
50 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
51 | + $post_id = get_the_ID(); |
|
52 | + endwhile; |
|
53 | + |
|
54 | + $this->assertTrue(is_int($post_id)); |
|
55 | + |
|
56 | + $data = array( |
|
57 | + 'sendact' => 'email_frnd', |
|
58 | + 'pid' => (string) $post_id, |
|
59 | + 'yourname' => 'Test User', |
|
60 | + 'youremail' => '[email protected]', |
|
61 | + 'frnd_subject' => 'Test', |
|
62 | + 'frnd_comments' => 'Hi there, This is a comment', |
|
63 | + 'to_email' => '[email protected]', |
|
64 | + 'to_name' => 'Test User 2', |
|
65 | + 'Send' => 'Send' |
|
66 | + ); |
|
67 | + |
|
68 | + add_filter('wp_redirect', '__return_false'); |
|
69 | + geodir_send_friend($data); |
|
70 | + remove_filter('wp_redirect', '__return_false'); |
|
71 | + } |
|
72 | + |
|
73 | + public function texstSendToFriendFailure() |
|
74 | + { |
|
75 | + $query_args = array( |
|
76 | + 'post_status' => 'publish', |
|
77 | + 'post_type' => 'gd_place', |
|
78 | + 'posts_per_page' => 1, |
|
79 | + ); |
|
80 | + |
|
81 | + $all_posts = new WP_Query( $query_args ); |
|
82 | + $post_id = null; |
|
83 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
84 | + $post_id = get_the_ID(); |
|
85 | + endwhile; |
|
86 | + |
|
87 | + $this->assertTrue(is_int($post_id)); |
|
88 | + |
|
89 | + $data = array( |
|
90 | + 'sendact' => 'email_frnd', |
|
91 | + 'pid' => (string) $post_id, |
|
92 | + 'yourname' => 'Test User', |
|
93 | + 'youremail' => '[email protected]', |
|
94 | + 'frnd_subject' => 'Test', |
|
95 | + 'frnd_comments' => 'Hi there, This is a comment', |
|
96 | + 'to_email' => 'Test User 2', //incorrect email |
|
97 | + 'to_name' => '[email protected]', |
|
98 | + 'Send' => 'Send' |
|
99 | + ); |
|
100 | + |
|
101 | + add_filter('wp_redirect', '__return_false'); |
|
102 | + add_filter('wp_mail', 'print_mail'); |
|
103 | + ob_start(); |
|
104 | + geodir_send_friend($data); |
|
105 | + $output = ob_get_clean(); |
|
106 | + $this->assertContains( 'Email from GeoDirectory failed to send', $output ); |
|
107 | + remove_filter('wp_mail', 'print_mail'); |
|
108 | + remove_filter('wp_redirect', '__return_false'); |
|
109 | + } |
|
110 | + |
|
111 | + public function tearDown() |
|
112 | + { |
|
113 | + parent::tearDown(); |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | ?> |
117 | 117 | \ No newline at end of file |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | 'posts_per_page' => 1, |
15 | 15 | ); |
16 | 16 | |
17 | - $all_posts = new WP_Query( $query_args ); |
|
17 | + $all_posts = new WP_Query($query_args); |
|
18 | 18 | $post_id = null; |
19 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
19 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
20 | 20 | $post_id = get_the_ID(); |
21 | 21 | endwhile; |
22 | 22 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | 'posts_per_page' => 1, |
46 | 46 | ); |
47 | 47 | |
48 | - $all_posts = new WP_Query( $query_args ); |
|
48 | + $all_posts = new WP_Query($query_args); |
|
49 | 49 | $post_id = null; |
50 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
50 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
51 | 51 | $post_id = get_the_ID(); |
52 | 52 | endwhile; |
53 | 53 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | 'posts_per_page' => 1, |
79 | 79 | ); |
80 | 80 | |
81 | - $all_posts = new WP_Query( $query_args ); |
|
81 | + $all_posts = new WP_Query($query_args); |
|
82 | 82 | $post_id = null; |
83 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
83 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
84 | 84 | $post_id = get_the_ID(); |
85 | 85 | endwhile; |
86 | 86 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ob_start(); |
104 | 104 | geodir_send_friend($data); |
105 | 105 | $output = ob_get_clean(); |
106 | - $this->assertContains( 'Email from GeoDirectory failed to send', $output ); |
|
106 | + $this->assertContains('Email from GeoDirectory failed to send', $output); |
|
107 | 107 | remove_filter('wp_mail', 'print_mail'); |
108 | 108 | remove_filter('wp_redirect', '__return_false'); |
109 | 109 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // reset the wpdb queries log, storing it on the profile stack if necessary |
41 | 41 | global $wpdb; |
42 | 42 | if ($this->stack) { |
43 | - $this->stack[count($this->stack)-1]['queries'] = $wpdb->queries; |
|
43 | + $this->stack[count($this->stack) - 1]['queries'] = $wpdb->queries; |
|
44 | 44 | } |
45 | 45 | $wpdb->queries = array(); |
46 | 46 | |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | |
75 | 75 | if (isset($this->profile[$name])) { |
76 | 76 | $this->profile[$name]['time'] += $time; |
77 | - $this->profile[$name]['calls'] ++; |
|
77 | + $this->profile[$name]['calls']++; |
|
78 | 78 | $this->profile[$name]['cache_cold_hits'] += ($wp_object_cache->cold_cache_hits - $item['cache_cold_hits']); |
79 | 79 | $this->profile[$name]['cache_warm_hits'] += ($wp_object_cache->warm_cache_hits - $item['cache_warm_hits']); |
80 | 80 | $this->profile[$name]['cache_misses'] += ($wp_object_cache->cache_misses - $item['cache_misses']); |
81 | - $this->profile[$name]['cache_dirty_objects'] = array_add( $this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta) ; |
|
82 | - $this->profile[$name]['actions'] = array_add( $this->profile[$name]['actions'], $item['actions'] ); |
|
83 | - $this->profile[$name]['filters'] = array_add( $this->profile[$name]['filters'], $item['filters'] ); |
|
84 | - $this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] ); |
|
81 | + $this->profile[$name]['cache_dirty_objects'] = array_add($this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta); |
|
82 | + $this->profile[$name]['actions'] = array_add($this->profile[$name]['actions'], $item['actions']); |
|
83 | + $this->profile[$name]['filters'] = array_add($this->profile[$name]['filters'], $item['filters']); |
|
84 | + $this->profile[$name]['queries'] = array_add($this->profile[$name]['queries'], $item['queries']); |
|
85 | 85 | #$this->_query_summary($item['queries'], $this->profile[$name]['queries']); |
86 | 86 | |
87 | 87 | } |
@@ -109,28 +109,28 @@ discard block |
||
109 | 109 | |
110 | 110 | function microtime($since = 0.0) { |
111 | 111 | list($usec, $sec) = explode(' ', microtime()); |
112 | - return (float)$sec + (float)$usec - $since; |
|
112 | + return (float) $sec + (float) $usec - $since; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | function log_filter($tag) { |
116 | 116 | if ($this->stack) { |
117 | 117 | global $wp_actions; |
118 | 118 | if ($tag == end($wp_actions)) |
119 | - @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
119 | + @$this->stack[count($this->stack) - 1]['actions'][$tag]++; |
|
120 | 120 | else |
121 | - @$this->stack[count($this->stack)-1]['filters'][$tag] ++; |
|
121 | + @$this->stack[count($this->stack) - 1]['filters'][$tag]++; |
|
122 | 122 | } |
123 | 123 | return $arg; |
124 | 124 | } |
125 | 125 | |
126 | 126 | function log_action($tag) { |
127 | 127 | if ($this->stack) |
128 | - @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
128 | + @$this->stack[count($this->stack) - 1]['actions'][$tag]++; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | function _current_action() { |
132 | 132 | global $wp_actions; |
133 | - return $wp_actions[count($wp_actions)-1]; |
|
133 | + return $wp_actions[count($wp_actions) - 1]; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | function results() { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $sql = preg_replace('/(WHERE \w+ =) \d+/', '$1 x', $sql); |
144 | 144 | $sql = preg_replace('/(WHERE \w+ =) \'\[-\w]+\'/', '$1 \'xxx\'', $sql); |
145 | 145 | |
146 | - @$out[$sql] ++; |
|
146 | + @$out[$sql]++; |
|
147 | 147 | } |
148 | 148 | asort($out); |
149 | 149 | return; |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | $out = array(); |
155 | 155 | foreach ($queries as $q) { |
156 | 156 | if (empty($q[2])) |
157 | - @$out['unknown'] ++; |
|
157 | + @$out['unknown']++; |
|
158 | 158 | else |
159 | - @$out[$q[2]] ++; |
|
159 | + @$out[$q[2]]++; |
|
160 | 160 | } |
161 | 161 | return $out; |
162 | 162 | } |
@@ -84,8 +84,7 @@ discard block |
||
84 | 84 | $this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] ); |
85 | 85 | #$this->_query_summary($item['queries'], $this->profile[$name]['queries']); |
86 | 86 | |
87 | - } |
|
88 | - else { |
|
87 | + } else { |
|
89 | 88 | $queries = array(); |
90 | 89 | $this->_query_summary($item['queries'], $queries); |
91 | 90 | $this->profile[$name] = array( |
@@ -115,17 +114,19 @@ discard block |
||
115 | 114 | function log_filter($tag) { |
116 | 115 | if ($this->stack) { |
117 | 116 | global $wp_actions; |
118 | - if ($tag == end($wp_actions)) |
|
119 | - @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
120 | - else |
|
121 | - @$this->stack[count($this->stack)-1]['filters'][$tag] ++; |
|
117 | + if ($tag == end($wp_actions)) { |
|
118 | + @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
119 | + } else { |
|
120 | + @$this->stack[count($this->stack)-1]['filters'][$tag] ++; |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | return $arg; |
124 | 124 | } |
125 | 125 | |
126 | 126 | function log_action($tag) { |
127 | - if ($this->stack) |
|
128 | - @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
127 | + if ($this->stack) { |
|
128 | + @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
129 | + } |
|
129 | 130 | } |
130 | 131 | |
131 | 132 | function _current_action() { |
@@ -153,36 +154,41 @@ discard block |
||
153 | 154 | // this requires the savequeries patch at https://core.trac.wordpress.org/ticket/5218 |
154 | 155 | $out = array(); |
155 | 156 | foreach ($queries as $q) { |
156 | - if (empty($q[2])) |
|
157 | - @$out['unknown'] ++; |
|
158 | - else |
|
159 | - @$out[$q[2]] ++; |
|
157 | + if (empty($q[2])) { |
|
158 | + @$out['unknown'] ++; |
|
159 | + } else { |
|
160 | + @$out[$q[2]] ++; |
|
161 | + } |
|
160 | 162 | } |
161 | 163 | return $out; |
162 | 164 | } |
163 | 165 | |
164 | 166 | function _dirty_objects_count($dirty_objects) { |
165 | 167 | $out = array(); |
166 | - foreach (array_keys($dirty_objects) as $group) |
|
167 | - $out[$group] = count($dirty_objects[$group]); |
|
168 | + foreach (array_keys($dirty_objects) as $group) { |
|
169 | + $out[$group] = count($dirty_objects[$group]); |
|
170 | + } |
|
168 | 171 | return $out; |
169 | 172 | } |
170 | 173 | |
171 | 174 | function array_add($a, $b) { |
172 | 175 | $out = $a; |
173 | - foreach (array_keys($b) as $key) |
|
174 | - if (array_key_exists($key, $out)) |
|
176 | + foreach (array_keys($b) as $key) { |
|
177 | + if (array_key_exists($key, $out)) |
|
175 | 178 | $out[$key] += $b[$key]; |
176 | - else |
|
177 | - $out[$key] = $b[$key]; |
|
179 | + } |
|
180 | + else { |
|
181 | + $out[$key] = $b[$key]; |
|
182 | + } |
|
178 | 183 | return $out; |
179 | 184 | } |
180 | 185 | |
181 | 186 | function array_sub($a, $b) { |
182 | 187 | $out = $a; |
183 | - foreach (array_keys($b) as $key) |
|
184 | - if (array_key_exists($key, $b)) |
|
188 | + foreach (array_keys($b) as $key) { |
|
189 | + if (array_key_exists($key, $b)) |
|
185 | 190 | $out[$key] -= $b[$key]; |
191 | + } |
|
186 | 192 | return $out; |
187 | 193 | } |
188 | 194 |