@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | // If this file is called directly, abort. |
9 | 9 | if (!defined('WPINC')) { |
10 | - die; |
|
10 | + die; |
|
11 | 11 | } |
12 | 12 | require_once('geodirectory-functions/shortcode_functions.php'); |
13 | 13 | |
@@ -32,43 +32,43 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function geodir_sc_add_listing($atts) |
34 | 34 | { |
35 | - ob_start(); |
|
36 | - $defaults = array( |
|
37 | - 'pid' => '', |
|
38 | - 'listing_type' => 'gd_place', |
|
39 | - 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
40 | - 'show_login' => false, |
|
41 | - ); |
|
42 | - $params = shortcode_atts($defaults, $atts); |
|
43 | - |
|
44 | - foreach ($params as $key => $value) { |
|
45 | - $_REQUEST[$key] = $value; |
|
46 | - } |
|
47 | - |
|
48 | - $user_id = get_current_user_id(); |
|
49 | - if (!$user_id) { |
|
50 | - echo $params['login_msg']; |
|
51 | - if ($params['show_login']) { |
|
52 | - echo "<br />"; |
|
53 | - $defaults = array( |
|
54 | - 'before_widget' => '', |
|
55 | - 'after_widget' => '', |
|
56 | - 'before_title' => '', |
|
57 | - 'after_title' => '', |
|
58 | - ); |
|
59 | - |
|
60 | - geodir_loginwidget_output($defaults, $defaults); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - } else { |
|
65 | - // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
66 | - } |
|
67 | - $output = ob_get_contents(); |
|
68 | - |
|
69 | - ob_end_clean(); |
|
70 | - |
|
71 | - return $output; |
|
35 | + ob_start(); |
|
36 | + $defaults = array( |
|
37 | + 'pid' => '', |
|
38 | + 'listing_type' => 'gd_place', |
|
39 | + 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
40 | + 'show_login' => false, |
|
41 | + ); |
|
42 | + $params = shortcode_atts($defaults, $atts); |
|
43 | + |
|
44 | + foreach ($params as $key => $value) { |
|
45 | + $_REQUEST[$key] = $value; |
|
46 | + } |
|
47 | + |
|
48 | + $user_id = get_current_user_id(); |
|
49 | + if (!$user_id) { |
|
50 | + echo $params['login_msg']; |
|
51 | + if ($params['show_login']) { |
|
52 | + echo "<br />"; |
|
53 | + $defaults = array( |
|
54 | + 'before_widget' => '', |
|
55 | + 'after_widget' => '', |
|
56 | + 'before_title' => '', |
|
57 | + 'after_title' => '', |
|
58 | + ); |
|
59 | + |
|
60 | + geodir_loginwidget_output($defaults, $defaults); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + } else { |
|
65 | + // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
66 | + } |
|
67 | + $output = ob_get_contents(); |
|
68 | + |
|
69 | + ob_end_clean(); |
|
70 | + |
|
71 | + return $output; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -96,136 +96,136 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function geodir_sc_home_map($atts) |
98 | 98 | { |
99 | - ob_start(); |
|
100 | - $defaults = array( |
|
101 | - 'width' => '960', |
|
102 | - 'height' => '425', |
|
103 | - 'maptype' => 'ROADMAP', |
|
104 | - 'zoom' => '13', |
|
105 | - 'autozoom' => '', |
|
106 | - 'child_collapse' => '0', |
|
107 | - 'scrollwheel' => '0', |
|
99 | + ob_start(); |
|
100 | + $defaults = array( |
|
101 | + 'width' => '960', |
|
102 | + 'height' => '425', |
|
103 | + 'maptype' => 'ROADMAP', |
|
104 | + 'zoom' => '13', |
|
105 | + 'autozoom' => '', |
|
106 | + 'child_collapse' => '0', |
|
107 | + 'scrollwheel' => '0', |
|
108 | 108 | 'marker_cluster' => false, |
109 | - 'latitude' => '', |
|
110 | - 'longitude' => '' |
|
111 | - ); |
|
112 | - |
|
113 | - $params = shortcode_atts($defaults, $atts); |
|
114 | - |
|
115 | - $params = gdsc_validate_map_args($params); |
|
116 | - |
|
117 | - $map_args = array( |
|
118 | - 'map_canvas_name' => 'gd_home_map', |
|
119 | - 'latitude' => $params['latitude'], |
|
120 | - 'longitude' => $params['longitude'], |
|
121 | - |
|
122 | - /** |
|
123 | - * Filter the widget width of the map on home/listings page. |
|
124 | - * |
|
125 | - * @since 1.0.0 |
|
126 | - * @param mixed(string|int|float) $params['width'] The map width. |
|
127 | - */ |
|
128 | - 'width' => apply_filters('widget_width', $params['width']), |
|
129 | - /** |
|
130 | - * Filter the widget height of the map on home/listings page. |
|
131 | - * |
|
132 | - * @since 1.0.0 |
|
133 | - * @param mixed(string|int|float) $params['height'] The map height. |
|
134 | - */ |
|
135 | - 'height' => apply_filters('widget_heigh', $params['height']), |
|
136 | - /** |
|
137 | - * Filter the widget maptype of the map on home/listings page. |
|
138 | - * |
|
139 | - * @since 1.0.0 |
|
109 | + 'latitude' => '', |
|
110 | + 'longitude' => '' |
|
111 | + ); |
|
112 | + |
|
113 | + $params = shortcode_atts($defaults, $atts); |
|
114 | + |
|
115 | + $params = gdsc_validate_map_args($params); |
|
116 | + |
|
117 | + $map_args = array( |
|
118 | + 'map_canvas_name' => 'gd_home_map', |
|
119 | + 'latitude' => $params['latitude'], |
|
120 | + 'longitude' => $params['longitude'], |
|
121 | + |
|
122 | + /** |
|
123 | + * Filter the widget width of the map on home/listings page. |
|
124 | + * |
|
125 | + * @since 1.0.0 |
|
126 | + * @param mixed(string|int|float) $params['width'] The map width. |
|
127 | + */ |
|
128 | + 'width' => apply_filters('widget_width', $params['width']), |
|
129 | + /** |
|
130 | + * Filter the widget height of the map on home/listings page. |
|
131 | + * |
|
132 | + * @since 1.0.0 |
|
133 | + * @param mixed(string|int|float) $params['height'] The map height. |
|
134 | + */ |
|
135 | + 'height' => apply_filters('widget_heigh', $params['height']), |
|
136 | + /** |
|
137 | + * Filter the widget maptype of the map on home/listings page. |
|
138 | + * |
|
139 | + * @since 1.0.0 |
|
140 | 140 | * @since 1.5.2 Added TERRAIN map type. |
141 | - * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
142 | - */ |
|
143 | - 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
144 | - /** |
|
145 | - * Filter the widget scrollwheel value of the map on home/listings page. |
|
146 | - * |
|
147 | - * Should the scrollwheel zoom the map or not. |
|
148 | - * |
|
149 | - * @since 1.0.0 |
|
150 | - * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
151 | - */ |
|
152 | - 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
153 | - /** |
|
154 | - * Filter the widget zoom level of the map on home/listings page. |
|
155 | - * |
|
156 | - * @since 1.0.0 |
|
157 | - * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
158 | - */ |
|
159 | - 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
160 | - /** |
|
161 | - * Filter the widget auto zoom value of the map on home/listings page. |
|
162 | - * |
|
163 | - * If the map should autozoom to fit the markers shown. |
|
164 | - * |
|
165 | - * @since 1.0.0 |
|
166 | - * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
167 | - */ |
|
168 | - 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
169 | - /** |
|
170 | - * Filter the widget child_collapse value of the map on home/listings page. |
|
171 | - * |
|
172 | - * If the map should auto collapse the child categories if the category bar is present. |
|
173 | - * |
|
174 | - * @since 1.0.0 |
|
175 | - * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
176 | - */ |
|
177 | - 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
178 | - 'enable_cat_filters' => true, |
|
179 | - 'enable_text_search' => true, |
|
180 | - 'enable_post_type_filters' => true, |
|
181 | - /** |
|
182 | - * Filter the widget enable_location_filters value of the map on home/listings page. |
|
183 | - * |
|
184 | - * This is used when the location addon is used. |
|
185 | - * |
|
186 | - * @since 1.0.0 |
|
187 | - * @param bool $val True if location filters should be used, false if not. |
|
188 | - */ |
|
189 | - 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
190 | - 'enable_jason_on_load' => false, |
|
191 | - 'enable_marker_cluster' => false, |
|
192 | - 'enable_map_resize_button' => true, |
|
193 | - 'map_class_name' => 'geodir-map-home-page', |
|
194 | - 'is_geodir_home_map_widget' => true, |
|
195 | - ); |
|
141 | + * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
142 | + */ |
|
143 | + 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
144 | + /** |
|
145 | + * Filter the widget scrollwheel value of the map on home/listings page. |
|
146 | + * |
|
147 | + * Should the scrollwheel zoom the map or not. |
|
148 | + * |
|
149 | + * @since 1.0.0 |
|
150 | + * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
151 | + */ |
|
152 | + 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
153 | + /** |
|
154 | + * Filter the widget zoom level of the map on home/listings page. |
|
155 | + * |
|
156 | + * @since 1.0.0 |
|
157 | + * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
158 | + */ |
|
159 | + 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
160 | + /** |
|
161 | + * Filter the widget auto zoom value of the map on home/listings page. |
|
162 | + * |
|
163 | + * If the map should autozoom to fit the markers shown. |
|
164 | + * |
|
165 | + * @since 1.0.0 |
|
166 | + * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
167 | + */ |
|
168 | + 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
169 | + /** |
|
170 | + * Filter the widget child_collapse value of the map on home/listings page. |
|
171 | + * |
|
172 | + * If the map should auto collapse the child categories if the category bar is present. |
|
173 | + * |
|
174 | + * @since 1.0.0 |
|
175 | + * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
176 | + */ |
|
177 | + 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
178 | + 'enable_cat_filters' => true, |
|
179 | + 'enable_text_search' => true, |
|
180 | + 'enable_post_type_filters' => true, |
|
181 | + /** |
|
182 | + * Filter the widget enable_location_filters value of the map on home/listings page. |
|
183 | + * |
|
184 | + * This is used when the location addon is used. |
|
185 | + * |
|
186 | + * @since 1.0.0 |
|
187 | + * @param bool $val True if location filters should be used, false if not. |
|
188 | + */ |
|
189 | + 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
190 | + 'enable_jason_on_load' => false, |
|
191 | + 'enable_marker_cluster' => false, |
|
192 | + 'enable_map_resize_button' => true, |
|
193 | + 'map_class_name' => 'geodir-map-home-page', |
|
194 | + 'is_geodir_home_map_widget' => true, |
|
195 | + ); |
|
196 | 196 | |
197 | 197 | // Add marker cluster |
198 | 198 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
199 | - $map_args['enable_marker_cluster'] = true; |
|
200 | - if(get_option('geodir_marker_cluster_type')) { |
|
201 | - if ($map_args['autozoom']) { |
|
202 | - $map_args['enable_marker_cluster_no_reposition'] = false; |
|
203 | - } else { |
|
204 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
205 | - } |
|
199 | + $map_args['enable_marker_cluster'] = true; |
|
200 | + if(get_option('geodir_marker_cluster_type')) { |
|
201 | + if ($map_args['autozoom']) { |
|
202 | + $map_args['enable_marker_cluster_no_reposition'] = false; |
|
203 | + } else { |
|
204 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
205 | + } |
|
206 | 206 | |
207 | - $map_args['enable_marker_cluster_server'] = true ; |
|
207 | + $map_args['enable_marker_cluster_server'] = true ; |
|
208 | 208 | |
209 | - } |
|
209 | + } |
|
210 | 210 | } else { |
211 | 211 | $map_args['enable_marker_cluster'] = false; |
212 | 212 | } |
213 | 213 | |
214 | - // if lat and long set in shortcode, hack it so the map is not repositioned |
|
215 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
216 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
217 | - } |
|
214 | + // if lat and long set in shortcode, hack it so the map is not repositioned |
|
215 | + if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
216 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | - geodir_draw_map($map_args); |
|
220 | + geodir_draw_map($map_args); |
|
221 | 221 | |
222 | - add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
222 | + add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
223 | 223 | |
224 | - $output = ob_get_contents(); |
|
224 | + $output = ob_get_contents(); |
|
225 | 225 | |
226 | - ob_end_clean(); |
|
226 | + ob_end_clean(); |
|
227 | 227 | |
228 | - return $output; |
|
228 | + return $output; |
|
229 | 229 | } |
230 | 230 | add_shortcode('gd_homepage_map', 'geodir_sc_home_map'); |
231 | 231 | |
@@ -259,77 +259,77 @@ discard block |
||
259 | 259 | */ |
260 | 260 | function geodir_sc_listing_map($atts) |
261 | 261 | { |
262 | - ob_start(); |
|
263 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
264 | - |
|
265 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
266 | - |
|
267 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
268 | - |
|
269 | - $defaults = array( |
|
270 | - 'width' => '294', |
|
271 | - 'height' => '370', |
|
272 | - 'zoom' => '13', |
|
273 | - 'autozoom' => '', |
|
274 | - 'sticky' => '', |
|
275 | - 'showall' => '0', |
|
276 | - 'scrollwheel' => '0', |
|
277 | - 'maptype' => 'ROADMAP', |
|
278 | - 'child_collapse' => 0, |
|
262 | + ob_start(); |
|
263 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
264 | + |
|
265 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
266 | + |
|
267 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
268 | + |
|
269 | + $defaults = array( |
|
270 | + 'width' => '294', |
|
271 | + 'height' => '370', |
|
272 | + 'zoom' => '13', |
|
273 | + 'autozoom' => '', |
|
274 | + 'sticky' => '', |
|
275 | + 'showall' => '0', |
|
276 | + 'scrollwheel' => '0', |
|
277 | + 'maptype' => 'ROADMAP', |
|
278 | + 'child_collapse' => 0, |
|
279 | 279 | 'marker_cluster' => false |
280 | - ); |
|
281 | - |
|
282 | - $params = shortcode_atts($defaults, $atts); |
|
283 | - |
|
284 | - $params = gdsc_validate_map_args($params); |
|
285 | - |
|
286 | - $map_args = array( |
|
287 | - 'map_canvas_name' => 'gd_listing_map', |
|
288 | - 'width' => $params['width'], |
|
289 | - 'height' => $params['height'], |
|
290 | - 'zoom' => $params['zoom'], |
|
291 | - 'autozoom' => $params['autozoom'], |
|
292 | - 'sticky' => $params['sticky'], |
|
293 | - 'showall' => $params['showall'], |
|
294 | - 'scrollwheel' => $params['scrollwheel'], |
|
295 | - 'child_collapse' => 0, |
|
296 | - 'enable_cat_filters' => false, |
|
297 | - 'enable_text_search' => false, |
|
298 | - 'enable_post_type_filters' => false, |
|
299 | - 'enable_location_filters' => false, |
|
300 | - 'enable_jason_on_load' => true, |
|
301 | - ); |
|
302 | - |
|
303 | - if (is_single()) { |
|
304 | - |
|
305 | - global $post; |
|
306 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
307 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
308 | - $mapview = $post->post_mapview; |
|
309 | - $map_args['zoom'] = $post->post_mapzoom; |
|
310 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
311 | - |
|
312 | - } else { |
|
313 | - $default_location = geodir_get_default_location(); |
|
314 | - |
|
315 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
316 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
317 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
318 | - } |
|
319 | - |
|
320 | - if (empty($mapview)) { |
|
321 | - $mapview = 'ROADMAP'; |
|
322 | - } |
|
323 | - |
|
324 | - // Set default map options |
|
325 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
326 | - $map_args['latitude'] = $map_default_lat; |
|
327 | - $map_args['longitude'] = $map_default_lng; |
|
328 | - $map_args['streetViewControl'] = true; |
|
329 | - $map_args['maptype'] = $mapview; |
|
330 | - $map_args['showPreview'] = '0'; |
|
331 | - $map_args['maxZoom'] = 21; |
|
332 | - $map_args['bubble_size'] = 'small'; |
|
280 | + ); |
|
281 | + |
|
282 | + $params = shortcode_atts($defaults, $atts); |
|
283 | + |
|
284 | + $params = gdsc_validate_map_args($params); |
|
285 | + |
|
286 | + $map_args = array( |
|
287 | + 'map_canvas_name' => 'gd_listing_map', |
|
288 | + 'width' => $params['width'], |
|
289 | + 'height' => $params['height'], |
|
290 | + 'zoom' => $params['zoom'], |
|
291 | + 'autozoom' => $params['autozoom'], |
|
292 | + 'sticky' => $params['sticky'], |
|
293 | + 'showall' => $params['showall'], |
|
294 | + 'scrollwheel' => $params['scrollwheel'], |
|
295 | + 'child_collapse' => 0, |
|
296 | + 'enable_cat_filters' => false, |
|
297 | + 'enable_text_search' => false, |
|
298 | + 'enable_post_type_filters' => false, |
|
299 | + 'enable_location_filters' => false, |
|
300 | + 'enable_jason_on_load' => true, |
|
301 | + ); |
|
302 | + |
|
303 | + if (is_single()) { |
|
304 | + |
|
305 | + global $post; |
|
306 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
307 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
308 | + $mapview = $post->post_mapview; |
|
309 | + $map_args['zoom'] = $post->post_mapzoom; |
|
310 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
311 | + |
|
312 | + } else { |
|
313 | + $default_location = geodir_get_default_location(); |
|
314 | + |
|
315 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
316 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
317 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
318 | + } |
|
319 | + |
|
320 | + if (empty($mapview)) { |
|
321 | + $mapview = 'ROADMAP'; |
|
322 | + } |
|
323 | + |
|
324 | + // Set default map options |
|
325 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
326 | + $map_args['latitude'] = $map_default_lat; |
|
327 | + $map_args['longitude'] = $map_default_lng; |
|
328 | + $map_args['streetViewControl'] = true; |
|
329 | + $map_args['maptype'] = $mapview; |
|
330 | + $map_args['showPreview'] = '0'; |
|
331 | + $map_args['maxZoom'] = 21; |
|
332 | + $map_args['bubble_size'] = 'small'; |
|
333 | 333 | |
334 | 334 | // Add marker cluster |
335 | 335 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
@@ -338,13 +338,13 @@ discard block |
||
338 | 338 | $map_args['enable_marker_cluster'] = false; |
339 | 339 | } |
340 | 340 | |
341 | - geodir_draw_map($map_args); |
|
341 | + geodir_draw_map($map_args); |
|
342 | 342 | |
343 | - $output = ob_get_contents(); |
|
343 | + $output = ob_get_contents(); |
|
344 | 344 | |
345 | - ob_end_clean(); |
|
345 | + ob_end_clean(); |
|
346 | 346 | |
347 | - return $output; |
|
347 | + return $output; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -377,120 +377,120 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function geodir_sc_listing_slider($atts) |
379 | 379 | { |
380 | - ob_start(); |
|
381 | - $defaults = array( |
|
382 | - 'post_type' => 'gd_place', |
|
383 | - 'category' => '0', |
|
384 | - 'post_number' => '5', |
|
385 | - 'slideshow' => '0', |
|
386 | - 'animation_loop' => 0, |
|
387 | - 'direction_nav' => 0, |
|
388 | - 'slideshow_speed' => 5000, |
|
389 | - 'animation_speed' => 600, |
|
390 | - 'animation' => 'slide', |
|
391 | - 'order_by' => 'latest', |
|
392 | - 'show_title' => '', |
|
393 | - 'show_featured_only' => '', |
|
394 | - 'title' => '', |
|
395 | - ); |
|
396 | - |
|
397 | - $params = shortcode_atts($defaults, $atts); |
|
398 | - |
|
399 | - |
|
400 | - /* |
|
380 | + ob_start(); |
|
381 | + $defaults = array( |
|
382 | + 'post_type' => 'gd_place', |
|
383 | + 'category' => '0', |
|
384 | + 'post_number' => '5', |
|
385 | + 'slideshow' => '0', |
|
386 | + 'animation_loop' => 0, |
|
387 | + 'direction_nav' => 0, |
|
388 | + 'slideshow_speed' => 5000, |
|
389 | + 'animation_speed' => 600, |
|
390 | + 'animation' => 'slide', |
|
391 | + 'order_by' => 'latest', |
|
392 | + 'show_title' => '', |
|
393 | + 'show_featured_only' => '', |
|
394 | + 'title' => '', |
|
395 | + ); |
|
396 | + |
|
397 | + $params = shortcode_atts($defaults, $atts); |
|
398 | + |
|
399 | + |
|
400 | + /* |
|
401 | 401 | * |
402 | 402 | * Now we begin the validation of the attributes. |
403 | 403 | */ |
404 | - // Check we have a valid post_type |
|
405 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
406 | - $params['post_type'] = 'gd_place'; |
|
407 | - } |
|
408 | - |
|
409 | - // Check we have a valid sort_order |
|
410 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
411 | - |
|
412 | - // Match the chosen animation to our options |
|
413 | - $animation_list = array('slide', 'fade'); |
|
414 | - if (!(in_array($params['animation'], $animation_list))) { |
|
415 | - $params['animation'] = 'slide'; |
|
416 | - } |
|
417 | - |
|
418 | - // Post_number needs to be a positive integer |
|
419 | - $params['post_number'] = absint($params['post_number']); |
|
420 | - if (0 == $params['post_number']) { |
|
421 | - $params['post_number'] = 1; |
|
422 | - } |
|
423 | - |
|
424 | - // Manage the entered categories |
|
425 | - if (0 != $params['category'] || '' != $params['category']) { |
|
426 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
427 | - } |
|
428 | - // Convert show_title to a bool |
|
429 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
430 | - |
|
431 | - // Convert show_featured_only to a bool |
|
432 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
433 | - |
|
434 | - /* |
|
404 | + // Check we have a valid post_type |
|
405 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
406 | + $params['post_type'] = 'gd_place'; |
|
407 | + } |
|
408 | + |
|
409 | + // Check we have a valid sort_order |
|
410 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
411 | + |
|
412 | + // Match the chosen animation to our options |
|
413 | + $animation_list = array('slide', 'fade'); |
|
414 | + if (!(in_array($params['animation'], $animation_list))) { |
|
415 | + $params['animation'] = 'slide'; |
|
416 | + } |
|
417 | + |
|
418 | + // Post_number needs to be a positive integer |
|
419 | + $params['post_number'] = absint($params['post_number']); |
|
420 | + if (0 == $params['post_number']) { |
|
421 | + $params['post_number'] = 1; |
|
422 | + } |
|
423 | + |
|
424 | + // Manage the entered categories |
|
425 | + if (0 != $params['category'] || '' != $params['category']) { |
|
426 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
427 | + } |
|
428 | + // Convert show_title to a bool |
|
429 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
430 | + |
|
431 | + // Convert show_featured_only to a bool |
|
432 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
433 | + |
|
434 | + /* |
|
435 | 435 | * Hopefully all attributes are now valid, and safe to pass forward |
436 | 436 | */ |
437 | 437 | |
438 | - // redeclare vars after validation |
|
439 | - |
|
440 | - if (isset($params['direction_nav'])) { |
|
441 | - $params['directionNav'] = $params['direction_nav']; |
|
442 | - } |
|
443 | - if (isset($params['animation_loop'])) { |
|
444 | - $params['animationLoop'] = $params['animation_loop']; |
|
445 | - } |
|
446 | - if (isset($params['slideshow_speed'])) { |
|
447 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
448 | - } |
|
449 | - if (isset($params['animation_speed'])) { |
|
450 | - $params['animationSpeed'] = $params['animation_speed']; |
|
451 | - } |
|
452 | - if (isset($params['order_by'])) { |
|
453 | - $params['list_sort'] = $params['order_by']; |
|
454 | - } |
|
455 | - |
|
456 | - $query_args = array( |
|
457 | - 'post_number' => $params['post_number'], |
|
458 | - 'is_geodir_loop' => true, |
|
459 | - 'post_type' => $params['post_type'], |
|
460 | - 'order_by' => $params['order_by'] |
|
461 | - ); |
|
462 | - |
|
463 | - if (1 == $params['show_featured_only']) { |
|
464 | - $query_args['show_featured_only'] = 1; |
|
465 | - } |
|
466 | - |
|
467 | - if (0 != $params['category'] && '' != $params['category']) { |
|
468 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
469 | - $tax_query = array( |
|
470 | - 'taxonomy' => $category_taxonomy[0], |
|
471 | - 'field' => 'id', |
|
472 | - 'terms' => $params['category'], |
|
473 | - ); |
|
474 | - |
|
475 | - $query_args['tax_query'] = array($tax_query); |
|
476 | - } |
|
477 | - |
|
478 | - $defaults = array( |
|
479 | - 'before_widget' => '', |
|
480 | - 'after_widget' => '', |
|
481 | - 'before_title' => '', |
|
482 | - 'after_title' => '', |
|
483 | - ); |
|
484 | - |
|
485 | - $query_args = array_merge($query_args, $params); |
|
486 | - |
|
487 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
488 | - |
|
489 | - $output = ob_get_contents(); |
|
490 | - |
|
491 | - ob_end_clean(); |
|
492 | - |
|
493 | - return $output; |
|
438 | + // redeclare vars after validation |
|
439 | + |
|
440 | + if (isset($params['direction_nav'])) { |
|
441 | + $params['directionNav'] = $params['direction_nav']; |
|
442 | + } |
|
443 | + if (isset($params['animation_loop'])) { |
|
444 | + $params['animationLoop'] = $params['animation_loop']; |
|
445 | + } |
|
446 | + if (isset($params['slideshow_speed'])) { |
|
447 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
448 | + } |
|
449 | + if (isset($params['animation_speed'])) { |
|
450 | + $params['animationSpeed'] = $params['animation_speed']; |
|
451 | + } |
|
452 | + if (isset($params['order_by'])) { |
|
453 | + $params['list_sort'] = $params['order_by']; |
|
454 | + } |
|
455 | + |
|
456 | + $query_args = array( |
|
457 | + 'post_number' => $params['post_number'], |
|
458 | + 'is_geodir_loop' => true, |
|
459 | + 'post_type' => $params['post_type'], |
|
460 | + 'order_by' => $params['order_by'] |
|
461 | + ); |
|
462 | + |
|
463 | + if (1 == $params['show_featured_only']) { |
|
464 | + $query_args['show_featured_only'] = 1; |
|
465 | + } |
|
466 | + |
|
467 | + if (0 != $params['category'] && '' != $params['category']) { |
|
468 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
469 | + $tax_query = array( |
|
470 | + 'taxonomy' => $category_taxonomy[0], |
|
471 | + 'field' => 'id', |
|
472 | + 'terms' => $params['category'], |
|
473 | + ); |
|
474 | + |
|
475 | + $query_args['tax_query'] = array($tax_query); |
|
476 | + } |
|
477 | + |
|
478 | + $defaults = array( |
|
479 | + 'before_widget' => '', |
|
480 | + 'after_widget' => '', |
|
481 | + 'before_title' => '', |
|
482 | + 'after_title' => '', |
|
483 | + ); |
|
484 | + |
|
485 | + $query_args = array_merge($query_args, $params); |
|
486 | + |
|
487 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
488 | + |
|
489 | + $output = ob_get_contents(); |
|
490 | + |
|
491 | + ob_end_clean(); |
|
492 | + |
|
493 | + return $output; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -514,22 +514,22 @@ discard block |
||
514 | 514 | */ |
515 | 515 | function geodir_sc_login_box($atts) |
516 | 516 | { |
517 | - ob_start(); |
|
517 | + ob_start(); |
|
518 | 518 | |
519 | - $defaults = array( |
|
520 | - 'before_widget' => '', |
|
521 | - 'after_widget' => '', |
|
522 | - 'before_title' => '', |
|
523 | - 'after_title' => '', |
|
524 | - ); |
|
519 | + $defaults = array( |
|
520 | + 'before_widget' => '', |
|
521 | + 'after_widget' => '', |
|
522 | + 'before_title' => '', |
|
523 | + 'after_title' => '', |
|
524 | + ); |
|
525 | 525 | |
526 | - geodir_loginwidget_output($defaults, $defaults); |
|
526 | + geodir_loginwidget_output($defaults, $defaults); |
|
527 | 527 | |
528 | - $output = ob_get_contents(); |
|
528 | + $output = ob_get_contents(); |
|
529 | 529 | |
530 | - ob_end_clean(); |
|
530 | + ob_end_clean(); |
|
531 | 531 | |
532 | - return $output; |
|
532 | + return $output; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -560,30 +560,30 @@ discard block |
||
560 | 560 | */ |
561 | 561 | function geodir_sc_popular_post_category($atts) |
562 | 562 | { |
563 | - ob_start(); |
|
564 | - global $geodir_post_category_str; |
|
565 | - $defaults = array( |
|
566 | - 'category_limit' => 15, |
|
567 | - 'before_widget' => '', |
|
568 | - 'after_widget' => '', |
|
569 | - 'before_title' => '', |
|
570 | - 'after_title' => '', |
|
571 | - 'title' => '', |
|
572 | - 'default_post_type' => '', |
|
573 | - 'parent_only' => false, |
|
574 | - ); |
|
575 | - |
|
576 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
577 | - $params['category_limit'] = absint($params['category_limit']); |
|
578 | - $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
579 | - $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
580 | - geodir_popular_post_category_output($params, $params); |
|
581 | - |
|
582 | - $output = ob_get_contents(); |
|
583 | - |
|
584 | - ob_end_clean(); |
|
585 | - |
|
586 | - return $output; |
|
563 | + ob_start(); |
|
564 | + global $geodir_post_category_str; |
|
565 | + $defaults = array( |
|
566 | + 'category_limit' => 15, |
|
567 | + 'before_widget' => '', |
|
568 | + 'after_widget' => '', |
|
569 | + 'before_title' => '', |
|
570 | + 'after_title' => '', |
|
571 | + 'title' => '', |
|
572 | + 'default_post_type' => '', |
|
573 | + 'parent_only' => false, |
|
574 | + ); |
|
575 | + |
|
576 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
577 | + $params['category_limit'] = absint($params['category_limit']); |
|
578 | + $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
579 | + $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
580 | + geodir_popular_post_category_output($params, $params); |
|
581 | + |
|
582 | + $output = ob_get_contents(); |
|
583 | + |
|
584 | + ob_end_clean(); |
|
585 | + |
|
586 | + return $output; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -623,97 +623,97 @@ discard block |
||
623 | 623 | */ |
624 | 624 | function geodir_sc_popular_post_view($atts) |
625 | 625 | { |
626 | - ob_start(); |
|
627 | - $defaults = array( |
|
628 | - 'post_type' => 'gd_place', |
|
629 | - 'category' => '0', |
|
630 | - 'post_number' => '5', |
|
631 | - 'layout' => 'gridview_onehalf', |
|
632 | - 'add_location_filter' => '0', |
|
633 | - 'list_sort' => 'latest', |
|
634 | - 'use_viewing_post_type' => '1', |
|
635 | - 'character_count' => '20', |
|
636 | - 'listing_width' => '', |
|
637 | - 'show_featured_only' => '0', |
|
638 | - 'show_special_only' => '0', |
|
639 | - 'with_pics_only' => '0', |
|
640 | - 'with_videos_only' => '0', |
|
641 | - 'before_widget' => '', |
|
642 | - 'after_widget' => '', |
|
643 | - 'before_title' => '<h3 class="widget-title">', |
|
644 | - 'after_title' => '</h3>', |
|
645 | - 'title' => '', |
|
646 | - 'category_title' => '', |
|
647 | - ); |
|
648 | - |
|
649 | - $params = shortcode_atts($defaults, $atts); |
|
650 | - |
|
651 | - /** |
|
652 | - * Validate our incoming params |
|
653 | - */ |
|
626 | + ob_start(); |
|
627 | + $defaults = array( |
|
628 | + 'post_type' => 'gd_place', |
|
629 | + 'category' => '0', |
|
630 | + 'post_number' => '5', |
|
631 | + 'layout' => 'gridview_onehalf', |
|
632 | + 'add_location_filter' => '0', |
|
633 | + 'list_sort' => 'latest', |
|
634 | + 'use_viewing_post_type' => '1', |
|
635 | + 'character_count' => '20', |
|
636 | + 'listing_width' => '', |
|
637 | + 'show_featured_only' => '0', |
|
638 | + 'show_special_only' => '0', |
|
639 | + 'with_pics_only' => '0', |
|
640 | + 'with_videos_only' => '0', |
|
641 | + 'before_widget' => '', |
|
642 | + 'after_widget' => '', |
|
643 | + 'before_title' => '<h3 class="widget-title">', |
|
644 | + 'after_title' => '</h3>', |
|
645 | + 'title' => '', |
|
646 | + 'category_title' => '', |
|
647 | + ); |
|
654 | 648 | |
655 | - // Validate the selected post type, default to gd_place on fail |
|
656 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
657 | - $params['post_type'] = 'gd_place'; |
|
658 | - } |
|
659 | - |
|
660 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
661 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
662 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
663 | - |
|
664 | - // Make sure we have an array |
|
665 | - if (!(is_array($params['category']))) { |
|
666 | - $params['category'] = explode(',', $params['category']); |
|
667 | - } |
|
668 | - |
|
669 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
670 | - // Otherwise it becomes empty and later on that will mean "All" |
|
671 | - $params['category'] = array_intersect($params['category'], $categories); |
|
672 | - |
|
673 | - // Post_number needs to be a positive integer |
|
674 | - $params['post_number'] = absint($params['post_number']); |
|
675 | - if (0 == $params['post_number']) { |
|
676 | - $params['post_number'] = 1; |
|
677 | - } |
|
678 | - |
|
679 | - // Validate our layout choice |
|
680 | - // Outside of the norm, I added some more simple terms to match the existing |
|
681 | - // So now I just run the switch to set it properly. |
|
682 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
683 | - |
|
684 | - // Validate our sorting choice |
|
685 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
686 | - |
|
687 | - // Validate character_count |
|
688 | - $params['character_count'] = absint($params['character_count']); |
|
689 | - if (20 > $params['character_count']) { |
|
690 | - $params['character_count'] = 20; |
|
691 | - } |
|
692 | - |
|
693 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
694 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
695 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
696 | - |
|
697 | - // Validate the checkboxes used on the widget |
|
698 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
699 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
700 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
701 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
702 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
703 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
704 | - |
|
705 | - /** |
|
706 | - * End of validation |
|
707 | - */ |
|
649 | + $params = shortcode_atts($defaults, $atts); |
|
650 | + |
|
651 | + /** |
|
652 | + * Validate our incoming params |
|
653 | + */ |
|
654 | + |
|
655 | + // Validate the selected post type, default to gd_place on fail |
|
656 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
657 | + $params['post_type'] = 'gd_place'; |
|
658 | + } |
|
659 | + |
|
660 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
661 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
662 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
708 | 663 | |
709 | - geodir_popular_postview_output($params, $params); |
|
664 | + // Make sure we have an array |
|
665 | + if (!(is_array($params['category']))) { |
|
666 | + $params['category'] = explode(',', $params['category']); |
|
667 | + } |
|
668 | + |
|
669 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
670 | + // Otherwise it becomes empty and later on that will mean "All" |
|
671 | + $params['category'] = array_intersect($params['category'], $categories); |
|
672 | + |
|
673 | + // Post_number needs to be a positive integer |
|
674 | + $params['post_number'] = absint($params['post_number']); |
|
675 | + if (0 == $params['post_number']) { |
|
676 | + $params['post_number'] = 1; |
|
677 | + } |
|
710 | 678 | |
679 | + // Validate our layout choice |
|
680 | + // Outside of the norm, I added some more simple terms to match the existing |
|
681 | + // So now I just run the switch to set it properly. |
|
682 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
711 | 683 | |
712 | - $output = ob_get_contents(); |
|
684 | + // Validate our sorting choice |
|
685 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
713 | 686 | |
714 | - ob_end_clean(); |
|
687 | + // Validate character_count |
|
688 | + $params['character_count'] = absint($params['character_count']); |
|
689 | + if (20 > $params['character_count']) { |
|
690 | + $params['character_count'] = 20; |
|
691 | + } |
|
715 | 692 | |
716 | - return $output; |
|
693 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
694 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
695 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
696 | + |
|
697 | + // Validate the checkboxes used on the widget |
|
698 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
699 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
700 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
701 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
702 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
703 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
704 | + |
|
705 | + /** |
|
706 | + * End of validation |
|
707 | + */ |
|
708 | + |
|
709 | + geodir_popular_postview_output($params, $params); |
|
710 | + |
|
711 | + |
|
712 | + $output = ob_get_contents(); |
|
713 | + |
|
714 | + ob_end_clean(); |
|
715 | + |
|
716 | + return $output; |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -735,37 +735,37 @@ discard block |
||
735 | 735 | * @return string Recent reviews HTML. |
736 | 736 | */ |
737 | 737 | function geodir_sc_recent_reviews($atts) { |
738 | - ob_start(); |
|
739 | - $defaults = array( |
|
738 | + ob_start(); |
|
739 | + $defaults = array( |
|
740 | 740 | 'title' => '', |
741 | 741 | 'count' => 5, |
742 | - ); |
|
742 | + ); |
|
743 | 743 | |
744 | - $params = shortcode_atts($defaults, $atts); |
|
744 | + $params = shortcode_atts($defaults, $atts); |
|
745 | 745 | |
746 | - $count = absint($params['count']); |
|
747 | - if (0 == $count) { |
|
748 | - $count = 1; |
|
749 | - } |
|
746 | + $count = absint($params['count']); |
|
747 | + if (0 == $count) { |
|
748 | + $count = 1; |
|
749 | + } |
|
750 | 750 | |
751 | 751 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
752 | 752 | |
753 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
753 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
754 | 754 | |
755 | - if ($comments_li) { |
|
756 | - if ($title != '') { ?> |
|
755 | + if ($comments_li) { |
|
756 | + if ($title != '') { ?> |
|
757 | 757 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
758 | 758 | <?php } ?> |
759 | 759 | <div class="geodir_sc_recent_reviews_section"> |
760 | 760 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
761 | 761 | </div> |
762 | 762 | <?php |
763 | - } |
|
764 | - $output = ob_get_contents(); |
|
763 | + } |
|
764 | + $output = ob_get_contents(); |
|
765 | 765 | |
766 | - ob_end_clean(); |
|
766 | + ob_end_clean(); |
|
767 | 767 | |
768 | - return $output; |
|
768 | + return $output; |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -795,64 +795,64 @@ discard block |
||
795 | 795 | */ |
796 | 796 | function geodir_sc_related_listings($atts) |
797 | 797 | { |
798 | - ob_start(); |
|
799 | - $defaults = array( |
|
800 | - 'post_number' => 5, |
|
801 | - 'relate_to' => 'category', |
|
802 | - 'layout' => 'gridview_onehalf', |
|
803 | - 'add_location_filter' => 0, |
|
804 | - 'listing_width' => '', |
|
805 | - 'list_sort' => 'latest', |
|
806 | - 'character_count' => 20, |
|
807 | - 'is_widget' => 1, |
|
808 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
809 | - ); |
|
810 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
811 | - |
|
812 | - $params = shortcode_atts($defaults, $atts); |
|
813 | - |
|
814 | - /** |
|
815 | - * Begin validating parameters |
|
816 | - */ |
|
798 | + ob_start(); |
|
799 | + $defaults = array( |
|
800 | + 'post_number' => 5, |
|
801 | + 'relate_to' => 'category', |
|
802 | + 'layout' => 'gridview_onehalf', |
|
803 | + 'add_location_filter' => 0, |
|
804 | + 'listing_width' => '', |
|
805 | + 'list_sort' => 'latest', |
|
806 | + 'character_count' => 20, |
|
807 | + 'is_widget' => 1, |
|
808 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
809 | + ); |
|
810 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
811 | + |
|
812 | + $params = shortcode_atts($defaults, $atts); |
|
813 | + |
|
814 | + /** |
|
815 | + * Begin validating parameters |
|
816 | + */ |
|
817 | 817 | |
818 | - // Validate that post_number is a number and is 1 or higher |
|
819 | - $params['post_number'] = absint($params['post_number']); |
|
820 | - if (0 === $params['post_number']) { |
|
821 | - $params['post_number'] = 1; |
|
822 | - } |
|
818 | + // Validate that post_number is a number and is 1 or higher |
|
819 | + $params['post_number'] = absint($params['post_number']); |
|
820 | + if (0 === $params['post_number']) { |
|
821 | + $params['post_number'] = 1; |
|
822 | + } |
|
823 | 823 | |
824 | - // Validate relate_to - only category or tags |
|
825 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
826 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
827 | - $params['relate_to'] = 'category'; |
|
828 | - } |
|
824 | + // Validate relate_to - only category or tags |
|
825 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
826 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
827 | + $params['relate_to'] = 'category'; |
|
828 | + } |
|
829 | 829 | |
830 | - // Validate layout selection |
|
831 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
830 | + // Validate layout selection |
|
831 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
832 | 832 | |
833 | - // Validate sorting option |
|
834 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
833 | + // Validate sorting option |
|
834 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
835 | 835 | |
836 | - // Validate add_location_filter |
|
837 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
836 | + // Validate add_location_filter |
|
837 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
838 | 838 | |
839 | - // Validate listing_width |
|
840 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
839 | + // Validate listing_width |
|
840 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
841 | 841 | |
842 | - // Validate character_count |
|
843 | - $params['character_count'] = absint($params['character_count']); |
|
844 | - if (20 > $params['character_count']) { |
|
845 | - $params['character_count'] = 20; |
|
846 | - } |
|
842 | + // Validate character_count |
|
843 | + $params['character_count'] = absint($params['character_count']); |
|
844 | + if (20 > $params['character_count']) { |
|
845 | + $params['character_count'] = 20; |
|
846 | + } |
|
847 | 847 | |
848 | - if ($related_display = geodir_related_posts_display($params)) { |
|
849 | - echo $related_display; |
|
850 | - } |
|
851 | - $output = ob_get_contents(); |
|
848 | + if ($related_display = geodir_related_posts_display($params)) { |
|
849 | + echo $related_display; |
|
850 | + } |
|
851 | + $output = ob_get_contents(); |
|
852 | 852 | |
853 | - ob_end_clean(); |
|
853 | + ob_end_clean(); |
|
854 | 854 | |
855 | - return $output; |
|
855 | + return $output; |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -876,12 +876,12 @@ discard block |
||
876 | 876 | * @return string Advanced search widget HTML. |
877 | 877 | */ |
878 | 878 | function geodir_sc_advanced_search($atts) { |
879 | - $defaults = array( |
|
879 | + $defaults = array( |
|
880 | 880 | 'title' => '', |
881 | 881 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">', |
882 | - 'after_widget' => '</section>', |
|
883 | - 'before_title' => '<h3 class="widget-title">', |
|
884 | - 'after_title' => '</h3>', |
|
882 | + 'after_widget' => '</section>', |
|
883 | + 'before_title' => '<h3 class="widget-title">', |
|
884 | + 'after_title' => '</h3>', |
|
885 | 885 | 'show_adv_search' => 'default' |
886 | 886 | ); |
887 | 887 | |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | the_widget('geodir_advance_search_widget', $params, $params ); |
906 | 906 | |
907 | 907 | $output = ob_get_contents(); |
908 | - ob_end_clean(); |
|
908 | + ob_end_clean(); |
|
909 | 909 | |
910 | - return $output; |
|
910 | + return $output; |
|
911 | 911 | } |
912 | 912 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
913 | 913 | |
@@ -953,48 +953,48 @@ discard block |
||
953 | 953 | 'add_location_filter' => '1', |
954 | 954 | 'tab_layout' => 'bestof-tabs-on-top', |
955 | 955 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
956 | - 'after_widget' => '</section>', |
|
957 | - 'before_title' => '<h3 class="widget-title">', |
|
958 | - 'after_title' => '</h3>', |
|
956 | + 'after_widget' => '</section>', |
|
957 | + 'before_title' => '<h3 class="widget-title">', |
|
958 | + 'after_title' => '</h3>', |
|
959 | 959 | ); |
960 | 960 | $params = shortcode_atts($defaults, $atts); |
961 | 961 | |
962 | - /** |
|
963 | - * Validate our incoming params |
|
964 | - */ |
|
962 | + /** |
|
963 | + * Validate our incoming params |
|
964 | + */ |
|
965 | 965 | |
966 | - // Validate the selected post type, default to gd_place on fail |
|
967 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
968 | - $params['post_type'] = 'gd_place'; |
|
969 | - } |
|
966 | + // Validate the selected post type, default to gd_place on fail |
|
967 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
968 | + $params['post_type'] = 'gd_place'; |
|
969 | + } |
|
970 | 970 | |
971 | 971 | // Post limit needs to be a positive integer |
972 | - $params['post_limit'] = absint($params['post_limit']); |
|
973 | - if (0 == $params['post_limit']) { |
|
974 | - $params['post_limit'] = 5; |
|
975 | - } |
|
972 | + $params['post_limit'] = absint($params['post_limit']); |
|
973 | + if (0 == $params['post_limit']) { |
|
974 | + $params['post_limit'] = 5; |
|
975 | + } |
|
976 | 976 | |
977 | 977 | // Category limit needs to be a positive integer |
978 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
979 | - if (0 == $params['categ_limit']) { |
|
980 | - $params['categ_limit'] = 3; |
|
981 | - } |
|
978 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
979 | + if (0 == $params['categ_limit']) { |
|
980 | + $params['categ_limit'] = 3; |
|
981 | + } |
|
982 | 982 | |
983 | 983 | // Tab layout validation |
984 | - $params['tab_layout'] = $params['tab_layout']; |
|
985 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
986 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
987 | - } |
|
984 | + $params['tab_layout'] = $params['tab_layout']; |
|
985 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
986 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
987 | + } |
|
988 | 988 | |
989 | 989 | // Validate character_count |
990 | - $params['character_count'] = $params['character_count']; |
|
990 | + $params['character_count'] = $params['character_count']; |
|
991 | 991 | |
992 | 992 | ob_start(); |
993 | 993 | the_widget('geodir_bestof_widget', $params, $params); |
994 | - $output = ob_get_contents(); |
|
995 | - ob_end_clean(); |
|
994 | + $output = ob_get_contents(); |
|
995 | + ob_end_clean(); |
|
996 | 996 | |
997 | - return $output; |
|
997 | + return $output; |
|
998 | 998 | } |
999 | 999 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
1000 | 1000 | |
@@ -1042,127 +1042,127 @@ discard block |
||
1042 | 1042 | * @return string HTML content to display geodirectory listings. |
1043 | 1043 | */ |
1044 | 1044 | function geodir_sc_gd_listings($atts, $content = '') { |
1045 | - global $post; |
|
1046 | - $defaults = array( |
|
1047 | - 'title' => '', |
|
1048 | - 'post_type' => 'gd_place', |
|
1049 | - 'category' => 0, |
|
1050 | - 'list_sort' => 'latest', |
|
1051 | - 'event_type' => '', |
|
1052 | - 'post_number' => 10, |
|
1053 | - 'post_author' => '', |
|
1054 | - 'layout' => 'gridview_onehalf', |
|
1055 | - 'listing_width' => '', |
|
1056 | - 'character_count' => 20, |
|
1057 | - 'add_location_filter' => 1, |
|
1058 | - 'show_featured_only' => '', |
|
1059 | - 'show_special_only' => '', |
|
1060 | - 'with_pics_only' => '', |
|
1061 | - 'with_videos_only' => '', |
|
1062 | - 'with_pagination' => '1', |
|
1063 | - 'top_pagination' => '0', |
|
1064 | - 'bottom_pagination' => '1', |
|
1065 | - 'without_no_results' => 0, |
|
1066 | - 'tags' => '' |
|
1067 | - ); |
|
1068 | - $params = shortcode_atts($defaults, $atts); |
|
1069 | - |
|
1070 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
1071 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1072 | - |
|
1073 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
1074 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1075 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1076 | - |
|
1077 | - // Make sure we have an array |
|
1078 | - if (!(is_array($params['category']))) { |
|
1079 | - $params['category'] = explode(',', $params['category']); |
|
1080 | - } |
|
1081 | - |
|
1082 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1083 | - // Otherwise it becomes empty and later on that will mean "All" |
|
1084 | - $params['category'] = array_intersect($params['category'], $categories); |
|
1085 | - |
|
1086 | - // Post_number needs to be a positive integer |
|
1087 | - $params['post_number'] = absint($params['post_number']); |
|
1088 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1045 | + global $post; |
|
1046 | + $defaults = array( |
|
1047 | + 'title' => '', |
|
1048 | + 'post_type' => 'gd_place', |
|
1049 | + 'category' => 0, |
|
1050 | + 'list_sort' => 'latest', |
|
1051 | + 'event_type' => '', |
|
1052 | + 'post_number' => 10, |
|
1053 | + 'post_author' => '', |
|
1054 | + 'layout' => 'gridview_onehalf', |
|
1055 | + 'listing_width' => '', |
|
1056 | + 'character_count' => 20, |
|
1057 | + 'add_location_filter' => 1, |
|
1058 | + 'show_featured_only' => '', |
|
1059 | + 'show_special_only' => '', |
|
1060 | + 'with_pics_only' => '', |
|
1061 | + 'with_videos_only' => '', |
|
1062 | + 'with_pagination' => '1', |
|
1063 | + 'top_pagination' => '0', |
|
1064 | + 'bottom_pagination' => '1', |
|
1065 | + 'without_no_results' => 0, |
|
1066 | + 'tags' => '' |
|
1067 | + ); |
|
1068 | + $params = shortcode_atts($defaults, $atts); |
|
1069 | + |
|
1070 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
1071 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1072 | + |
|
1073 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
1074 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1075 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1076 | + |
|
1077 | + // Make sure we have an array |
|
1078 | + if (!(is_array($params['category']))) { |
|
1079 | + $params['category'] = explode(',', $params['category']); |
|
1080 | + } |
|
1081 | + |
|
1082 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1083 | + // Otherwise it becomes empty and later on that will mean "All" |
|
1084 | + $params['category'] = array_intersect($params['category'], $categories); |
|
1085 | + |
|
1086 | + // Post_number needs to be a positive integer |
|
1087 | + $params['post_number'] = absint($params['post_number']); |
|
1088 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1089 | 1089 | |
1090 | - // Post_number needs to be a positive integer |
|
1091 | - if (!empty($atts['post_author'])) { |
|
1092 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1093 | - $params['post_author'] = $post->post_author; |
|
1094 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1095 | - $params['post_author'] = absint($atts['post_author']); |
|
1096 | - } else { |
|
1097 | - unset($params['post_author']); |
|
1098 | - } |
|
1099 | - } else { |
|
1100 | - unset($params['post_author']); |
|
1101 | - } |
|
1102 | - |
|
1103 | - // Validate character_count |
|
1104 | - //todo: is this necessary? |
|
1105 | - $params['character_count'] = $params['character_count']; |
|
1106 | - |
|
1107 | - // Validate our layout choice |
|
1108 | - // Outside of the norm, I added some more simple terms to match the existing |
|
1109 | - // So now I just run the switch to set it properly. |
|
1110 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1111 | - |
|
1112 | - // Validate our sorting choice |
|
1113 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1114 | - |
|
1115 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
1116 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1117 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1118 | - |
|
1119 | - // Validate the checkboxes used on the widget |
|
1120 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1121 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1122 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1123 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1124 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1125 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1126 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1127 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1128 | - |
|
1129 | - // Clean tags |
|
1130 | - if (!empty($params['tags'])) { |
|
1131 | - if (!is_array($params['tags'])) { |
|
1132 | - $comma = _x(',', 'tag delimiter'); |
|
1133 | - if ( ',' !== $comma ) { |
|
1134 | - $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1135 | - } |
|
1136 | - $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1137 | - $params['tags'] = array_map('trim', $params['tags']); |
|
1138 | - } |
|
1139 | - } else { |
|
1140 | - $params['tags'] = array(); |
|
1141 | - } |
|
1142 | - |
|
1143 | - /** |
|
1144 | - * End of validation |
|
1145 | - */ |
|
1146 | - if (isset($atts['geodir_ajax'])) { |
|
1147 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1148 | - unset($atts['geodir_ajax']); |
|
1149 | - } |
|
1150 | - if (isset($atts['pageno'])) { |
|
1151 | - $params['pageno'] = $atts['pageno']; |
|
1152 | - unset($atts['pageno']); |
|
1153 | - } |
|
1154 | - |
|
1155 | - if ( !empty($atts['shortcode_content']) ) { |
|
1156 | - $content = $atts['shortcode_content']; |
|
1157 | - } |
|
1158 | - $params['shortcode_content'] = trim($content); |
|
1159 | - $atts['shortcode_content'] = trim($content); |
|
1090 | + // Post_number needs to be a positive integer |
|
1091 | + if (!empty($atts['post_author'])) { |
|
1092 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1093 | + $params['post_author'] = $post->post_author; |
|
1094 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1095 | + $params['post_author'] = absint($atts['post_author']); |
|
1096 | + } else { |
|
1097 | + unset($params['post_author']); |
|
1098 | + } |
|
1099 | + } else { |
|
1100 | + unset($params['post_author']); |
|
1101 | + } |
|
1102 | + |
|
1103 | + // Validate character_count |
|
1104 | + //todo: is this necessary? |
|
1105 | + $params['character_count'] = $params['character_count']; |
|
1106 | + |
|
1107 | + // Validate our layout choice |
|
1108 | + // Outside of the norm, I added some more simple terms to match the existing |
|
1109 | + // So now I just run the switch to set it properly. |
|
1110 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1111 | + |
|
1112 | + // Validate our sorting choice |
|
1113 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1114 | + |
|
1115 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
1116 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1117 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1118 | + |
|
1119 | + // Validate the checkboxes used on the widget |
|
1120 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1121 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1122 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1123 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1124 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1125 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1126 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1127 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1128 | + |
|
1129 | + // Clean tags |
|
1130 | + if (!empty($params['tags'])) { |
|
1131 | + if (!is_array($params['tags'])) { |
|
1132 | + $comma = _x(',', 'tag delimiter'); |
|
1133 | + if ( ',' !== $comma ) { |
|
1134 | + $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1135 | + } |
|
1136 | + $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1137 | + $params['tags'] = array_map('trim', $params['tags']); |
|
1138 | + } |
|
1139 | + } else { |
|
1140 | + $params['tags'] = array(); |
|
1141 | + } |
|
1142 | + |
|
1143 | + /** |
|
1144 | + * End of validation |
|
1145 | + */ |
|
1146 | + if (isset($atts['geodir_ajax'])) { |
|
1147 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1148 | + unset($atts['geodir_ajax']); |
|
1149 | + } |
|
1150 | + if (isset($atts['pageno'])) { |
|
1151 | + $params['pageno'] = $atts['pageno']; |
|
1152 | + unset($atts['pageno']); |
|
1153 | + } |
|
1154 | + |
|
1155 | + if ( !empty($atts['shortcode_content']) ) { |
|
1156 | + $content = $atts['shortcode_content']; |
|
1157 | + } |
|
1158 | + $params['shortcode_content'] = trim($content); |
|
1159 | + $atts['shortcode_content'] = trim($content); |
|
1160 | 1160 | |
1161 | - $params['shortcode_atts'] = $atts; |
|
1161 | + $params['shortcode_atts'] = $atts; |
|
1162 | 1162 | |
1163 | - $output = geodir_sc_gd_listings_output($params); |
|
1163 | + $output = geodir_sc_gd_listings_output($params); |
|
1164 | 1164 | |
1165 | - return $output; |
|
1165 | + return $output; |
|
1166 | 1166 | } |
1167 | 1167 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
1168 | 1168 | |
@@ -1202,56 +1202,56 @@ discard block |
||
1202 | 1202 | * @return string HTML content to display CPT categories. |
1203 | 1203 | */ |
1204 | 1204 | function geodir_sc_cpt_categories_widget($atts, $content = '') { |
1205 | - $defaults = array( |
|
1206 | - 'title' => '', |
|
1207 | - 'post_type' => '', // NULL for all |
|
1208 | - 'hide_empty' => '', |
|
1209 | - 'show_count' => '', |
|
1210 | - 'hide_icon' => '', |
|
1211 | - 'cpt_left' => '', |
|
1212 | - 'sort_by' => 'count', |
|
1213 | - 'max_count' => 'all', |
|
1214 | - 'max_level' => '1', |
|
1215 | - 'no_cpt_filter' => '', |
|
1216 | - 'no_cat_filter' => '', |
|
1217 | - 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1218 | - 'after_widget' => '</section>', |
|
1219 | - 'before_title' => '<h3 class="widget-title">', |
|
1220 | - 'after_title' => '</h3>', |
|
1221 | - ); |
|
1222 | - $params = shortcode_atts($defaults, $atts); |
|
1223 | - |
|
1224 | - /** |
|
1225 | - * Validate our incoming params |
|
1226 | - */ |
|
1227 | - // Make sure we have an array |
|
1228 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1229 | - |
|
1230 | - // Validate the checkboxes used on the widget |
|
1231 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1232 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1233 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1234 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1205 | + $defaults = array( |
|
1206 | + 'title' => '', |
|
1207 | + 'post_type' => '', // NULL for all |
|
1208 | + 'hide_empty' => '', |
|
1209 | + 'show_count' => '', |
|
1210 | + 'hide_icon' => '', |
|
1211 | + 'cpt_left' => '', |
|
1212 | + 'sort_by' => 'count', |
|
1213 | + 'max_count' => 'all', |
|
1214 | + 'max_level' => '1', |
|
1215 | + 'no_cpt_filter' => '', |
|
1216 | + 'no_cat_filter' => '', |
|
1217 | + 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1218 | + 'after_widget' => '</section>', |
|
1219 | + 'before_title' => '<h3 class="widget-title">', |
|
1220 | + 'after_title' => '</h3>', |
|
1221 | + ); |
|
1222 | + $params = shortcode_atts($defaults, $atts); |
|
1235 | 1223 | |
1236 | - if ($params['max_count'] != 'all') { |
|
1237 | - $params['max_count'] = absint($params['max_count']); |
|
1238 | - } |
|
1224 | + /** |
|
1225 | + * Validate our incoming params |
|
1226 | + */ |
|
1227 | + // Make sure we have an array |
|
1228 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1229 | + |
|
1230 | + // Validate the checkboxes used on the widget |
|
1231 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1232 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1233 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1234 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1235 | + |
|
1236 | + if ($params['max_count'] != 'all') { |
|
1237 | + $params['max_count'] = absint($params['max_count']); |
|
1238 | + } |
|
1239 | 1239 | |
1240 | - if ($params['max_level'] != 'all') { |
|
1241 | - $params['max_level'] = absint($params['max_level']); |
|
1242 | - } |
|
1240 | + if ($params['max_level'] != 'all') { |
|
1241 | + $params['max_level'] = absint($params['max_level']); |
|
1242 | + } |
|
1243 | 1243 | |
1244 | - $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1245 | - $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1244 | + $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1245 | + $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1246 | 1246 | |
1247 | - $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1247 | + $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1248 | 1248 | |
1249 | - ob_start(); |
|
1250 | - the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1251 | - $output = ob_get_contents(); |
|
1252 | - ob_end_clean(); |
|
1249 | + ob_start(); |
|
1250 | + the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1251 | + $output = ob_get_contents(); |
|
1252 | + ob_end_clean(); |
|
1253 | 1253 | |
1254 | - return $output; |
|
1254 | + return $output; |
|
1255 | 1255 | } |
1256 | 1256 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
1257 | 1257 | |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | * @return string HTML code. |
1267 | 1267 | */ |
1268 | 1268 | function geodir_sc_responsive_videos($atts, $content) { |
1269 | - return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1269 | + return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1270 | 1270 | } |
1271 | 1271 | add_shortcode('gd_video', 'geodir_sc_responsive_videos'); |
1272 | 1272 | ?> |
1273 | 1273 | \ No newline at end of file |
@@ -16,22 +16,22 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function geodir_on_wp_loaded() |
18 | 18 | { |
19 | - /** |
|
20 | - * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms. |
|
21 | - * |
|
22 | - * @since 1.0.0 |
|
23 | - */ |
|
24 | - do_action('giodir_handle_request_plugins_loaded'); |
|
25 | - global $wpdb; |
|
19 | + /** |
|
20 | + * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms. |
|
21 | + * |
|
22 | + * @since 1.0.0 |
|
23 | + */ |
|
24 | + do_action('giodir_handle_request_plugins_loaded'); |
|
25 | + global $wpdb; |
|
26 | 26 | |
27 | 27 | |
28 | - if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') { |
|
29 | - geodir_send_inquiry($_REQUEST); // function in custom_functions.php |
|
28 | + if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') { |
|
29 | + geodir_send_inquiry($_REQUEST); // function in custom_functions.php |
|
30 | 30 | |
31 | - } elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') { |
|
32 | - geodir_send_friend($_REQUEST); // function in custom_functions.php |
|
31 | + } elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') { |
|
32 | + geodir_send_friend($_REQUEST); // function in custom_functions.php |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | */ |
45 | 45 | function geodir_on_wp() |
46 | 46 | { |
47 | - if(geodir_is_page('login')) { |
|
48 | - geodir_user_signup(); |
|
49 | - } |
|
47 | + if(geodir_is_page('login')) { |
|
48 | + geodir_user_signup(); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,47 +59,47 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function geodir_on_init() |
61 | 61 | { |
62 | - /** |
|
63 | - * Called on the wp_init WP hook at the start of the geodir_on_init() function. |
|
64 | - * |
|
65 | - * @since 1.0.0 |
|
66 | - */ |
|
67 | - do_action('giodir_handle_request'); |
|
68 | - global $wpdb; |
|
69 | - |
|
70 | - |
|
71 | - |
|
72 | - |
|
73 | - if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) { |
|
74 | - show_admin_bar(false); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') { |
|
79 | - /** |
|
80 | - * Contains map marker functions. |
|
81 | - * |
|
82 | - * @since 1.0.0 |
|
83 | - * @package GeoDirectory |
|
84 | - */ |
|
85 | - include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php'); |
|
86 | - die; |
|
87 | - } |
|
88 | - |
|
89 | - if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') { |
|
90 | - if (isset($_REQUEST['ga_start'])) { |
|
91 | - $ga_start = $_REQUEST['ga_start']; |
|
92 | - } else { |
|
93 | - $ga_start = ''; |
|
94 | - } |
|
95 | - if (isset($_REQUEST['ga_end'])) { |
|
96 | - $ga_end = $_REQUEST['ga_end']; |
|
97 | - } else { |
|
98 | - $ga_end = ''; |
|
99 | - } |
|
100 | - geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end); |
|
101 | - die; |
|
102 | - } |
|
62 | + /** |
|
63 | + * Called on the wp_init WP hook at the start of the geodir_on_init() function. |
|
64 | + * |
|
65 | + * @since 1.0.0 |
|
66 | + */ |
|
67 | + do_action('giodir_handle_request'); |
|
68 | + global $wpdb; |
|
69 | + |
|
70 | + |
|
71 | + |
|
72 | + |
|
73 | + if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) { |
|
74 | + show_admin_bar(false); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') { |
|
79 | + /** |
|
80 | + * Contains map marker functions. |
|
81 | + * |
|
82 | + * @since 1.0.0 |
|
83 | + * @package GeoDirectory |
|
84 | + */ |
|
85 | + include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php'); |
|
86 | + die; |
|
87 | + } |
|
88 | + |
|
89 | + if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') { |
|
90 | + if (isset($_REQUEST['ga_start'])) { |
|
91 | + $ga_start = $_REQUEST['ga_start']; |
|
92 | + } else { |
|
93 | + $ga_start = ''; |
|
94 | + } |
|
95 | + if (isset($_REQUEST['ga_end'])) { |
|
96 | + $ga_end = $_REQUEST['ga_end']; |
|
97 | + } else { |
|
98 | + $ga_end = ''; |
|
99 | + } |
|
100 | + geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end); |
|
101 | + die; |
|
102 | + } |
|
103 | 103 | |
104 | 104 | |
105 | 105 | } |
@@ -118,265 +118,265 @@ discard block |
||
118 | 118 | * @todo check if nonce is required here and if so add one. |
119 | 119 | */ |
120 | 120 | function geodir_ajax_handler() { |
121 | - global $wpdb, $gd_session; |
|
121 | + global $wpdb, $gd_session; |
|
122 | 122 | |
123 | - if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') { |
|
123 | + if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') { |
|
124 | 124 | $gd_session->set('gd_listing_view', $_REQUEST['gd_listing_view']); |
125 | - echo '1'; |
|
126 | - } |
|
127 | - |
|
128 | - if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') { |
|
129 | - if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) |
|
130 | - geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']); |
|
131 | - else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) |
|
132 | - geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']); |
|
133 | - } |
|
134 | - |
|
135 | - if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) { |
|
136 | - if (current_user_can('manage_options')) { |
|
137 | - /** |
|
138 | - * Contains admin ajax handling functions. |
|
139 | - * |
|
140 | - * @since 1.0.0 |
|
141 | - * @package GeoDirectory |
|
142 | - */ |
|
143 | - include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php'); |
|
144 | - } else { |
|
145 | - wp_redirect(geodir_login_url()); |
|
146 | - gd_die(); |
|
147 | - } |
|
148 | - } |
|
149 | - |
|
150 | - if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) { |
|
151 | - if (current_user_can('manage_options')) { |
|
152 | - switch ($_REQUEST['geodir_autofill']): |
|
153 | - case "geodir_dummy_delete" : |
|
154 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) |
|
155 | - return; |
|
156 | - |
|
157 | - if (isset($_REQUEST['posttype'])) |
|
158 | - /** |
|
159 | - * Used to delete the dummy post data per post type. |
|
160 | - * |
|
161 | - * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype']. |
|
162 | - * |
|
163 | - * @since 1.0.0 |
|
164 | - */ |
|
165 | - do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']); |
|
166 | - break; |
|
167 | - case "geodir_dummy_insert" : |
|
168 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) |
|
169 | - return; |
|
170 | - |
|
171 | - global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
|
172 | - $dummy_post_index = $_REQUEST['insert_dummy_post_index']; |
|
173 | - $city_bound_lat1 = $_REQUEST['city_bound_lat1']; |
|
174 | - $city_bound_lng1 = $_REQUEST['city_bound_lng1']; |
|
175 | - $city_bound_lat2 = $_REQUEST['city_bound_lat2']; |
|
176 | - $city_bound_lng2 = $_REQUEST['city_bound_lng2']; |
|
177 | - |
|
178 | - if (isset($_REQUEST['posttype'])) |
|
179 | - /** |
|
180 | - * Used to insert the dummy post data per post type. |
|
181 | - * |
|
182 | - * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype']. |
|
183 | - * |
|
184 | - * @since 1.0.0 |
|
185 | - */ |
|
186 | - do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']); |
|
187 | - |
|
188 | - break; |
|
189 | - endswitch; |
|
190 | - } else { |
|
191 | - wp_redirect(geodir_login_url()); |
|
192 | - exit(); |
|
193 | - } |
|
194 | - } |
|
195 | - |
|
196 | - if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') { |
|
197 | - |
|
198 | - if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') { |
|
199 | - $template = locate_template(array("geodirectory/popup-forms.php")); |
|
200 | - if (!$template) { |
|
201 | - $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php'; |
|
202 | - } |
|
203 | - require_once($template); |
|
204 | - } |
|
205 | - |
|
206 | - gd_die(); |
|
207 | - } |
|
208 | - |
|
209 | - /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){ |
|
125 | + echo '1'; |
|
126 | + } |
|
127 | + |
|
128 | + if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') { |
|
129 | + if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) |
|
130 | + geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']); |
|
131 | + else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) |
|
132 | + geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']); |
|
133 | + } |
|
134 | + |
|
135 | + if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) { |
|
136 | + if (current_user_can('manage_options')) { |
|
137 | + /** |
|
138 | + * Contains admin ajax handling functions. |
|
139 | + * |
|
140 | + * @since 1.0.0 |
|
141 | + * @package GeoDirectory |
|
142 | + */ |
|
143 | + include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php'); |
|
144 | + } else { |
|
145 | + wp_redirect(geodir_login_url()); |
|
146 | + gd_die(); |
|
147 | + } |
|
148 | + } |
|
149 | + |
|
150 | + if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) { |
|
151 | + if (current_user_can('manage_options')) { |
|
152 | + switch ($_REQUEST['geodir_autofill']): |
|
153 | + case "geodir_dummy_delete" : |
|
154 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) |
|
155 | + return; |
|
156 | + |
|
157 | + if (isset($_REQUEST['posttype'])) |
|
158 | + /** |
|
159 | + * Used to delete the dummy post data per post type. |
|
160 | + * |
|
161 | + * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype']. |
|
162 | + * |
|
163 | + * @since 1.0.0 |
|
164 | + */ |
|
165 | + do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']); |
|
166 | + break; |
|
167 | + case "geodir_dummy_insert" : |
|
168 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) |
|
169 | + return; |
|
170 | + |
|
171 | + global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
|
172 | + $dummy_post_index = $_REQUEST['insert_dummy_post_index']; |
|
173 | + $city_bound_lat1 = $_REQUEST['city_bound_lat1']; |
|
174 | + $city_bound_lng1 = $_REQUEST['city_bound_lng1']; |
|
175 | + $city_bound_lat2 = $_REQUEST['city_bound_lat2']; |
|
176 | + $city_bound_lng2 = $_REQUEST['city_bound_lng2']; |
|
177 | + |
|
178 | + if (isset($_REQUEST['posttype'])) |
|
179 | + /** |
|
180 | + * Used to insert the dummy post data per post type. |
|
181 | + * |
|
182 | + * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype']. |
|
183 | + * |
|
184 | + * @since 1.0.0 |
|
185 | + */ |
|
186 | + do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']); |
|
187 | + |
|
188 | + break; |
|
189 | + endswitch; |
|
190 | + } else { |
|
191 | + wp_redirect(geodir_login_url()); |
|
192 | + exit(); |
|
193 | + } |
|
194 | + } |
|
195 | + |
|
196 | + if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') { |
|
197 | + |
|
198 | + if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') { |
|
199 | + $template = locate_template(array("geodirectory/popup-forms.php")); |
|
200 | + if (!$template) { |
|
201 | + $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php'; |
|
202 | + } |
|
203 | + require_once($template); |
|
204 | + } |
|
205 | + |
|
206 | + gd_die(); |
|
207 | + } |
|
208 | + |
|
209 | + /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){ |
|
210 | 210 | include_once ( geodir_plugin_path() . '/geodirectory-templates/advance-search-form.php'); |
211 | 211 | }*/ |
212 | 212 | |
213 | - if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') { |
|
214 | - /** |
|
215 | - * Contains map marker functions. |
|
216 | - * |
|
217 | - * @since 1.0.0 |
|
218 | - * @package GeoDirectory |
|
219 | - */ |
|
220 | - include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php'); |
|
221 | - } |
|
222 | - |
|
223 | - if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') { |
|
224 | - if (is_user_logged_in()) { |
|
225 | - switch ($_REQUEST['ajax_action']): |
|
226 | - case "add" : |
|
227 | - geodir_add_to_favorite((int)$_REQUEST['pid']); |
|
228 | - break; |
|
229 | - case "remove" : |
|
230 | - geodir_remove_from_favorite((int)$_REQUEST['pid']); |
|
231 | - break; |
|
232 | - endswitch; |
|
233 | - } else { |
|
234 | - wp_redirect(geodir_login_url()); |
|
235 | - exit(); |
|
236 | - } |
|
237 | - } |
|
238 | - |
|
239 | - if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') { |
|
240 | - |
|
241 | - $is_current_user_owner = true; |
|
242 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
243 | - $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']); |
|
244 | - } |
|
245 | - |
|
246 | - $request = $gd_session->get('listing'); |
|
247 | - |
|
248 | - if (is_user_logged_in() && $is_current_user_owner) { |
|
249 | - |
|
250 | - switch ($_REQUEST['ajax_action']): |
|
251 | - case "add": |
|
252 | - case "update": |
|
253 | - |
|
254 | - if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') { |
|
255 | - $last_id = geodir_save_listing(); |
|
256 | - |
|
257 | - if ($last_id) { |
|
258 | - //$redirect_to = get_permalink( $last_id ); |
|
259 | - $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id)); |
|
260 | - |
|
261 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
262 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
263 | - $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false); |
|
264 | - } else |
|
265 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
266 | - |
|
267 | - wp_redirect($redirect_to); |
|
268 | - } else { |
|
269 | - $gd_session->un_set('listing'); |
|
270 | - wp_redirect(home_url()); |
|
271 | - } |
|
272 | - |
|
273 | - break; |
|
274 | - case "cancel" : |
|
275 | - |
|
276 | - $gd_session->un_set('listing'); |
|
277 | - |
|
278 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) |
|
279 | - wp_redirect(get_permalink($_REQUEST['pid'])); |
|
280 | - else { |
|
281 | - geodir_remove_temp_images(); |
|
282 | - wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type']))); |
|
283 | - } |
|
284 | - |
|
285 | - break; |
|
286 | - |
|
287 | - case "publish" : |
|
288 | - |
|
289 | - if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') { |
|
290 | - |
|
291 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
292 | - $new_post = array(); |
|
293 | - $new_post['ID'] = $_REQUEST['pid']; |
|
294 | - |
|
295 | - $lastid = wp_update_post($new_post); |
|
296 | - |
|
297 | - $gd_session->un_set('listing'); |
|
298 | - wp_redirect(get_permalink($lastid)); |
|
299 | - } else { |
|
300 | - $last_id = geodir_save_listing(); |
|
301 | - |
|
302 | - if ($last_id) { |
|
303 | - //$redirect_to = get_permalink( $last_id ); |
|
304 | - $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id)); |
|
305 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
306 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
307 | - $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false); |
|
308 | - } else |
|
309 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
310 | - |
|
311 | - $gd_session->un_set('listing'); |
|
312 | - wp_redirect($redirect_to); |
|
313 | - } |
|
314 | - } else { |
|
315 | - $gd_session->un_set('listing'); |
|
316 | - wp_redirect(home_url()); |
|
317 | - } |
|
318 | - |
|
319 | - break; |
|
320 | - case "delete" : |
|
321 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
322 | - global $current_user; |
|
323 | - |
|
324 | - if (get_option('geodir_disable_perm_delete')) { |
|
325 | - $lastid = wp_trash_post($_REQUEST['pid']); |
|
326 | - } else { |
|
327 | - $lastid = wp_delete_post($_REQUEST['pid']); |
|
328 | - } |
|
329 | - |
|
330 | - if ($lastid && !is_wp_error($lastid)) |
|
331 | - wp_redirect($_SERVER['HTTP_REFERER']); |
|
332 | - |
|
333 | - //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) ); |
|
334 | - } |
|
335 | - break; |
|
336 | - endswitch; |
|
337 | - |
|
338 | - $gd_session->un_set('listing'); |
|
339 | - } else { |
|
340 | - $gd_session->un_set('listing'); |
|
341 | - wp_redirect(geodir_login_url()); |
|
342 | - exit(); |
|
343 | - } |
|
344 | - } |
|
345 | - |
|
346 | - if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') { |
|
347 | - /** |
|
348 | - * Contains registration and login functions. |
|
349 | - * @todo Fix the file path. |
|
350 | - * |
|
351 | - * @since 1.0.0 |
|
352 | - * @package GeoDirectory |
|
353 | - */ |
|
354 | - include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php'); |
|
355 | - } |
|
356 | - |
|
357 | - if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') { |
|
358 | - $args = array('taxonomy' => sanitize_text_field($_REQUEST['term'])); |
|
359 | - if (!empty($_REQUEST['parent_only'])) { |
|
360 | - $args['parent'] = 0; |
|
361 | - } |
|
362 | - $terms_o = get_terms($args); |
|
213 | + if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') { |
|
214 | + /** |
|
215 | + * Contains map marker functions. |
|
216 | + * |
|
217 | + * @since 1.0.0 |
|
218 | + * @package GeoDirectory |
|
219 | + */ |
|
220 | + include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php'); |
|
221 | + } |
|
222 | + |
|
223 | + if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') { |
|
224 | + if (is_user_logged_in()) { |
|
225 | + switch ($_REQUEST['ajax_action']): |
|
226 | + case "add" : |
|
227 | + geodir_add_to_favorite((int)$_REQUEST['pid']); |
|
228 | + break; |
|
229 | + case "remove" : |
|
230 | + geodir_remove_from_favorite((int)$_REQUEST['pid']); |
|
231 | + break; |
|
232 | + endswitch; |
|
233 | + } else { |
|
234 | + wp_redirect(geodir_login_url()); |
|
235 | + exit(); |
|
236 | + } |
|
237 | + } |
|
238 | + |
|
239 | + if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') { |
|
240 | + |
|
241 | + $is_current_user_owner = true; |
|
242 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
243 | + $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']); |
|
244 | + } |
|
245 | + |
|
246 | + $request = $gd_session->get('listing'); |
|
247 | + |
|
248 | + if (is_user_logged_in() && $is_current_user_owner) { |
|
249 | + |
|
250 | + switch ($_REQUEST['ajax_action']): |
|
251 | + case "add": |
|
252 | + case "update": |
|
253 | + |
|
254 | + if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') { |
|
255 | + $last_id = geodir_save_listing(); |
|
256 | + |
|
257 | + if ($last_id) { |
|
258 | + //$redirect_to = get_permalink( $last_id ); |
|
259 | + $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id)); |
|
260 | + |
|
261 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
262 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
263 | + $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false); |
|
264 | + } else |
|
265 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
266 | + |
|
267 | + wp_redirect($redirect_to); |
|
268 | + } else { |
|
269 | + $gd_session->un_set('listing'); |
|
270 | + wp_redirect(home_url()); |
|
271 | + } |
|
272 | + |
|
273 | + break; |
|
274 | + case "cancel" : |
|
275 | + |
|
276 | + $gd_session->un_set('listing'); |
|
277 | + |
|
278 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) |
|
279 | + wp_redirect(get_permalink($_REQUEST['pid'])); |
|
280 | + else { |
|
281 | + geodir_remove_temp_images(); |
|
282 | + wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type']))); |
|
283 | + } |
|
284 | + |
|
285 | + break; |
|
286 | + |
|
287 | + case "publish" : |
|
288 | + |
|
289 | + if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') { |
|
290 | + |
|
291 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
292 | + $new_post = array(); |
|
293 | + $new_post['ID'] = $_REQUEST['pid']; |
|
294 | + |
|
295 | + $lastid = wp_update_post($new_post); |
|
296 | + |
|
297 | + $gd_session->un_set('listing'); |
|
298 | + wp_redirect(get_permalink($lastid)); |
|
299 | + } else { |
|
300 | + $last_id = geodir_save_listing(); |
|
301 | + |
|
302 | + if ($last_id) { |
|
303 | + //$redirect_to = get_permalink( $last_id ); |
|
304 | + $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id)); |
|
305 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
306 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
307 | + $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false); |
|
308 | + } else |
|
309 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
310 | + |
|
311 | + $gd_session->un_set('listing'); |
|
312 | + wp_redirect($redirect_to); |
|
313 | + } |
|
314 | + } else { |
|
315 | + $gd_session->un_set('listing'); |
|
316 | + wp_redirect(home_url()); |
|
317 | + } |
|
318 | + |
|
319 | + break; |
|
320 | + case "delete" : |
|
321 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
322 | + global $current_user; |
|
323 | + |
|
324 | + if (get_option('geodir_disable_perm_delete')) { |
|
325 | + $lastid = wp_trash_post($_REQUEST['pid']); |
|
326 | + } else { |
|
327 | + $lastid = wp_delete_post($_REQUEST['pid']); |
|
328 | + } |
|
329 | + |
|
330 | + if ($lastid && !is_wp_error($lastid)) |
|
331 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
332 | + |
|
333 | + //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) ); |
|
334 | + } |
|
335 | + break; |
|
336 | + endswitch; |
|
337 | + |
|
338 | + $gd_session->un_set('listing'); |
|
339 | + } else { |
|
340 | + $gd_session->un_set('listing'); |
|
341 | + wp_redirect(geodir_login_url()); |
|
342 | + exit(); |
|
343 | + } |
|
344 | + } |
|
345 | + |
|
346 | + if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') { |
|
347 | + /** |
|
348 | + * Contains registration and login functions. |
|
349 | + * @todo Fix the file path. |
|
350 | + * |
|
351 | + * @since 1.0.0 |
|
352 | + * @package GeoDirectory |
|
353 | + */ |
|
354 | + include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php'); |
|
355 | + } |
|
356 | + |
|
357 | + if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') { |
|
358 | + $args = array('taxonomy' => sanitize_text_field($_REQUEST['term'])); |
|
359 | + if (!empty($_REQUEST['parent_only'])) { |
|
360 | + $args['parent'] = 0; |
|
361 | + } |
|
362 | + $terms_o = get_terms($args); |
|
363 | 363 | |
364 | - // Skip terms which has no listing |
|
365 | - if (!empty($terms_o)) { |
|
366 | - $filter_terms = array(); |
|
364 | + // Skip terms which has no listing |
|
365 | + if (!empty($terms_o)) { |
|
366 | + $filter_terms = array(); |
|
367 | 367 | |
368 | - foreach ($terms_o as $term) { |
|
369 | - if (isset($term->count) && $term->count > 0) { |
|
370 | - $filter_terms[] = $term; |
|
371 | - } |
|
372 | - } |
|
373 | - $terms_o = $filter_terms; |
|
374 | - } |
|
368 | + foreach ($terms_o as $term) { |
|
369 | + if (isset($term->count) && $term->count > 0) { |
|
370 | + $filter_terms[] = $term; |
|
371 | + } |
|
372 | + } |
|
373 | + $terms_o = $filter_terms; |
|
374 | + } |
|
375 | 375 | |
376 | - $terms = geodir_sort_terms($terms_o, 'count'); |
|
377 | - geodir_helper_cat_list_output($terms, intval($_REQUEST['limit'])); |
|
378 | - exit(); |
|
379 | - } |
|
376 | + $terms = geodir_sort_terms($terms_o, 'count'); |
|
377 | + geodir_helper_cat_list_output($terms, intval($_REQUEST['limit'])); |
|
378 | + exit(); |
|
379 | + } |
|
380 | 380 | |
381 | - gd_die(); |
|
381 | + gd_die(); |
|
382 | 382 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * Get All Plugin functions from WordPress |
12 | 12 | */ |
13 | -include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
13 | +include_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
14 | 14 | |
15 | 15 | /*-----------------------------------------------------------------------------------*/ |
16 | 16 | /* Helper functions */ |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function geodir_plugin_url() { |
29 | 29 | |
30 | - if ( is_ssl() ) : |
|
31 | - return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) ); |
|
30 | + if (is_ssl()) : |
|
31 | + return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__))); |
|
32 | 32 | else : |
33 | - return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) ); |
|
33 | + return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__))); |
|
34 | 34 | endif; |
35 | 35 | } |
36 | 36 | |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | * @return string example url eg: /home/geo/public_html/wp-content/plugins/geodirectory |
46 | 46 | */ |
47 | 47 | function geodir_plugin_path() { |
48 | - if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) { |
|
49 | - return dirname( dirname( __FILE__ ) ); |
|
48 | + if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) { |
|
49 | + return dirname(dirname(__FILE__)); |
|
50 | 50 | } else { |
51 | - return WP_PLUGIN_DIR . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) ); |
|
51 | + return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__))); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | * @return bool true or false. |
64 | 64 | * @todo check if this is faster than normal WP check and remove if not. |
65 | 65 | */ |
66 | -function geodir_is_plugin_active( $plugin ) { |
|
67 | - $active_plugins = get_option( 'active_plugins' ); |
|
68 | - foreach ( $active_plugins as $key => $active_plugin ) { |
|
69 | - if ( strstr( $active_plugin, $plugin ) ) { |
|
66 | +function geodir_is_plugin_active($plugin) { |
|
67 | + $active_plugins = get_option('active_plugins'); |
|
68 | + foreach ($active_plugins as $key => $active_plugin) { |
|
69 | + if (strstr($active_plugin, $plugin)) { |
|
70 | 70 | return true; |
71 | 71 | } |
72 | 72 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return bool|int|string the formatted date. |
90 | 90 | */ |
91 | -function geodir_get_formated_date( $date ) { |
|
92 | - return mysql2date( get_option( 'date_format' ), $date ); |
|
91 | +function geodir_get_formated_date($date) { |
|
92 | + return mysql2date(get_option('date_format'), $date); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return bool|int|string the formatted time. |
107 | 107 | */ |
108 | -function geodir_get_formated_time( $time ) { |
|
109 | - return mysql2date( get_option( 'time_format' ), $time, $translate = true ); |
|
108 | +function geodir_get_formated_time($time) { |
|
109 | + return mysql2date(get_option('time_format'), $time, $translate = true); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -124,35 +124,35 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return string Formatted link. |
126 | 126 | */ |
127 | -function geodir_getlink( $url, $params = array(), $use_existing_arguments = false ) { |
|
128 | - if ( $use_existing_arguments ) { |
|
127 | +function geodir_getlink($url, $params = array(), $use_existing_arguments = false) { |
|
128 | + if ($use_existing_arguments) { |
|
129 | 129 | $params = $params + $_GET; |
130 | 130 | } |
131 | - if ( ! $params ) { |
|
131 | + if (!$params) { |
|
132 | 132 | return $url; |
133 | 133 | } |
134 | 134 | $link = $url; |
135 | - if ( strpos( $link, '?' ) === false ) { |
|
135 | + if (strpos($link, '?') === false) { |
|
136 | 136 | $link .= '?'; |
137 | 137 | } //If there is no '?' add one at the end |
138 | - elseif ( strpos( $link, '//maps.google.com/maps/api/js?language=' ) ) { |
|
138 | + elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) { |
|
139 | 139 | $link .= '&'; |
140 | 140 | } //If there is no '&' at the END, add one. |
141 | - elseif ( ! preg_match( '/(\?|\&(amp;)?)$/', $link ) ) { |
|
141 | + elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) { |
|
142 | 142 | $link .= '&'; |
143 | 143 | } //If there is no '&' at the END, add one. |
144 | 144 | |
145 | 145 | $params_arr = array(); |
146 | - foreach ( $params as $key => $value ) { |
|
147 | - if ( gettype( $value ) == 'array' ) { //Handle array data properly |
|
148 | - foreach ( $value as $val ) { |
|
149 | - $params_arr[] = $key . '[]=' . urlencode( $val ); |
|
146 | + foreach ($params as $key => $value) { |
|
147 | + if (gettype($value) == 'array') { //Handle array data properly |
|
148 | + foreach ($value as $val) { |
|
149 | + $params_arr[] = $key.'[]='.urlencode($val); |
|
150 | 150 | } |
151 | 151 | } else { |
152 | - $params_arr[] = $key . '=' . urlencode( $value ); |
|
152 | + $params_arr[] = $key.'='.urlencode($value); |
|
153 | 153 | } |
154 | 154 | } |
155 | - $link .= implode( '&', $params_arr ); |
|
155 | + $link .= implode('&', $params_arr); |
|
156 | 156 | |
157 | 157 | return $link; |
158 | 158 | } |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return string Listing page url if valid. Otherwise home url will be returned. |
171 | 171 | */ |
172 | -function geodir_get_addlisting_link( $post_type = '' ) { |
|
172 | +function geodir_get_addlisting_link($post_type = '') { |
|
173 | 173 | global $wpdb; |
174 | 174 | |
175 | 175 | //$check_pkg = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'"); |
176 | 176 | $check_pkg = 1; |
177 | - if ( post_type_exists( $post_type ) && $check_pkg ) { |
|
177 | + if (post_type_exists($post_type) && $check_pkg) { |
|
178 | 178 | |
179 | - $add_listing_link = get_page_link( geodir_add_listing_page_id() ); |
|
179 | + $add_listing_link = get_page_link(geodir_add_listing_page_id()); |
|
180 | 180 | |
181 | - return esc_url( add_query_arg( array( 'listing_type' => $post_type ), $add_listing_link ) ); |
|
181 | + return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link)); |
|
182 | 182 | } else { |
183 | - return get_bloginfo( 'url' ); |
|
183 | + return get_bloginfo('url'); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | */ |
195 | 195 | function geodir_curPageURL() { |
196 | 196 | $pageURL = 'http'; |
197 | - if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) { |
|
197 | + if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { |
|
198 | 198 | $pageURL .= "s"; |
199 | 199 | } |
200 | 200 | $pageURL .= "://"; |
201 | - $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; |
|
201 | + $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Filter the current page URL returned by function geodir_curPageURL(). |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @param string $pageURL The URL of the current page. |
209 | 209 | */ |
210 | - return apply_filters( 'geodir_curPageURL', $pageURL ); |
|
210 | + return apply_filters('geodir_curPageURL', $pageURL); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return string Cleaned variable. |
225 | 225 | */ |
226 | -function geodir_clean( $string ) { |
|
226 | +function geodir_clean($string) { |
|
227 | 227 | |
228 | - $string = trim( strip_tags( stripslashes( $string ) ) ); |
|
229 | - $string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens. |
|
230 | - $string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars. |
|
231 | - $string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one. |
|
228 | + $string = trim(strip_tags(stripslashes($string))); |
|
229 | + $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens. |
|
230 | + $string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars. |
|
231 | + $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one. |
|
232 | 232 | |
233 | 233 | return $string; |
234 | 234 | } |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | */ |
243 | 243 | function geodir_get_weekday() { |
244 | 244 | return array( |
245 | - __( 'Sunday', 'geodirectory' ), |
|
246 | - __( 'Monday', 'geodirectory' ), |
|
247 | - __( 'Tuesday', 'geodirectory' ), |
|
248 | - __( 'Wednesday', 'geodirectory' ), |
|
249 | - __( 'Thursday', 'geodirectory' ), |
|
250 | - __( 'Friday', 'geodirectory' ), |
|
251 | - __( 'Saturday', 'geodirectory' ) |
|
245 | + __('Sunday', 'geodirectory'), |
|
246 | + __('Monday', 'geodirectory'), |
|
247 | + __('Tuesday', 'geodirectory'), |
|
248 | + __('Wednesday', 'geodirectory'), |
|
249 | + __('Thursday', 'geodirectory'), |
|
250 | + __('Friday', 'geodirectory'), |
|
251 | + __('Saturday', 'geodirectory') |
|
252 | 252 | ); |
253 | 253 | } |
254 | 254 | |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | */ |
262 | 262 | function geodir_get_weeks() { |
263 | 263 | return array( |
264 | - __( 'First', 'geodirectory' ), |
|
265 | - __( 'Second', 'geodirectory' ), |
|
266 | - __( 'Third', 'geodirectory' ), |
|
267 | - __( 'Fourth', 'geodirectory' ), |
|
268 | - __( 'Last', 'geodirectory' ) |
|
264 | + __('First', 'geodirectory'), |
|
265 | + __('Second', 'geodirectory'), |
|
266 | + __('Third', 'geodirectory'), |
|
267 | + __('Fourth', 'geodirectory'), |
|
268 | + __('Last', 'geodirectory') |
|
269 | 269 | ); |
270 | 270 | } |
271 | 271 | |
@@ -284,112 +284,112 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return bool If valid returns true. Otherwise false. |
286 | 286 | */ |
287 | -function geodir_is_page( $gdpage = '' ) { |
|
287 | +function geodir_is_page($gdpage = '') { |
|
288 | 288 | |
289 | 289 | global $wp_query, $post, $wp; |
290 | 290 | //if(!is_admin()): |
291 | 291 | |
292 | - switch ( $gdpage ): |
|
292 | + switch ($gdpage): |
|
293 | 293 | case 'add-listing': |
294 | 294 | |
295 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) { |
|
295 | + if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) { |
|
296 | 296 | return true; |
297 | - } elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) { |
|
297 | + } elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) { |
|
298 | 298 | return true; |
299 | 299 | } |
300 | 300 | |
301 | 301 | break; |
302 | 302 | case 'preview': |
303 | - if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] ) |
|
304 | - && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() ) |
|
303 | + if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type']) |
|
304 | + && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
|
305 | 305 | ) { |
306 | 306 | return true; |
307 | 307 | } |
308 | 308 | break; |
309 | 309 | case 'listing-success': |
310 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) { |
|
310 | + if (is_page() && get_query_var('page_id') == geodir_success_page_id()) { |
|
311 | 311 | return true; |
312 | 312 | } |
313 | 313 | break; |
314 | 314 | case 'detail': |
315 | - $post_type = get_query_var( 'post_type' ); |
|
316 | - if ( is_array( $post_type ) ) { |
|
317 | - $post_type = reset( $post_type ); |
|
315 | + $post_type = get_query_var('post_type'); |
|
316 | + if (is_array($post_type)) { |
|
317 | + $post_type = reset($post_type); |
|
318 | 318 | } |
319 | - if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) { |
|
319 | + if (is_single() && in_array($post_type, geodir_get_posttypes())) { |
|
320 | 320 | return true; |
321 | 321 | } |
322 | 322 | break; |
323 | 323 | case 'pt': |
324 | - $post_type = get_query_var( 'post_type' ); |
|
325 | - if ( is_array( $post_type ) ) { |
|
326 | - $post_type = reset( $post_type ); |
|
324 | + $post_type = get_query_var('post_type'); |
|
325 | + if (is_array($post_type)) { |
|
326 | + $post_type = reset($post_type); |
|
327 | 327 | } |
328 | - if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) { |
|
328 | + if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) { |
|
329 | 329 | return true; |
330 | 330 | } |
331 | 331 | |
332 | 332 | break; |
333 | 333 | case 'listing': |
334 | - if ( is_tax() && geodir_get_taxonomy_posttype() ) { |
|
334 | + if (is_tax() && geodir_get_taxonomy_posttype()) { |
|
335 | 335 | global $current_term, $taxonomy, $term; |
336 | 336 | |
337 | 337 | return true; |
338 | 338 | } |
339 | - $post_type = get_query_var( 'post_type' ); |
|
340 | - if ( is_array( $post_type ) ) { |
|
341 | - $post_type = reset( $post_type ); |
|
339 | + $post_type = get_query_var('post_type'); |
|
340 | + if (is_array($post_type)) { |
|
341 | + $post_type = reset($post_type); |
|
342 | 342 | } |
343 | - if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) { |
|
343 | + if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) { |
|
344 | 344 | return true; |
345 | 345 | } |
346 | 346 | |
347 | 347 | break; |
348 | 348 | case 'home': |
349 | 349 | |
350 | - if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) { |
|
350 | + if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) { |
|
351 | 351 | return true; |
352 | 352 | } |
353 | 353 | |
354 | 354 | break; |
355 | 355 | case 'location': |
356 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) { |
|
356 | + if (is_page() && get_query_var('page_id') == geodir_location_page_id()) { |
|
357 | 357 | return true; |
358 | 358 | } |
359 | 359 | break; |
360 | 360 | case 'author': |
361 | - if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
361 | + if (is_author() && isset($_REQUEST['geodir_dashbord'])) { |
|
362 | 362 | return true; |
363 | 363 | } |
364 | 364 | |
365 | - if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) { |
|
366 | - if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) { |
|
365 | + if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) { |
|
366 | + if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) { |
|
367 | 367 | return true; |
368 | 368 | } |
369 | 369 | } |
370 | 370 | break; |
371 | 371 | case 'search': |
372 | - if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) { |
|
372 | + if (is_search() && isset($_REQUEST['geodir_search'])) { |
|
373 | 373 | return true; |
374 | 374 | } |
375 | 375 | break; |
376 | 376 | case 'info': |
377 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) { |
|
377 | + if (is_page() && get_query_var('page_id') == geodir_info_page_id()) { |
|
378 | 378 | return true; |
379 | 379 | } |
380 | 380 | break; |
381 | 381 | case 'login': |
382 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) { |
|
382 | + if (is_page() && get_query_var('page_id') == geodir_login_page_id()) { |
|
383 | 383 | return true; |
384 | 384 | } |
385 | 385 | break; |
386 | 386 | case 'checkout': |
387 | - if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) { |
|
387 | + if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) { |
|
388 | 388 | return true; |
389 | 389 | } |
390 | 390 | break; |
391 | 391 | case 'invoices': |
392 | - if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) { |
|
392 | + if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) { |
|
393 | 393 | return true; |
394 | 394 | } |
395 | 395 | break; |
@@ -414,28 +414,28 @@ discard block |
||
414 | 414 | * |
415 | 415 | * @param object $wp WordPress object. |
416 | 416 | */ |
417 | -function geodir_set_is_geodir_page( $wp ) { |
|
418 | - if ( ! is_admin() ) { |
|
417 | +function geodir_set_is_geodir_page($wp) { |
|
418 | + if (!is_admin()) { |
|
419 | 419 | //$wp->query_vars['gd_is_geodir_page'] = false; |
420 | 420 | //print_r() |
421 | - if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array( |
|
421 | + if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array( |
|
422 | 422 | 'preview', |
423 | 423 | 'page', |
424 | 424 | 'paged', |
425 | 425 | 'cpage' |
426 | - ) ) |
|
426 | + )) |
|
427 | 427 | ) { |
428 | - if ( get_option( 'geodir_set_as_home' ) ) { |
|
428 | + if (get_option('geodir_set_as_home')) { |
|
429 | 429 | $wp->query_vars['gd_is_geodir_page'] = true; |
430 | 430 | } |
431 | - if ( geodir_is_page( 'home' ) ) { |
|
431 | + if (geodir_is_page('home')) { |
|
432 | 432 | $wp->query_vars['gd_is_geodir_page'] = true; |
433 | 433 | } |
434 | 434 | |
435 | 435 | |
436 | 436 | } |
437 | 437 | |
438 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) { |
|
438 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) { |
|
439 | 439 | if ( |
440 | 440 | $wp->query_vars['page_id'] == geodir_add_listing_page_id() |
441 | 441 | || $wp->query_vars['page_id'] == geodir_preview_page_id() |
@@ -444,26 +444,26 @@ discard block |
||
444 | 444 | || $wp->query_vars['page_id'] == geodir_home_page_id() |
445 | 445 | || $wp->query_vars['page_id'] == geodir_info_page_id() |
446 | 446 | || $wp->query_vars['page_id'] == geodir_login_page_id() |
447 | - || ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() ) |
|
448 | - || ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() ) |
|
447 | + || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id()) |
|
448 | + || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id()) |
|
449 | 449 | ) { |
450 | 450 | $wp->query_vars['gd_is_geodir_page'] = true; |
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) { |
|
455 | - $page = get_page_by_path( $wp->query_vars['pagename'] ); |
|
454 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) { |
|
455 | + $page = get_page_by_path($wp->query_vars['pagename']); |
|
456 | 456 | |
457 | - if ( ! empty( $page ) && ( |
|
457 | + if (!empty($page) && ( |
|
458 | 458 | $page->ID == geodir_add_listing_page_id() |
459 | 459 | || $page->ID == geodir_preview_page_id() |
460 | 460 | || $page->ID == geodir_success_page_id() |
461 | 461 | || $page->ID == geodir_location_page_id() |
462 | - || ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() ) |
|
463 | - || ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() ) |
|
464 | - || ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() ) |
|
465 | - || ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() ) |
|
466 | - || ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() ) |
|
462 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id()) |
|
463 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id()) |
|
464 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id()) |
|
465 | + || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id()) |
|
466 | + || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id()) |
|
467 | 467 | ) |
468 | 468 | ) { |
469 | 469 | $wp->query_vars['gd_is_geodir_page'] = true; |
@@ -471,20 +471,20 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | |
474 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) { |
|
474 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') { |
|
475 | 475 | $requested_post_type = $wp->query_vars['post_type']; |
476 | 476 | // check if this post type is geodirectory post types |
477 | 477 | $post_type_array = geodir_get_posttypes(); |
478 | - if ( in_array( $requested_post_type, $post_type_array ) ) { |
|
478 | + if (in_array($requested_post_type, $post_type_array)) { |
|
479 | 479 | $wp->query_vars['gd_is_geodir_page'] = true; |
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) { |
|
484 | - $geodir_taxonomis = geodir_get_taxonomies( '', true ); |
|
485 | - if ( ! empty( $geodir_taxonomis ) ) { |
|
486 | - foreach ( $geodir_taxonomis as $taxonomy ) { |
|
487 | - if ( array_key_exists( $taxonomy, $wp->query_vars ) ) { |
|
483 | + if (!isset($wp->query_vars['gd_is_geodir_page'])) { |
|
484 | + $geodir_taxonomis = geodir_get_taxonomies('', true); |
|
485 | + if (!empty($geodir_taxonomis)) { |
|
486 | + foreach ($geodir_taxonomis as $taxonomy) { |
|
487 | + if (array_key_exists($taxonomy, $wp->query_vars)) { |
|
488 | 488 | $wp->query_vars['gd_is_geodir_page'] = true; |
489 | 489 | break; |
490 | 490 | } |
@@ -493,20 +493,20 @@ discard block |
||
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
496 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) { |
|
497 | 497 | $wp->query_vars['gd_is_geodir_page'] = true; |
498 | 498 | } |
499 | 499 | |
500 | 500 | |
501 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) { |
|
501 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) { |
|
502 | 502 | $wp->query_vars['gd_is_geodir_page'] = true; |
503 | 503 | } |
504 | 504 | |
505 | 505 | |
506 | 506 | //check if homepage |
507 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) |
|
508 | - && ! isset( $wp->query_vars['page_id'] ) |
|
509 | - && ! isset( $wp->query_vars['pagename'] ) |
|
507 | + if (!isset($wp->query_vars['gd_is_geodir_page']) |
|
508 | + && !isset($wp->query_vars['page_id']) |
|
509 | + && !isset($wp->query_vars['pagename']) |
|
510 | 510 | && is_page_geodir_home() |
511 | 511 | ) { |
512 | 512 | $wp->query_vars['gd_is_geodir_page'] = true; |
@@ -530,14 +530,14 @@ discard block |
||
530 | 530 | */ |
531 | 531 | function geodir_is_geodir_page() { |
532 | 532 | global $wp; |
533 | - if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) { |
|
533 | + if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) { |
|
534 | 534 | return true; |
535 | 535 | } else { |
536 | 536 | return false; |
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
540 | -if ( ! function_exists( 'geodir_get_imagesize' ) ) { |
|
540 | +if (!function_exists('geodir_get_imagesize')) { |
|
541 | 541 | /** |
542 | 542 | * Get image size using the size key . |
543 | 543 | * |
@@ -548,13 +548,13 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @return array|mixed|void|WP_Error If valid returns image size. Else returns error. |
550 | 550 | */ |
551 | - function geodir_get_imagesize( $size = '' ) { |
|
551 | + function geodir_get_imagesize($size = '') { |
|
552 | 552 | |
553 | 553 | $imagesizes = array( |
554 | - 'list-thumb' => array( 'w' => 283, 'h' => 188 ), |
|
555 | - 'thumbnail' => array( 'w' => 125, 'h' => 125 ), |
|
556 | - 'widget-thumb' => array( 'w' => 50, 'h' => 50 ), |
|
557 | - 'slider-thumb' => array( 'w' => 100, 'h' => 100 ) |
|
554 | + 'list-thumb' => array('w' => 283, 'h' => 188), |
|
555 | + 'thumbnail' => array('w' => 125, 'h' => 125), |
|
556 | + 'widget-thumb' => array('w' => 50, 'h' => 50), |
|
557 | + 'slider-thumb' => array('w' => 100, 'h' => 100) |
|
558 | 558 | ); |
559 | 559 | |
560 | 560 | /** |
@@ -564,9 +564,9 @@ discard block |
||
564 | 564 | * |
565 | 565 | * @param array $imagesizes Image size array. |
566 | 566 | */ |
567 | - $imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes ); |
|
567 | + $imagesizes = apply_filters('geodir_imagesizes', $imagesizes); |
|
568 | 568 | |
569 | - if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) { |
|
569 | + if (!empty($size) && array_key_exists($size, $imagesizes)) { |
|
570 | 570 | /** |
571 | 571 | * Filters image size of the passed key. |
572 | 572 | * |
@@ -574,11 +574,11 @@ discard block |
||
574 | 574 | * |
575 | 575 | * @param array $imagesizes [$size] Image size array of the passed key. |
576 | 576 | */ |
577 | - return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] ); |
|
577 | + return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]); |
|
578 | 578 | |
579 | - } elseif ( ! empty( $size ) ) { |
|
579 | + } elseif (!empty($size)) { |
|
580 | 580 | |
581 | - return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) ); |
|
581 | + return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory')); |
|
582 | 582 | |
583 | 583 | } |
584 | 584 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | */ |
603 | 603 | |
604 | 604 | |
605 | -if ( ! function_exists( 'createRandomString' ) ) { |
|
605 | +if (!function_exists('createRandomString')) { |
|
606 | 606 | /** |
607 | 607 | * Creates random string. |
608 | 608 | * |
@@ -612,21 +612,21 @@ discard block |
||
612 | 612 | */ |
613 | 613 | function createRandomString() { |
614 | 614 | $chars = "abcdefghijkmlnopqrstuvwxyz1023456789"; |
615 | - srand( (double) microtime() * 1000000 ); |
|
615 | + srand((double) microtime() * 1000000); |
|
616 | 616 | $i = 0; |
617 | 617 | $rstring = ''; |
618 | - while ( $i <= 25 ) { |
|
618 | + while ($i <= 25) { |
|
619 | 619 | $num = rand() % 33; |
620 | - $tmp = substr( $chars, $num, 1 ); |
|
621 | - $rstring = $rstring . $tmp; |
|
622 | - $i ++; |
|
620 | + $tmp = substr($chars, $num, 1); |
|
621 | + $rstring = $rstring.$tmp; |
|
622 | + $i++; |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | return $rstring; |
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | -if ( ! function_exists( 'geodir_getDistanceRadius' ) ) { |
|
629 | +if (!function_exists('geodir_getDistanceRadius')) { |
|
630 | 630 | /** |
631 | 631 | * Calculates the distance radius. |
632 | 632 | * |
@@ -637,9 +637,9 @@ discard block |
||
637 | 637 | * |
638 | 638 | * @return float The mean radius. |
639 | 639 | */ |
640 | - function geodir_getDistanceRadius( $uom = 'km' ) { |
|
640 | + function geodir_getDistanceRadius($uom = 'km') { |
|
641 | 641 | // Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude |
642 | - switch ( geodir_strtolower( $uom ) ): |
|
642 | + switch (geodir_strtolower($uom)): |
|
643 | 643 | case 'km' : |
644 | 644 | $earthMeanRadius = 6371.009; // km |
645 | 645 | break; |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | |
674 | -if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) { |
|
674 | +if (!function_exists('geodir_calculateDistanceFromLatLong')) { |
|
675 | 675 | /** |
676 | 676 | * Calculate the great circle distance between two points identified by longitude and latitude. |
677 | 677 | * |
@@ -684,17 +684,17 @@ discard block |
||
684 | 684 | * |
685 | 685 | * @return float The distance. |
686 | 686 | */ |
687 | - function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) { |
|
687 | + function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') { |
|
688 | 688 | // Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude |
689 | 689 | |
690 | - $earthMeanRadius = geodir_getDistanceRadius( $uom ); |
|
690 | + $earthMeanRadius = geodir_getDistanceRadius($uom); |
|
691 | 691 | |
692 | - $deltaLatitude = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] ); |
|
693 | - $deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] ); |
|
694 | - $a = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) + |
|
695 | - cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) * |
|
696 | - sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 ); |
|
697 | - $c = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) ); |
|
692 | + $deltaLatitude = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']); |
|
693 | + $deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']); |
|
694 | + $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) + |
|
695 | + cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) * |
|
696 | + sin($deltaLongitude / 2) * sin($deltaLongitude / 2); |
|
697 | + $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); |
|
698 | 698 | $distance = $earthMeanRadius * $c; |
699 | 699 | |
700 | 700 | return $distance; |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | } |
704 | 704 | |
705 | 705 | |
706 | -if ( ! function_exists( 'geodir_sendEmail' ) ) { |
|
706 | +if (!function_exists('geodir_sendEmail')) { |
|
707 | 707 | /** |
708 | 708 | * The main function that send transactional emails using the args provided. |
709 | 709 | * |
@@ -722,83 +722,83 @@ discard block |
||
722 | 722 | * @param string $post_id The post ID. |
723 | 723 | * @param string $user_id The user ID. |
724 | 724 | */ |
725 | - function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) { |
|
725 | + function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') { |
|
726 | 726 | $login_details = ''; |
727 | 727 | |
728 | 728 | // strip slashes from subject & message text |
729 | - $to_subject = stripslashes_deep( $to_subject ); |
|
730 | - $to_message = stripslashes_deep( $to_message ); |
|
731 | - |
|
732 | - if ( $message_type == 'send_friend' ) { |
|
733 | - $subject = get_option( 'geodir_email_friend_subject' ); |
|
734 | - $message = get_option( 'geodir_email_friend_content' ); |
|
735 | - } elseif ( $message_type == 'send_enquiry' ) { |
|
736 | - $subject = get_option( 'geodir_email_enquiry_subject' ); |
|
737 | - $message = get_option( 'geodir_email_enquiry_content' ); |
|
738 | - } elseif ( $message_type == 'forgot_password' ) { |
|
739 | - $subject = get_option( 'geodir_forgot_password_subject' ); |
|
740 | - $message = get_option( 'geodir_forgot_password_content' ); |
|
729 | + $to_subject = stripslashes_deep($to_subject); |
|
730 | + $to_message = stripslashes_deep($to_message); |
|
731 | + |
|
732 | + if ($message_type == 'send_friend') { |
|
733 | + $subject = get_option('geodir_email_friend_subject'); |
|
734 | + $message = get_option('geodir_email_friend_content'); |
|
735 | + } elseif ($message_type == 'send_enquiry') { |
|
736 | + $subject = get_option('geodir_email_enquiry_subject'); |
|
737 | + $message = get_option('geodir_email_enquiry_content'); |
|
738 | + } elseif ($message_type == 'forgot_password') { |
|
739 | + $subject = get_option('geodir_forgot_password_subject'); |
|
740 | + $message = get_option('geodir_forgot_password_content'); |
|
741 | 741 | $login_details = $to_message; |
742 | - } elseif ( $message_type == 'registration' ) { |
|
743 | - $subject = get_option( 'geodir_registration_success_email_subject' ); |
|
744 | - $message = get_option( 'geodir_registration_success_email_content' ); |
|
742 | + } elseif ($message_type == 'registration') { |
|
743 | + $subject = get_option('geodir_registration_success_email_subject'); |
|
744 | + $message = get_option('geodir_registration_success_email_content'); |
|
745 | 745 | $login_details = $to_message; |
746 | - } elseif ( $message_type == 'post_submit' ) { |
|
747 | - $subject = get_option( 'geodir_post_submited_success_email_subject' ); |
|
748 | - $message = get_option( 'geodir_post_submited_success_email_content' ); |
|
749 | - } elseif ( $message_type == 'listing_published' ) { |
|
750 | - $subject = get_option( 'geodir_post_published_email_subject' ); |
|
751 | - $message = get_option( 'geodir_post_published_email_content' ); |
|
752 | - } elseif ( $message_type == 'listing_edited' ) { |
|
753 | - $subject = get_option( 'geodir_post_edited_email_subject_admin' ); |
|
754 | - $message = get_option( 'geodir_post_edited_email_content_admin' ); |
|
746 | + } elseif ($message_type == 'post_submit') { |
|
747 | + $subject = get_option('geodir_post_submited_success_email_subject'); |
|
748 | + $message = get_option('geodir_post_submited_success_email_content'); |
|
749 | + } elseif ($message_type == 'listing_published') { |
|
750 | + $subject = get_option('geodir_post_published_email_subject'); |
|
751 | + $message = get_option('geodir_post_published_email_content'); |
|
752 | + } elseif ($message_type == 'listing_edited') { |
|
753 | + $subject = get_option('geodir_post_edited_email_subject_admin'); |
|
754 | + $message = get_option('geodir_post_edited_email_content_admin'); |
|
755 | 755 | } |
756 | 756 | |
757 | - if ( ! empty( $subject ) ) { |
|
758 | - $subject = __( stripslashes_deep( $subject ), 'geodirectory' ); |
|
757 | + if (!empty($subject)) { |
|
758 | + $subject = __(stripslashes_deep($subject), 'geodirectory'); |
|
759 | 759 | } |
760 | 760 | |
761 | - if ( ! empty( $message ) ) { |
|
762 | - $message = __( stripslashes_deep( $message ), 'geodirectory' ); |
|
761 | + if (!empty($message)) { |
|
762 | + $message = __(stripslashes_deep($message), 'geodirectory'); |
|
763 | 763 | } |
764 | 764 | |
765 | - $to_message = nl2br( $to_message ); |
|
766 | - $sitefromEmail = get_option( 'site_email' ); |
|
765 | + $to_message = nl2br($to_message); |
|
766 | + $sitefromEmail = get_option('site_email'); |
|
767 | 767 | $sitefromEmailName = get_site_emailName(); |
768 | - $productlink = get_permalink( $post_id ); |
|
768 | + $productlink = get_permalink($post_id); |
|
769 | 769 | |
770 | 770 | $user_login = ''; |
771 | - if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) { |
|
771 | + if ($user_id > 0 && $user_info = get_userdata($user_id)) { |
|
772 | 772 | $user_login = $user_info->user_login; |
773 | 773 | } |
774 | 774 | |
775 | 775 | $posted_date = ''; |
776 | 776 | $listingLink = ''; |
777 | 777 | |
778 | - $post_info = get_post( $post_id ); |
|
778 | + $post_info = get_post($post_id); |
|
779 | 779 | |
780 | - if ( $post_info ) { |
|
780 | + if ($post_info) { |
|
781 | 781 | $posted_date = $post_info->post_date; |
782 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
782 | + $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>'; |
|
783 | 783 | } |
784 | 784 | $siteurl = home_url(); |
785 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
785 | + $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>'; |
|
786 | 786 | $loginurl = geodir_login_url(); |
787 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
787 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
788 | 788 | |
789 | - $post_author_id = ! empty( $post_info ) ? $post_info->post_author : 0; |
|
790 | - $post_author_name = geodir_get_client_name( $post_author_id ); |
|
791 | - $current_date = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) ); |
|
789 | + $post_author_id = !empty($post_info) ? $post_info->post_author : 0; |
|
790 | + $post_author_name = geodir_get_client_name($post_author_id); |
|
791 | + $current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp')); |
|
792 | 792 | |
793 | - if ( $fromEmail == '' ) { |
|
794 | - $fromEmail = get_option( 'site_email' ); |
|
793 | + if ($fromEmail == '') { |
|
794 | + $fromEmail = get_option('site_email'); |
|
795 | 795 | } |
796 | 796 | |
797 | - if ( $fromEmailName == '' ) { |
|
798 | - $fromEmailName = get_option( 'site_email_name' ); |
|
797 | + if ($fromEmailName == '') { |
|
798 | + $fromEmailName = get_option('site_email_name'); |
|
799 | 799 | } |
800 | 800 | |
801 | - $search_array = array( |
|
801 | + $search_array = array( |
|
802 | 802 | '[#listing_link#]', |
803 | 803 | '[#site_name_url#]', |
804 | 804 | '[#post_id#]', |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | $post_author_name, |
839 | 839 | $current_date |
840 | 840 | ); |
841 | - $message = str_replace( $search_array, $replace_array, $message ); |
|
841 | + $message = str_replace($search_array, $replace_array, $message); |
|
842 | 842 | |
843 | 843 | $search_array = array( |
844 | 844 | '[#listing_link#]', |
@@ -874,12 +874,12 @@ discard block |
||
874 | 874 | $post_author_name, |
875 | 875 | $current_date |
876 | 876 | ); |
877 | - $subject = str_replace( $search_array, $replace_array, $subject ); |
|
877 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
878 | 878 | |
879 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
880 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
881 | - $headers .= "Reply-To: " . $fromEmail . "\r\n"; |
|
882 | - $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n"; |
|
879 | + $headers = 'MIME-Version: 1.0'."\r\n"; |
|
880 | + $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
881 | + $headers .= "Reply-To: ".$fromEmail."\r\n"; |
|
882 | + $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n"; |
|
883 | 883 | |
884 | 884 | $to = $toEmail; |
885 | 885 | |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * @param string $post_id The post ID. |
902 | 902 | * @param string $user_id The user ID. |
903 | 903 | */ |
904 | - $to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ); |
|
904 | + $to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id); |
|
905 | 905 | /** |
906 | 906 | * Filter the client email subject. |
907 | 907 | * |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | * @param string $post_id The post ID. |
921 | 921 | * @param string $user_id The user ID. |
922 | 922 | */ |
923 | - $subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ); |
|
923 | + $subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id); |
|
924 | 924 | /** |
925 | 925 | * Filter the client email message. |
926 | 926 | * |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | * @param string $post_id The post ID. |
940 | 940 | * @param string $user_id The user ID. |
941 | 941 | */ |
942 | - $message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ); |
|
942 | + $message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id); |
|
943 | 943 | /** |
944 | 944 | * Filter the client email headers. |
945 | 945 | * |
@@ -958,39 +958,39 @@ discard block |
||
958 | 958 | * @param string $post_id The post ID. |
959 | 959 | * @param string $user_id The user ID. |
960 | 960 | */ |
961 | - $headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ); |
|
961 | + $headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id); |
|
962 | 962 | |
963 | - $sent = wp_mail( $to, $subject, $message, $headers ); |
|
963 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
964 | 964 | |
965 | - if ( ! $sent ) { |
|
966 | - if ( is_array( $to ) ) { |
|
967 | - $to = implode( ',', $to ); |
|
965 | + if (!$sent) { |
|
966 | + if (is_array($to)) { |
|
967 | + $to = implode(',', $to); |
|
968 | 968 | } |
969 | 969 | $log_message = sprintf( |
970 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
970 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'), |
|
971 | 971 | $message_type, |
972 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
972 | + date_i18n('F j Y H:i:s', current_time('timestamp')), |
|
973 | 973 | $to, |
974 | 974 | $subject |
975 | 975 | ); |
976 | - geodir_error_log( $log_message ); |
|
976 | + geodir_error_log($log_message); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | ///////// ADMIN BCC EMIALS |
980 | - $adminEmail = get_bloginfo( 'admin_email' ); |
|
980 | + $adminEmail = get_bloginfo('admin_email'); |
|
981 | 981 | $to = $adminEmail; |
982 | 982 | |
983 | 983 | $admin_bcc = false; |
984 | - if ( $message_type == 'registration' ) { |
|
985 | - $message_raw = explode( __( "Password:", 'geodirectory' ), $message ); |
|
986 | - $message_raw2 = explode( "</p>", $message_raw[1], 2 ); |
|
987 | - $message = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1]; |
|
984 | + if ($message_type == 'registration') { |
|
985 | + $message_raw = explode(__("Password:", 'geodirectory'), $message); |
|
986 | + $message_raw2 = explode("</p>", $message_raw[1], 2); |
|
987 | + $message = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1]; |
|
988 | 988 | } |
989 | - if ( $message_type == 'post_submit' ) { |
|
990 | - $subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' ); |
|
991 | - $message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' ); |
|
989 | + if ($message_type == 'post_submit') { |
|
990 | + $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory'); |
|
991 | + $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory'); |
|
992 | 992 | |
993 | - $search_array = array( |
|
993 | + $search_array = array( |
|
994 | 994 | '[#listing_link#]', |
995 | 995 | '[#site_name_url#]', |
996 | 996 | '[#post_id#]', |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | $user_login, |
1023 | 1023 | $user_login |
1024 | 1024 | ); |
1025 | - $message = str_replace( $search_array, $replace_array, $message ); |
|
1025 | + $message = str_replace($search_array, $replace_array, $message); |
|
1026 | 1026 | |
1027 | 1027 | $search_array = array( |
1028 | 1028 | '[#listing_link#]', |
@@ -1050,40 +1050,40 @@ discard block |
||
1050 | 1050 | $user_login, |
1051 | 1051 | $user_login |
1052 | 1052 | ); |
1053 | - $subject = str_replace( $search_array, $replace_array, $subject ); |
|
1053 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
1054 | 1054 | |
1055 | 1055 | $subject .= ' - ADMIN BCC COPY'; |
1056 | 1056 | $admin_bcc = true; |
1057 | 1057 | |
1058 | - } elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) { |
|
1058 | + } elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) { |
|
1059 | 1059 | $subject .= ' - ADMIN BCC COPY'; |
1060 | 1060 | $admin_bcc = true; |
1061 | - } elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) { |
|
1061 | + } elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) { |
|
1062 | 1062 | $subject .= ' - ADMIN BCC COPY'; |
1063 | 1063 | $admin_bcc = true; |
1064 | - } elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) { |
|
1064 | + } elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) { |
|
1065 | 1065 | $subject .= ' - ADMIN BCC COPY'; |
1066 | 1066 | $admin_bcc = true; |
1067 | - } elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) { |
|
1067 | + } elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) { |
|
1068 | 1068 | $subject .= ' - ADMIN BCC COPY'; |
1069 | 1069 | $admin_bcc = true; |
1070 | 1070 | } |
1071 | 1071 | |
1072 | - if ( $admin_bcc === true ) { |
|
1073 | - $sent = wp_mail( $to, $subject, $message, $headers ); |
|
1072 | + if ($admin_bcc === true) { |
|
1073 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
1074 | 1074 | |
1075 | - if ( ! $sent ) { |
|
1076 | - if ( is_array( $to ) ) { |
|
1077 | - $to = implode( ',', $to ); |
|
1075 | + if (!$sent) { |
|
1076 | + if (is_array($to)) { |
|
1077 | + $to = implode(',', $to); |
|
1078 | 1078 | } |
1079 | 1079 | $log_message = sprintf( |
1080 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1080 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'), |
|
1081 | 1081 | $message_type, |
1082 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1082 | + date_i18n('F j Y H:i:s', current_time('timestamp')), |
|
1083 | 1083 | $to, |
1084 | 1084 | $subject |
1085 | 1085 | ); |
1086 | - geodir_error_log( $log_message ); |
|
1086 | + geodir_error_log($log_message); |
|
1087 | 1087 | } |
1088 | 1088 | } |
1089 | 1089 | |
@@ -1099,27 +1099,27 @@ discard block |
||
1099 | 1099 | */ |
1100 | 1100 | function geodir_taxonomy_breadcrumb() { |
1101 | 1101 | |
1102 | - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
1102 | + $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
|
1103 | 1103 | $parent = $term->parent; |
1104 | 1104 | |
1105 | - while ( $parent ): |
|
1105 | + while ($parent): |
|
1106 | 1106 | $parents[] = $parent; |
1107 | - $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) ); |
|
1107 | + $new_parent = get_term_by('id', $parent, get_query_var('taxonomy')); |
|
1108 | 1108 | $parent = $new_parent->parent; |
1109 | 1109 | endwhile; |
1110 | 1110 | |
1111 | - if ( ! empty( $parents ) ): |
|
1112 | - $parents = array_reverse( $parents ); |
|
1111 | + if (!empty($parents)): |
|
1112 | + $parents = array_reverse($parents); |
|
1113 | 1113 | |
1114 | - foreach ( $parents as $parent ): |
|
1115 | - $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) ); |
|
1116 | - $url = get_term_link( $item, get_query_var( 'taxonomy' ) ); |
|
1117 | - echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>'; |
|
1114 | + foreach ($parents as $parent): |
|
1115 | + $item = get_term_by('id', $parent, get_query_var('taxonomy')); |
|
1116 | + $url = get_term_link($item, get_query_var('taxonomy')); |
|
1117 | + echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>'; |
|
1118 | 1118 | endforeach; |
1119 | 1119 | |
1120 | 1120 | endif; |
1121 | 1121 | |
1122 | - echo '<li> > ' . $term->name . '</li>'; |
|
1122 | + echo '<li> > '.$term->name.'</li>'; |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | |
@@ -1141,9 +1141,9 @@ discard block |
||
1141 | 1141 | * |
1142 | 1142 | * @since 1.0.0 |
1143 | 1143 | */ |
1144 | - $separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' ); |
|
1144 | + $separator = apply_filters('geodir_breadcrumb_separator', ' > '); |
|
1145 | 1145 | |
1146 | - if ( ! geodir_is_page( 'home' ) ) { |
|
1146 | + if (!geodir_is_page('home')) { |
|
1147 | 1147 | $breadcrumb = ''; |
1148 | 1148 | $url_categoris = ''; |
1149 | 1149 | $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">'; |
@@ -1152,162 +1152,162 @@ discard block |
||
1152 | 1152 | * |
1153 | 1153 | * @since 1.0.0 |
1154 | 1154 | */ |
1155 | - $breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>'; |
|
1155 | + $breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>'; |
|
1156 | 1156 | |
1157 | 1157 | $gd_post_type = geodir_get_current_posttype(); |
1158 | - $post_type_info = get_post_type_object( $gd_post_type ); |
|
1158 | + $post_type_info = get_post_type_object($gd_post_type); |
|
1159 | 1159 | |
1160 | - remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' ); |
|
1160 | + remove_filter('post_type_archive_link', 'geodir_get_posttype_link'); |
|
1161 | 1161 | |
1162 | - $listing_link = get_post_type_archive_link( $gd_post_type ); |
|
1162 | + $listing_link = get_post_type_archive_link($gd_post_type); |
|
1163 | 1163 | |
1164 | - add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 ); |
|
1165 | - $listing_link = rtrim( $listing_link, '/' ); |
|
1164 | + add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2); |
|
1165 | + $listing_link = rtrim($listing_link, '/'); |
|
1166 | 1166 | $listing_link .= '/'; |
1167 | 1167 | |
1168 | 1168 | $post_type_for_location_link = $listing_link; |
1169 | - $location_terms = geodir_get_current_location_terms( 'query_vars', $gd_post_type ); |
|
1169 | + $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
1170 | 1170 | |
1171 | 1171 | global $wp, $gd_session; |
1172 | 1172 | $location_link = $post_type_for_location_link; |
1173 | 1173 | |
1174 | - if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) { |
|
1174 | + if (geodir_is_page('detail') || geodir_is_page('listing')) { |
|
1175 | 1175 | global $post; |
1176 | - $location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false; |
|
1177 | - $neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false; |
|
1176 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1177 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1178 | 1178 | |
1179 | - if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) { |
|
1179 | + if (geodir_is_page('detail') && isset($post->country_slug)) { |
|
1180 | 1180 | $location_terms = array( |
1181 | 1181 | 'gd_country' => $post->country_slug, |
1182 | 1182 | 'gd_region' => $post->region_slug, |
1183 | 1183 | 'gd_city' => $post->city_slug |
1184 | 1184 | ); |
1185 | 1185 | |
1186 | - if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) { |
|
1186 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1187 | 1187 | $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
1188 | 1188 | } |
1189 | 1189 | } |
1190 | 1190 | |
1191 | - $geodir_show_location_url = get_option( 'geodir_show_location_url' ); |
|
1191 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1192 | 1192 | |
1193 | 1193 | $hide_url_part = array(); |
1194 | - if ( $location_manager ) { |
|
1195 | - $hide_country_part = get_option( 'geodir_location_hide_country_part' ); |
|
1196 | - $hide_region_part = get_option( 'geodir_location_hide_region_part' ); |
|
1197 | - |
|
1198 | - if ( $hide_region_part && $hide_country_part ) { |
|
1199 | - $hide_url_part = array( 'gd_country', 'gd_region' ); |
|
1200 | - } else if ( $hide_region_part && ! $hide_country_part ) { |
|
1201 | - $hide_url_part = array( 'gd_region' ); |
|
1202 | - } else if ( ! $hide_region_part && $hide_country_part ) { |
|
1203 | - $hide_url_part = array( 'gd_country' ); |
|
1194 | + if ($location_manager) { |
|
1195 | + $hide_country_part = get_option('geodir_location_hide_country_part'); |
|
1196 | + $hide_region_part = get_option('geodir_location_hide_region_part'); |
|
1197 | + |
|
1198 | + if ($hide_region_part && $hide_country_part) { |
|
1199 | + $hide_url_part = array('gd_country', 'gd_region'); |
|
1200 | + } else if ($hide_region_part && !$hide_country_part) { |
|
1201 | + $hide_url_part = array('gd_region'); |
|
1202 | + } else if (!$hide_region_part && $hide_country_part) { |
|
1203 | + $hide_url_part = array('gd_country'); |
|
1204 | 1204 | } |
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | $hide_text_part = array(); |
1208 | - if ( $geodir_show_location_url == 'country_city' ) { |
|
1209 | - $hide_text_part = array( 'gd_region' ); |
|
1208 | + if ($geodir_show_location_url == 'country_city') { |
|
1209 | + $hide_text_part = array('gd_region'); |
|
1210 | 1210 | |
1211 | - if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) { |
|
1212 | - unset( $location_terms['gd_region'] ); |
|
1211 | + if (isset($location_terms['gd_region']) && !$location_manager) { |
|
1212 | + unset($location_terms['gd_region']); |
|
1213 | 1213 | } |
1214 | - } else if ( $geodir_show_location_url == 'region_city' ) { |
|
1215 | - $hide_text_part = array( 'gd_country' ); |
|
1214 | + } else if ($geodir_show_location_url == 'region_city') { |
|
1215 | + $hide_text_part = array('gd_country'); |
|
1216 | 1216 | |
1217 | - if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) { |
|
1218 | - unset( $location_terms['gd_country'] ); |
|
1217 | + if (isset($location_terms['gd_country']) && !$location_manager) { |
|
1218 | + unset($location_terms['gd_country']); |
|
1219 | 1219 | } |
1220 | - } else if ( $geodir_show_location_url == 'city' ) { |
|
1221 | - $hide_text_part = array( 'gd_country', 'gd_region' ); |
|
1220 | + } else if ($geodir_show_location_url == 'city') { |
|
1221 | + $hide_text_part = array('gd_country', 'gd_region'); |
|
1222 | 1222 | |
1223 | - if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) { |
|
1224 | - unset( $location_terms['gd_country'] ); |
|
1223 | + if (isset($location_terms['gd_country']) && !$location_manager) { |
|
1224 | + unset($location_terms['gd_country']); |
|
1225 | 1225 | } |
1226 | - if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) { |
|
1227 | - unset( $location_terms['gd_region'] ); |
|
1226 | + if (isset($location_terms['gd_region']) && !$location_manager) { |
|
1227 | + unset($location_terms['gd_region']); |
|
1228 | 1228 | } |
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | $is_location_last = ''; |
1232 | 1232 | $is_taxonomy_last = ''; |
1233 | 1233 | $breadcrumb .= '<li>'; |
1234 | - if ( get_query_var( $gd_post_type . 'category' ) ) { |
|
1235 | - $gd_taxonomy = $gd_post_type . 'category'; |
|
1236 | - } elseif ( get_query_var( $gd_post_type . '_tags' ) ) { |
|
1237 | - $gd_taxonomy = $gd_post_type . '_tags'; |
|
1234 | + if (get_query_var($gd_post_type.'category')) { |
|
1235 | + $gd_taxonomy = $gd_post_type.'category'; |
|
1236 | + } elseif (get_query_var($gd_post_type.'_tags')) { |
|
1237 | + $gd_taxonomy = $gd_post_type.'_tags'; |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | - $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>'; |
|
1241 | - if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) { |
|
1240 | + $breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>'; |
|
1241 | + if (!empty($gd_taxonomy) || geodir_is_page('detail')) { |
|
1242 | 1242 | $is_location_last = false; |
1243 | 1243 | } else { |
1244 | 1244 | $is_location_last = true; |
1245 | 1245 | } |
1246 | 1246 | |
1247 | - if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) { |
|
1247 | + if (!empty($gd_taxonomy) && geodir_is_page('listing')) { |
|
1248 | 1248 | $is_taxonomy_last = true; |
1249 | 1249 | } else { |
1250 | 1250 | $is_taxonomy_last = false; |
1251 | 1251 | } |
1252 | 1252 | |
1253 | - if ( ! empty( $location_terms ) ) { |
|
1254 | - $geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false; |
|
1253 | + if (!empty($location_terms)) { |
|
1254 | + $geodir_get_locations = function_exists('get_actual_location_name') ? true : false; |
|
1255 | 1255 | |
1256 | - foreach ( $location_terms as $key => $location_term ) { |
|
1257 | - if ( $location_term != '' ) { |
|
1258 | - if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb. |
|
1256 | + foreach ($location_terms as $key => $location_term) { |
|
1257 | + if ($location_term != '') { |
|
1258 | + if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb. |
|
1259 | 1259 | continue; |
1260 | 1260 | } |
1261 | 1261 | |
1262 | - $gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term ); |
|
1263 | - $gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text ); |
|
1264 | - $gd_location_link_text = ucfirst( $gd_location_link_text ); |
|
1262 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term); |
|
1263 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
1264 | + $gd_location_link_text = ucfirst($gd_location_link_text); |
|
1265 | 1265 | |
1266 | 1266 | $location_term_actual_country = ''; |
1267 | 1267 | $location_term_actual_region = ''; |
1268 | 1268 | $location_term_actual_city = ''; |
1269 | - if ( $geodir_get_locations ) { |
|
1270 | - if ( $key == 'gd_country' ) { |
|
1271 | - $location_term_actual_country = get_actual_location_name( 'country', $location_term, true ); |
|
1272 | - } else if ( $key == 'gd_region' ) { |
|
1273 | - $location_term_actual_region = get_actual_location_name( 'region', $location_term, true ); |
|
1274 | - } else if ( $key == 'gd_city' ) { |
|
1275 | - $location_term_actual_city = get_actual_location_name( 'city', $location_term, true ); |
|
1269 | + if ($geodir_get_locations) { |
|
1270 | + if ($key == 'gd_country') { |
|
1271 | + $location_term_actual_country = get_actual_location_name('country', $location_term, true); |
|
1272 | + } else if ($key == 'gd_region') { |
|
1273 | + $location_term_actual_region = get_actual_location_name('region', $location_term, true); |
|
1274 | + } else if ($key == 'gd_city') { |
|
1275 | + $location_term_actual_city = get_actual_location_name('city', $location_term, true); |
|
1276 | 1276 | } |
1277 | 1277 | } else { |
1278 | 1278 | $location_info = geodir_get_location(); |
1279 | 1279 | |
1280 | - if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) { |
|
1281 | - if ( $key == 'gd_country' ) { |
|
1282 | - $location_term_actual_country = __( $location_info->country, 'geodirectory' ); |
|
1283 | - } else if ( $key == 'gd_region' ) { |
|
1284 | - $location_term_actual_region = __( $location_info->region, 'geodirectory' ); |
|
1285 | - } else if ( $key == 'gd_city' ) { |
|
1286 | - $location_term_actual_city = __( $location_info->city, 'geodirectory' ); |
|
1280 | + if (!empty($location_info) && isset($location_info->location_id)) { |
|
1281 | + if ($key == 'gd_country') { |
|
1282 | + $location_term_actual_country = __($location_info->country, 'geodirectory'); |
|
1283 | + } else if ($key == 'gd_region') { |
|
1284 | + $location_term_actual_region = __($location_info->region, 'geodirectory'); |
|
1285 | + } else if ($key == 'gd_city') { |
|
1286 | + $location_term_actual_city = __($location_info->city, 'geodirectory'); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | } |
1290 | 1290 | |
1291 | - if ( $is_location_last && $key == 'gd_country' && ! ( isset( $location_terms['gd_region'] ) && $location_terms['gd_region'] != '' ) && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) { |
|
1292 | - $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text; |
|
1293 | - } else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) { |
|
1294 | - $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text; |
|
1295 | - } else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) { |
|
1296 | - $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text; |
|
1297 | - } else if ( $is_location_last && $key == 'gd_neighbourhood' ) { |
|
1298 | - $breadcrumb .= $separator . $gd_location_link_text; |
|
1291 | + if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) { |
|
1292 | + $breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text; |
|
1293 | + } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) { |
|
1294 | + $breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text; |
|
1295 | + } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) { |
|
1296 | + $breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text; |
|
1297 | + } else if ($is_location_last && $key == 'gd_neighbourhood') { |
|
1298 | + $breadcrumb .= $separator.$gd_location_link_text; |
|
1299 | 1299 | } else { |
1300 | - if ( get_option( 'permalink_structure' ) != '' ) { |
|
1301 | - $location_link .= $location_term . '/'; |
|
1300 | + if (get_option('permalink_structure') != '') { |
|
1301 | + $location_link .= $location_term.'/'; |
|
1302 | 1302 | } else { |
1303 | - $location_link .= "&$key=" . $location_term; |
|
1303 | + $location_link .= "&$key=".$location_term; |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | - if ( $key == 'gd_country' && $location_term_actual_country != '' ) { |
|
1306 | + if ($key == 'gd_country' && $location_term_actual_country != '') { |
|
1307 | 1307 | $gd_location_link_text = $location_term_actual_country; |
1308 | - } else if ( $key == 'gd_region' && $location_term_actual_region != '' ) { |
|
1308 | + } else if ($key == 'gd_region' && $location_term_actual_region != '') { |
|
1309 | 1309 | $gd_location_link_text = $location_term_actual_region; |
1310 | - } else if ( $key == 'gd_city' && $location_term_actual_city != '' ) { |
|
1310 | + } else if ($key == 'gd_city' && $location_term_actual_city != '') { |
|
1311 | 1311 | $gd_location_link_text = $location_term_actual_city; |
1312 | 1312 | } |
1313 | 1313 | |
@@ -1317,76 +1317,76 @@ discard block |
||
1317 | 1317 | } |
1318 | 1318 | */ |
1319 | 1319 | |
1320 | - $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>'; |
|
1320 | + $breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>'; |
|
1321 | 1321 | } |
1322 | 1322 | } |
1323 | 1323 | } |
1324 | 1324 | } |
1325 | 1325 | |
1326 | - if ( ! empty( $gd_taxonomy ) ) { |
|
1326 | + if (!empty($gd_taxonomy)) { |
|
1327 | 1327 | $term_index = 1; |
1328 | 1328 | |
1329 | 1329 | //if(get_option('geodir_add_categories_url')) |
1330 | 1330 | { |
1331 | - if ( get_query_var( $gd_post_type . '_tags' ) ) { |
|
1332 | - $cat_link = $listing_link . 'tags/'; |
|
1331 | + if (get_query_var($gd_post_type.'_tags')) { |
|
1332 | + $cat_link = $listing_link.'tags/'; |
|
1333 | 1333 | } else { |
1334 | 1334 | $cat_link = $listing_link; |
1335 | 1335 | } |
1336 | 1336 | |
1337 | - foreach ( $location_terms as $key => $location_term ) { |
|
1338 | - if ( $location_manager && in_array( $key, $hide_url_part ) ) { |
|
1337 | + foreach ($location_terms as $key => $location_term) { |
|
1338 | + if ($location_manager && in_array($key, $hide_url_part)) { |
|
1339 | 1339 | continue; |
1340 | 1340 | } |
1341 | 1341 | |
1342 | - if ( $location_term != '' ) { |
|
1343 | - if ( get_option( 'permalink_structure' ) != '' ) { |
|
1344 | - $cat_link .= $location_term . '/'; |
|
1342 | + if ($location_term != '') { |
|
1343 | + if (get_option('permalink_structure') != '') { |
|
1344 | + $cat_link .= $location_term.'/'; |
|
1345 | 1345 | } |
1346 | 1346 | } |
1347 | 1347 | } |
1348 | 1348 | |
1349 | - $term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) ); |
|
1350 | - foreach ( $term_array as $term ) { |
|
1351 | - $term_link_text = preg_replace( '/-(\d+)$/', '', $term ); |
|
1352 | - $term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text ); |
|
1349 | + $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/")); |
|
1350 | + foreach ($term_array as $term) { |
|
1351 | + $term_link_text = preg_replace('/-(\d+)$/', '', $term); |
|
1352 | + $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text); |
|
1353 | 1353 | |
1354 | 1354 | // get term actual name |
1355 | - $term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' ); |
|
1356 | - if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) { |
|
1357 | - $term_link_text = urldecode( $term_info['name'] ); |
|
1355 | + $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A'); |
|
1356 | + if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') { |
|
1357 | + $term_link_text = urldecode($term_info['name']); |
|
1358 | 1358 | } else { |
1359 | 1359 | continue; |
1360 | 1360 | //$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text))); |
1361 | 1361 | } |
1362 | 1362 | |
1363 | - if ( $term_index == count( $term_array ) && $is_taxonomy_last ) { |
|
1364 | - $breadcrumb .= $separator . $term_link_text; |
|
1363 | + if ($term_index == count($term_array) && $is_taxonomy_last) { |
|
1364 | + $breadcrumb .= $separator.$term_link_text; |
|
1365 | 1365 | } else { |
1366 | - $cat_link .= $term . '/'; |
|
1367 | - $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>'; |
|
1366 | + $cat_link .= $term.'/'; |
|
1367 | + $breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>'; |
|
1368 | 1368 | } |
1369 | - $term_index ++; |
|
1369 | + $term_index++; |
|
1370 | 1370 | } |
1371 | 1371 | } |
1372 | 1372 | |
1373 | 1373 | |
1374 | 1374 | } |
1375 | 1375 | |
1376 | - if ( geodir_is_page( 'detail' ) ) { |
|
1377 | - $breadcrumb .= $separator . get_the_title(); |
|
1376 | + if (geodir_is_page('detail')) { |
|
1377 | + $breadcrumb .= $separator.get_the_title(); |
|
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | $breadcrumb .= '</li>'; |
1381 | 1381 | |
1382 | 1382 | |
1383 | - } elseif ( geodir_is_page( 'author' ) ) { |
|
1383 | + } elseif (geodir_is_page('author')) { |
|
1384 | 1384 | $user_id = get_current_user_id(); |
1385 | - $author_link = get_author_posts_url( $user_id ); |
|
1386 | - $default_author_link = geodir_getlink( $author_link, array( |
|
1385 | + $author_link = get_author_posts_url($user_id); |
|
1386 | + $default_author_link = geodir_getlink($author_link, array( |
|
1387 | 1387 | 'geodir_dashbord' => 'true', |
1388 | 1388 | 'stype' => 'gd_place' |
1389 | - ), false ); |
|
1389 | + ), false); |
|
1390 | 1390 | |
1391 | 1391 | /** |
1392 | 1392 | * Filter author page link. |
@@ -1396,16 +1396,16 @@ discard block |
||
1396 | 1396 | * @param string $default_author_link Default author link. |
1397 | 1397 | * @param int $user_id Author ID. |
1398 | 1398 | */ |
1399 | - $default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id ); |
|
1399 | + $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id); |
|
1400 | 1400 | |
1401 | 1401 | $breadcrumb .= '<li>'; |
1402 | - $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>'; |
|
1402 | + $breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>'; |
|
1403 | 1403 | |
1404 | - if ( isset( $_REQUEST['list'] ) ) { |
|
1405 | - $author_link = geodir_getlink( $author_link, array( |
|
1404 | + if (isset($_REQUEST['list'])) { |
|
1405 | + $author_link = geodir_getlink($author_link, array( |
|
1406 | 1406 | 'geodir_dashbord' => 'true', |
1407 | 1407 | 'stype' => $_REQUEST['stype'] |
1408 | - ), false ); |
|
1408 | + ), false); |
|
1409 | 1409 | |
1410 | 1410 | /** |
1411 | 1411 | * Filter author page link. |
@@ -1416,61 +1416,61 @@ discard block |
||
1416 | 1416 | * @param int $user_id Author ID. |
1417 | 1417 | * @param string $_REQUEST ['stype'] Post type. |
1418 | 1418 | */ |
1419 | - $author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] ); |
|
1419 | + $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']); |
|
1420 | 1420 | |
1421 | - $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>'; |
|
1422 | - $breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] ); |
|
1421 | + $breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>'; |
|
1422 | + $breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']); |
|
1423 | 1423 | } else { |
1424 | - $breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' ); |
|
1424 | + $breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory'); |
|
1425 | 1425 | } |
1426 | 1426 | |
1427 | 1427 | $breadcrumb .= '</li>'; |
1428 | - } elseif ( is_category() || is_single() ) { |
|
1428 | + } elseif (is_category() || is_single()) { |
|
1429 | 1429 | $category = get_the_category(); |
1430 | - if ( is_category() ) { |
|
1431 | - $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>'; |
|
1430 | + if (is_category()) { |
|
1431 | + $breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>'; |
|
1432 | 1432 | } |
1433 | - if ( is_single() ) { |
|
1434 | - $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>'; |
|
1435 | - $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>'; |
|
1433 | + if (is_single()) { |
|
1434 | + $breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>'; |
|
1435 | + $breadcrumb .= '<li>'.$separator.get_the_title().'</li>'; |
|
1436 | 1436 | } |
1437 | 1437 | /* End of my version ##################################################### */ |
1438 | - } else if ( is_page() ) { |
|
1438 | + } else if (is_page()) { |
|
1439 | 1439 | $page_title = get_the_title(); |
1440 | 1440 | |
1441 | - if ( geodir_is_page( 'location' ) ) { |
|
1441 | + if (geodir_is_page('location')) { |
|
1442 | 1442 | $location_page_id = geodir_location_page_id(); |
1443 | - $loc_post = get_post( $location_page_id ); |
|
1443 | + $loc_post = get_post($location_page_id); |
|
1444 | 1444 | $post_name = $loc_post->post_name; |
1445 | - $slug = ucwords( str_replace( '-', ' ', $post_name ) ); |
|
1446 | - $page_title = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' ); |
|
1445 | + $slug = ucwords(str_replace('-', ' ', $post_name)); |
|
1446 | + $page_title = !empty($slug) ? $slug : __('Location', 'geodirectory'); |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | - $breadcrumb .= '<li>' . $separator; |
|
1450 | - $breadcrumb .= stripslashes_deep( $page_title ); |
|
1449 | + $breadcrumb .= '<li>'.$separator; |
|
1450 | + $breadcrumb .= stripslashes_deep($page_title); |
|
1451 | 1451 | $breadcrumb .= '</li>'; |
1452 | - } else if ( is_tag() ) { |
|
1453 | - $breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>'; |
|
1454 | - } else if ( is_day() ) { |
|
1455 | - $breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " "; |
|
1456 | - the_time( 'F jS, Y' ); |
|
1452 | + } else if (is_tag()) { |
|
1453 | + $breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>'; |
|
1454 | + } else if (is_day()) { |
|
1455 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." "; |
|
1456 | + the_time('F jS, Y'); |
|
1457 | 1457 | $breadcrumb .= '</li>'; |
1458 | - } else if ( is_month() ) { |
|
1459 | - $breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " "; |
|
1460 | - the_time( 'F, Y' ); |
|
1458 | + } else if (is_month()) { |
|
1459 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." "; |
|
1460 | + the_time('F, Y'); |
|
1461 | 1461 | $breadcrumb .= '</li>'; |
1462 | - } else if ( is_year() ) { |
|
1463 | - $breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " "; |
|
1464 | - the_time( 'Y' ); |
|
1462 | + } else if (is_year()) { |
|
1463 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." "; |
|
1464 | + the_time('Y'); |
|
1465 | 1465 | $breadcrumb .= '</li>'; |
1466 | - } else if ( is_author() ) { |
|
1467 | - $breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' ); |
|
1466 | + } else if (is_author()) { |
|
1467 | + $breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory'); |
|
1468 | 1468 | $breadcrumb .= '</li>'; |
1469 | - } else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) { |
|
1470 | - $breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' ); |
|
1469 | + } else if (isset($_GET['paged']) && !empty($_GET['paged'])) { |
|
1470 | + $breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory'); |
|
1471 | 1471 | $breadcrumb .= '</li>'; |
1472 | - } else if ( is_search() ) { |
|
1473 | - $breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' ); |
|
1472 | + } else if (is_search()) { |
|
1473 | + $breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory'); |
|
1474 | 1474 | $breadcrumb .= '</li>'; |
1475 | 1475 | } |
1476 | 1476 | $breadcrumb .= '</ul></div>'; |
@@ -1483,13 +1483,13 @@ discard block |
||
1483 | 1483 | * @param string $breadcrumb Breadcrumb HTML. |
1484 | 1484 | * @param string $separator Breadcrumb separator. |
1485 | 1485 | */ |
1486 | - echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator ); |
|
1486 | + echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator); |
|
1487 | 1487 | } |
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | |
1491 | -add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin |
|
1492 | -if ( ! function_exists( 'geodir_allow_wpadmin' ) ) { |
|
1491 | +add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin |
|
1492 | +if (!function_exists('geodir_allow_wpadmin')) { |
|
1493 | 1493 | /** |
1494 | 1494 | * Allow only admins to access wp-admin. |
1495 | 1495 | * |
@@ -1501,12 +1501,12 @@ discard block |
||
1501 | 1501 | */ |
1502 | 1502 | function geodir_allow_wpadmin() { |
1503 | 1503 | global $wpdb; |
1504 | - if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through |
|
1504 | + if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through |
|
1505 | 1505 | { |
1506 | - if ( current_user_can( 'administrator' ) ) { |
|
1506 | + if (current_user_can('administrator')) { |
|
1507 | 1507 | } else { |
1508 | 1508 | |
1509 | - wp_redirect( home_url() ); |
|
1509 | + wp_redirect(home_url()); |
|
1510 | 1510 | exit; |
1511 | 1511 | } |
1512 | 1512 | |
@@ -1525,23 +1525,23 @@ discard block |
||
1525 | 1525 | * |
1526 | 1526 | * @return array|WP_Error The uploaded data as array. When failure returns error. |
1527 | 1527 | */ |
1528 | -function fetch_remote_file( $url ) { |
|
1528 | +function fetch_remote_file($url) { |
|
1529 | 1529 | // extract the file name and extension from the url |
1530 | - require_once( ABSPATH . 'wp-includes/pluggable.php' ); |
|
1531 | - $file_name = basename( $url ); |
|
1532 | - if ( strpos( $file_name, '?' ) !== false ) { |
|
1533 | - list( $file_name ) = explode( '?', $file_name ); |
|
1530 | + require_once(ABSPATH.'wp-includes/pluggable.php'); |
|
1531 | + $file_name = basename($url); |
|
1532 | + if (strpos($file_name, '?') !== false) { |
|
1533 | + list($file_name) = explode('?', $file_name); |
|
1534 | 1534 | } |
1535 | 1535 | $dummy = false; |
1536 | 1536 | $add_to_cache = false; |
1537 | 1537 | $key = null; |
1538 | - if ( strpos( $url, '/dummy/' ) !== false ) { |
|
1538 | + if (strpos($url, '/dummy/') !== false) { |
|
1539 | 1539 | $dummy = true; |
1540 | - $key = "dummy_" . str_replace( '.', '_', $file_name ); |
|
1541 | - $value = get_transient( 'cached_dummy_images' ); |
|
1542 | - if ( $value ) { |
|
1543 | - if ( isset( $value[ $key ] ) ) { |
|
1544 | - return $value[ $key ]; |
|
1540 | + $key = "dummy_".str_replace('.', '_', $file_name); |
|
1541 | + $value = get_transient('cached_dummy_images'); |
|
1542 | + if ($value) { |
|
1543 | + if (isset($value[$key])) { |
|
1544 | + return $value[$key]; |
|
1545 | 1545 | } else { |
1546 | 1546 | $add_to_cache = true; |
1547 | 1547 | } |
@@ -1552,58 +1552,58 @@ discard block |
||
1552 | 1552 | |
1553 | 1553 | // get placeholder file in the upload dir with a unique, sanitized filename |
1554 | 1554 | |
1555 | - $post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : ''; |
|
1555 | + $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : ''; |
|
1556 | 1556 | |
1557 | - $upload = wp_upload_bits( $file_name, 0, '', $post_upload_date ); |
|
1558 | - if ( $upload['error'] ) { |
|
1559 | - return new WP_Error( 'upload_dir_error', $upload['error'] ); |
|
1557 | + $upload = wp_upload_bits($file_name, 0, '', $post_upload_date); |
|
1558 | + if ($upload['error']) { |
|
1559 | + return new WP_Error('upload_dir_error', $upload['error']); |
|
1560 | 1560 | } |
1561 | 1561 | |
1562 | 1562 | |
1563 | - sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay |
|
1563 | + sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay |
|
1564 | 1564 | |
1565 | 1565 | // fetch the remote url and write it to the placeholder file |
1566 | - $headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) ); |
|
1566 | + $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file'])); |
|
1567 | 1567 | |
1568 | 1568 | $log_message = ''; |
1569 | - if ( is_wp_error( $headers ) ) { |
|
1570 | - echo 'file: ' . $url; |
|
1569 | + if (is_wp_error($headers)) { |
|
1570 | + echo 'file: '.$url; |
|
1571 | 1571 | |
1572 | - return new WP_Error( 'import_file_error', $headers->get_error_message() ); |
|
1572 | + return new WP_Error('import_file_error', $headers->get_error_message()); |
|
1573 | 1573 | } |
1574 | 1574 | |
1575 | - $filesize = filesize( $upload['file'] ); |
|
1575 | + $filesize = filesize($upload['file']); |
|
1576 | 1576 | // request failed |
1577 | - if ( ! $headers ) { |
|
1578 | - $log_message = __( 'Remote server did not respond', 'geodirectory' ); |
|
1577 | + if (!$headers) { |
|
1578 | + $log_message = __('Remote server did not respond', 'geodirectory'); |
|
1579 | 1579 | } // make sure the fetch was successful |
1580 | - elseif ( $headers['response']['code'] != '200' ) { |
|
1581 | - $log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) ); |
|
1582 | - } elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) { |
|
1583 | - $log_message = __( 'Remote file is incorrect size', 'geodirectory' ); |
|
1584 | - } elseif ( 0 == $filesize ) { |
|
1585 | - $log_message = __( 'Zero size file downloaded', 'geodirectory' ); |
|
1586 | - } |
|
1587 | - |
|
1588 | - if ( $log_message ) { |
|
1589 | - $del = unlink( $upload['file'] ); |
|
1590 | - if ( ! $del ) { |
|
1591 | - geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) ); |
|
1580 | + elseif ($headers['response']['code'] != '200') { |
|
1581 | + $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response'])); |
|
1582 | + } elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) { |
|
1583 | + $log_message = __('Remote file is incorrect size', 'geodirectory'); |
|
1584 | + } elseif (0 == $filesize) { |
|
1585 | + $log_message = __('Zero size file downloaded', 'geodirectory'); |
|
1586 | + } |
|
1587 | + |
|
1588 | + if ($log_message) { |
|
1589 | + $del = unlink($upload['file']); |
|
1590 | + if (!$del) { |
|
1591 | + geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); |
|
1592 | 1592 | } |
1593 | 1593 | |
1594 | - return new WP_Error( 'import_file_error', $log_message ); |
|
1594 | + return new WP_Error('import_file_error', $log_message); |
|
1595 | 1595 | } |
1596 | 1596 | |
1597 | - if ( $dummy && $add_to_cache && is_array( $upload ) ) { |
|
1598 | - $images = get_transient( 'cached_dummy_images' ); |
|
1599 | - if ( is_array( $images ) ) { |
|
1600 | - $images[ $key ] = $upload; |
|
1597 | + if ($dummy && $add_to_cache && is_array($upload)) { |
|
1598 | + $images = get_transient('cached_dummy_images'); |
|
1599 | + if (is_array($images)) { |
|
1600 | + $images[$key] = $upload; |
|
1601 | 1601 | } else { |
1602 | - $images = array( $key => $upload ); |
|
1602 | + $images = array($key => $upload); |
|
1603 | 1603 | } |
1604 | 1604 | |
1605 | 1605 | //setting the cache using the WP Transient API |
1606 | - set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache |
|
1606 | + set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | 1609 | return $upload; |
@@ -1617,12 +1617,12 @@ discard block |
||
1617 | 1617 | * @return string|void Max upload size. |
1618 | 1618 | */ |
1619 | 1619 | function geodir_max_upload_size() { |
1620 | - $max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 ); |
|
1620 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2); |
|
1621 | 1621 | |
1622 | - if ( $max_filesize > 0 && $max_filesize < 1 ) { |
|
1623 | - $max_filesize = (int) ( $max_filesize * 1024 ) . 'kb'; |
|
1622 | + if ($max_filesize > 0 && $max_filesize < 1) { |
|
1623 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
1624 | 1624 | } else { |
1625 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
1625 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
1626 | 1626 | } |
1627 | 1627 | |
1628 | 1628 | /** |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | * |
1633 | 1633 | * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb. |
1634 | 1634 | */ |
1635 | - return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize ); |
|
1635 | + return apply_filters('geodir_default_image_upload_size_limit', $max_filesize); |
|
1636 | 1636 | } |
1637 | 1637 | |
1638 | 1638 | /** |
@@ -1645,8 +1645,8 @@ discard block |
||
1645 | 1645 | * @return bool If dummy folder exists returns true, else false. |
1646 | 1646 | */ |
1647 | 1647 | function geodir_dummy_folder_exists() { |
1648 | - $path = geodir_plugin_path() . '/geodirectory-admin/dummy/'; |
|
1649 | - if ( ! is_dir( $path ) ) { |
|
1648 | + $path = geodir_plugin_path().'/geodirectory-admin/dummy/'; |
|
1649 | + if (!is_dir($path)) { |
|
1650 | 1650 | return false; |
1651 | 1651 | } else { |
1652 | 1652 | return true; |
@@ -1665,17 +1665,17 @@ discard block |
||
1665 | 1665 | * |
1666 | 1666 | * @return object Author info. |
1667 | 1667 | */ |
1668 | -function geodir_get_author_info( $aid ) { |
|
1668 | +function geodir_get_author_info($aid) { |
|
1669 | 1669 | global $wpdb; |
1670 | 1670 | /*$infosql = "select * from $wpdb->users where ID=$aid";*/ |
1671 | - $infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) ); |
|
1672 | - $info = $wpdb->get_results( $infosql ); |
|
1673 | - if ( $info ) { |
|
1671 | + $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid)); |
|
1672 | + $info = $wpdb->get_results($infosql); |
|
1673 | + if ($info) { |
|
1674 | 1674 | return $info[0]; |
1675 | 1675 | } |
1676 | 1676 | } |
1677 | 1677 | |
1678 | -if ( ! function_exists( 'adminEmail' ) ) { |
|
1678 | +if (!function_exists('adminEmail')) { |
|
1679 | 1679 | /** |
1680 | 1680 | * Send emails to client on post submission, renew etc. |
1681 | 1681 | * |
@@ -1688,67 +1688,67 @@ discard block |
||
1688 | 1688 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
1689 | 1689 | * @param string $custom_1 Custom data to be sent. |
1690 | 1690 | */ |
1691 | - function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) { |
|
1691 | + function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') { |
|
1692 | 1692 | global $wpdb; |
1693 | - if ( $message_type == 'expiration' ) { |
|
1694 | - $subject = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) ); |
|
1695 | - $client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) ); |
|
1696 | - } elseif ( $message_type == 'post_submited' ) { |
|
1697 | - $subject = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' ); |
|
1698 | - $client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' ); |
|
1699 | - } elseif ( $message_type == 'renew' ) { |
|
1700 | - $subject = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' ); |
|
1701 | - $client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' ); |
|
1702 | - } elseif ( $message_type == 'upgrade' ) { |
|
1703 | - $subject = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' ); |
|
1704 | - $client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' ); |
|
1705 | - } elseif ( $message_type == 'claim_approved' ) { |
|
1706 | - $subject = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' ); |
|
1707 | - $client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' ); |
|
1708 | - } elseif ( $message_type == 'claim_rejected' ) { |
|
1709 | - $subject = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' ); |
|
1710 | - $client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' ); |
|
1711 | - } elseif ( $message_type == 'claim_requested' ) { |
|
1712 | - $subject = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' ); |
|
1713 | - $client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' ); |
|
1714 | - } elseif ( $message_type == 'auto_claim' ) { |
|
1715 | - $subject = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' ); |
|
1716 | - $client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' ); |
|
1717 | - } elseif ( $message_type == 'payment_success' ) { |
|
1718 | - $subject = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' ); |
|
1719 | - $client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' ); |
|
1720 | - } elseif ( $message_type == 'payment_fail' ) { |
|
1721 | - $subject = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' ); |
|
1722 | - $client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' ); |
|
1693 | + if ($message_type == 'expiration') { |
|
1694 | + $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory')); |
|
1695 | + $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory')); |
|
1696 | + } elseif ($message_type == 'post_submited') { |
|
1697 | + $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory'); |
|
1698 | + $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory'); |
|
1699 | + } elseif ($message_type == 'renew') { |
|
1700 | + $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory'); |
|
1701 | + $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory'); |
|
1702 | + } elseif ($message_type == 'upgrade') { |
|
1703 | + $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory'); |
|
1704 | + $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory'); |
|
1705 | + } elseif ($message_type == 'claim_approved') { |
|
1706 | + $subject = __(get_option('claim_approved_email_subject'), 'geodirectory'); |
|
1707 | + $client_message = __(get_option('claim_approved_email_content'), 'geodirectory'); |
|
1708 | + } elseif ($message_type == 'claim_rejected') { |
|
1709 | + $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory'); |
|
1710 | + $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory'); |
|
1711 | + } elseif ($message_type == 'claim_requested') { |
|
1712 | + $subject = __(get_option('claim_email_subject_admin'), 'geodirectory'); |
|
1713 | + $client_message = __(get_option('claim_email_content_admin'), 'geodirectory'); |
|
1714 | + } elseif ($message_type == 'auto_claim') { |
|
1715 | + $subject = __(get_option('auto_claim_email_subject'), 'geodirectory'); |
|
1716 | + $client_message = __(get_option('auto_claim_email_content'), 'geodirectory'); |
|
1717 | + } elseif ($message_type == 'payment_success') { |
|
1718 | + $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory'); |
|
1719 | + $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory'); |
|
1720 | + } elseif ($message_type == 'payment_fail') { |
|
1721 | + $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory'); |
|
1722 | + $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory'); |
|
1723 | 1723 | } |
1724 | 1724 | $transaction_details = $custom_1; |
1725 | - $fromEmail = get_option( 'site_email' ); |
|
1725 | + $fromEmail = get_option('site_email'); |
|
1726 | 1726 | $fromEmailName = get_site_emailName(); |
1727 | 1727 | //$alivedays = get_post_meta($page_id,'alive_days',true); |
1728 | - $pkg_limit = get_property_price_info_listing( $page_id ); |
|
1728 | + $pkg_limit = get_property_price_info_listing($page_id); |
|
1729 | 1729 | $alivedays = $pkg_limit['days']; |
1730 | - $productlink = get_permalink( $page_id ); |
|
1731 | - $post_info = get_post( $page_id ); |
|
1732 | - $post_date = date( 'dS F,Y', strtotime( $post_info->post_date ) ); |
|
1733 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
1730 | + $productlink = get_permalink($page_id); |
|
1731 | + $post_info = get_post($page_id); |
|
1732 | + $post_date = date('dS F,Y', strtotime($post_info->post_date)); |
|
1733 | + $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>'; |
|
1734 | 1734 | $loginurl = geodir_login_url(); |
1735 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
1735 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
1736 | 1736 | $siteurl = home_url(); |
1737 | - $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>'; |
|
1738 | - $user_info = get_userdata( $user_id ); |
|
1737 | + $siteurl_link = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>'; |
|
1738 | + $user_info = get_userdata($user_id); |
|
1739 | 1739 | $user_email = $user_info->user_email; |
1740 | - $display_name = geodir_get_client_name( $user_id ); |
|
1740 | + $display_name = geodir_get_client_name($user_id); |
|
1741 | 1741 | $user_login = $user_info->user_login; |
1742 | - $number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' ); |
|
1743 | - if ( $number_of_grace_days == '' ) { |
|
1742 | + $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days'); |
|
1743 | + if ($number_of_grace_days == '') { |
|
1744 | 1744 | $number_of_grace_days = 1; |
1745 | 1745 | } |
1746 | - if ( $post_info->post_type == 'event' ) { |
|
1746 | + if ($post_info->post_type == 'event') { |
|
1747 | 1747 | $post_type = 'event'; |
1748 | 1748 | } else { |
1749 | 1749 | $post_type = 'listing'; |
1750 | 1750 | } |
1751 | - $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>'; |
|
1751 | + $renew_link = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>'; |
|
1752 | 1752 | $search_array = array( |
1753 | 1753 | '[#client_name#]', |
1754 | 1754 | '[#listing_link#]', |
@@ -1764,7 +1764,7 @@ discard block |
||
1764 | 1764 | '[#site_name#]', |
1765 | 1765 | '[#transaction_details#]' |
1766 | 1766 | ); |
1767 | - $replace_array = array( |
|
1767 | + $replace_array = array( |
|
1768 | 1768 | $display_name, |
1769 | 1769 | $listingLink, |
1770 | 1770 | $post_date, |
@@ -1779,11 +1779,11 @@ discard block |
||
1779 | 1779 | $fromEmailName, |
1780 | 1780 | $transaction_details |
1781 | 1781 | ); |
1782 | - $client_message = str_replace( $search_array, $replace_array, $client_message ); |
|
1783 | - $subject = str_replace( $search_array, $replace_array, $subject ); |
|
1784 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
1785 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
1786 | - $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n"; |
|
1782 | + $client_message = str_replace($search_array, $replace_array, $client_message); |
|
1783 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
1784 | + $headers = 'MIME-Version: 1.0'."\r\n"; |
|
1785 | + $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
1786 | + $headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n"; |
|
1787 | 1787 | |
1788 | 1788 | $to = $fromEmail; |
1789 | 1789 | $message = $client_message; |
@@ -1801,7 +1801,7 @@ discard block |
||
1801 | 1801 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
1802 | 1802 | * @param string $custom_1 Custom data to be sent. |
1803 | 1803 | */ |
1804 | - $to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 ); |
|
1804 | + $to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1); |
|
1805 | 1805 | /** |
1806 | 1806 | * Filter the admin email subject. |
1807 | 1807 | * |
@@ -1814,7 +1814,7 @@ discard block |
||
1814 | 1814 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
1815 | 1815 | * @param string $custom_1 Custom data to be sent. |
1816 | 1816 | */ |
1817 | - $subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 ); |
|
1817 | + $subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1); |
|
1818 | 1818 | /** |
1819 | 1819 | * Filter the admin email message. |
1820 | 1820 | * |
@@ -1827,7 +1827,7 @@ discard block |
||
1827 | 1827 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
1828 | 1828 | * @param string $custom_1 Custom data to be sent. |
1829 | 1829 | */ |
1830 | - $message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 ); |
|
1830 | + $message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1); |
|
1831 | 1831 | /** |
1832 | 1832 | * Filter the admin email headers. |
1833 | 1833 | * |
@@ -1840,22 +1840,22 @@ discard block |
||
1840 | 1840 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
1841 | 1841 | * @param string $custom_1 Custom data to be sent. |
1842 | 1842 | */ |
1843 | - $headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 ); |
|
1843 | + $headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1); |
|
1844 | 1844 | |
1845 | 1845 | |
1846 | - $sent = wp_mail( $to, $subject, $message, $headers ); |
|
1847 | - if ( ! $sent ) { |
|
1848 | - if ( is_array( $to ) ) { |
|
1849 | - $to = implode( ',', $to ); |
|
1846 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
1847 | + if (!$sent) { |
|
1848 | + if (is_array($to)) { |
|
1849 | + $to = implode(',', $to); |
|
1850 | 1850 | } |
1851 | 1851 | $log_message = sprintf( |
1852 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
1852 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'), |
|
1853 | 1853 | $message_type, |
1854 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
1854 | + date_i18n('F j Y H:i:s', current_time('timestamp')), |
|
1855 | 1855 | $to, |
1856 | 1856 | $subject |
1857 | 1857 | ); |
1858 | - geodir_error_log( $log_message ); |
|
1858 | + geodir_error_log($log_message); |
|
1859 | 1859 | } |
1860 | 1860 | } |
1861 | 1861 | } |
@@ -1875,12 +1875,12 @@ discard block |
||
1875 | 1875 | * |
1876 | 1876 | * @return array Category IDs. |
1877 | 1877 | */ |
1878 | -function gd_lang_object_ids( $ids_array, $type ) { |
|
1879 | - if ( function_exists( 'icl_object_id' ) ) { |
|
1878 | +function gd_lang_object_ids($ids_array, $type) { |
|
1879 | + if (function_exists('icl_object_id')) { |
|
1880 | 1880 | $res = array(); |
1881 | - foreach ( $ids_array as $id ) { |
|
1882 | - $xlat = icl_object_id( $id, $type, false ); |
|
1883 | - if ( ! is_null( $xlat ) ) { |
|
1881 | + foreach ($ids_array as $id) { |
|
1882 | + $xlat = icl_object_id($id, $type, false); |
|
1883 | + if (!is_null($xlat)) { |
|
1884 | 1884 | $res[] = $xlat; |
1885 | 1885 | } |
1886 | 1886 | } |
@@ -1904,20 +1904,20 @@ discard block |
||
1904 | 1904 | * |
1905 | 1905 | * @return array Modified Body CSS classes. |
1906 | 1906 | */ |
1907 | -function geodir_custom_posts_body_class( $classes ) { |
|
1907 | +function geodir_custom_posts_body_class($classes) { |
|
1908 | 1908 | global $wpdb, $wp; |
1909 | - $post_types = geodir_get_posttypes( 'object' ); |
|
1910 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) { |
|
1909 | + $post_types = geodir_get_posttypes('object'); |
|
1910 | + if (!empty($post_types) && count((array) $post_types) > 1) { |
|
1911 | 1911 | $classes[] = 'geodir_custom_posts'; |
1912 | 1912 | } |
1913 | 1913 | |
1914 | 1914 | // fix body class for signup page |
1915 | - if ( geodir_is_page( 'login' ) ) { |
|
1915 | + if (geodir_is_page('login')) { |
|
1916 | 1916 | $new_classes = array(); |
1917 | 1917 | $new_classes[] = 'signup page-geodir-signup'; |
1918 | - if ( ! empty( $classes ) ) { |
|
1919 | - foreach ( $classes as $class ) { |
|
1920 | - if ( $class && $class != 'home' && $class != 'blog' ) { |
|
1918 | + if (!empty($classes)) { |
|
1919 | + foreach ($classes as $class) { |
|
1920 | + if ($class && $class != 'home' && $class != 'blog') { |
|
1921 | 1921 | $new_classes[] = $class; |
1922 | 1922 | } |
1923 | 1923 | } |
@@ -1925,14 +1925,14 @@ discard block |
||
1925 | 1925 | $classes = $new_classes; |
1926 | 1926 | } |
1927 | 1927 | |
1928 | - if ( geodir_is_geodir_page() ) { |
|
1928 | + if (geodir_is_geodir_page()) { |
|
1929 | 1929 | $classes[] = 'geodir-page'; |
1930 | 1930 | } |
1931 | 1931 | |
1932 | 1932 | return $classes; |
1933 | 1933 | } |
1934 | 1934 | |
1935 | -add_filter( 'body_class', 'geodir_custom_posts_body_class' ); // let's add a class to the body so we can style the new addition to the search |
|
1935 | +add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search |
|
1936 | 1936 | |
1937 | 1937 | |
1938 | 1938 | /** |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | * |
1949 | 1949 | * @since 1.0.0 |
1950 | 1950 | */ |
1951 | - return apply_filters( 'geodir_map_zoom_level', array( |
|
1951 | + return apply_filters('geodir_map_zoom_level', array( |
|
1952 | 1952 | 1, |
1953 | 1953 | 2, |
1954 | 1954 | 3, |
@@ -1968,7 +1968,7 @@ discard block |
||
1968 | 1968 | 17, |
1969 | 1969 | 18, |
1970 | 1970 | 19 |
1971 | - ) ); |
|
1971 | + )); |
|
1972 | 1972 | |
1973 | 1973 | } |
1974 | 1974 | |
@@ -1981,12 +1981,12 @@ discard block |
||
1981 | 1981 | * |
1982 | 1982 | * @param string $geodir_option_name Option key. |
1983 | 1983 | */ |
1984 | -function geodir_option_version_backup( $geodir_option_name ) { |
|
1984 | +function geodir_option_version_backup($geodir_option_name) { |
|
1985 | 1985 | $version_date = time(); |
1986 | - $geodir_option = get_option( $geodir_option_name ); |
|
1986 | + $geodir_option = get_option($geodir_option_name); |
|
1987 | 1987 | |
1988 | - if ( ! empty( $geodir_option ) ) { |
|
1989 | - add_option( $geodir_option_name . '_' . $version_date, $geodir_option ); |
|
1988 | + if (!empty($geodir_option)) { |
|
1989 | + add_option($geodir_option_name.'_'.$version_date, $geodir_option); |
|
1990 | 1990 | } |
1991 | 1991 | } |
1992 | 1992 | |
@@ -2000,10 +2000,10 @@ discard block |
||
2000 | 2000 | * |
2001 | 2001 | * @return int Page ID. |
2002 | 2002 | */ |
2003 | -function get_page_id_geodir_add_listing_page( $page_id ) { |
|
2004 | - if ( geodir_wpml_multilingual_status() ) { |
|
2003 | +function get_page_id_geodir_add_listing_page($page_id) { |
|
2004 | + if (geodir_wpml_multilingual_status()) { |
|
2005 | 2005 | $post_type = 'post_page'; |
2006 | - $page_id = geodir_get_wpml_element_id( $page_id, $post_type ); |
|
2006 | + $page_id = geodir_get_wpml_element_id($page_id, $post_type); |
|
2007 | 2007 | } |
2008 | 2008 | |
2009 | 2009 | return $page_id; |
@@ -2017,7 +2017,7 @@ discard block |
||
2017 | 2017 | * @return bool Returns true when sitepress multilingual CMS active. else returns false. |
2018 | 2018 | */ |
2019 | 2019 | function geodir_wpml_multilingual_status() { |
2020 | - if ( function_exists( 'icl_object_id' ) ) { |
|
2020 | + if (function_exists('icl_object_id')) { |
|
2021 | 2021 | return true; |
2022 | 2022 | } |
2023 | 2023 | |
@@ -2035,19 +2035,19 @@ discard block |
||
2035 | 2035 | * |
2036 | 2036 | * @return int Element ID when exists. Else the page id. |
2037 | 2037 | */ |
2038 | -function geodir_get_wpml_element_id( $page_id, $post_type ) { |
|
2038 | +function geodir_get_wpml_element_id($page_id, $post_type) { |
|
2039 | 2039 | global $sitepress; |
2040 | - if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) { |
|
2041 | - $trid = $sitepress->get_element_trid( $page_id, $post_type ); |
|
2040 | + if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) { |
|
2041 | + $trid = $sitepress->get_element_trid($page_id, $post_type); |
|
2042 | 2042 | |
2043 | - if ( $trid > 0 ) { |
|
2044 | - $translations = $sitepress->get_element_translations( $trid, $post_type ); |
|
2043 | + if ($trid > 0) { |
|
2044 | + $translations = $sitepress->get_element_translations($trid, $post_type); |
|
2045 | 2045 | |
2046 | 2046 | $lang = $sitepress->get_current_language(); |
2047 | 2047 | $lang = $lang ? $lang : $sitepress->get_default_language(); |
2048 | 2048 | |
2049 | - if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) { |
|
2050 | - $page_id = $translations[ $lang ]->element_id; |
|
2049 | + if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) { |
|
2050 | + $page_id = $translations[$lang]->element_id; |
|
2051 | 2051 | } |
2052 | 2052 | } |
2053 | 2053 | } |
@@ -2064,15 +2064,15 @@ discard block |
||
2064 | 2064 | */ |
2065 | 2065 | function geodir_wpml_check_element_id() { |
2066 | 2066 | global $sitepress; |
2067 | - if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) { |
|
2067 | + if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) { |
|
2068 | 2068 | $el_type = 'post_page'; |
2069 | - $el_id = get_option( 'geodir_add_listing_page' ); |
|
2069 | + $el_id = get_option('geodir_add_listing_page'); |
|
2070 | 2070 | $default_lang = $sitepress->get_default_language(); |
2071 | - $el_details = $sitepress->get_element_language_details( $el_id, $el_type ); |
|
2071 | + $el_details = $sitepress->get_element_language_details($el_id, $el_type); |
|
2072 | 2072 | |
2073 | - if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) { |
|
2074 | - if ( ! $el_details->source_language_code ) { |
|
2075 | - $sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang ); |
|
2073 | + if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) { |
|
2074 | + if (!$el_details->source_language_code) { |
|
2075 | + $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang); |
|
2076 | 2076 | $sitepress->icl_translations_cache->clear(); |
2077 | 2077 | } |
2078 | 2078 | } |
@@ -2091,41 +2091,41 @@ discard block |
||
2091 | 2091 | * |
2092 | 2092 | * @return string Orderby SQL. |
2093 | 2093 | */ |
2094 | -function geodir_widget_listings_get_order( $query_args ) { |
|
2094 | +function geodir_widget_listings_get_order($query_args) { |
|
2095 | 2095 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
2096 | 2096 | |
2097 | 2097 | $query_args = $gd_query_args_widgets; |
2098 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) { |
|
2099 | - return $wpdb->posts . ".post_date DESC, "; |
|
2098 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2099 | + return $wpdb->posts.".post_date DESC, "; |
|
2100 | 2100 | } |
2101 | 2101 | |
2102 | - $post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type']; |
|
2103 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2102 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
2103 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2104 | 2104 | |
2105 | - $sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : ''; |
|
2105 | + $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : ''; |
|
2106 | 2106 | |
2107 | - switch ( $sort_by ) { |
|
2107 | + switch ($sort_by) { |
|
2108 | 2108 | case 'latest': |
2109 | 2109 | case 'newest': |
2110 | - $orderby = $wpdb->posts . ".post_date DESC, "; |
|
2110 | + $orderby = $wpdb->posts.".post_date DESC, "; |
|
2111 | 2111 | break; |
2112 | 2112 | case 'featured': |
2113 | - $orderby = $table . ".is_featured ASC, "; |
|
2113 | + $orderby = $table.".is_featured ASC, "; |
|
2114 | 2114 | break; |
2115 | 2115 | case 'az': |
2116 | - $orderby = $wpdb->posts . ".post_title ASC, "; |
|
2116 | + $orderby = $wpdb->posts.".post_title ASC, "; |
|
2117 | 2117 | break; |
2118 | 2118 | case 'high_review': |
2119 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
2119 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
2120 | 2120 | break; |
2121 | 2121 | case 'high_rating': |
2122 | - $orderby = "( " . $table . ".overall_rating ) DESC, "; |
|
2122 | + $orderby = "( ".$table.".overall_rating ) DESC, "; |
|
2123 | 2123 | break; |
2124 | 2124 | case 'random': |
2125 | 2125 | $orderby = "RAND(), "; |
2126 | 2126 | break; |
2127 | 2127 | default: |
2128 | - $orderby = $wpdb->posts . ".post_title ASC, "; |
|
2128 | + $orderby = $wpdb->posts.".post_title ASC, "; |
|
2129 | 2129 | break; |
2130 | 2130 | } |
2131 | 2131 | |
@@ -2147,15 +2147,15 @@ discard block |
||
2147 | 2147 | * |
2148 | 2148 | * @return mixed Result object. |
2149 | 2149 | */ |
2150 | -function geodir_get_widget_listings( $query_args = array(), $count_only = false ) { |
|
2150 | +function geodir_get_widget_listings($query_args = array(), $count_only = false) { |
|
2151 | 2151 | global $wpdb, $plugin_prefix, $table_prefix; |
2152 | 2152 | $GLOBALS['gd_query_args_widgets'] = $query_args; |
2153 | 2153 | $gd_query_args_widgets = $query_args; |
2154 | 2154 | |
2155 | - $post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type']; |
|
2156 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2155 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
2156 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2157 | 2157 | |
2158 | - $fields = $wpdb->posts . ".*, " . $table . ".*"; |
|
2158 | + $fields = $wpdb->posts.".*, ".$table.".*"; |
|
2159 | 2159 | /** |
2160 | 2160 | * Filter widget listing fields string part that is being used for query. |
2161 | 2161 | * |
@@ -2165,17 +2165,17 @@ discard block |
||
2165 | 2165 | * @param string $table Table name. |
2166 | 2166 | * @param string $post_type Post type. |
2167 | 2167 | */ |
2168 | - $fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type ); |
|
2168 | + $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type); |
|
2169 | 2169 | |
2170 | - $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)"; |
|
2170 | + $join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)"; |
|
2171 | 2171 | |
2172 | 2172 | ########### WPML ########### |
2173 | 2173 | |
2174 | - if ( function_exists( 'icl_object_id' ) ) { |
|
2174 | + if (function_exists('icl_object_id')) { |
|
2175 | 2175 | global $sitepress; |
2176 | 2176 | $lang_code = ICL_LANGUAGE_CODE; |
2177 | - if ( $lang_code ) { |
|
2178 | - $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
2177 | + if ($lang_code) { |
|
2178 | + $join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
2179 | 2179 | } |
2180 | 2180 | } |
2181 | 2181 | |
@@ -2189,15 +2189,15 @@ discard block |
||
2189 | 2189 | * @param string $join Join clause string. |
2190 | 2190 | * @param string $post_type Post type. |
2191 | 2191 | */ |
2192 | - $join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type ); |
|
2192 | + $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type); |
|
2193 | 2193 | |
2194 | - $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : ''; |
|
2194 | + $post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : ''; |
|
2195 | 2195 | |
2196 | - $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'"; |
|
2196 | + $where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'"; |
|
2197 | 2197 | |
2198 | 2198 | ########### WPML ########### |
2199 | - if ( function_exists( 'icl_object_id' ) ) { |
|
2200 | - if ( $lang_code ) { |
|
2199 | + if (function_exists('icl_object_id')) { |
|
2200 | + if ($lang_code) { |
|
2201 | 2201 | $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' "; |
2202 | 2202 | } |
2203 | 2203 | } |
@@ -2210,8 +2210,8 @@ discard block |
||
2210 | 2210 | * @param string $where Where clause string. |
2211 | 2211 | * @param string $post_type Post type. |
2212 | 2212 | */ |
2213 | - $where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type ); |
|
2214 | - $where = $where != '' ? " WHERE 1=1 " . $where : ''; |
|
2213 | + $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type); |
|
2214 | + $where = $where != '' ? " WHERE 1=1 ".$where : ''; |
|
2215 | 2215 | |
2216 | 2216 | $groupby = " GROUP BY $wpdb->posts.ID "; |
2217 | 2217 | /** |
@@ -2222,15 +2222,15 @@ discard block |
||
2222 | 2222 | * @param string $groupby Group by clause string. |
2223 | 2223 | * @param string $post_type Post type. |
2224 | 2224 | */ |
2225 | - $groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type ); |
|
2225 | + $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type); |
|
2226 | 2226 | |
2227 | - if ( $count_only ) { |
|
2228 | - $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . " |
|
2229 | - " . $join . " |
|
2227 | + if ($count_only) { |
|
2228 | + $sql = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts." |
|
2229 | + " . $join." |
|
2230 | 2230 | " . $where; |
2231 | - $rows = (int) $wpdb->get_var( $sql ); |
|
2231 | + $rows = (int) $wpdb->get_var($sql); |
|
2232 | 2232 | } else { |
2233 | - $orderby = geodir_widget_listings_get_order( $query_args ); |
|
2233 | + $orderby = geodir_widget_listings_get_order($query_args); |
|
2234 | 2234 | /** |
2235 | 2235 | * Filter widget listing orderby clause string part that is being used for query. |
2236 | 2236 | * |
@@ -2240,11 +2240,11 @@ discard block |
||
2240 | 2240 | * @param string $table Table name. |
2241 | 2241 | * @param string $post_type Post type. |
2242 | 2242 | */ |
2243 | - $orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type ); |
|
2244 | - $orderby .= $wpdb->posts . ".post_title ASC"; |
|
2245 | - $orderby = $orderby != '' ? " ORDER BY " . $orderby : ''; |
|
2243 | + $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type); |
|
2244 | + $orderby .= $wpdb->posts.".post_title ASC"; |
|
2245 | + $orderby = $orderby != '' ? " ORDER BY ".$orderby : ''; |
|
2246 | 2246 | |
2247 | - $limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5; |
|
2247 | + $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5; |
|
2248 | 2248 | /** |
2249 | 2249 | * Filter widget listing limit that is being used for query. |
2250 | 2250 | * |
@@ -2253,26 +2253,26 @@ discard block |
||
2253 | 2253 | * @param int $limit Query results limit. |
2254 | 2254 | * @param string $post_type Post type. |
2255 | 2255 | */ |
2256 | - $limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type ); |
|
2256 | + $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type); |
|
2257 | 2257 | |
2258 | - $page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1; |
|
2259 | - if ( ! $page ) { |
|
2258 | + $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1; |
|
2259 | + if (!$page) { |
|
2260 | 2260 | $page = 1; |
2261 | 2261 | } |
2262 | 2262 | |
2263 | - $limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : ""; |
|
2263 | + $limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : ""; |
|
2264 | 2264 | |
2265 | - $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . " |
|
2266 | - " . $join . " |
|
2267 | - " . $where . " |
|
2268 | - " . $groupby . " |
|
2269 | - " . $orderby . " |
|
2265 | + $sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts." |
|
2266 | + " . $join." |
|
2267 | + " . $where." |
|
2268 | + " . $groupby." |
|
2269 | + " . $orderby." |
|
2270 | 2270 | " . $limit; |
2271 | - $rows = $wpdb->get_results( $sql ); |
|
2271 | + $rows = $wpdb->get_results($sql); |
|
2272 | 2272 | } |
2273 | 2273 | |
2274 | - unset( $GLOBALS['gd_query_args_widgets'] ); |
|
2275 | - unset( $gd_query_args_widgets ); |
|
2274 | + unset($GLOBALS['gd_query_args_widgets']); |
|
2275 | + unset($gd_query_args_widgets); |
|
2276 | 2276 | |
2277 | 2277 | return $rows; |
2278 | 2278 | } |
@@ -2289,11 +2289,11 @@ discard block |
||
2289 | 2289 | * |
2290 | 2290 | * @return string Modified fields SQL. |
2291 | 2291 | */ |
2292 | -function geodir_function_widget_listings_fields( $fields ) { |
|
2292 | +function geodir_function_widget_listings_fields($fields) { |
|
2293 | 2293 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
2294 | 2294 | |
2295 | 2295 | $query_args = $gd_query_args_widgets; |
2296 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) { |
|
2296 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2297 | 2297 | return $fields; |
2298 | 2298 | } |
2299 | 2299 | |
@@ -2312,24 +2312,24 @@ discard block |
||
2312 | 2312 | * |
2313 | 2313 | * @return string Modified join clause SQL. |
2314 | 2314 | */ |
2315 | -function geodir_function_widget_listings_join( $join ) { |
|
2315 | +function geodir_function_widget_listings_join($join) { |
|
2316 | 2316 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
2317 | 2317 | |
2318 | 2318 | $query_args = $gd_query_args_widgets; |
2319 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) { |
|
2319 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2320 | 2320 | return $join; |
2321 | 2321 | } |
2322 | 2322 | |
2323 | - $post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type']; |
|
2324 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2323 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
2324 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2325 | 2325 | |
2326 | - if ( ! empty( $query_args['with_pics_only'] ) ) { |
|
2327 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
2326 | + if (!empty($query_args['with_pics_only'])) { |
|
2327 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
2328 | 2328 | } |
2329 | 2329 | |
2330 | - if ( ! empty( $query_args['tax_query'] ) ) { |
|
2331 | - $tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' ); |
|
2332 | - if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) { |
|
2330 | + if (!empty($query_args['tax_query'])) { |
|
2331 | + $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID'); |
|
2332 | + if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) { |
|
2333 | 2333 | $join .= $tax_queries['join']; |
2334 | 2334 | } |
2335 | 2335 | } |
@@ -2349,49 +2349,49 @@ discard block |
||
2349 | 2349 | * |
2350 | 2350 | * @return string Modified where clause SQL. |
2351 | 2351 | */ |
2352 | -function geodir_function_widget_listings_where( $where ) { |
|
2352 | +function geodir_function_widget_listings_where($where) { |
|
2353 | 2353 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
2354 | 2354 | |
2355 | 2355 | $query_args = $gd_query_args_widgets; |
2356 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) { |
|
2356 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2357 | 2357 | return $where; |
2358 | 2358 | } |
2359 | - $post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type']; |
|
2360 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
2359 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
2360 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
2361 | 2361 | |
2362 | - if ( ! empty( $query_args ) ) { |
|
2363 | - if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) { |
|
2364 | - $where = geodir_default_location_where( $where, $table ); |
|
2362 | + if (!empty($query_args)) { |
|
2363 | + if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) { |
|
2364 | + $where = geodir_default_location_where($where, $table); |
|
2365 | 2365 | } |
2366 | 2366 | |
2367 | - if ( ! empty( $query_args['post_author'] ) ) { |
|
2368 | - $where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author']; |
|
2367 | + if (!empty($query_args['post_author'])) { |
|
2368 | + $where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author']; |
|
2369 | 2369 | } |
2370 | 2370 | |
2371 | - if ( ! empty( $query_args['show_featured_only'] ) ) { |
|
2372 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
2371 | + if (!empty($query_args['show_featured_only'])) { |
|
2372 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
2373 | 2373 | } |
2374 | 2374 | |
2375 | - if ( ! empty( $query_args['show_special_only'] ) ) { |
|
2376 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
2375 | + if (!empty($query_args['show_special_only'])) { |
|
2376 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
2377 | 2377 | } |
2378 | 2378 | |
2379 | - if ( ! empty( $query_args['with_pics_only'] ) ) { |
|
2380 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL "; |
|
2379 | + if (!empty($query_args['with_pics_only'])) { |
|
2380 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL "; |
|
2381 | 2381 | } |
2382 | 2382 | |
2383 | - if ( ! empty( $query_args['featured_image_only'] ) ) { |
|
2384 | - $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' "; |
|
2383 | + if (!empty($query_args['featured_image_only'])) { |
|
2384 | + $where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' "; |
|
2385 | 2385 | } |
2386 | 2386 | |
2387 | - if ( ! empty( $query_args['with_videos_only'] ) ) { |
|
2388 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
2387 | + if (!empty($query_args['with_videos_only'])) { |
|
2388 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
2389 | 2389 | } |
2390 | 2390 | |
2391 | - if ( ! empty( $query_args['tax_query'] ) ) { |
|
2392 | - $tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' ); |
|
2391 | + if (!empty($query_args['tax_query'])) { |
|
2392 | + $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID'); |
|
2393 | 2393 | |
2394 | - if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) { |
|
2394 | + if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) { |
|
2395 | 2395 | $where .= $tax_queries['where']; |
2396 | 2396 | } |
2397 | 2397 | } |
@@ -2412,11 +2412,11 @@ discard block |
||
2412 | 2412 | * |
2413 | 2413 | * @return string Modified orderby clause SQL. |
2414 | 2414 | */ |
2415 | -function geodir_function_widget_listings_orderby( $orderby ) { |
|
2415 | +function geodir_function_widget_listings_orderby($orderby) { |
|
2416 | 2416 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
2417 | 2417 | |
2418 | 2418 | $query_args = $gd_query_args_widgets; |
2419 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) { |
|
2419 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2420 | 2420 | return $orderby; |
2421 | 2421 | } |
2422 | 2422 | |
@@ -2435,15 +2435,15 @@ discard block |
||
2435 | 2435 | * |
2436 | 2436 | * @return int Query limit. |
2437 | 2437 | */ |
2438 | -function geodir_function_widget_listings_limit( $limit ) { |
|
2438 | +function geodir_function_widget_listings_limit($limit) { |
|
2439 | 2439 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
2440 | 2440 | |
2441 | 2441 | $query_args = $gd_query_args_widgets; |
2442 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) { |
|
2442 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) { |
|
2443 | 2443 | return $limit; |
2444 | 2444 | } |
2445 | 2445 | |
2446 | - if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) { |
|
2446 | + if (!empty($query_args) && !empty($query_args['posts_per_page'])) { |
|
2447 | 2447 | $limit = (int) $query_args['posts_per_page']; |
2448 | 2448 | } |
2449 | 2449 | |
@@ -2461,12 +2461,12 @@ discard block |
||
2461 | 2461 | * |
2462 | 2462 | * @return int Large size width. |
2463 | 2463 | */ |
2464 | -function geodir_media_image_large_width( $default = 800, $params = '' ) { |
|
2465 | - $large_size_w = get_option( 'large_size_w' ); |
|
2464 | +function geodir_media_image_large_width($default = 800, $params = '') { |
|
2465 | + $large_size_w = get_option('large_size_w'); |
|
2466 | 2466 | $large_size_w = $large_size_w > 0 ? $large_size_w : $default; |
2467 | - $large_size_w = absint( $large_size_w ); |
|
2467 | + $large_size_w = absint($large_size_w); |
|
2468 | 2468 | |
2469 | - if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) { |
|
2469 | + if (!get_option('geodir_use_wp_media_large_size')) { |
|
2470 | 2470 | $large_size_w = 800; |
2471 | 2471 | } |
2472 | 2472 | |
@@ -2479,7 +2479,7 @@ discard block |
||
2479 | 2479 | * @param int $default Default width. |
2480 | 2480 | * @param string|array $params Image parameters. |
2481 | 2481 | */ |
2482 | - $large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params ); |
|
2482 | + $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params); |
|
2483 | 2483 | |
2484 | 2484 | return $large_size_w; |
2485 | 2485 | } |
@@ -2495,12 +2495,12 @@ discard block |
||
2495 | 2495 | * |
2496 | 2496 | * @return int Large size height. |
2497 | 2497 | */ |
2498 | -function geodir_media_image_large_height( $default = 800, $params = '' ) { |
|
2499 | - $large_size_h = get_option( 'large_size_h' ); |
|
2498 | +function geodir_media_image_large_height($default = 800, $params = '') { |
|
2499 | + $large_size_h = get_option('large_size_h'); |
|
2500 | 2500 | $large_size_h = $large_size_h > 0 ? $large_size_h : $default; |
2501 | - $large_size_h = absint( $large_size_h ); |
|
2501 | + $large_size_h = absint($large_size_h); |
|
2502 | 2502 | |
2503 | - if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) { |
|
2503 | + if (!get_option('geodir_use_wp_media_large_size')) { |
|
2504 | 2504 | $large_size_h = 800; |
2505 | 2505 | } |
2506 | 2506 | |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | * @param int $default Default height. |
2514 | 2514 | * @param string|array $params Image parameters. |
2515 | 2515 | */ |
2516 | - $large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params ); |
|
2516 | + $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params); |
|
2517 | 2517 | |
2518 | 2518 | return $large_size_h; |
2519 | 2519 | } |
@@ -2530,8 +2530,8 @@ discard block |
||
2530 | 2530 | * |
2531 | 2531 | * @return string Sanitized name. |
2532 | 2532 | */ |
2533 | -function geodir_sanitize_location_name( $type, $name, $translate = true ) { |
|
2534 | - if ( $name == '' ) { |
|
2533 | +function geodir_sanitize_location_name($type, $name, $translate = true) { |
|
2534 | + if ($name == '') { |
|
2535 | 2535 | return null; |
2536 | 2536 | } |
2537 | 2537 | |
@@ -2540,13 +2540,13 @@ discard block |
||
2540 | 2540 | $type = $type == 'gd_city' ? 'city' : $type; |
2541 | 2541 | |
2542 | 2542 | $return = $name; |
2543 | - if ( function_exists( 'get_actual_location_name' ) ) { |
|
2544 | - $return = get_actual_location_name( $type, $name, $translate ); |
|
2543 | + if (function_exists('get_actual_location_name')) { |
|
2544 | + $return = get_actual_location_name($type, $name, $translate); |
|
2545 | 2545 | } else { |
2546 | - $return = preg_replace( '/-(\d+)$/', '', $return ); |
|
2547 | - $return = preg_replace( '/[_-]/', ' ', $return ); |
|
2548 | - $return = geodir_ucwords( $return ); |
|
2549 | - $return = $translate ? __( $return, 'geodirectory' ) : $return; |
|
2546 | + $return = preg_replace('/-(\d+)$/', '', $return); |
|
2547 | + $return = preg_replace('/[_-]/', ' ', $return); |
|
2548 | + $return = geodir_ucwords($return); |
|
2549 | + $return = $translate ? __($return, 'geodirectory') : $return; |
|
2550 | 2550 | } |
2551 | 2551 | |
2552 | 2552 | return $return; |
@@ -2561,14 +2561,14 @@ discard block |
||
2561 | 2561 | * |
2562 | 2562 | * @param int $number Comments number. |
2563 | 2563 | */ |
2564 | -function geodir_comments_number( $number ) { |
|
2564 | +function geodir_comments_number($number) { |
|
2565 | 2565 | |
2566 | - if ( $number > 1 ) { |
|
2567 | - $output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) ); |
|
2568 | - } elseif ( $number == 0 || $number == '' ) { |
|
2569 | - $output = __( 'No Reviews', 'geodirectory' ); |
|
2566 | + if ($number > 1) { |
|
2567 | + $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory')); |
|
2568 | + } elseif ($number == 0 || $number == '') { |
|
2569 | + $output = __('No Reviews', 'geodirectory'); |
|
2570 | 2570 | } else { // must be one |
2571 | - $output = __( '1 Review', 'geodirectory' ); |
|
2571 | + $output = __('1 Review', 'geodirectory'); |
|
2572 | 2572 | } |
2573 | 2573 | echo $output; |
2574 | 2574 | } |
@@ -2583,18 +2583,18 @@ discard block |
||
2583 | 2583 | */ |
2584 | 2584 | function is_page_geodir_home() { |
2585 | 2585 | global $wpdb; |
2586 | - $cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() ); |
|
2587 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
2588 | - remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
2586 | + $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL()); |
|
2587 | + if (function_exists('geodir_location_geo_home_link')) { |
|
2588 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
2589 | 2589 | } |
2590 | - $home_url = home_url( '', 'http' ); |
|
2591 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) { |
|
2592 | - add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
2590 | + $home_url = home_url('', 'http'); |
|
2591 | + if (function_exists('geodir_location_geo_home_link')) { |
|
2592 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
2593 | 2593 | } |
2594 | - $home_url = str_replace( "www.", "", $home_url ); |
|
2595 | - if ( ( strpos( $home_url, $cur_url ) !== false || strpos( $home_url . '/', $cur_url ) !== false ) && ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) ) { |
|
2594 | + $home_url = str_replace("www.", "", $home_url); |
|
2595 | + if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) { |
|
2596 | 2596 | return true; |
2597 | - } elseif ( get_query_var( 'page_id' ) == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) { |
|
2597 | + } elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) { |
|
2598 | 2598 | return true; |
2599 | 2599 | } else { |
2600 | 2600 | return false; |
@@ -2614,18 +2614,18 @@ discard block |
||
2614 | 2614 | * |
2615 | 2615 | * @return string The canonical URL. |
2616 | 2616 | */ |
2617 | -function geodir_wpseo_homepage_canonical( $url ) { |
|
2617 | +function geodir_wpseo_homepage_canonical($url) { |
|
2618 | 2618 | global $post; |
2619 | 2619 | |
2620 | - if ( is_page_geodir_home() ) { |
|
2620 | + if (is_page_geodir_home()) { |
|
2621 | 2621 | return home_url(); |
2622 | 2622 | } |
2623 | 2623 | |
2624 | 2624 | return $url; |
2625 | 2625 | } |
2626 | 2626 | |
2627 | -add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 ); |
|
2628 | -add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 ); |
|
2627 | +add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10); |
|
2628 | +add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10); |
|
2629 | 2629 | |
2630 | 2630 | /** |
2631 | 2631 | * Add extra fields to google maps script call. |
@@ -2638,20 +2638,20 @@ discard block |
||
2638 | 2638 | * |
2639 | 2639 | * @return string Modified extra string. |
2640 | 2640 | */ |
2641 | -function geodir_googlemap_script_extra_details_page( $extra ) { |
|
2641 | +function geodir_googlemap_script_extra_details_page($extra) { |
|
2642 | 2642 | global $post; |
2643 | 2643 | $add_google_places_api = false; |
2644 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) { |
|
2644 | + if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) { |
|
2645 | 2645 | $add_google_places_api = true; |
2646 | 2646 | } |
2647 | - if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) { |
|
2647 | + if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) { |
|
2648 | 2648 | $extra .= "&libraries=places"; |
2649 | 2649 | } |
2650 | 2650 | |
2651 | 2651 | return $extra; |
2652 | 2652 | } |
2653 | 2653 | |
2654 | -add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 ); |
|
2654 | +add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1); |
|
2655 | 2655 | |
2656 | 2656 | |
2657 | 2657 | /** |
@@ -2669,99 +2669,99 @@ discard block |
||
2669 | 2669 | * after_widget. |
2670 | 2670 | * @param array|string $instance The settings for the particular instance of the widget. |
2671 | 2671 | */ |
2672 | -function geodir_popular_post_category_output( $args = '', $instance = '' ) { |
|
2672 | +function geodir_popular_post_category_output($args = '', $instance = '') { |
|
2673 | 2673 | // prints the widget |
2674 | 2674 | global $wpdb, $plugin_prefix, $geodir_post_category_str; |
2675 | - extract( $args, EXTR_SKIP ); |
|
2675 | + extract($args, EXTR_SKIP); |
|
2676 | 2676 | |
2677 | 2677 | echo $before_widget; |
2678 | 2678 | |
2679 | 2679 | /** This filter is documented in geodirectory_widgets.php */ |
2680 | - $title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) ); |
|
2680 | + $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2681 | 2681 | |
2682 | 2682 | $gd_post_type = geodir_get_current_posttype(); |
2683 | 2683 | |
2684 | - $category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15; |
|
2685 | - if ( ! empty( $gd_post_type ) ) { |
|
2684 | + $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15; |
|
2685 | + if (!empty($gd_post_type)) { |
|
2686 | 2686 | $default_post_type = $gd_post_type; |
2687 | - } elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) { |
|
2687 | + } elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) { |
|
2688 | 2688 | $default_post_type = $instance['default_post_type']; |
2689 | 2689 | } else { |
2690 | 2690 | $all_gd_post_type = geodir_get_posttypes(); |
2691 | - $default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : ''; |
|
2691 | + $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : ''; |
|
2692 | 2692 | } |
2693 | - $parent_only = !empty( $instance['parent_only'] ) ? true : false; |
|
2693 | + $parent_only = !empty($instance['parent_only']) ? true : false; |
|
2694 | 2694 | |
2695 | 2695 | $taxonomy = array(); |
2696 | - if ( ! empty( $gd_post_type ) ) { |
|
2697 | - $taxonomy[] = $gd_post_type . "category"; |
|
2696 | + if (!empty($gd_post_type)) { |
|
2697 | + $taxonomy[] = $gd_post_type."category"; |
|
2698 | 2698 | } else { |
2699 | - $taxonomy = geodir_get_taxonomies( $gd_post_type ); |
|
2699 | + $taxonomy = geodir_get_taxonomies($gd_post_type); |
|
2700 | 2700 | } |
2701 | 2701 | |
2702 | - $term_args = array( 'taxonomy' => $taxonomy ); |
|
2703 | - if ( $parent_only ) { |
|
2702 | + $term_args = array('taxonomy' => $taxonomy); |
|
2703 | + if ($parent_only) { |
|
2704 | 2704 | $term_args['parent'] = 0; |
2705 | 2705 | } |
2706 | 2706 | |
2707 | - $terms = get_terms( $term_args ); |
|
2707 | + $terms = get_terms($term_args); |
|
2708 | 2708 | $a_terms = array(); |
2709 | 2709 | $b_terms = array(); |
2710 | 2710 | |
2711 | - foreach ( $terms as $term ) { |
|
2712 | - if ( $term->count > 0 ) { |
|
2713 | - $a_terms[ $term->taxonomy ][] = $term; |
|
2711 | + foreach ($terms as $term) { |
|
2712 | + if ($term->count > 0) { |
|
2713 | + $a_terms[$term->taxonomy][] = $term; |
|
2714 | 2714 | } |
2715 | 2715 | } |
2716 | 2716 | |
2717 | - if ( ! empty( $a_terms ) ) { |
|
2718 | - foreach ( $a_terms as $b_key => $b_val ) { |
|
2719 | - $b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' ); |
|
2717 | + if (!empty($a_terms)) { |
|
2718 | + foreach ($a_terms as $b_key => $b_val) { |
|
2719 | + $b_terms[$b_key] = geodir_sort_terms($b_val, 'count'); |
|
2720 | 2720 | } |
2721 | 2721 | |
2722 | - $default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : ''; |
|
2722 | + $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : ''; |
|
2723 | 2723 | |
2724 | 2724 | $tax_change_output = ''; |
2725 | - if ( count( $b_terms ) > 1 ) { |
|
2726 | - $tax_change_output .= "<select data-limit='$category_limit' data-parent='" . (int)$parent_only . "' class='geodir-cat-list-tax' onchange='geodir_get_post_term(this);'>"; |
|
2727 | - foreach ( $b_terms as $key => $val ) { |
|
2728 | - $ptype = get_post_type_object( str_replace( "category", "", $key ) ); |
|
2729 | - $cpt_name = __( $ptype->labels->singular_name, 'geodirectory' ); |
|
2730 | - $tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>"; |
|
2725 | + if (count($b_terms) > 1) { |
|
2726 | + $tax_change_output .= "<select data-limit='$category_limit' data-parent='".(int) $parent_only."' class='geodir-cat-list-tax' onchange='geodir_get_post_term(this);'>"; |
|
2727 | + foreach ($b_terms as $key => $val) { |
|
2728 | + $ptype = get_post_type_object(str_replace("category", "", $key)); |
|
2729 | + $cpt_name = __($ptype->labels->singular_name, 'geodirectory'); |
|
2730 | + $tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>"; |
|
2731 | 2731 | } |
2732 | 2732 | $tax_change_output .= "</select>"; |
2733 | 2733 | } |
2734 | 2734 | |
2735 | - if ( ! empty( $b_terms ) ) { |
|
2736 | - $terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array |
|
2737 | - global $cat_count;//make global so we can change via function |
|
2735 | + if (!empty($b_terms)) { |
|
2736 | + $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array |
|
2737 | + global $cat_count; //make global so we can change via function |
|
2738 | 2738 | $cat_count = 0; |
2739 | 2739 | ?> |
2740 | 2740 | <div class="geodir-category-list-in clearfix"> |
2741 | 2741 | <div class="geodir-cat-list clearfix"> |
2742 | 2742 | <?php |
2743 | - echo $before_title . __( $title ) . $after_title; |
|
2743 | + echo $before_title.__($title).$after_title; |
|
2744 | 2744 | |
2745 | 2745 | echo $tax_change_output; |
2746 | 2746 | |
2747 | 2747 | echo '<ul class="geodir-popular-cat-list">'; |
2748 | 2748 | |
2749 | - geodir_helper_cat_list_output( $terms, $category_limit ); |
|
2749 | + geodir_helper_cat_list_output($terms, $category_limit); |
|
2750 | 2750 | |
2751 | 2751 | echo '</ul>'; |
2752 | 2752 | ?> |
2753 | 2753 | </div> |
2754 | 2754 | <?php |
2755 | 2755 | $hide = ''; |
2756 | - if ( $cat_count < $category_limit ) { |
|
2756 | + if ($cat_count < $category_limit) { |
|
2757 | 2757 | $hide = 'style="display:none;"'; |
2758 | 2758 | } |
2759 | 2759 | echo "<div class='geodir-cat-list-more' $hide >"; |
2760 | - echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>'; |
|
2761 | - echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>'; |
|
2760 | + echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>'; |
|
2761 | + echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>'; |
|
2762 | 2762 | echo "</div>"; |
2763 | 2763 | /* add scripts */ |
2764 | - add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 ); |
|
2764 | + add_action('wp_footer', 'geodir_popular_category_add_scripts', 100); |
|
2765 | 2765 | ?> |
2766 | 2766 | </div> |
2767 | 2767 | <?php |
@@ -2780,25 +2780,25 @@ discard block |
||
2780 | 2780 | * @param array $terms An array of term objects. |
2781 | 2781 | * @param int $category_limit Number of categories to display by default. |
2782 | 2782 | */ |
2783 | -function geodir_helper_cat_list_output( $terms, $category_limit ) { |
|
2783 | +function geodir_helper_cat_list_output($terms, $category_limit) { |
|
2784 | 2784 | global $geodir_post_category_str, $cat_count; |
2785 | 2785 | $term_icons = geodir_get_term_icon(); |
2786 | 2786 | |
2787 | 2787 | $geodir_post_category_str = array(); |
2788 | 2788 | |
2789 | 2789 | |
2790 | - foreach ( $terms as $cat ) { |
|
2791 | - $post_type = str_replace( "category", "", $cat->taxonomy ); |
|
2792 | - $term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : ''; |
|
2790 | + foreach ($terms as $cat) { |
|
2791 | + $post_type = str_replace("category", "", $cat->taxonomy); |
|
2792 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : ''; |
|
2793 | 2793 | |
2794 | - $cat_count ++; |
|
2794 | + $cat_count++; |
|
2795 | 2795 | |
2796 | - $geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id ); |
|
2796 | + $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id); |
|
2797 | 2797 | |
2798 | 2798 | $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show'; |
2799 | 2799 | $total_post = $cat->count; |
2800 | 2800 | |
2801 | - $term_link = get_term_link( $cat, $cat->taxonomy ); |
|
2801 | + $term_link = get_term_link($cat, $cat->taxonomy); |
|
2802 | 2802 | /** |
2803 | 2803 | * Filer the category term link. |
2804 | 2804 | * |
@@ -2808,11 +2808,11 @@ discard block |
||
2808 | 2808 | * @param int $cat ->term_id The term id. |
2809 | 2809 | * @param string $post_type Wordpress post type. |
2810 | 2810 | */ |
2811 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type ); |
|
2811 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type); |
|
2812 | 2812 | |
2813 | - echo '<li class="' . $class_row . '"><a href="' . $term_link . '">'; |
|
2814 | - echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; |
|
2815 | - echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> '; |
|
2813 | + echo '<li class="'.$class_row.'"><a href="'.$term_link.'">'; |
|
2814 | + echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">'; |
|
2815 | + echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> '; |
|
2816 | 2816 | echo '</a></li>'; |
2817 | 2817 | } |
2818 | 2818 | } |
@@ -2827,14 +2827,14 @@ discard block |
||
2827 | 2827 | * @param array|string $args Display arguments including before_title, after_title, before_widget, and after_widget. |
2828 | 2828 | * @param array|string $instance The settings for the particular instance of the widget. |
2829 | 2829 | */ |
2830 | -function geodir_listing_slider_widget_output( $args = '', $instance = '' ) { |
|
2830 | +function geodir_listing_slider_widget_output($args = '', $instance = '') { |
|
2831 | 2831 | // prints the widget |
2832 | - extract( $args, EXTR_SKIP ); |
|
2832 | + extract($args, EXTR_SKIP); |
|
2833 | 2833 | |
2834 | 2834 | echo $before_widget; |
2835 | 2835 | |
2836 | 2836 | /** This filter is documented in geodirectory_widgets.php */ |
2837 | - $title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) ); |
|
2837 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
2838 | 2838 | /** |
2839 | 2839 | * Filter the widget post type. |
2840 | 2840 | * |
@@ -2842,7 +2842,7 @@ discard block |
||
2842 | 2842 | * |
2843 | 2843 | * @param string $instance ['post_type'] Post type of listing. |
2844 | 2844 | */ |
2845 | - $post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] ); |
|
2845 | + $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']); |
|
2846 | 2846 | /** |
2847 | 2847 | * Filter the widget's term. |
2848 | 2848 | * |
@@ -2850,7 +2850,7 @@ discard block |
||
2850 | 2850 | * |
2851 | 2851 | * @param string $instance ['category'] Filter by term. Can be any valid term. |
2852 | 2852 | */ |
2853 | - $category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] ); |
|
2853 | + $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']); |
|
2854 | 2854 | /** |
2855 | 2855 | * Filter the widget listings limit. |
2856 | 2856 | * |
@@ -2858,7 +2858,7 @@ discard block |
||
2858 | 2858 | * |
2859 | 2859 | * @param string $instance ['post_number'] Number of listings to display. |
2860 | 2860 | */ |
2861 | - $post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] ); |
|
2861 | + $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
|
2862 | 2862 | /** |
2863 | 2863 | * Filter the widget listings limit shown at one time. |
2864 | 2864 | * |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | * |
2867 | 2867 | * @param string $instance ['max_show'] Number of listings to display on screen. |
2868 | 2868 | */ |
2869 | - $max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] ); |
|
2869 | + $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']); |
|
2870 | 2870 | /** |
2871 | 2871 | * Filter the widget slide width. |
2872 | 2872 | * |
@@ -2874,7 +2874,7 @@ discard block |
||
2874 | 2874 | * |
2875 | 2875 | * @param string $instance ['slide_width'] Width of the slides shown. |
2876 | 2876 | */ |
2877 | - $slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] ); |
|
2877 | + $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']); |
|
2878 | 2878 | /** |
2879 | 2879 | * Filter widget's "show title" value. |
2880 | 2880 | * |
@@ -2882,7 +2882,7 @@ discard block |
||
2882 | 2882 | * |
2883 | 2883 | * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0. |
2884 | 2884 | */ |
2885 | - $show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] ); |
|
2885 | + $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']); |
|
2886 | 2886 | /** |
2887 | 2887 | * Filter widget's "slideshow" value. |
2888 | 2888 | * |
@@ -2890,7 +2890,7 @@ discard block |
||
2890 | 2890 | * |
2891 | 2891 | * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically. |
2892 | 2892 | */ |
2893 | - $slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] ); |
|
2893 | + $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']); |
|
2894 | 2894 | /** |
2895 | 2895 | * Filter widget's "animationLoop" value. |
2896 | 2896 | * |
@@ -2898,7 +2898,7 @@ discard block |
||
2898 | 2898 | * |
2899 | 2899 | * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop. |
2900 | 2900 | */ |
2901 | - $animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] ); |
|
2901 | + $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']); |
|
2902 | 2902 | /** |
2903 | 2903 | * Filter widget's "directionNav" value. |
2904 | 2904 | * |
@@ -2906,7 +2906,7 @@ discard block |
||
2906 | 2906 | * |
2907 | 2907 | * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0. |
2908 | 2908 | */ |
2909 | - $directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] ); |
|
2909 | + $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']); |
|
2910 | 2910 | /** |
2911 | 2911 | * Filter widget's "slideshowSpeed" value. |
2912 | 2912 | * |
@@ -2914,7 +2914,7 @@ discard block |
||
2914 | 2914 | * |
2915 | 2915 | * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds. |
2916 | 2916 | */ |
2917 | - $slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] ); |
|
2917 | + $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']); |
|
2918 | 2918 | /** |
2919 | 2919 | * Filter widget's "animationSpeed" value. |
2920 | 2920 | * |
@@ -2922,7 +2922,7 @@ discard block |
||
2922 | 2922 | * |
2923 | 2923 | * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds. |
2924 | 2924 | */ |
2925 | - $animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] ); |
|
2925 | + $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']); |
|
2926 | 2926 | /** |
2927 | 2927 | * Filter widget's "animation" value. |
2928 | 2928 | * |
@@ -2930,7 +2930,7 @@ discard block |
||
2930 | 2930 | * |
2931 | 2931 | * @param string $instance ['animation'] Controls the animation type, "fade" or "slide". |
2932 | 2932 | */ |
2933 | - $animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] ); |
|
2933 | + $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']); |
|
2934 | 2934 | /** |
2935 | 2935 | * Filter widget's "list_sort" type. |
2936 | 2936 | * |
@@ -2938,10 +2938,10 @@ discard block |
||
2938 | 2938 | * |
2939 | 2939 | * @param string $instance ['list_sort'] Listing sort by type. |
2940 | 2940 | */ |
2941 | - $list_sort = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] ); |
|
2942 | - $show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null; |
|
2941 | + $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
|
2942 | + $show_featured_only = !empty($instance['show_featured_only']) ? 1 : null; |
|
2943 | 2943 | |
2944 | - wp_enqueue_script( 'geodirectory-jquery-flexslider-js' ); |
|
2944 | + wp_enqueue_script('geodirectory-jquery-flexslider-js'); |
|
2945 | 2945 | ?> |
2946 | 2946 | <script type="text/javascript"> |
2947 | 2947 | jQuery(window).load(function () { |
@@ -2956,23 +2956,23 @@ discard block |
||
2956 | 2956 | itemWidth: 75, |
2957 | 2957 | itemMargin: 5, |
2958 | 2958 | asNavFor: '#geodir_widget_slider', |
2959 | - rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?> |
|
2959 | + rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?> |
|
2960 | 2960 | }); |
2961 | 2961 | |
2962 | 2962 | jQuery('#geodir_widget_slider').flexslider({ |
2963 | - animation: "<?php echo $animation;?>", |
|
2963 | + animation: "<?php echo $animation; ?>", |
|
2964 | 2964 | selector: ".geodir-slides > li", |
2965 | 2965 | namespace: "geodir-", |
2966 | 2966 | controlNav: true, |
2967 | - animationLoop: <?php echo $animationLoop;?>, |
|
2968 | - slideshow: <?php echo $slideshow;?>, |
|
2969 | - slideshowSpeed: <?php echo $slideshowSpeed;?>, |
|
2970 | - animationSpeed: <?php echo $animationSpeed;?>, |
|
2971 | - directionNav: <?php echo $directionNav;?>, |
|
2972 | - maxItems: <?php echo $max_show;?>, |
|
2967 | + animationLoop: <?php echo $animationLoop; ?>, |
|
2968 | + slideshow: <?php echo $slideshow; ?>, |
|
2969 | + slideshowSpeed: <?php echo $slideshowSpeed; ?>, |
|
2970 | + animationSpeed: <?php echo $animationSpeed; ?>, |
|
2971 | + directionNav: <?php echo $directionNav; ?>, |
|
2972 | + maxItems: <?php echo $max_show; ?>, |
|
2973 | 2973 | move: 1, |
2974 | - <?php if ( $slide_width ) { |
|
2975 | - echo "itemWidth: " . $slide_width . ","; |
|
2974 | + <?php if ($slide_width) { |
|
2975 | + echo "itemWidth: ".$slide_width.","; |
|
2976 | 2976 | }?> |
2977 | 2977 | sync: "#geodir_widget_carousel", |
2978 | 2978 | start: function (slider) { |
@@ -2980,7 +2980,7 @@ discard block |
||
2980 | 2980 | jQuery('#geodir_widget_slider').css({'visibility': 'visible'}); |
2981 | 2981 | jQuery('#geodir_widget_carousel').css({'visibility': 'visible'}); |
2982 | 2982 | }, |
2983 | - rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?> |
|
2983 | + rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?> |
|
2984 | 2984 | }); |
2985 | 2985 | }); |
2986 | 2986 | </script> |
@@ -2991,62 +2991,62 @@ discard block |
||
2991 | 2991 | 'post_type' => $post_type, |
2992 | 2992 | 'order_by' => $list_sort |
2993 | 2993 | ); |
2994 | - if ( $show_featured_only ) { |
|
2994 | + if ($show_featured_only) { |
|
2995 | 2995 | $query_args['show_featured_only'] = 1; |
2996 | 2996 | } |
2997 | 2997 | |
2998 | - if ( $category != 0 || $category != '' ) { |
|
2999 | - $category_taxonomy = geodir_get_taxonomies( $post_type ); |
|
2998 | + if ($category != 0 || $category != '') { |
|
2999 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
3000 | 3000 | $tax_query = array( |
3001 | 3001 | 'taxonomy' => $category_taxonomy[0], |
3002 | 3002 | 'field' => 'id', |
3003 | 3003 | 'terms' => $category |
3004 | 3004 | ); |
3005 | 3005 | |
3006 | - $query_args['tax_query'] = array( $tax_query ); |
|
3006 | + $query_args['tax_query'] = array($tax_query); |
|
3007 | 3007 | } |
3008 | 3008 | |
3009 | 3009 | // we want listings with featured image only |
3010 | 3010 | $query_args['featured_image_only'] = 1; |
3011 | 3011 | |
3012 | - if ( $post_type == 'gd_event' ) { |
|
3012 | + if ($post_type == 'gd_event') { |
|
3013 | 3013 | $query_args['gedir_event_listing_filter'] = 'upcoming'; |
3014 | 3014 | }// show only upcoming events |
3015 | 3015 | |
3016 | - $widget_listings = geodir_get_widget_listings( $query_args ); |
|
3017 | - if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) { |
|
3018 | - if ( $title ) { |
|
3019 | - echo $before_title . $title . $after_title; |
|
3016 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
3017 | + if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) { |
|
3018 | + if ($title) { |
|
3019 | + echo $before_title.$title.$after_title; |
|
3020 | 3020 | } |
3021 | 3021 | |
3022 | 3022 | global $post; |
3023 | 3023 | |
3024 | - $current_post = $post;// keep current post info |
|
3024 | + $current_post = $post; // keep current post info |
|
3025 | 3025 | |
3026 | 3026 | $widget_main_slides = ''; |
3027 | 3027 | $nav_slides = ''; |
3028 | 3028 | $widget_slides = 0; |
3029 | 3029 | |
3030 | - foreach ( $widget_listings as $widget_listing ) { |
|
3030 | + foreach ($widget_listings as $widget_listing) { |
|
3031 | 3031 | global $gd_widget_listing_type; |
3032 | 3032 | $post = $widget_listing; |
3033 | - $widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) ); |
|
3033 | + $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img')); |
|
3034 | 3034 | |
3035 | - if ( ! empty( $widget_image ) ) { |
|
3036 | - if ( $widget_image->height >= 200 ) { |
|
3035 | + if (!empty($widget_image)) { |
|
3036 | + if ($widget_image->height >= 200) { |
|
3037 | 3037 | $widget_spacer_height = 0; |
3038 | 3038 | } else { |
3039 | - $widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 ); |
|
3039 | + $widget_spacer_height = ((200 - $widget_image->height) / 2); |
|
3040 | 3040 | } |
3041 | 3041 | |
3042 | - $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />'; |
|
3042 | + $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />'; |
|
3043 | 3043 | |
3044 | 3044 | $title = ''; |
3045 | - if ( $show_title ) { |
|
3046 | - $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>'; |
|
3045 | + if ($show_title) { |
|
3046 | + $title_html = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>'; |
|
3047 | 3047 | $post_id = $post->ID; |
3048 | - $post_permalink = get_permalink( $post->ID ); |
|
3049 | - $post_title = get_the_title( $post->ID ); |
|
3048 | + $post_permalink = get_permalink($post->ID); |
|
3049 | + $post_title = get_the_title($post->ID); |
|
3050 | 3050 | /** |
3051 | 3051 | * Filter the listing slider widget title. |
3052 | 3052 | * |
@@ -3057,12 +3057,12 @@ discard block |
||
3057 | 3057 | * @param string $post_permalink The post permalink url. |
3058 | 3058 | * @param string $post_title The post title text. |
3059 | 3059 | */ |
3060 | - $title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title ); |
|
3060 | + $title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title); |
|
3061 | 3061 | } |
3062 | 3062 | |
3063 | - $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>'; |
|
3064 | - $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
3065 | - $widget_slides ++; |
|
3063 | + $widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>'; |
|
3064 | + $nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>'; |
|
3065 | + $widget_slides++; |
|
3066 | 3066 | } |
3067 | 3067 | } |
3068 | 3068 | ?> |
@@ -3071,7 +3071,7 @@ discard block |
||
3071 | 3071 | <div id="geodir_widget_slider" class="geodir_flexslider"> |
3072 | 3072 | <ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul> |
3073 | 3073 | </div> |
3074 | - <?php if ( $widget_slides > 1 ) { ?> |
|
3074 | + <?php if ($widget_slides > 1) { ?> |
|
3075 | 3075 | <div id="geodir_widget_carousel" class="geodir_flexslider"> |
3076 | 3076 | <ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul> |
3077 | 3077 | </div> |
@@ -3079,7 +3079,7 @@ discard block |
||
3079 | 3079 | </div> |
3080 | 3080 | <?php |
3081 | 3081 | $GLOBALS['post'] = $current_post; |
3082 | - setup_postdata( $current_post ); |
|
3082 | + setup_postdata($current_post); |
|
3083 | 3083 | } |
3084 | 3084 | echo $after_widget; |
3085 | 3085 | } |
@@ -3095,46 +3095,46 @@ discard block |
||
3095 | 3095 | * @param array|string $args Display arguments including before_title, after_title, before_widget, and after_widget. |
3096 | 3096 | * @param array|string $instance The settings for the particular instance of the widget. |
3097 | 3097 | */ |
3098 | -function geodir_loginwidget_output( $args = '', $instance = '' ) { |
|
3098 | +function geodir_loginwidget_output($args = '', $instance = '') { |
|
3099 | 3099 | //print_r($args); |
3100 | 3100 | //print_r($instance); |
3101 | 3101 | // prints the widget |
3102 | - extract( $args, EXTR_SKIP ); |
|
3102 | + extract($args, EXTR_SKIP); |
|
3103 | 3103 | |
3104 | 3104 | /** This filter is documented in geodirectory_widgets.php */ |
3105 | - $title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) ); |
|
3105 | + $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory')); |
|
3106 | 3106 | |
3107 | 3107 | echo $before_widget; |
3108 | - echo $before_title . $title . $after_title; |
|
3108 | + echo $before_title.$title.$after_title; |
|
3109 | 3109 | |
3110 | - if ( is_user_logged_in() ) { |
|
3110 | + if (is_user_logged_in()) { |
|
3111 | 3111 | global $current_user; |
3112 | 3112 | |
3113 | - $author_link = get_author_posts_url( $current_user->data->ID ); |
|
3114 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
3113 | + $author_link = get_author_posts_url($current_user->data->ID); |
|
3114 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
3115 | 3115 | |
3116 | 3116 | echo '<ul class="geodir-loginbox-list">'; |
3117 | 3117 | ob_start(); |
3118 | 3118 | ?> |
3119 | 3119 | <li><a class="signin" |
3120 | - href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li> |
|
3120 | + href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li> |
|
3121 | 3121 | <?php |
3122 | - $post_types = geodir_get_posttypes( 'object' ); |
|
3123 | - $show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' ); |
|
3124 | - $geodir_allow_posttype_frontend = get_option( 'geodir_allow_posttype_frontend' ); |
|
3122 | + $post_types = geodir_get_posttypes('object'); |
|
3123 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard'); |
|
3124 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
3125 | 3125 | |
3126 | - if ( ! empty( $show_add_listing_post_types_main_nav ) ) { |
|
3126 | + if (!empty($show_add_listing_post_types_main_nav)) { |
|
3127 | 3127 | $addlisting_links = ''; |
3128 | - foreach ( $post_types as $key => $postobj ) { |
|
3128 | + foreach ($post_types as $key => $postobj) { |
|
3129 | 3129 | |
3130 | - if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) { |
|
3130 | + if (in_array($key, $show_add_listing_post_types_main_nav)) { |
|
3131 | 3131 | |
3132 | - if ( $add_link = geodir_get_addlisting_link( $key ) ) { |
|
3132 | + if ($add_link = geodir_get_addlisting_link($key)) { |
|
3133 | 3133 | |
3134 | 3134 | $name = $postobj->labels->name; |
3135 | 3135 | |
3136 | 3136 | $selected = ''; |
3137 | - if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) { |
|
3137 | + if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) { |
|
3138 | 3138 | $selected = 'selected="selected"'; |
3139 | 3139 | } |
3140 | 3140 | |
@@ -3147,22 +3147,22 @@ discard block |
||
3147 | 3147 | * @param string $key Add listing array key. |
3148 | 3148 | * @param int $current_user ->ID Current user ID. |
3149 | 3149 | */ |
3150 | - $add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID ); |
|
3150 | + $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID); |
|
3151 | 3151 | |
3152 | - $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>'; |
|
3152 | + $addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
3153 | 3153 | |
3154 | 3154 | } |
3155 | 3155 | } |
3156 | 3156 | |
3157 | 3157 | } |
3158 | 3158 | |
3159 | - if ( $addlisting_links != '' ) { ?> |
|
3159 | + if ($addlisting_links != '') { ?> |
|
3160 | 3160 | |
3161 | 3161 | <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value" |
3162 | 3162 | option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false" |
3163 | - data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>"> |
|
3163 | + data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>"> |
|
3164 | 3164 | <option value="" disabled="disabled" selected="selected" |
3165 | - style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option> |
|
3165 | + style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option> |
|
3166 | 3166 | <?php echo $addlisting_links; ?> |
3167 | 3167 | </select></li> <?php |
3168 | 3168 | |
@@ -3170,23 +3170,23 @@ discard block |
||
3170 | 3170 | |
3171 | 3171 | } |
3172 | 3172 | // My Favourites in Dashboard |
3173 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
3173 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
3174 | 3174 | $user_favourite = geodir_user_favourite_listing_count(); |
3175 | 3175 | |
3176 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
3176 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
3177 | 3177 | $favourite_links = ''; |
3178 | 3178 | |
3179 | - foreach ( $post_types as $key => $postobj ) { |
|
3180 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
3179 | + foreach ($post_types as $key => $postobj) { |
|
3180 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
3181 | 3181 | $name = $postobj->labels->name; |
3182 | - $post_type_link = geodir_getlink( $author_link, array( |
|
3182 | + $post_type_link = geodir_getlink($author_link, array( |
|
3183 | 3183 | 'stype' => $key, |
3184 | 3184 | 'list' => 'favourite' |
3185 | - ), false ); |
|
3185 | + ), false); |
|
3186 | 3186 | |
3187 | 3187 | $selected = ''; |
3188 | 3188 | |
3189 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
3189 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
3190 | 3190 | $selected = 'selected="selected"'; |
3191 | 3191 | } |
3192 | 3192 | /** |
@@ -3198,20 +3198,20 @@ discard block |
||
3198 | 3198 | * @param string $key Favorite listing array key. |
3199 | 3199 | * @param int $current_user ->ID Current user ID. |
3200 | 3200 | */ |
3201 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID ); |
|
3201 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID); |
|
3202 | 3202 | |
3203 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>'; |
|
3203 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
3204 | 3204 | } |
3205 | 3205 | } |
3206 | 3206 | |
3207 | - if ( $favourite_links != '' ) { |
|
3207 | + if ($favourite_links != '') { |
|
3208 | 3208 | ?> |
3209 | 3209 | <li> |
3210 | 3210 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" |
3211 | 3211 | option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" |
3212 | - data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>"> |
|
3212 | + data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>"> |
|
3213 | 3213 | <option value="" disabled="disabled" selected="selected" |
3214 | - style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option> |
|
3214 | + style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option> |
|
3215 | 3215 | <?php echo $favourite_links; ?> |
3216 | 3216 | </select> |
3217 | 3217 | </li> |
@@ -3220,19 +3220,19 @@ discard block |
||
3220 | 3220 | } |
3221 | 3221 | |
3222 | 3222 | |
3223 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
3223 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
3224 | 3224 | $user_listing = geodir_user_post_listing_count(); |
3225 | 3225 | |
3226 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
3226 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
3227 | 3227 | $listing_links = ''; |
3228 | 3228 | |
3229 | - foreach ( $post_types as $key => $postobj ) { |
|
3230 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
3229 | + foreach ($post_types as $key => $postobj) { |
|
3230 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
3231 | 3231 | $name = $postobj->labels->name; |
3232 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
3232 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
3233 | 3233 | |
3234 | 3234 | $selected = ''; |
3235 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
3235 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
3236 | 3236 | $selected = 'selected="selected"'; |
3237 | 3237 | } |
3238 | 3238 | |
@@ -3245,20 +3245,20 @@ discard block |
||
3245 | 3245 | * @param string $key My listing array key. |
3246 | 3246 | * @param int $current_user ->ID Current user ID. |
3247 | 3247 | */ |
3248 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID ); |
|
3248 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID); |
|
3249 | 3249 | |
3250 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>'; |
|
3250 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
3251 | 3251 | } |
3252 | 3252 | } |
3253 | 3253 | |
3254 | - if ( $listing_links != '' ) { |
|
3254 | + if ($listing_links != '') { |
|
3255 | 3255 | ?> |
3256 | 3256 | <li> |
3257 | 3257 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" |
3258 | 3258 | option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" |
3259 | - data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>"> |
|
3259 | + data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>"> |
|
3260 | 3260 | <option value="" disabled="disabled" selected="selected" |
3261 | - style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option> |
|
3261 | + style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option> |
|
3262 | 3262 | <?php echo $listing_links; ?> |
3263 | 3263 | </select> |
3264 | 3264 | </li> |
@@ -3274,7 +3274,7 @@ discard block |
||
3274 | 3274 | * |
3275 | 3275 | * @param string $dashboard_link Dashboard links HTML. |
3276 | 3276 | */ |
3277 | - echo apply_filters( 'geodir_dashboard_links', $dashboard_link ); |
|
3277 | + echo apply_filters('geodir_dashboard_links', $dashboard_link); |
|
3278 | 3278 | echo '</ul>'; |
3279 | 3279 | |
3280 | 3280 | /** |
@@ -3282,7 +3282,7 @@ discard block |
||
3282 | 3282 | * |
3283 | 3283 | * @since 1.6.6 |
3284 | 3284 | */ |
3285 | - do_action( 'geodir_after_loginwidget_form_logged_in' ); |
|
3285 | + do_action('geodir_after_loginwidget_form_logged_in'); |
|
3286 | 3286 | |
3287 | 3287 | |
3288 | 3288 | } else { |
@@ -3297,18 +3297,18 @@ discard block |
||
3297 | 3297 | <form name="loginform" class="loginform1" |
3298 | 3298 | action="<?php echo geodir_login_url(); ?>" |
3299 | 3299 | method="post"> |
3300 | - <div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log" |
|
3300 | + <div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log" |
|
3301 | 3301 | type="text" class="textfield user_login1"/> <span |
3302 | 3302 | class="user_loginInfo"></span></div> |
3303 | - <div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>" |
|
3303 | + <div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>" |
|
3304 | 3304 | name="pwd" type="password" |
3305 | 3305 | class="textfield user_pass1 input-text"/><span |
3306 | 3306 | class="user_passInfo"></span></div> |
3307 | 3307 | |
3308 | - <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/> |
|
3308 | + <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/> |
|
3309 | 3309 | <input type="hidden" name="testcookie" value="1"/> |
3310 | 3310 | |
3311 | - <?php do_action( 'login_form' ); ?> |
|
3311 | + <?php do_action('login_form'); ?> |
|
3312 | 3312 | |
3313 | 3313 | <div class="geodir_form_row clearfix"><input type="submit" name="submit" |
3314 | 3314 | value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/> |
@@ -3321,7 +3321,7 @@ discard block |
||
3321 | 3321 | * @since 1.0.0 |
3322 | 3322 | */ |
3323 | 3323 | ?> |
3324 | - <a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>" |
|
3324 | + <a href="<?php echo geodir_login_url(array('signup' => true)); ?>" |
|
3325 | 3325 | class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a> |
3326 | 3326 | |
3327 | 3327 | <?php |
@@ -3331,7 +3331,7 @@ discard block |
||
3331 | 3331 | * @since 1.0.0 |
3332 | 3332 | */ |
3333 | 3333 | ?> |
3334 | - <a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>" |
|
3334 | + <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>" |
|
3335 | 3335 | class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div> |
3336 | 3336 | </form> |
3337 | 3337 | <?php |
@@ -3340,7 +3340,7 @@ discard block |
||
3340 | 3340 | * |
3341 | 3341 | * @since 1.6.6 |
3342 | 3342 | */ |
3343 | - do_action( 'geodir_after_loginwidget_form_logged_out' ); |
|
3343 | + do_action('geodir_after_loginwidget_form_logged_out'); |
|
3344 | 3344 | } |
3345 | 3345 | |
3346 | 3346 | echo $after_widget; |
@@ -3362,16 +3362,16 @@ discard block |
||
3362 | 3362 | * after_widget. |
3363 | 3363 | * @param array|string $instance The settings for the particular instance of the widget. |
3364 | 3364 | */ |
3365 | -function geodir_popular_postview_output( $args = '', $instance = '' ) { |
|
3365 | +function geodir_popular_postview_output($args = '', $instance = '') { |
|
3366 | 3366 | global $gd_session; |
3367 | 3367 | |
3368 | 3368 | // prints the widget |
3369 | - extract( $args, EXTR_SKIP ); |
|
3369 | + extract($args, EXTR_SKIP); |
|
3370 | 3370 | |
3371 | 3371 | echo $before_widget; |
3372 | 3372 | |
3373 | 3373 | /** This filter is documented in geodirectory_widgets.php */ |
3374 | - $title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) ); |
|
3374 | + $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
3375 | 3375 | /** |
3376 | 3376 | * Filter the widget post type. |
3377 | 3377 | * |
@@ -3379,7 +3379,7 @@ discard block |
||
3379 | 3379 | * |
3380 | 3380 | * @param string $instance ['post_type'] Post type of listing. |
3381 | 3381 | */ |
3382 | - $post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] ); |
|
3382 | + $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']); |
|
3383 | 3383 | /** |
3384 | 3384 | * Filter the widget's term. |
3385 | 3385 | * |
@@ -3387,7 +3387,7 @@ discard block |
||
3387 | 3387 | * |
3388 | 3388 | * @param string $instance ['category'] Filter by term. Can be any valid term. |
3389 | 3389 | */ |
3390 | - $category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] ); |
|
3390 | + $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']); |
|
3391 | 3391 | /** |
3392 | 3392 | * Filter the widget listings limit. |
3393 | 3393 | * |
@@ -3395,7 +3395,7 @@ discard block |
||
3395 | 3395 | * |
3396 | 3396 | * @param string $instance ['post_number'] Number of listings to display. |
3397 | 3397 | */ |
3398 | - $post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] ); |
|
3398 | + $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
|
3399 | 3399 | /** |
3400 | 3400 | * Filter widget's "layout" type. |
3401 | 3401 | * |
@@ -3403,7 +3403,7 @@ discard block |
||
3403 | 3403 | * |
3404 | 3404 | * @param string $instance ['layout'] Widget layout type. |
3405 | 3405 | */ |
3406 | - $layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] ); |
|
3406 | + $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']); |
|
3407 | 3407 | /** |
3408 | 3408 | * Filter widget's "add_location_filter" value. |
3409 | 3409 | * |
@@ -3411,7 +3411,7 @@ discard block |
||
3411 | 3411 | * |
3412 | 3412 | * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0. |
3413 | 3413 | */ |
3414 | - $add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] ); |
|
3414 | + $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']); |
|
3415 | 3415 | /** |
3416 | 3416 | * Filter widget's listing width. |
3417 | 3417 | * |
@@ -3419,7 +3419,7 @@ discard block |
||
3419 | 3419 | * |
3420 | 3420 | * @param string $instance ['listing_width'] Listing width. |
3421 | 3421 | */ |
3422 | - $listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] ); |
|
3422 | + $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']); |
|
3423 | 3423 | /** |
3424 | 3424 | * Filter widget's "list_sort" type. |
3425 | 3425 | * |
@@ -3427,25 +3427,25 @@ discard block |
||
3427 | 3427 | * |
3428 | 3428 | * @param string $instance ['list_sort'] Listing sort by type. |
3429 | 3429 | */ |
3430 | - $list_sort = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] ); |
|
3431 | - $use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false; |
|
3430 | + $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
|
3431 | + $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
3432 | 3432 | |
3433 | 3433 | // set post type to current viewing post type |
3434 | - if ( $use_viewing_post_type ) { |
|
3434 | + if ($use_viewing_post_type) { |
|
3435 | 3435 | $current_post_type = geodir_get_current_posttype(); |
3436 | - if ( $current_post_type != '' && $current_post_type != $post_type ) { |
|
3436 | + if ($current_post_type != '' && $current_post_type != $post_type) { |
|
3437 | 3437 | $post_type = $current_post_type; |
3438 | 3438 | $category = array(); // old post type category will not work for current changed post type |
3439 | 3439 | } |
3440 | 3440 | } |
3441 | 3441 | // replace widget title dynamically |
3442 | - $posttype_plural_label = __( get_post_type_plural_label( $post_type ), 'geodirectory' ); |
|
3443 | - $posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' ); |
|
3442 | + $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory'); |
|
3443 | + $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory'); |
|
3444 | 3444 | |
3445 | - $title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title ); |
|
3446 | - $title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title ); |
|
3445 | + $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title); |
|
3446 | + $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title); |
|
3447 | 3447 | |
3448 | - if ( isset( $instance['character_count'] ) ) { |
|
3448 | + if (isset($instance['character_count'])) { |
|
3449 | 3449 | /** |
3450 | 3450 | * Filter the widget's excerpt character count. |
3451 | 3451 | * |
@@ -3453,37 +3453,37 @@ discard block |
||
3453 | 3453 | * |
3454 | 3454 | * @param int $instance ['character_count'] Excerpt character count. |
3455 | 3455 | */ |
3456 | - $character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] ); |
|
3456 | + $character_count = apply_filters('widget_list_character_count', $instance['character_count']); |
|
3457 | 3457 | } else { |
3458 | 3458 | $character_count = ''; |
3459 | 3459 | } |
3460 | 3460 | |
3461 | - if ( empty( $title ) || $title == 'All' ) { |
|
3462 | - $title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' ); |
|
3461 | + if (empty($title) || $title == 'All') { |
|
3462 | + $title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory'); |
|
3463 | 3463 | } |
3464 | 3464 | |
3465 | 3465 | $location_url = array(); |
3466 | - $city = get_query_var( 'gd_city' ); |
|
3467 | - if ( ! empty( $city ) ) { |
|
3468 | - $country = get_query_var( 'gd_country' ); |
|
3469 | - $region = get_query_var( 'gd_region' ); |
|
3466 | + $city = get_query_var('gd_city'); |
|
3467 | + if (!empty($city)) { |
|
3468 | + $country = get_query_var('gd_country'); |
|
3469 | + $region = get_query_var('gd_region'); |
|
3470 | 3470 | |
3471 | - $geodir_show_location_url = get_option( 'geodir_show_location_url' ); |
|
3471 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
3472 | 3472 | |
3473 | - if ( $geodir_show_location_url == 'all' ) { |
|
3474 | - if ( $country != '' ) { |
|
3473 | + if ($geodir_show_location_url == 'all') { |
|
3474 | + if ($country != '') { |
|
3475 | 3475 | $location_url[] = $country; |
3476 | 3476 | } |
3477 | 3477 | |
3478 | - if ( $region != '' ) { |
|
3478 | + if ($region != '') { |
|
3479 | 3479 | $location_url[] = $region; |
3480 | 3480 | } |
3481 | - } else if ( $geodir_show_location_url == 'country_city' ) { |
|
3482 | - if ( $country != '' ) { |
|
3481 | + } else if ($geodir_show_location_url == 'country_city') { |
|
3482 | + if ($country != '') { |
|
3483 | 3483 | $location_url[] = $country; |
3484 | 3484 | } |
3485 | - } else if ( $geodir_show_location_url == 'region_city' ) { |
|
3486 | - if ( $region != '' ) { |
|
3485 | + } else if ($geodir_show_location_url == 'region_city') { |
|
3486 | + if ($region != '') { |
|
3487 | 3487 | $location_url[] = $region; |
3488 | 3488 | } |
3489 | 3489 | } |
@@ -3491,37 +3491,37 @@ discard block |
||
3491 | 3491 | $location_url[] = $city; |
3492 | 3492 | } |
3493 | 3493 | |
3494 | - $location_url = implode( '/', $location_url ); |
|
3494 | + $location_url = implode('/', $location_url); |
|
3495 | 3495 | $skip_location = false; |
3496 | - if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) { |
|
3496 | + if (!$add_location_filter && $gd_session->get('gd_multi_location')) { |
|
3497 | 3497 | $skip_location = true; |
3498 | - $gd_session->un_set( 'gd_multi_location' ); |
|
3498 | + $gd_session->un_set('gd_multi_location'); |
|
3499 | 3499 | } |
3500 | 3500 | |
3501 | - if ( get_option( 'permalink_structure' ) ) { |
|
3502 | - $viewall_url = get_post_type_archive_link( $post_type ); |
|
3501 | + if (get_option('permalink_structure')) { |
|
3502 | + $viewall_url = get_post_type_archive_link($post_type); |
|
3503 | 3503 | } else { |
3504 | - $viewall_url = get_post_type_archive_link( $post_type ); |
|
3504 | + $viewall_url = get_post_type_archive_link($post_type); |
|
3505 | 3505 | } |
3506 | 3506 | |
3507 | - if ( ! empty( $category ) && $category[0] != '0' ) { |
|
3507 | + if (!empty($category) && $category[0] != '0') { |
|
3508 | 3508 | global $geodir_add_location_url; |
3509 | 3509 | |
3510 | 3510 | $geodir_add_location_url = '0'; |
3511 | 3511 | |
3512 | - if ( $add_location_filter != '0' ) { |
|
3512 | + if ($add_location_filter != '0') { |
|
3513 | 3513 | $geodir_add_location_url = '1'; |
3514 | 3514 | } |
3515 | 3515 | |
3516 | - $viewall_url = get_term_link( (int) $category[0], $post_type . 'category' ); |
|
3516 | + $viewall_url = get_term_link((int) $category[0], $post_type.'category'); |
|
3517 | 3517 | |
3518 | 3518 | $geodir_add_location_url = null; |
3519 | 3519 | } |
3520 | - if ( $skip_location ) { |
|
3521 | - $gd_session->set( 'gd_multi_location', 1 ); |
|
3520 | + if ($skip_location) { |
|
3521 | + $gd_session->set('gd_multi_location', 1); |
|
3522 | 3522 | } |
3523 | 3523 | |
3524 | - if ( is_wp_error( $viewall_url ) ) { |
|
3524 | + if (is_wp_error($viewall_url)) { |
|
3525 | 3525 | $viewall_url = ''; |
3526 | 3526 | } |
3527 | 3527 | |
@@ -3533,34 +3533,34 @@ discard block |
||
3533 | 3533 | 'order_by' => $list_sort |
3534 | 3534 | ); |
3535 | 3535 | |
3536 | - if ( $character_count ) { |
|
3536 | + if ($character_count) { |
|
3537 | 3537 | $query_args['excerpt_length'] = $character_count; |
3538 | 3538 | } |
3539 | 3539 | |
3540 | - if ( ! empty( $instance['show_featured_only'] ) ) { |
|
3540 | + if (!empty($instance['show_featured_only'])) { |
|
3541 | 3541 | $query_args['show_featured_only'] = 1; |
3542 | 3542 | } |
3543 | 3543 | |
3544 | - if ( ! empty( $instance['show_special_only'] ) ) { |
|
3544 | + if (!empty($instance['show_special_only'])) { |
|
3545 | 3545 | $query_args['show_special_only'] = 1; |
3546 | 3546 | } |
3547 | 3547 | |
3548 | - if ( ! empty( $instance['with_pics_only'] ) ) { |
|
3548 | + if (!empty($instance['with_pics_only'])) { |
|
3549 | 3549 | $query_args['with_pics_only'] = 0; |
3550 | 3550 | $query_args['featured_image_only'] = 1; |
3551 | 3551 | } |
3552 | 3552 | |
3553 | - if ( ! empty( $instance['with_videos_only'] ) ) { |
|
3553 | + if (!empty($instance['with_videos_only'])) { |
|
3554 | 3554 | $query_args['with_videos_only'] = 1; |
3555 | 3555 | } |
3556 | - $with_no_results = ! empty( $instance['without_no_results'] ) ? false : true; |
|
3556 | + $with_no_results = !empty($instance['without_no_results']) ? false : true; |
|
3557 | 3557 | |
3558 | - if ( ! empty( $category ) && $category[0] != '0' ) { |
|
3559 | - $category_taxonomy = geodir_get_taxonomies( $post_type ); |
|
3558 | + if (!empty($category) && $category[0] != '0') { |
|
3559 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
3560 | 3560 | |
3561 | 3561 | ######### WPML ######### |
3562 | - if ( function_exists( 'icl_object_id' ) ) { |
|
3563 | - $category = gd_lang_object_ids( $category, $category_taxonomy[0] ); |
|
3562 | + if (function_exists('icl_object_id')) { |
|
3563 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
3564 | 3564 | } |
3565 | 3565 | ######### WPML ######### |
3566 | 3566 | |
@@ -3570,14 +3570,14 @@ discard block |
||
3570 | 3570 | 'terms' => $category |
3571 | 3571 | ); |
3572 | 3572 | |
3573 | - $query_args['tax_query'] = array( $tax_query ); |
|
3573 | + $query_args['tax_query'] = array($tax_query); |
|
3574 | 3574 | } |
3575 | 3575 | |
3576 | 3576 | global $gridview_columns_widget, $geodir_is_widget_listing; |
3577 | 3577 | |
3578 | - $widget_listings = geodir_get_widget_listings( $query_args ); |
|
3578 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
3579 | 3579 | |
3580 | - if ( ! empty( $widget_listings ) || $with_no_results ) { |
|
3580 | + if (!empty($widget_listings) || $with_no_results) { |
|
3581 | 3581 | ?> |
3582 | 3582 | <div class="geodir_locations geodir_location_listing"> |
3583 | 3583 | |
@@ -3587,11 +3587,11 @@ discard block |
||
3587 | 3587 | * |
3588 | 3588 | * @since 1.0.0 |
3589 | 3589 | */ |
3590 | - do_action( 'geodir_before_view_all_link_in_widget' ); ?> |
|
3590 | + do_action('geodir_before_view_all_link_in_widget'); ?> |
|
3591 | 3591 | <div class="geodir_list_heading clearfix"> |
3592 | - <?php echo $before_title . $title . $after_title; ?> |
|
3592 | + <?php echo $before_title.$title.$after_title; ?> |
|
3593 | 3593 | <a href="<?php echo $viewall_url; ?>" |
3594 | - class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a> |
|
3594 | + class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a> |
|
3595 | 3595 | </div> |
3596 | 3596 | <?php |
3597 | 3597 | /** |
@@ -3599,10 +3599,10 @@ discard block |
||
3599 | 3599 | * |
3600 | 3600 | * @since 1.0.0 |
3601 | 3601 | */ |
3602 | - do_action( 'geodir_after_view_all_link_in_widget' ); ?> |
|
3602 | + do_action('geodir_after_view_all_link_in_widget'); ?> |
|
3603 | 3603 | <?php |
3604 | - if ( strstr( $layout, 'gridview' ) ) { |
|
3605 | - $listing_view_exp = explode( '_', $layout ); |
|
3604 | + if (strstr($layout, 'gridview')) { |
|
3605 | + $listing_view_exp = explode('_', $layout); |
|
3606 | 3606 | $gridview_columns_widget = $layout; |
3607 | 3607 | $layout = $listing_view_exp[0]; |
3608 | 3608 | } else { |
@@ -3614,8 +3614,8 @@ discard block |
||
3614 | 3614 | * |
3615 | 3615 | * @since 1.0.0 |
3616 | 3616 | */ |
3617 | - $template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) ); |
|
3618 | - if ( ! isset( $character_count ) ) { |
|
3617 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
3618 | + if (!isset($character_count)) { |
|
3619 | 3619 | /** |
3620 | 3620 | * Filter the widget's excerpt character count. |
3621 | 3621 | * |
@@ -3623,7 +3623,7 @@ discard block |
||
3623 | 3623 | * |
3624 | 3624 | * @param int $instance ['character_count'] Excerpt character count. |
3625 | 3625 | */ |
3626 | - $character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count ); |
|
3626 | + $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count); |
|
3627 | 3627 | } |
3628 | 3628 | |
3629 | 3629 | global $post, $map_jason, $map_canvas_arr; |
@@ -3638,13 +3638,13 @@ discard block |
||
3638 | 3638 | * |
3639 | 3639 | * @since 1.0.0 |
3640 | 3640 | */ |
3641 | - include( $template ); |
|
3641 | + include($template); |
|
3642 | 3642 | |
3643 | 3643 | $geodir_is_widget_listing = false; |
3644 | 3644 | |
3645 | 3645 | $GLOBALS['post'] = $current_post; |
3646 | - if ( ! empty( $current_post ) ) { |
|
3647 | - setup_postdata( $current_post ); |
|
3646 | + if (!empty($current_post)) { |
|
3647 | + setup_postdata($current_post); |
|
3648 | 3648 | } |
3649 | 3649 | $map_jason = $current_map_jason; |
3650 | 3650 | $map_canvas_arr = $current_map_canvas_arr; |
@@ -3675,12 +3675,12 @@ discard block |
||
3675 | 3675 | * |
3676 | 3676 | * @return int Reviews count. |
3677 | 3677 | */ |
3678 | -function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) { |
|
3678 | +function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) { |
|
3679 | 3679 | global $wpdb, $plugin_prefix; |
3680 | 3680 | |
3681 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
3681 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
3682 | 3682 | |
3683 | - $sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")"; |
|
3683 | + $sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")"; |
|
3684 | 3684 | |
3685 | 3685 | /** |
3686 | 3686 | * Filter count review sql query. |
@@ -3692,9 +3692,9 @@ discard block |
||
3692 | 3692 | * @param int $taxonomy The taxonomy Id. |
3693 | 3693 | * @param string $post_type The post type. |
3694 | 3694 | */ |
3695 | - $sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type ); |
|
3695 | + $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type); |
|
3696 | 3696 | |
3697 | - $count = $wpdb->get_var( $sql ); |
|
3697 | + $count = $wpdb->get_var($sql); |
|
3698 | 3698 | |
3699 | 3699 | return $count; |
3700 | 3700 | } |
@@ -3712,7 +3712,7 @@ discard block |
||
3712 | 3712 | * |
3713 | 3713 | * @return array Term array data. |
3714 | 3714 | */ |
3715 | -function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) { |
|
3715 | +function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) { |
|
3716 | 3716 | /** |
3717 | 3717 | * Filter review count option data. |
3718 | 3718 | * |
@@ -3722,78 +3722,78 @@ discard block |
||
3722 | 3722 | * @param bool $force_update Force update option value?. Default.false. |
3723 | 3723 | * @param int $post_ID The post id to update if any. |
3724 | 3724 | */ |
3725 | - $option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID ); |
|
3726 | - if ( ! empty( $option_data ) ) { |
|
3725 | + $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID); |
|
3726 | + if (!empty($option_data)) { |
|
3727 | 3727 | return $option_data; |
3728 | 3728 | } |
3729 | 3729 | |
3730 | - $option_data = get_option( 'geodir_global_review_count' ); |
|
3730 | + $option_data = get_option('geodir_global_review_count'); |
|
3731 | 3731 | |
3732 | - if ( ! $option_data || $force_update ) { |
|
3733 | - if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only. |
|
3732 | + if (!$option_data || $force_update) { |
|
3733 | + if ((int) $post_ID > 0) { // Update reviews count for specific post categories only. |
|
3734 | 3734 | global $gd_session; |
3735 | 3735 | $term_array = (array) $option_data; |
3736 | - $post_type = get_post_type( $post_ID ); |
|
3737 | - $taxonomy = $post_type . 'category'; |
|
3738 | - $terms = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) ); |
|
3739 | - |
|
3740 | - if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { |
|
3741 | - foreach ( $terms as $term_id ) { |
|
3742 | - $count = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ); |
|
3743 | - $children = get_term_children( $term_id, $taxonomy ); |
|
3744 | - $term_array[ $term_id ] = $count; |
|
3736 | + $post_type = get_post_type($post_ID); |
|
3737 | + $taxonomy = $post_type.'category'; |
|
3738 | + $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids')); |
|
3739 | + |
|
3740 | + if (!empty($terms) && !is_wp_error($terms)) { |
|
3741 | + foreach ($terms as $term_id) { |
|
3742 | + $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type); |
|
3743 | + $children = get_term_children($term_id, $taxonomy); |
|
3744 | + $term_array[$term_id] = $count; |
|
3745 | 3745 | } |
3746 | 3746 | } |
3747 | 3747 | |
3748 | - $session_listing = $gd_session->get( 'listing' ); |
|
3748 | + $session_listing = $gd_session->get('listing'); |
|
3749 | 3749 | |
3750 | 3750 | $terms = array(); |
3751 | - if ( isset( $_POST['post_category'][ $taxonomy ] ) ) { |
|
3752 | - $terms = (array) $_POST['post_category'][ $taxonomy ]; |
|
3753 | - } else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) { |
|
3754 | - $terms = (array) $session_listing['post_category'][ $taxonomy ]; |
|
3751 | + if (isset($_POST['post_category'][$taxonomy])) { |
|
3752 | + $terms = (array) $_POST['post_category'][$taxonomy]; |
|
3753 | + } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) { |
|
3754 | + $terms = (array) $session_listing['post_category'][$taxonomy]; |
|
3755 | 3755 | } |
3756 | 3756 | |
3757 | - if ( ! empty( $terms ) ) { |
|
3758 | - foreach ( $terms as $term_id ) { |
|
3759 | - if ( $term_id > 0 ) { |
|
3760 | - $count = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ); |
|
3761 | - $children = get_term_children( $term_id, $taxonomy ); |
|
3762 | - $term_array[ $term_id ] = $count; |
|
3757 | + if (!empty($terms)) { |
|
3758 | + foreach ($terms as $term_id) { |
|
3759 | + if ($term_id > 0) { |
|
3760 | + $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type); |
|
3761 | + $children = get_term_children($term_id, $taxonomy); |
|
3762 | + $term_array[$term_id] = $count; |
|
3763 | 3763 | } |
3764 | 3764 | } |
3765 | 3765 | } |
3766 | 3766 | } else { // Update reviews count for all post categories. |
3767 | 3767 | $term_array = array(); |
3768 | 3768 | $post_types = geodir_get_posttypes(); |
3769 | - foreach ( $post_types as $post_type ) { |
|
3769 | + foreach ($post_types as $post_type) { |
|
3770 | 3770 | |
3771 | - $taxonomy = geodir_get_taxonomies( $post_type ); |
|
3771 | + $taxonomy = geodir_get_taxonomies($post_type); |
|
3772 | 3772 | $taxonomy = $taxonomy[0]; |
3773 | 3773 | |
3774 | 3774 | $args = array( |
3775 | 3775 | 'hide_empty' => false |
3776 | 3776 | ); |
3777 | 3777 | |
3778 | - $terms = get_terms( $taxonomy, $args ); |
|
3778 | + $terms = get_terms($taxonomy, $args); |
|
3779 | 3779 | |
3780 | - foreach ( $terms as $term ) { |
|
3781 | - $count = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type ); |
|
3782 | - $children = get_term_children( $term->term_id, $taxonomy ); |
|
3780 | + foreach ($terms as $term) { |
|
3781 | + $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type); |
|
3782 | + $children = get_term_children($term->term_id, $taxonomy); |
|
3783 | 3783 | /*if ( is_array( $children ) ) { |
3784 | 3784 | foreach ( $children as $child_id ) { |
3785 | 3785 | $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type); |
3786 | 3786 | $count = $count + $child_count; |
3787 | 3787 | } |
3788 | 3788 | }*/ |
3789 | - $term_array[ $term->term_id ] = $count; |
|
3789 | + $term_array[$term->term_id] = $count; |
|
3790 | 3790 | } |
3791 | 3791 | } |
3792 | 3792 | } |
3793 | 3793 | |
3794 | - update_option( 'geodir_global_review_count', $term_array ); |
|
3794 | + update_option('geodir_global_review_count', $term_array); |
|
3795 | 3795 | //clear cache |
3796 | - wp_cache_delete( 'geodir_global_review_count' ); |
|
3796 | + wp_cache_delete('geodir_global_review_count'); |
|
3797 | 3797 | |
3798 | 3798 | return $term_array; |
3799 | 3799 | } else { |
@@ -3809,39 +3809,39 @@ discard block |
||
3809 | 3809 | * @package GeoDirectory |
3810 | 3810 | * @return bool |
3811 | 3811 | */ |
3812 | -function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) { |
|
3813 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) { |
|
3812 | +function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') { |
|
3813 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') { |
|
3814 | 3814 | return; // do not run if importing listings |
3815 | 3815 | } |
3816 | 3816 | |
3817 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
3817 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
3818 | 3818 | return; |
3819 | 3819 | } |
3820 | 3820 | |
3821 | 3821 | $post_ID = 0; |
3822 | - if ( ! empty( $post ) ) { |
|
3823 | - if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) { |
|
3822 | + if (!empty($post)) { |
|
3823 | + if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) { |
|
3824 | 3824 | return; |
3825 | 3825 | } |
3826 | 3826 | |
3827 | - if ( $new_status == 'auto-draft' && $old_status == 'new' ) { |
|
3827 | + if ($new_status == 'auto-draft' && $old_status == 'new') { |
|
3828 | 3828 | return; |
3829 | 3829 | } |
3830 | 3830 | |
3831 | - if ( ! empty( $post->ID ) ) { |
|
3831 | + if (!empty($post->ID)) { |
|
3832 | 3832 | $post_ID = $post->ID; |
3833 | 3833 | } |
3834 | 3834 | } |
3835 | 3835 | |
3836 | - if ( $new_status != $old_status ) { |
|
3837 | - geodir_count_reviews_by_terms( true, $post_ID ); |
|
3836 | + if ($new_status != $old_status) { |
|
3837 | + geodir_count_reviews_by_terms(true, $post_ID); |
|
3838 | 3838 | } |
3839 | 3839 | |
3840 | 3840 | return true; |
3841 | 3841 | } |
3842 | 3842 | |
3843 | -function geodir_term_review_count_force_update_single_post( $post_id ) { |
|
3844 | - geodir_count_reviews_by_terms( true, $post_id ); |
|
3843 | +function geodir_term_review_count_force_update_single_post($post_id) { |
|
3844 | + geodir_count_reviews_by_terms(true, $post_id); |
|
3845 | 3845 | } |
3846 | 3846 | |
3847 | 3847 | /*-----------------------------------------------------------------------------------*/ |
@@ -3858,11 +3858,11 @@ discard block |
||
3858 | 3858 | * |
3859 | 3859 | * @return int Post count. |
3860 | 3860 | */ |
3861 | -function geodir_count_posts_by_term( $data, $term ) { |
|
3861 | +function geodir_count_posts_by_term($data, $term) { |
|
3862 | 3862 | |
3863 | - if ( $data ) { |
|
3864 | - if ( isset( $data[ $term->term_id ] ) ) { |
|
3865 | - return $data[ $term->term_id ]; |
|
3863 | + if ($data) { |
|
3864 | + if (isset($data[$term->term_id])) { |
|
3865 | + return $data[$term->term_id]; |
|
3866 | 3866 | } else { |
3867 | 3867 | return 0; |
3868 | 3868 | } |
@@ -3879,8 +3879,8 @@ discard block |
||
3879 | 3879 | * param array $terms An array of term objects. |
3880 | 3880 | * @return array Sorted terms array. |
3881 | 3881 | */ |
3882 | -function geodir_sort_terms_by_count( $terms ) { |
|
3883 | - usort( $terms, "geodir_sort_by_count_obj" ); |
|
3882 | +function geodir_sort_terms_by_count($terms) { |
|
3883 | + usort($terms, "geodir_sort_by_count_obj"); |
|
3884 | 3884 | |
3885 | 3885 | return $terms; |
3886 | 3886 | } |
@@ -3895,8 +3895,8 @@ discard block |
||
3895 | 3895 | * |
3896 | 3896 | * @return array Sorted terms array. |
3897 | 3897 | */ |
3898 | -function geodir_sort_terms_by_review_count( $terms ) { |
|
3899 | - usort( $terms, "geodir_sort_by_review_count_obj" ); |
|
3898 | +function geodir_sort_terms_by_review_count($terms) { |
|
3899 | + usort($terms, "geodir_sort_by_review_count_obj"); |
|
3900 | 3900 | |
3901 | 3901 | return $terms; |
3902 | 3902 | } |
@@ -3912,12 +3912,12 @@ discard block |
||
3912 | 3912 | * |
3913 | 3913 | * @return array Sorted terms array. |
3914 | 3914 | */ |
3915 | -function geodir_sort_terms( $terms, $sort = 'count' ) { |
|
3916 | - if ( $sort == 'count' ) { |
|
3917 | - return geodir_sort_terms_by_count( $terms ); |
|
3915 | +function geodir_sort_terms($terms, $sort = 'count') { |
|
3916 | + if ($sort == 'count') { |
|
3917 | + return geodir_sort_terms_by_count($terms); |
|
3918 | 3918 | } |
3919 | - if ( $sort == 'review_count' ) { |
|
3920 | - return geodir_sort_terms_by_review_count( $terms ); |
|
3919 | + if ($sort == 'review_count') { |
|
3920 | + return geodir_sort_terms_by_review_count($terms); |
|
3921 | 3921 | } |
3922 | 3922 | } |
3923 | 3923 | |
@@ -3935,7 +3935,7 @@ discard block |
||
3935 | 3935 | * |
3936 | 3936 | * @return bool |
3937 | 3937 | */ |
3938 | -function geodir_sort_by_count( $a, $b ) { |
|
3938 | +function geodir_sort_by_count($a, $b) { |
|
3939 | 3939 | return $a['count'] < $b['count']; |
3940 | 3940 | } |
3941 | 3941 | |
@@ -3950,7 +3950,7 @@ discard block |
||
3950 | 3950 | * |
3951 | 3951 | * @return bool |
3952 | 3952 | */ |
3953 | -function geodir_sort_by_count_obj( $a, $b ) { |
|
3953 | +function geodir_sort_by_count_obj($a, $b) { |
|
3954 | 3954 | return $a->count < $b->count; |
3955 | 3955 | } |
3956 | 3956 | |
@@ -3965,7 +3965,7 @@ discard block |
||
3965 | 3965 | * |
3966 | 3966 | * @return bool |
3967 | 3967 | */ |
3968 | -function geodir_sort_by_review_count_obj( $a, $b ) { |
|
3968 | +function geodir_sort_by_review_count_obj($a, $b) { |
|
3969 | 3969 | return $a->review_count < $b->review_count; |
3970 | 3970 | } |
3971 | 3971 | |
@@ -3982,35 +3982,35 @@ discard block |
||
3982 | 3982 | * @since 1.4.2 |
3983 | 3983 | * @package GeoDirectory |
3984 | 3984 | */ |
3985 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' ); |
|
3985 | + $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory'); |
|
3986 | 3986 | |
3987 | - load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' ); |
|
3988 | - load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' ); |
|
3987 | + load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo'); |
|
3988 | + load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages'); |
|
3989 | 3989 | |
3990 | 3990 | /** |
3991 | 3991 | * Define language constants. |
3992 | 3992 | * |
3993 | 3993 | * @since 1.0.0 |
3994 | 3994 | */ |
3995 | - require_once( geodir_plugin_path() . '/language.php' ); |
|
3995 | + require_once(geodir_plugin_path().'/language.php'); |
|
3996 | 3996 | |
3997 | - $language_file = geodir_plugin_path() . '/db-language.php'; |
|
3997 | + $language_file = geodir_plugin_path().'/db-language.php'; |
|
3998 | 3998 | |
3999 | 3999 | // Load language string file if not created yet |
4000 | - if ( ! file_exists( $language_file ) ) { |
|
4000 | + if (!file_exists($language_file)) { |
|
4001 | 4001 | geodirectory_load_db_language(); |
4002 | 4002 | } |
4003 | 4003 | |
4004 | - if ( file_exists( $language_file ) ) { |
|
4004 | + if (file_exists($language_file)) { |
|
4005 | 4005 | /** |
4006 | 4006 | * Language strings from database. |
4007 | 4007 | * |
4008 | 4008 | * @since 1.4.2 |
4009 | 4009 | */ |
4010 | 4010 | try { |
4011 | - require_once( $language_file ); |
|
4012 | - } catch ( Exception $e ) { |
|
4013 | - error_log( 'Language Error: ' . $e->getMessage() ); |
|
4011 | + require_once($language_file); |
|
4012 | + } catch (Exception $e) { |
|
4013 | + error_log('Language Error: '.$e->getMessage()); |
|
4014 | 4014 | } |
4015 | 4015 | } |
4016 | 4016 | } |
@@ -4027,19 +4027,19 @@ discard block |
||
4027 | 4027 | */ |
4028 | 4028 | function geodirectory_load_db_language() { |
4029 | 4029 | global $wp_filesystem; |
4030 | - if ( empty( $wp_filesystem ) ) { |
|
4031 | - require_once( ABSPATH . '/wp-admin/includes/file.php' ); |
|
4030 | + if (empty($wp_filesystem)) { |
|
4031 | + require_once(ABSPATH.'/wp-admin/includes/file.php'); |
|
4032 | 4032 | WP_Filesystem(); |
4033 | 4033 | global $wp_filesystem; |
4034 | 4034 | } |
4035 | 4035 | |
4036 | - $language_file = geodir_plugin_path() . '/db-language.php'; |
|
4036 | + $language_file = geodir_plugin_path().'/db-language.php'; |
|
4037 | 4037 | |
4038 | - if ( is_file( $language_file ) && ! is_writable( $language_file ) ) { |
|
4038 | + if (is_file($language_file) && !is_writable($language_file)) { |
|
4039 | 4039 | return false; |
4040 | 4040 | } // Not possible to create. |
4041 | 4041 | |
4042 | - if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) { |
|
4042 | + if (!is_file($language_file) && !is_writable(dirname($language_file))) { |
|
4043 | 4043 | return false; |
4044 | 4044 | } // Not possible to create. |
4045 | 4045 | |
@@ -4052,9 +4052,9 @@ discard block |
||
4052 | 4052 | * |
4053 | 4053 | * @param array $contents_strings Array of strings. |
4054 | 4054 | */ |
4055 | - $contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings ); |
|
4055 | + $contents_strings = apply_filters('geodir_load_db_language', $contents_strings); |
|
4056 | 4056 | |
4057 | - $contents_strings = array_unique( $contents_strings ); |
|
4057 | + $contents_strings = array_unique($contents_strings); |
|
4058 | 4058 | |
4059 | 4059 | $contents_head = array(); |
4060 | 4060 | $contents_head[] = "<?php"; |
@@ -4071,20 +4071,20 @@ discard block |
||
4071 | 4071 | $contents_foot[] = ""; |
4072 | 4072 | $contents_foot[] = ""; |
4073 | 4073 | |
4074 | - $contents = implode( PHP_EOL, $contents_head ); |
|
4074 | + $contents = implode(PHP_EOL, $contents_head); |
|
4075 | 4075 | |
4076 | - if ( ! empty( $contents_strings ) ) { |
|
4077 | - foreach ( $contents_strings as $string ) { |
|
4078 | - if ( is_scalar( $string ) && $string != '' ) { |
|
4079 | - $string = str_replace( "'", "\'", $string ); |
|
4080 | - $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');"; |
|
4076 | + if (!empty($contents_strings)) { |
|
4077 | + foreach ($contents_strings as $string) { |
|
4078 | + if (is_scalar($string) && $string != '') { |
|
4079 | + $string = str_replace("'", "\'", $string); |
|
4080 | + $contents .= PHP_EOL."__('".$string."', 'geodirectory');"; |
|
4081 | 4081 | } |
4082 | 4082 | } |
4083 | 4083 | } |
4084 | 4084 | |
4085 | - $contents .= implode( PHP_EOL, $contents_foot ); |
|
4085 | + $contents .= implode(PHP_EOL, $contents_foot); |
|
4086 | 4086 | |
4087 | - if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) { |
|
4087 | + if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) { |
|
4088 | 4088 | return false; |
4089 | 4089 | } // Failure; could not write file. |
4090 | 4090 | |
@@ -4104,45 +4104,45 @@ discard block |
||
4104 | 4104 | * |
4105 | 4105 | * @return array Translation texts. |
4106 | 4106 | */ |
4107 | -function geodir_load_custom_field_translation( $translation_texts = array() ) { |
|
4107 | +function geodir_load_custom_field_translation($translation_texts = array()) { |
|
4108 | 4108 | global $wpdb; |
4109 | 4109 | |
4110 | 4110 | // Custom fields table |
4111 | - $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE; |
|
4112 | - $rows = $wpdb->get_results( $sql ); |
|
4111 | + $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE; |
|
4112 | + $rows = $wpdb->get_results($sql); |
|
4113 | 4113 | |
4114 | - if ( ! empty( $rows ) ) { |
|
4115 | - foreach ( $rows as $row ) { |
|
4116 | - if ( ! empty( $row->admin_title ) ) { |
|
4117 | - $translation_texts[] = stripslashes_deep( $row->admin_title ); |
|
4114 | + if (!empty($rows)) { |
|
4115 | + foreach ($rows as $row) { |
|
4116 | + if (!empty($row->admin_title)) { |
|
4117 | + $translation_texts[] = stripslashes_deep($row->admin_title); |
|
4118 | 4118 | } |
4119 | 4119 | |
4120 | - if ( ! empty( $row->admin_desc ) ) { |
|
4121 | - $translation_texts[] = stripslashes_deep( $row->admin_desc ); |
|
4120 | + if (!empty($row->admin_desc)) { |
|
4121 | + $translation_texts[] = stripslashes_deep($row->admin_desc); |
|
4122 | 4122 | } |
4123 | 4123 | |
4124 | - if ( ! empty( $row->site_title ) ) { |
|
4125 | - $translation_texts[] = stripslashes_deep( $row->site_title ); |
|
4124 | + if (!empty($row->site_title)) { |
|
4125 | + $translation_texts[] = stripslashes_deep($row->site_title); |
|
4126 | 4126 | } |
4127 | 4127 | |
4128 | - if ( ! empty( $row->clabels ) ) { |
|
4129 | - $translation_texts[] = stripslashes_deep( $row->clabels ); |
|
4128 | + if (!empty($row->clabels)) { |
|
4129 | + $translation_texts[] = stripslashes_deep($row->clabels); |
|
4130 | 4130 | } |
4131 | 4131 | |
4132 | - if ( ! empty( $row->required_msg ) ) { |
|
4133 | - $translation_texts[] = stripslashes_deep( $row->required_msg ); |
|
4132 | + if (!empty($row->required_msg)) { |
|
4133 | + $translation_texts[] = stripslashes_deep($row->required_msg); |
|
4134 | 4134 | } |
4135 | 4135 | |
4136 | - if ( ! empty( $row->default_value ) ) { |
|
4137 | - $translation_texts[] = stripslashes_deep( $row->default_value ); |
|
4136 | + if (!empty($row->default_value)) { |
|
4137 | + $translation_texts[] = stripslashes_deep($row->default_value); |
|
4138 | 4138 | } |
4139 | 4139 | |
4140 | - if ( ! empty( $row->option_values ) ) { |
|
4141 | - $option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) ); |
|
4140 | + if (!empty($row->option_values)) { |
|
4141 | + $option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values)); |
|
4142 | 4142 | |
4143 | - if ( ! empty( $option_values ) ) { |
|
4144 | - foreach ( $option_values as $option_value ) { |
|
4145 | - if ( ! empty( $option_value['label'] ) ) { |
|
4143 | + if (!empty($option_values)) { |
|
4144 | + foreach ($option_values as $option_value) { |
|
4145 | + if (!empty($option_value['label'])) { |
|
4146 | 4146 | $translation_texts[] = $option_value['label']; |
4147 | 4147 | } |
4148 | 4148 | } |
@@ -4152,48 +4152,48 @@ discard block |
||
4152 | 4152 | } |
4153 | 4153 | |
4154 | 4154 | // Custom sorting fields table |
4155 | - $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE; |
|
4156 | - $rows = $wpdb->get_results( $sql ); |
|
4155 | + $sql = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE; |
|
4156 | + $rows = $wpdb->get_results($sql); |
|
4157 | 4157 | |
4158 | - if ( ! empty( $rows ) ) { |
|
4159 | - foreach ( $rows as $row ) { |
|
4160 | - if ( ! empty( $row->site_title ) ) { |
|
4161 | - $translation_texts[] = stripslashes_deep( $row->site_title ); |
|
4158 | + if (!empty($rows)) { |
|
4159 | + foreach ($rows as $row) { |
|
4160 | + if (!empty($row->site_title)) { |
|
4161 | + $translation_texts[] = stripslashes_deep($row->site_title); |
|
4162 | 4162 | } |
4163 | 4163 | |
4164 | - if ( ! empty( $row->asc_title ) ) { |
|
4165 | - $translation_texts[] = stripslashes_deep( $row->asc_title ); |
|
4164 | + if (!empty($row->asc_title)) { |
|
4165 | + $translation_texts[] = stripslashes_deep($row->asc_title); |
|
4166 | 4166 | } |
4167 | 4167 | |
4168 | - if ( ! empty( $row->desc_title ) ) { |
|
4169 | - $translation_texts[] = stripslashes_deep( $row->desc_title ); |
|
4168 | + if (!empty($row->desc_title)) { |
|
4169 | + $translation_texts[] = stripslashes_deep($row->desc_title); |
|
4170 | 4170 | } |
4171 | 4171 | } |
4172 | 4172 | } |
4173 | 4173 | |
4174 | 4174 | // Advance search filter fields table |
4175 | - if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) { |
|
4176 | - $sql = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE; |
|
4177 | - $rows = $wpdb->get_results( $sql ); |
|
4178 | - |
|
4179 | - if ( ! empty( $rows ) ) { |
|
4180 | - foreach ( $rows as $row ) { |
|
4181 | - if ( ! empty( $row->field_site_name ) ) { |
|
4182 | - $translation_texts[] = stripslashes_deep( $row->field_site_name ); |
|
4175 | + if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) { |
|
4176 | + $sql = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE; |
|
4177 | + $rows = $wpdb->get_results($sql); |
|
4178 | + |
|
4179 | + if (!empty($rows)) { |
|
4180 | + foreach ($rows as $row) { |
|
4181 | + if (!empty($row->field_site_name)) { |
|
4182 | + $translation_texts[] = stripslashes_deep($row->field_site_name); |
|
4183 | 4183 | } |
4184 | 4184 | |
4185 | - if ( ! empty( $row->front_search_title ) ) { |
|
4186 | - $translation_texts[] = stripslashes_deep( $row->front_search_title ); |
|
4185 | + if (!empty($row->front_search_title)) { |
|
4186 | + $translation_texts[] = stripslashes_deep($row->front_search_title); |
|
4187 | 4187 | } |
4188 | 4188 | |
4189 | - if ( ! empty( $row->field_desc ) ) { |
|
4190 | - $translation_texts[] = stripslashes_deep( $row->field_desc ); |
|
4189 | + if (!empty($row->field_desc)) { |
|
4190 | + $translation_texts[] = stripslashes_deep($row->field_desc); |
|
4191 | 4191 | } |
4192 | 4192 | } |
4193 | 4193 | } |
4194 | 4194 | } |
4195 | 4195 | |
4196 | - $translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts; |
|
4196 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
4197 | 4197 | |
4198 | 4198 | return $translation_texts; |
4199 | 4199 | } |
@@ -4215,7 +4215,7 @@ discard block |
||
4215 | 4215 | * |
4216 | 4216 | * @param array $geodir_allowed_mime_types and file extensions. |
4217 | 4217 | */ |
4218 | - return apply_filters( 'geodir_allowed_mime_types', array( |
|
4218 | + return apply_filters('geodir_allowed_mime_types', array( |
|
4219 | 4219 | 'Image' => array( // Image formats. |
4220 | 4220 | 'jpg' => 'image/jpeg', |
4221 | 4221 | 'jpe' => 'image/jpeg', |
@@ -4283,18 +4283,18 @@ discard block |
||
4283 | 4283 | * |
4284 | 4284 | * @return string User display name. |
4285 | 4285 | */ |
4286 | -function geodir_get_client_name( $user_id ) { |
|
4286 | +function geodir_get_client_name($user_id) { |
|
4287 | 4287 | $client_name = ''; |
4288 | 4288 | |
4289 | - $user_data = get_userdata( $user_id ); |
|
4289 | + $user_data = get_userdata($user_id); |
|
4290 | 4290 | |
4291 | - if ( ! empty( $user_data ) ) { |
|
4292 | - if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) { |
|
4293 | - $client_name = trim( $user_data->display_name ); |
|
4294 | - } else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) { |
|
4295 | - $client_name = trim( $user_data->user_nicename ); |
|
4291 | + if (!empty($user_data)) { |
|
4292 | + if (isset($user_data->display_name) && trim($user_data->display_name) != '') { |
|
4293 | + $client_name = trim($user_data->display_name); |
|
4294 | + } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') { |
|
4295 | + $client_name = trim($user_data->user_nicename); |
|
4296 | 4296 | } else { |
4297 | - $client_name = trim( $user_data->user_login ); |
|
4297 | + $client_name = trim($user_data->user_login); |
|
4298 | 4298 | } |
4299 | 4299 | } |
4300 | 4300 | |
@@ -4302,19 +4302,19 @@ discard block |
||
4302 | 4302 | } |
4303 | 4303 | |
4304 | 4304 | |
4305 | -add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 ); |
|
4305 | +add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1); |
|
4306 | 4306 | /* |
4307 | 4307 | * Add location variables to wpseo replacements. |
4308 | 4308 | * |
4309 | 4309 | * @since 1.5.4 |
4310 | 4310 | */ |
4311 | -function geodir_wpseo_replacements( $vars ) { |
|
4311 | +function geodir_wpseo_replacements($vars) { |
|
4312 | 4312 | |
4313 | 4313 | global $wp; |
4314 | 4314 | $title = ''; |
4315 | 4315 | // location variables |
4316 | 4316 | $gd_post_type = geodir_get_current_posttype(); |
4317 | - $location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type ); |
|
4317 | + $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
4318 | 4318 | /** |
4319 | 4319 | * Filter the title variables location variables array |
4320 | 4320 | * |
@@ -4324,105 +4324,105 @@ discard block |
||
4324 | 4324 | * @param array $location_array The array of location variables. |
4325 | 4325 | * @param array $vars The page title variables. |
4326 | 4326 | */ |
4327 | - $location_array = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars ); |
|
4327 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars); |
|
4328 | 4328 | $location_titles = array(); |
4329 | - if ( get_query_var( 'gd_country_full' ) ) { |
|
4330 | - if ( get_query_var( 'gd_country_full' ) ) { |
|
4331 | - $location_array['gd_country'] = get_query_var( 'gd_country_full' ); |
|
4329 | + if (get_query_var('gd_country_full')) { |
|
4330 | + if (get_query_var('gd_country_full')) { |
|
4331 | + $location_array['gd_country'] = get_query_var('gd_country_full'); |
|
4332 | 4332 | } |
4333 | - if ( get_query_var( 'gd_region_full' ) ) { |
|
4334 | - $location_array['gd_region'] = get_query_var( 'gd_region_full' ); |
|
4333 | + if (get_query_var('gd_region_full')) { |
|
4334 | + $location_array['gd_region'] = get_query_var('gd_region_full'); |
|
4335 | 4335 | } |
4336 | - if ( get_query_var( 'gd_city_full' ) ) { |
|
4337 | - $location_array['gd_city'] = get_query_var( 'gd_city_full' ); |
|
4336 | + if (get_query_var('gd_city_full')) { |
|
4337 | + $location_array['gd_city'] = get_query_var('gd_city_full'); |
|
4338 | 4338 | } |
4339 | 4339 | } |
4340 | 4340 | $location_single = ''; |
4341 | - $gd_country = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : ''; |
|
4342 | - $gd_region = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : ''; |
|
4343 | - $gd_city = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : ''; |
|
4341 | + $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
4342 | + $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
4343 | + $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
4344 | 4344 | |
4345 | 4345 | $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
4346 | 4346 | |
4347 | - if ( function_exists( 'get_actual_location_name' ) ) { |
|
4348 | - $gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country; |
|
4349 | - $gd_region_actual = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region; |
|
4350 | - $gd_city_actual = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city; |
|
4347 | + if (function_exists('get_actual_location_name')) { |
|
4348 | + $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country; |
|
4349 | + $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region; |
|
4350 | + $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city; |
|
4351 | 4351 | } |
4352 | 4352 | |
4353 | - if ( $gd_city != '' ) { |
|
4354 | - if ( $gd_city_actual != '' ) { |
|
4353 | + if ($gd_city != '') { |
|
4354 | + if ($gd_city_actual != '') { |
|
4355 | 4355 | $gd_city = $gd_city_actual; |
4356 | 4356 | } else { |
4357 | - $gd_city = preg_replace( '/-(\d+)$/', '', $gd_city ); |
|
4358 | - $gd_city = preg_replace( '/[_-]/', ' ', $gd_city ); |
|
4359 | - $gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' ); |
|
4357 | + $gd_city = preg_replace('/-(\d+)$/', '', $gd_city); |
|
4358 | + $gd_city = preg_replace('/[_-]/', ' ', $gd_city); |
|
4359 | + $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
4360 | 4360 | } |
4361 | 4361 | $location_single = $gd_city; |
4362 | 4362 | |
4363 | - } else if ( $gd_region != '' ) { |
|
4364 | - if ( $gd_region_actual != '' ) { |
|
4363 | + } else if ($gd_region != '') { |
|
4364 | + if ($gd_region_actual != '') { |
|
4365 | 4365 | $gd_region = $gd_region_actual; |
4366 | 4366 | } else { |
4367 | - $gd_region = preg_replace( '/-(\d+)$/', '', $gd_region ); |
|
4368 | - $gd_region = preg_replace( '/[_-]/', ' ', $gd_region ); |
|
4369 | - $gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' ); |
|
4367 | + $gd_region = preg_replace('/-(\d+)$/', '', $gd_region); |
|
4368 | + $gd_region = preg_replace('/[_-]/', ' ', $gd_region); |
|
4369 | + $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
4370 | 4370 | } |
4371 | 4371 | |
4372 | 4372 | $location_single = $gd_region; |
4373 | - } else if ( $gd_country != '' ) { |
|
4374 | - if ( $gd_country_actual != '' ) { |
|
4373 | + } else if ($gd_country != '') { |
|
4374 | + if ($gd_country_actual != '') { |
|
4375 | 4375 | $gd_country = $gd_country_actual; |
4376 | 4376 | } else { |
4377 | - $gd_country = preg_replace( '/-(\d+)$/', '', $gd_country ); |
|
4378 | - $gd_country = preg_replace( '/[_-]/', ' ', $gd_country ); |
|
4379 | - $gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' ); |
|
4377 | + $gd_country = preg_replace('/-(\d+)$/', '', $gd_country); |
|
4378 | + $gd_country = preg_replace('/[_-]/', ' ', $gd_country); |
|
4379 | + $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
4380 | 4380 | } |
4381 | 4381 | |
4382 | 4382 | $location_single = $gd_country; |
4383 | 4383 | } |
4384 | 4384 | |
4385 | - if ( ! empty( $location_array ) ) { |
|
4385 | + if (!empty($location_array)) { |
|
4386 | 4386 | |
4387 | - $actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false; |
|
4388 | - $location_array = array_reverse( $location_array ); |
|
4387 | + $actual_location_name = function_exists('get_actual_location_name') ? true : false; |
|
4388 | + $location_array = array_reverse($location_array); |
|
4389 | 4389 | |
4390 | - foreach ( $location_array as $location_type => $location ) { |
|
4391 | - $gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location ); |
|
4392 | - $gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text ); |
|
4390 | + foreach ($location_array as $location_type => $location) { |
|
4391 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location); |
|
4392 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
4393 | 4393 | |
4394 | - $location_name = geodir_ucwords( $gd_location_link_text ); |
|
4395 | - $location_name = __( $location_name, 'geodirectory' ); |
|
4394 | + $location_name = geodir_ucwords($gd_location_link_text); |
|
4395 | + $location_name = __($location_name, 'geodirectory'); |
|
4396 | 4396 | |
4397 | - if ( $actual_location_name ) { |
|
4398 | - $location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type; |
|
4399 | - $location_name = get_actual_location_name( $location_type, $location, true ); |
|
4397 | + if ($actual_location_name) { |
|
4398 | + $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type; |
|
4399 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
4400 | 4400 | } |
4401 | 4401 | |
4402 | 4402 | $location_titles[] = $location_name; |
4403 | 4403 | } |
4404 | - if ( ! empty( $location_titles ) ) { |
|
4405 | - $location_titles = array_unique( $location_titles ); |
|
4404 | + if (!empty($location_titles)) { |
|
4405 | + $location_titles = array_unique($location_titles); |
|
4406 | 4406 | } |
4407 | 4407 | } |
4408 | 4408 | |
4409 | 4409 | |
4410 | - if ( ! empty( $location_titles ) ) { |
|
4411 | - $vars['%%location%%'] = implode( ", ", $location_titles ); |
|
4410 | + if (!empty($location_titles)) { |
|
4411 | + $vars['%%location%%'] = implode(", ", $location_titles); |
|
4412 | 4412 | } |
4413 | 4413 | |
4414 | 4414 | |
4415 | - if ( ! empty( $location_titles ) ) { |
|
4416 | - $vars['%%in_location%%'] = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles ); |
|
4415 | + if (!empty($location_titles)) { |
|
4416 | + $vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles); |
|
4417 | 4417 | } |
4418 | 4418 | |
4419 | 4419 | |
4420 | - if ( $location_single ) { |
|
4421 | - $vars['%%in_location_single%%'] = __( 'in', 'geodirectory' ) . ' ' . $location_single; |
|
4420 | + if ($location_single) { |
|
4421 | + $vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single; |
|
4422 | 4422 | } |
4423 | 4423 | |
4424 | 4424 | |
4425 | - if ( $location_single ) { |
|
4425 | + if ($location_single) { |
|
4426 | 4426 | $vars['%%location_single%%'] = $location_single; |
4427 | 4427 | } |
4428 | 4428 | |
@@ -4435,13 +4435,13 @@ discard block |
||
4435 | 4435 | * @param string $vars The title with variables. |
4436 | 4436 | * @param array $location_array The array of location variables. |
4437 | 4437 | */ |
4438 | - return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array ); |
|
4438 | + return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array); |
|
4439 | 4439 | } |
4440 | 4440 | |
4441 | 4441 | |
4442 | -add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 ); |
|
4443 | -add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 ); |
|
4444 | -add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 ); |
|
4442 | +add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3); |
|
4443 | +add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2); |
|
4444 | +add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3); |
|
4445 | 4445 | |
4446 | 4446 | /** |
4447 | 4447 | * Filter the title variables. |
@@ -4483,14 +4483,14 @@ discard block |
||
4483 | 4483 | * |
4484 | 4484 | * @return string Title after filtered variables. |
4485 | 4485 | */ |
4486 | -function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) { |
|
4486 | +function geodir_filter_title_variables($title, $gd_page, $sep = '') { |
|
4487 | 4487 | global $wp, $post; |
4488 | 4488 | |
4489 | - if ( ! $gd_page || ! $title ) { |
|
4489 | + if (!$gd_page || !$title) { |
|
4490 | 4490 | return $title; // if no a GD page then bail. |
4491 | 4491 | } |
4492 | 4492 | |
4493 | - if ( $sep == '' ) { |
|
4493 | + if ($sep == '') { |
|
4494 | 4494 | /** |
4495 | 4495 | * Filter the page title separator. |
4496 | 4496 | * |
@@ -4499,100 +4499,100 @@ discard block |
||
4499 | 4499 | * |
4500 | 4500 | * @param string $sep The separator, default: `|`. |
4501 | 4501 | */ |
4502 | - $sep = apply_filters( 'geodir_page_title_separator', '|' ); |
|
4502 | + $sep = apply_filters('geodir_page_title_separator', '|'); |
|
4503 | 4503 | } |
4504 | 4504 | |
4505 | - if ( strpos( $title, '%%title%%' ) !== false ) { |
|
4506 | - $title = str_replace( "%%title%%", $post->post_title, $title ); |
|
4505 | + if (strpos($title, '%%title%%') !== false) { |
|
4506 | + $title = str_replace("%%title%%", $post->post_title, $title); |
|
4507 | 4507 | } |
4508 | 4508 | |
4509 | - if ( strpos( $title, '%%sitename%%' ) !== false ) { |
|
4510 | - $title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title ); |
|
4509 | + if (strpos($title, '%%sitename%%') !== false) { |
|
4510 | + $title = str_replace("%%sitename%%", get_bloginfo('name'), $title); |
|
4511 | 4511 | } |
4512 | 4512 | |
4513 | - if ( strpos( $title, '%%sitedesc%%' ) !== false ) { |
|
4514 | - $title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title ); |
|
4513 | + if (strpos($title, '%%sitedesc%%') !== false) { |
|
4514 | + $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title); |
|
4515 | 4515 | } |
4516 | 4516 | |
4517 | - if ( strpos( $title, '%%excerpt%%' ) !== false ) { |
|
4518 | - $title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title ); |
|
4517 | + if (strpos($title, '%%excerpt%%') !== false) { |
|
4518 | + $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title); |
|
4519 | 4519 | } |
4520 | 4520 | |
4521 | - if ( $gd_page == 'search' || $gd_page == 'author' ) { |
|
4522 | - $post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : ''; |
|
4523 | - } else if ( $gd_page == 'add-listing' ) { |
|
4524 | - $post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : ''; |
|
4525 | - $post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type; |
|
4526 | - } else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) { |
|
4521 | + if ($gd_page == 'search' || $gd_page == 'author') { |
|
4522 | + $post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : ''; |
|
4523 | + } else if ($gd_page == 'add-listing') { |
|
4524 | + $post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : ''; |
|
4525 | + $post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type; |
|
4526 | + } else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) { |
|
4527 | 4527 | $post_type = $post->post_type; |
4528 | 4528 | } else { |
4529 | - $post_type = get_query_var( 'post_type' ); |
|
4529 | + $post_type = get_query_var('post_type'); |
|
4530 | 4530 | } |
4531 | 4531 | |
4532 | - if ( strpos( $title, '%%pt_single%%' ) !== false ) { |
|
4532 | + if (strpos($title, '%%pt_single%%') !== false) { |
|
4533 | 4533 | $singular_name = ''; |
4534 | - if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) { |
|
4535 | - $singular_name = __( $singular_name, 'geodirectory' ); |
|
4534 | + if ($post_type && $singular_name = get_post_type_singular_label($post_type)) { |
|
4535 | + $singular_name = __($singular_name, 'geodirectory'); |
|
4536 | 4536 | } |
4537 | 4537 | |
4538 | - $title = str_replace( "%%pt_single%%", $singular_name, $title ); |
|
4538 | + $title = str_replace("%%pt_single%%", $singular_name, $title); |
|
4539 | 4539 | } |
4540 | 4540 | |
4541 | - if ( strpos( $title, '%%pt_plural%%' ) !== false ) { |
|
4541 | + if (strpos($title, '%%pt_plural%%') !== false) { |
|
4542 | 4542 | $plural_name = ''; |
4543 | - if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) { |
|
4544 | - $plural_name = __( $plural_name, 'geodirectory' ); |
|
4543 | + if ($post_type && $plural_name = get_post_type_plural_label($post_type)) { |
|
4544 | + $plural_name = __($plural_name, 'geodirectory'); |
|
4545 | 4545 | } |
4546 | 4546 | |
4547 | - $title = str_replace( "%%pt_plural%%", $plural_name, $title ); |
|
4547 | + $title = str_replace("%%pt_plural%%", $plural_name, $title); |
|
4548 | 4548 | } |
4549 | 4549 | |
4550 | - if ( strpos( $title, '%%category%%' ) !== false ) { |
|
4550 | + if (strpos($title, '%%category%%') !== false) { |
|
4551 | 4551 | $cat_name = ''; |
4552 | 4552 | |
4553 | - if ( $gd_page == 'detail' ) { |
|
4554 | - if ( $post->default_category ) { |
|
4555 | - $cat = get_term( $post->default_category, $post->post_type . 'category' ); |
|
4556 | - $cat_name = ( isset( $cat->name ) ) ? $cat->name : ''; |
|
4553 | + if ($gd_page == 'detail') { |
|
4554 | + if ($post->default_category) { |
|
4555 | + $cat = get_term($post->default_category, $post->post_type.'category'); |
|
4556 | + $cat_name = (isset($cat->name)) ? $cat->name : ''; |
|
4557 | 4557 | } |
4558 | - } else if ( $gd_page == 'listing' ) { |
|
4558 | + } else if ($gd_page == 'listing') { |
|
4559 | 4559 | $queried_object = get_queried_object(); |
4560 | - if ( isset( $queried_object->name ) ) { |
|
4560 | + if (isset($queried_object->name)) { |
|
4561 | 4561 | $cat_name = $queried_object->name; |
4562 | 4562 | } |
4563 | 4563 | } |
4564 | - $title = str_replace( "%%category%%", $cat_name, $title ); |
|
4564 | + $title = str_replace("%%category%%", $cat_name, $title); |
|
4565 | 4565 | } |
4566 | 4566 | |
4567 | - if ( strpos( $title, '%%tag%%' ) !== false ) { |
|
4567 | + if (strpos($title, '%%tag%%') !== false) { |
|
4568 | 4568 | $cat_name = ''; |
4569 | 4569 | |
4570 | - if ( $gd_page == 'detail' ) { |
|
4571 | - if ( $post->default_category ) { |
|
4572 | - $cat = get_term( $post->default_category, $post->post_type . 'category' ); |
|
4573 | - $cat_name = ( isset( $cat->name ) ) ? $cat->name : ''; |
|
4570 | + if ($gd_page == 'detail') { |
|
4571 | + if ($post->default_category) { |
|
4572 | + $cat = get_term($post->default_category, $post->post_type.'category'); |
|
4573 | + $cat_name = (isset($cat->name)) ? $cat->name : ''; |
|
4574 | 4574 | } |
4575 | - } else if ( $gd_page == 'listing' ) { |
|
4575 | + } else if ($gd_page == 'listing') { |
|
4576 | 4576 | $queried_object = get_queried_object(); |
4577 | - if ( isset( $queried_object->name ) ) { |
|
4577 | + if (isset($queried_object->name)) { |
|
4578 | 4578 | $cat_name = $queried_object->name; |
4579 | 4579 | } |
4580 | 4580 | } |
4581 | - $title = str_replace( "%%tag%%", $cat_name, $title ); |
|
4581 | + $title = str_replace("%%tag%%", $cat_name, $title); |
|
4582 | 4582 | } |
4583 | 4583 | |
4584 | - if ( strpos( $title, '%%id%%' ) !== false ) { |
|
4585 | - $ID = ( isset( $post->ID ) ) ? $post->ID : ''; |
|
4586 | - $title = str_replace( "%%id%%", $ID, $title ); |
|
4584 | + if (strpos($title, '%%id%%') !== false) { |
|
4585 | + $ID = (isset($post->ID)) ? $post->ID : ''; |
|
4586 | + $title = str_replace("%%id%%", $ID, $title); |
|
4587 | 4587 | } |
4588 | 4588 | |
4589 | - if ( strpos( $title, '%%sep%%' ) !== false ) { |
|
4590 | - $title = str_replace( "%%sep%%", $sep, $title ); |
|
4589 | + if (strpos($title, '%%sep%%') !== false) { |
|
4590 | + $title = str_replace("%%sep%%", $sep, $title); |
|
4591 | 4591 | } |
4592 | 4592 | |
4593 | 4593 | // location variables |
4594 | 4594 | $gd_post_type = geodir_get_current_posttype(); |
4595 | - $location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type ); |
|
4595 | + $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type); |
|
4596 | 4596 | /** |
4597 | 4597 | * Filter the title variables location variables array |
4598 | 4598 | * |
@@ -4604,166 +4604,166 @@ discard block |
||
4604 | 4604 | * @param string $gd_page The page being filtered. |
4605 | 4605 | * @param string $sep The separator, default: `|`. |
4606 | 4606 | */ |
4607 | - $location_array = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep ); |
|
4607 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep); |
|
4608 | 4608 | $location_titles = array(); |
4609 | - if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) { |
|
4610 | - if ( get_query_var( 'gd_country_full' ) ) { |
|
4611 | - $location_array['gd_country'] = get_query_var( 'gd_country_full' ); |
|
4609 | + if ($gd_page == 'location' && get_query_var('gd_country_full')) { |
|
4610 | + if (get_query_var('gd_country_full')) { |
|
4611 | + $location_array['gd_country'] = get_query_var('gd_country_full'); |
|
4612 | 4612 | } |
4613 | - if ( get_query_var( 'gd_region_full' ) ) { |
|
4614 | - $location_array['gd_region'] = get_query_var( 'gd_region_full' ); |
|
4613 | + if (get_query_var('gd_region_full')) { |
|
4614 | + $location_array['gd_region'] = get_query_var('gd_region_full'); |
|
4615 | 4615 | } |
4616 | - if ( get_query_var( 'gd_city_full' ) ) { |
|
4617 | - $location_array['gd_city'] = get_query_var( 'gd_city_full' ); |
|
4616 | + if (get_query_var('gd_city_full')) { |
|
4617 | + $location_array['gd_city'] = get_query_var('gd_city_full'); |
|
4618 | 4618 | } |
4619 | 4619 | } |
4620 | 4620 | $location_single = ''; |
4621 | - $gd_country = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : ''; |
|
4622 | - $gd_region = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : ''; |
|
4623 | - $gd_city = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : ''; |
|
4621 | + $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
4622 | + $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
4623 | + $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
4624 | 4624 | |
4625 | 4625 | $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
4626 | 4626 | |
4627 | - if ( function_exists( 'get_actual_location_name' ) ) { |
|
4628 | - $gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country; |
|
4629 | - $gd_region_actual = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region; |
|
4630 | - $gd_city_actual = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city; |
|
4627 | + if (function_exists('get_actual_location_name')) { |
|
4628 | + $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country; |
|
4629 | + $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region; |
|
4630 | + $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city; |
|
4631 | 4631 | } |
4632 | 4632 | |
4633 | - if ( $gd_city != '' ) { |
|
4634 | - if ( $gd_city_actual != '' ) { |
|
4633 | + if ($gd_city != '') { |
|
4634 | + if ($gd_city_actual != '') { |
|
4635 | 4635 | $gd_city = $gd_city_actual; |
4636 | 4636 | } else { |
4637 | - $gd_city = preg_replace( '/-(\d+)$/', '', $gd_city ); |
|
4638 | - $gd_city = preg_replace( '/[_-]/', ' ', $gd_city ); |
|
4639 | - $gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' ); |
|
4637 | + $gd_city = preg_replace('/-(\d+)$/', '', $gd_city); |
|
4638 | + $gd_city = preg_replace('/[_-]/', ' ', $gd_city); |
|
4639 | + $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
4640 | 4640 | } |
4641 | 4641 | $location_single = $gd_city; |
4642 | 4642 | |
4643 | - } else if ( $gd_region != '' ) { |
|
4644 | - if ( $gd_region_actual != '' ) { |
|
4643 | + } else if ($gd_region != '') { |
|
4644 | + if ($gd_region_actual != '') { |
|
4645 | 4645 | $gd_region = $gd_region_actual; |
4646 | 4646 | } else { |
4647 | - $gd_region = preg_replace( '/-(\d+)$/', '', $gd_region ); |
|
4648 | - $gd_region = preg_replace( '/[_-]/', ' ', $gd_region ); |
|
4649 | - $gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' ); |
|
4647 | + $gd_region = preg_replace('/-(\d+)$/', '', $gd_region); |
|
4648 | + $gd_region = preg_replace('/[_-]/', ' ', $gd_region); |
|
4649 | + $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
4650 | 4650 | } |
4651 | 4651 | |
4652 | 4652 | $location_single = $gd_region; |
4653 | - } else if ( $gd_country != '' ) { |
|
4654 | - if ( $gd_country_actual != '' ) { |
|
4653 | + } else if ($gd_country != '') { |
|
4654 | + if ($gd_country_actual != '') { |
|
4655 | 4655 | $gd_country = $gd_country_actual; |
4656 | 4656 | } else { |
4657 | - $gd_country = preg_replace( '/-(\d+)$/', '', $gd_country ); |
|
4658 | - $gd_country = preg_replace( '/[_-]/', ' ', $gd_country ); |
|
4659 | - $gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' ); |
|
4657 | + $gd_country = preg_replace('/-(\d+)$/', '', $gd_country); |
|
4658 | + $gd_country = preg_replace('/[_-]/', ' ', $gd_country); |
|
4659 | + $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
4660 | 4660 | } |
4661 | 4661 | |
4662 | 4662 | $location_single = $gd_country; |
4663 | 4663 | } |
4664 | 4664 | |
4665 | - if ( ! empty( $location_array ) ) { |
|
4665 | + if (!empty($location_array)) { |
|
4666 | 4666 | |
4667 | - $actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false; |
|
4668 | - $location_array = array_reverse( $location_array ); |
|
4667 | + $actual_location_name = function_exists('get_actual_location_name') ? true : false; |
|
4668 | + $location_array = array_reverse($location_array); |
|
4669 | 4669 | |
4670 | - foreach ( $location_array as $location_type => $location ) { |
|
4671 | - $gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location ); |
|
4672 | - $gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text ); |
|
4670 | + foreach ($location_array as $location_type => $location) { |
|
4671 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location); |
|
4672 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text); |
|
4673 | 4673 | |
4674 | - $location_name = geodir_ucwords( $gd_location_link_text ); |
|
4675 | - $location_name = __( $location_name, 'geodirectory' ); |
|
4674 | + $location_name = geodir_ucwords($gd_location_link_text); |
|
4675 | + $location_name = __($location_name, 'geodirectory'); |
|
4676 | 4676 | |
4677 | - if ( $actual_location_name ) { |
|
4678 | - $location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type; |
|
4679 | - $location_name = get_actual_location_name( $location_type, $location, true ); |
|
4677 | + if ($actual_location_name) { |
|
4678 | + $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type; |
|
4679 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
4680 | 4680 | } |
4681 | 4681 | |
4682 | 4682 | $location_titles[] = $location_name; |
4683 | 4683 | } |
4684 | - if ( ! empty( $location_titles ) ) { |
|
4685 | - $location_titles = array_unique( $location_titles ); |
|
4684 | + if (!empty($location_titles)) { |
|
4685 | + $location_titles = array_unique($location_titles); |
|
4686 | 4686 | } |
4687 | 4687 | } |
4688 | 4688 | |
4689 | 4689 | |
4690 | - if ( strpos( $title, '%%location%%' ) !== false ) { |
|
4690 | + if (strpos($title, '%%location%%') !== false) { |
|
4691 | 4691 | $location = ''; |
4692 | - if ( $location_titles ) { |
|
4693 | - $location = implode( ", ", $location_titles ); |
|
4692 | + if ($location_titles) { |
|
4693 | + $location = implode(", ", $location_titles); |
|
4694 | 4694 | } |
4695 | - $title = str_replace( "%%location%%", $location, $title ); |
|
4695 | + $title = str_replace("%%location%%", $location, $title); |
|
4696 | 4696 | } |
4697 | 4697 | |
4698 | - if ( strpos( $title, '%%in_location%%' ) !== false ) { |
|
4698 | + if (strpos($title, '%%in_location%%') !== false) { |
|
4699 | 4699 | $location = ''; |
4700 | - if ( $location_titles ) { |
|
4701 | - $location = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles ); |
|
4700 | + if ($location_titles) { |
|
4701 | + $location = __('in ', 'geodirectory').implode(", ", $location_titles); |
|
4702 | 4702 | } |
4703 | - $title = str_replace( "%%in_location%%", $location, $title ); |
|
4703 | + $title = str_replace("%%in_location%%", $location, $title); |
|
4704 | 4704 | } |
4705 | 4705 | |
4706 | - if ( strpos( $title, '%%in_location_single%%' ) !== false ) { |
|
4707 | - if ( $location_single ) { |
|
4708 | - $location_single = __( 'in', 'geodirectory' ) . ' ' . $location_single; |
|
4706 | + if (strpos($title, '%%in_location_single%%') !== false) { |
|
4707 | + if ($location_single) { |
|
4708 | + $location_single = __('in', 'geodirectory').' '.$location_single; |
|
4709 | 4709 | } |
4710 | - $title = str_replace( "%%in_location_single%%", $location_single, $title ); |
|
4710 | + $title = str_replace("%%in_location_single%%", $location_single, $title); |
|
4711 | 4711 | } |
4712 | 4712 | |
4713 | - if ( strpos( $title, '%%location_single%%' ) !== false ) { |
|
4714 | - $title = str_replace( "%%location_single%%", $location_single, $title ); |
|
4713 | + if (strpos($title, '%%location_single%%') !== false) { |
|
4714 | + $title = str_replace("%%location_single%%", $location_single, $title); |
|
4715 | 4715 | } |
4716 | 4716 | |
4717 | 4717 | |
4718 | - if ( strpos( $title, '%%search_term%%' ) !== false ) { |
|
4718 | + if (strpos($title, '%%search_term%%') !== false) { |
|
4719 | 4719 | $search_term = ''; |
4720 | - if ( isset( $_REQUEST['s'] ) ) { |
|
4721 | - $search_term = esc_attr( $_REQUEST['s'] ); |
|
4720 | + if (isset($_REQUEST['s'])) { |
|
4721 | + $search_term = esc_attr($_REQUEST['s']); |
|
4722 | 4722 | } |
4723 | - $title = str_replace( "%%search_term%%", $search_term, $title ); |
|
4723 | + $title = str_replace("%%search_term%%", $search_term, $title); |
|
4724 | 4724 | } |
4725 | 4725 | |
4726 | - if ( strpos( $title, '%%search_near%%' ) !== false ) { |
|
4726 | + if (strpos($title, '%%search_near%%') !== false) { |
|
4727 | 4727 | $search_term = ''; |
4728 | - if ( isset( $_REQUEST['snear'] ) ) { |
|
4729 | - $search_term = esc_attr( $_REQUEST['snear'] ); |
|
4728 | + if (isset($_REQUEST['snear'])) { |
|
4729 | + $search_term = esc_attr($_REQUEST['snear']); |
|
4730 | 4730 | } |
4731 | - $title = str_replace( "%%search_near%%", $search_term, $title ); |
|
4731 | + $title = str_replace("%%search_near%%", $search_term, $title); |
|
4732 | 4732 | } |
4733 | 4733 | |
4734 | - if ( strpos( $title, '%%name%%' ) !== false ) { |
|
4735 | - if ( is_author() ) { |
|
4736 | - $curauth = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) ); |
|
4734 | + if (strpos($title, '%%name%%') !== false) { |
|
4735 | + if (is_author()) { |
|
4736 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
|
4737 | 4737 | $author_name = $curauth->display_name; |
4738 | 4738 | } else { |
4739 | 4739 | $author_name = get_the_author(); |
4740 | 4740 | } |
4741 | - if ( ! $author_name || $author_name === '' ) { |
|
4741 | + if (!$author_name || $author_name === '') { |
|
4742 | 4742 | $queried_object = get_queried_object(); |
4743 | 4743 | |
4744 | - if ( isset( $queried_object->data->user_nicename ) ) { |
|
4744 | + if (isset($queried_object->data->user_nicename)) { |
|
4745 | 4745 | $author_name = $queried_object->data->display_name; |
4746 | 4746 | } |
4747 | 4747 | } |
4748 | - $title = str_replace( "%%name%%", $author_name, $title ); |
|
4748 | + $title = str_replace("%%name%%", $author_name, $title); |
|
4749 | 4749 | } |
4750 | 4750 | |
4751 | - if ( strpos( $title, '%%page%%' ) !== false ) { |
|
4752 | - $page = geodir_title_meta_page( $sep ); |
|
4753 | - $title = str_replace( "%%page%%", $page, $title ); |
|
4751 | + if (strpos($title, '%%page%%') !== false) { |
|
4752 | + $page = geodir_title_meta_page($sep); |
|
4753 | + $title = str_replace("%%page%%", $page, $title); |
|
4754 | 4754 | } |
4755 | - if ( strpos( $title, '%%pagenumber%%' ) !== false ) { |
|
4755 | + if (strpos($title, '%%pagenumber%%') !== false) { |
|
4756 | 4756 | $pagenumber = geodir_title_meta_pagenumber(); |
4757 | - $title = str_replace( "%%pagenumber%%", $pagenumber, $title ); |
|
4757 | + $title = str_replace("%%pagenumber%%", $pagenumber, $title); |
|
4758 | 4758 | } |
4759 | - if ( strpos( $title, '%%pagetotal%%' ) !== false ) { |
|
4759 | + if (strpos($title, '%%pagetotal%%') !== false) { |
|
4760 | 4760 | $pagetotal = geodir_title_meta_pagetotal(); |
4761 | - $title = str_replace( "%%pagetotal%%", $pagetotal, $title ); |
|
4761 | + $title = str_replace("%%pagetotal%%", $pagetotal, $title); |
|
4762 | 4762 | } |
4763 | 4763 | |
4764 | - $title = wptexturize( $title ); |
|
4765 | - $title = convert_chars( $title ); |
|
4766 | - $title = esc_html( $title ); |
|
4764 | + $title = wptexturize($title); |
|
4765 | + $title = convert_chars($title); |
|
4766 | + $title = esc_html($title); |
|
4767 | 4767 | |
4768 | 4768 | /** |
4769 | 4769 | * Filter the title variables after standard ones have been filtered. |
@@ -4777,7 +4777,7 @@ discard block |
||
4777 | 4777 | * @param string $sep The separator, default: `|`. |
4778 | 4778 | */ |
4779 | 4779 | |
4780 | - return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep ); |
|
4780 | + return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep); |
|
4781 | 4781 | } |
4782 | 4782 | |
4783 | 4783 | /** |
@@ -4790,82 +4790,82 @@ discard block |
||
4790 | 4790 | * |
4791 | 4791 | * @return array Translation texts. |
4792 | 4792 | */ |
4793 | -function geodir_load_cpt_text_translation( $translation_texts = array() ) { |
|
4794 | - $gd_post_types = geodir_get_posttypes( 'array' ); |
|
4793 | +function geodir_load_cpt_text_translation($translation_texts = array()) { |
|
4794 | + $gd_post_types = geodir_get_posttypes('array'); |
|
4795 | 4795 | |
4796 | - if ( ! empty( $gd_post_types ) ) { |
|
4797 | - foreach ( $gd_post_types as $post_type => $cpt_info ) { |
|
4798 | - $labels = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : ''; |
|
4799 | - $description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : ''; |
|
4800 | - $seo = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : ''; |
|
4796 | + if (!empty($gd_post_types)) { |
|
4797 | + foreach ($gd_post_types as $post_type => $cpt_info) { |
|
4798 | + $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : ''; |
|
4799 | + $description = isset($cpt_info['description']) ? $cpt_info['description'] : ''; |
|
4800 | + $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : ''; |
|
4801 | 4801 | |
4802 | - if ( ! empty( $labels ) ) { |
|
4803 | - if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) { |
|
4802 | + if (!empty($labels)) { |
|
4803 | + if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) { |
|
4804 | 4804 | $translation_texts[] = $labels['name']; |
4805 | 4805 | } |
4806 | - if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) { |
|
4806 | + if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) { |
|
4807 | 4807 | $translation_texts[] = $labels['singular_name']; |
4808 | 4808 | } |
4809 | - if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) { |
|
4809 | + if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) { |
|
4810 | 4810 | $translation_texts[] = $labels['add_new']; |
4811 | 4811 | } |
4812 | - if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) { |
|
4812 | + if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) { |
|
4813 | 4813 | $translation_texts[] = $labels['add_new_item']; |
4814 | 4814 | } |
4815 | - if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) { |
|
4815 | + if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) { |
|
4816 | 4816 | $translation_texts[] = $labels['edit_item']; |
4817 | 4817 | } |
4818 | - if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) { |
|
4818 | + if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) { |
|
4819 | 4819 | $translation_texts[] = $labels['new_item']; |
4820 | 4820 | } |
4821 | - if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) { |
|
4821 | + if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) { |
|
4822 | 4822 | $translation_texts[] = $labels['view_item']; |
4823 | 4823 | } |
4824 | - if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) { |
|
4824 | + if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) { |
|
4825 | 4825 | $translation_texts[] = $labels['search_items']; |
4826 | 4826 | } |
4827 | - if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) { |
|
4827 | + if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) { |
|
4828 | 4828 | $translation_texts[] = $labels['not_found']; |
4829 | 4829 | } |
4830 | - if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) { |
|
4830 | + if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) { |
|
4831 | 4831 | $translation_texts[] = $labels['not_found_in_trash']; |
4832 | 4832 | } |
4833 | - if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) { |
|
4833 | + if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) { |
|
4834 | 4834 | $translation_texts[] = $labels['label_post_profile']; |
4835 | 4835 | } |
4836 | - if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) { |
|
4836 | + if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) { |
|
4837 | 4837 | $translation_texts[] = $labels['label_post_info']; |
4838 | 4838 | } |
4839 | - if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) { |
|
4839 | + if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) { |
|
4840 | 4840 | $translation_texts[] = $labels['label_post_images']; |
4841 | 4841 | } |
4842 | - if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) { |
|
4842 | + if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) { |
|
4843 | 4843 | $translation_texts[] = $labels['label_post_map']; |
4844 | 4844 | } |
4845 | - if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) { |
|
4845 | + if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) { |
|
4846 | 4846 | $translation_texts[] = $labels['label_reviews']; |
4847 | 4847 | } |
4848 | - if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) { |
|
4848 | + if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) { |
|
4849 | 4849 | $translation_texts[] = $labels['label_related_listing']; |
4850 | 4850 | } |
4851 | 4851 | } |
4852 | 4852 | |
4853 | - if ( $description != '' && ! in_array( $description, $translation_texts ) ) { |
|
4854 | - $translation_texts[] = normalize_whitespace( $description ); |
|
4853 | + if ($description != '' && !in_array($description, $translation_texts)) { |
|
4854 | + $translation_texts[] = normalize_whitespace($description); |
|
4855 | 4855 | } |
4856 | 4856 | |
4857 | - if ( ! empty( $seo ) ) { |
|
4858 | - if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) { |
|
4859 | - $translation_texts[] = normalize_whitespace( $seo['meta_keyword'] ); |
|
4857 | + if (!empty($seo)) { |
|
4858 | + if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) { |
|
4859 | + $translation_texts[] = normalize_whitespace($seo['meta_keyword']); |
|
4860 | 4860 | } |
4861 | 4861 | |
4862 | - if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) { |
|
4863 | - $translation_texts[] = normalize_whitespace( $seo['meta_description'] ); |
|
4862 | + if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) { |
|
4863 | + $translation_texts[] = normalize_whitespace($seo['meta_description']); |
|
4864 | 4864 | } |
4865 | 4865 | } |
4866 | 4866 | } |
4867 | 4867 | } |
4868 | - $translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts; |
|
4868 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
4869 | 4869 | |
4870 | 4870 | return $translation_texts; |
4871 | 4871 | } |
@@ -4880,27 +4880,27 @@ discard block |
||
4880 | 4880 | * |
4881 | 4881 | * @return array Location terms. |
4882 | 4882 | */ |
4883 | -function geodir_remove_location_terms( $location_terms = array() ) { |
|
4884 | - $location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false; |
|
4883 | +function geodir_remove_location_terms($location_terms = array()) { |
|
4884 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
4885 | 4885 | |
4886 | - if ( ! empty( $location_terms ) && $location_manager ) { |
|
4887 | - $hide_country_part = get_option( 'geodir_location_hide_country_part' ); |
|
4888 | - $hide_region_part = get_option( 'geodir_location_hide_region_part' ); |
|
4886 | + if (!empty($location_terms) && $location_manager) { |
|
4887 | + $hide_country_part = get_option('geodir_location_hide_country_part'); |
|
4888 | + $hide_region_part = get_option('geodir_location_hide_region_part'); |
|
4889 | 4889 | |
4890 | - if ( $hide_region_part && $hide_country_part ) { |
|
4891 | - if ( isset( $location_terms['gd_country'] ) ) { |
|
4892 | - unset( $location_terms['gd_country'] ); |
|
4890 | + if ($hide_region_part && $hide_country_part) { |
|
4891 | + if (isset($location_terms['gd_country'])) { |
|
4892 | + unset($location_terms['gd_country']); |
|
4893 | 4893 | } |
4894 | - if ( isset( $location_terms['gd_region'] ) ) { |
|
4895 | - unset( $location_terms['gd_region'] ); |
|
4894 | + if (isset($location_terms['gd_region'])) { |
|
4895 | + unset($location_terms['gd_region']); |
|
4896 | 4896 | } |
4897 | - } else if ( $hide_region_part && ! $hide_country_part ) { |
|
4898 | - if ( isset( $location_terms['gd_region'] ) ) { |
|
4899 | - unset( $location_terms['gd_region'] ); |
|
4897 | + } else if ($hide_region_part && !$hide_country_part) { |
|
4898 | + if (isset($location_terms['gd_region'])) { |
|
4899 | + unset($location_terms['gd_region']); |
|
4900 | 4900 | } |
4901 | - } else if ( ! $hide_region_part && $hide_country_part ) { |
|
4902 | - if ( isset( $location_terms['gd_country'] ) ) { |
|
4903 | - unset( $location_terms['gd_country'] ); |
|
4901 | + } else if (!$hide_region_part && $hide_country_part) { |
|
4902 | + if (isset($location_terms['gd_country'])) { |
|
4903 | + unset($location_terms['gd_country']); |
|
4904 | 4904 | } |
4905 | 4905 | } |
4906 | 4906 | } |
@@ -4918,33 +4918,33 @@ discard block |
||
4918 | 4918 | * @param WP_Post $post Post object. |
4919 | 4919 | * @param bool $update Whether this is an existing listing being updated or not. |
4920 | 4920 | */ |
4921 | -function geodir_on_wp_insert_post( $post_ID, $post, $update ) { |
|
4922 | - if ( ! $update ) { |
|
4921 | +function geodir_on_wp_insert_post($post_ID, $post, $update) { |
|
4922 | + if (!$update) { |
|
4923 | 4923 | return; |
4924 | 4924 | } |
4925 | 4925 | |
4926 | - $action = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : ''; |
|
4927 | - $is_admin = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false; |
|
4926 | + $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : ''; |
|
4927 | + $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false; |
|
4928 | 4928 | $inline_save = $action == 'inline-save' ? true : false; |
4929 | 4929 | |
4930 | - if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) { |
|
4930 | + if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) { |
|
4931 | 4931 | return; |
4932 | 4932 | } |
4933 | 4933 | |
4934 | - if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) { |
|
4934 | + if ($action != '' && in_array($action, array('geodir_import_export'))) { |
|
4935 | 4935 | return; |
4936 | 4936 | } |
4937 | 4937 | |
4938 | 4938 | $user_id = (int) get_current_user_id(); |
4939 | 4939 | |
4940 | - if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) { |
|
4941 | - $author_id = ! empty( $post->post_author ) ? $post->post_author : 0; |
|
4940 | + if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) { |
|
4941 | + $author_id = !empty($post->post_author) ? $post->post_author : 0; |
|
4942 | 4942 | |
4943 | - if ( $user_id == $author_id && ! is_super_admin() ) { |
|
4944 | - $from_email = get_option( 'site_email' ); |
|
4943 | + if ($user_id == $author_id && !is_super_admin()) { |
|
4944 | + $from_email = get_option('site_email'); |
|
4945 | 4945 | $from_name = get_site_emailName(); |
4946 | - $to_email = get_option( 'admin_email' ); |
|
4947 | - $to_name = get_option( 'name' ); |
|
4946 | + $to_email = get_option('admin_email'); |
|
4947 | + $to_name = get_option('name'); |
|
4948 | 4948 | $message_type = 'listing_edited'; |
4949 | 4949 | |
4950 | 4950 | $notify_edited = true; |
@@ -4956,9 +4956,9 @@ discard block |
||
4956 | 4956 | * @param bool $notify_edited Notify on listing edited by author? |
4957 | 4957 | * @param object $post The current post object. |
4958 | 4958 | */ |
4959 | - $notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post ); |
|
4959 | + $notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post); |
|
4960 | 4960 | |
4961 | - geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID ); |
|
4961 | + geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID); |
|
4962 | 4962 | } |
4963 | 4963 | } |
4964 | 4964 | } |
@@ -4973,14 +4973,14 @@ discard block |
||
4973 | 4973 | * |
4974 | 4974 | * @return string|null The current page start & end numbering. |
4975 | 4975 | */ |
4976 | -function geodir_title_meta_page( $sep ) { |
|
4976 | +function geodir_title_meta_page($sep) { |
|
4977 | 4977 | $replacement = null; |
4978 | 4978 | |
4979 | - $max = geodir_title_meta_pagenumbering( 'max' ); |
|
4980 | - $nr = geodir_title_meta_pagenumbering( 'nr' ); |
|
4979 | + $max = geodir_title_meta_pagenumbering('max'); |
|
4980 | + $nr = geodir_title_meta_pagenumbering('nr'); |
|
4981 | 4981 | |
4982 | - if ( $max > 1 && $nr > 1 ) { |
|
4983 | - $replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max ); |
|
4982 | + if ($max > 1 && $nr > 1) { |
|
4983 | + $replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max); |
|
4984 | 4984 | } |
4985 | 4985 | |
4986 | 4986 | return $replacement; |
@@ -4997,8 +4997,8 @@ discard block |
||
4997 | 4997 | function geodir_title_meta_pagenumber() { |
4998 | 4998 | $replacement = null; |
4999 | 4999 | |
5000 | - $nr = geodir_title_meta_pagenumbering( 'nr' ); |
|
5001 | - if ( isset( $nr ) && $nr > 0 ) { |
|
5000 | + $nr = geodir_title_meta_pagenumbering('nr'); |
|
5001 | + if (isset($nr) && $nr > 0) { |
|
5002 | 5002 | $replacement = (string) $nr; |
5003 | 5003 | } |
5004 | 5004 | |
@@ -5016,8 +5016,8 @@ discard block |
||
5016 | 5016 | function geodir_title_meta_pagetotal() { |
5017 | 5017 | $replacement = null; |
5018 | 5018 | |
5019 | - $max = geodir_title_meta_pagenumbering( 'max' ); |
|
5020 | - if ( isset( $max ) && $max > 0 ) { |
|
5019 | + $max = geodir_title_meta_pagenumbering('max'); |
|
5020 | + if (isset($max) && $max > 0) { |
|
5021 | 5021 | $replacement = (string) $max; |
5022 | 5022 | } |
5023 | 5023 | |
@@ -5037,36 +5037,36 @@ discard block |
||
5037 | 5037 | * |
5038 | 5038 | * @return int|null The current page numbering. |
5039 | 5039 | */ |
5040 | -function geodir_title_meta_pagenumbering( $request = 'nr' ) { |
|
5040 | +function geodir_title_meta_pagenumbering($request = 'nr') { |
|
5041 | 5041 | global $wp_query, $post; |
5042 | 5042 | $max_num_pages = null; |
5043 | 5043 | $page_number = null; |
5044 | 5044 | |
5045 | 5045 | $max_num_pages = 1; |
5046 | 5046 | |
5047 | - if ( ! is_singular() ) { |
|
5048 | - $page_number = get_query_var( 'paged' ); |
|
5049 | - if ( $page_number === 0 || $page_number === '' ) { |
|
5047 | + if (!is_singular()) { |
|
5048 | + $page_number = get_query_var('paged'); |
|
5049 | + if ($page_number === 0 || $page_number === '') { |
|
5050 | 5050 | $page_number = 1; |
5051 | 5051 | } |
5052 | 5052 | |
5053 | - if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) { |
|
5053 | + if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) { |
|
5054 | 5054 | $max_num_pages = $wp_query->max_num_pages; |
5055 | 5055 | } |
5056 | 5056 | } else { |
5057 | - $page_number = get_query_var( 'page' ); |
|
5058 | - if ( $page_number === 0 || $page_number === '' ) { |
|
5057 | + $page_number = get_query_var('page'); |
|
5058 | + if ($page_number === 0 || $page_number === '') { |
|
5059 | 5059 | $page_number = 1; |
5060 | 5060 | } |
5061 | 5061 | |
5062 | - if ( isset( $post->post_content ) ) { |
|
5063 | - $max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 ); |
|
5062 | + if (isset($post->post_content)) { |
|
5063 | + $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1); |
|
5064 | 5064 | } |
5065 | 5065 | } |
5066 | 5066 | |
5067 | 5067 | $return = null; |
5068 | 5068 | |
5069 | - switch ( $request ) { |
|
5069 | + switch ($request) { |
|
5070 | 5070 | case 'nr': |
5071 | 5071 | $return = $page_number; |
5072 | 5072 | break; |
@@ -5087,14 +5087,14 @@ discard block |
||
5087 | 5087 | * |
5088 | 5088 | * @return array Terms. |
5089 | 5089 | */ |
5090 | -function geodir_filter_empty_terms( $terms ) { |
|
5091 | - if ( empty( $terms ) ) { |
|
5090 | +function geodir_filter_empty_terms($terms) { |
|
5091 | + if (empty($terms)) { |
|
5092 | 5092 | return $terms; |
5093 | 5093 | } |
5094 | 5094 | |
5095 | 5095 | $return = array(); |
5096 | - foreach ( $terms as $term ) { |
|
5097 | - if ( isset( $term->count ) && $term->count > 0 ) { |
|
5096 | + foreach ($terms as $term) { |
|
5097 | + if (isset($term->count) && $term->count > 0) { |
|
5098 | 5098 | $return[] = $term; |
5099 | 5099 | } else { |
5100 | 5100 | /** |
@@ -5105,7 +5105,7 @@ discard block |
||
5105 | 5105 | * @param array $return The array of terms to return. |
5106 | 5106 | * @param object $term The term object. |
5107 | 5107 | */ |
5108 | - $return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term ); |
|
5108 | + $return = apply_filters('geodir_filter_empty_terms_filter', $return, $term); |
|
5109 | 5109 | } |
5110 | 5110 | } |
5111 | 5111 | |
@@ -5122,12 +5122,12 @@ discard block |
||
5122 | 5122 | * |
5123 | 5123 | * @return array |
5124 | 5124 | */ |
5125 | -function geodir_remove_hentry( $class ) { |
|
5126 | - if ( geodir_is_page( 'detail' ) ) { |
|
5127 | - $class = array_diff( $class, array( 'hentry' ) ); |
|
5125 | +function geodir_remove_hentry($class) { |
|
5126 | + if (geodir_is_page('detail')) { |
|
5127 | + $class = array_diff($class, array('hentry')); |
|
5128 | 5128 | } |
5129 | 5129 | |
5130 | 5130 | return $class; |
5131 | 5131 | } |
5132 | 5132 | |
5133 | -add_filter( 'post_class', 'geodir_remove_hentry' ); |
|
5134 | 5133 | \ No newline at end of file |
5134 | +add_filter('post_class', 'geodir_remove_hentry'); |
|
5135 | 5135 | \ No newline at end of file |
@@ -14,83 +14,83 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_popular_post_category extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
18 | - * Register the popular post category widget. |
|
19 | - * |
|
20 | - * @since 1.0.0 |
|
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'popular_post_category', // Base ID |
|
27 | - __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Front-end display content for popular post category widget. |
|
34 | - * |
|
35 | - * @since 1.0.0 |
|
36 | - * @since 1.5.1 Declare function public. |
|
37 | - * |
|
38 | - * @param array $args Widget arguments. |
|
39 | - * @param array $instance Saved values from database. |
|
40 | - */ |
|
41 | - public function widget($args, $instance) |
|
42 | - { |
|
43 | - geodir_popular_post_category_output($args, $instance); |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Sanitize popular post category widget form values as they are saved. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * @since 1.5.1 Declare function public. |
|
51 | - * @since 1.5.1 Added default_post_type parameter. |
|
52 | - * @since 1.6.9 Added parent_only parameter. |
|
53 | - * |
|
54 | - * @param array $new_instance Values just sent to be saved. |
|
55 | - * @param array $old_instance Previously saved values from database. |
|
56 | - * |
|
57 | - * @return array Updated safe values to be saved. |
|
58 | - */ |
|
59 | - public function update($new_instance, $old_instance) |
|
60 | - { |
|
61 | - //save the widget |
|
62 | - $instance = $old_instance; |
|
63 | - $instance['title'] = strip_tags($new_instance['title']); |
|
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
65 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | - $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | - $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | - return $instance; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Back-end popular post category widget settings form. |
|
73 | - * |
|
74 | - * @since 1.0.0 |
|
75 | - * @since 1.5.1 Declare function public. |
|
76 | - * @since 1.5.1 Added option to set default post type. |
|
77 | - * @since 1.6.9 Added option to show parent categories only. |
|
78 | - * |
|
79 | - * @param array $instance Previously saved values from database. |
|
80 | - */ |
|
81 | - public function form($instance) |
|
82 | - { |
|
83 | - //widgetform in backend |
|
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | - |
|
86 | - $title = strip_tags($instance['title']); |
|
87 | - $category_limit = (int)$instance['category_limit']; |
|
88 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | - $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
17 | + /** |
|
18 | + * Register the popular post category widget. |
|
19 | + * |
|
20 | + * @since 1.0.0 |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'popular_post_category', // Base ID |
|
27 | + __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Front-end display content for popular post category widget. |
|
34 | + * |
|
35 | + * @since 1.0.0 |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | + * |
|
38 | + * @param array $args Widget arguments. |
|
39 | + * @param array $instance Saved values from database. |
|
40 | + */ |
|
41 | + public function widget($args, $instance) |
|
42 | + { |
|
43 | + geodir_popular_post_category_output($args, $instance); |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Sanitize popular post category widget form values as they are saved. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Added default_post_type parameter. |
|
52 | + * @since 1.6.9 Added parent_only parameter. |
|
53 | + * |
|
54 | + * @param array $new_instance Values just sent to be saved. |
|
55 | + * @param array $old_instance Previously saved values from database. |
|
56 | + * |
|
57 | + * @return array Updated safe values to be saved. |
|
58 | + */ |
|
59 | + public function update($new_instance, $old_instance) |
|
60 | + { |
|
61 | + //save the widget |
|
62 | + $instance = $old_instance; |
|
63 | + $instance['title'] = strip_tags($new_instance['title']); |
|
64 | + $category_limit = (int)$new_instance['category_limit']; |
|
65 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | + $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | + $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | + return $instance; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Back-end popular post category widget settings form. |
|
73 | + * |
|
74 | + * @since 1.0.0 |
|
75 | + * @since 1.5.1 Declare function public. |
|
76 | + * @since 1.5.1 Added option to set default post type. |
|
77 | + * @since 1.6.9 Added option to show parent categories only. |
|
78 | + * |
|
79 | + * @param array $instance Previously saved values from database. |
|
80 | + */ |
|
81 | + public function form($instance) |
|
82 | + { |
|
83 | + //widgetform in backend |
|
84 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | + |
|
86 | + $title = strip_tags($instance['title']); |
|
87 | + $category_limit = (int)$instance['category_limit']; |
|
88 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | + $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | + $parent_only = !empty($instance['parent_only']) ? true: false; |
|
91 | 91 | |
92 | - $post_type_options = geodir_get_posttypes('options'); |
|
93 | - ?> |
|
92 | + $post_type_options = geodir_get_posttypes('options'); |
|
93 | + ?> |
|
94 | 94 | <p> |
95 | 95 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
96 | 96 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
117 | 117 | </p> |
118 | 118 | <?php |
119 | - } |
|
119 | + } |
|
120 | 120 | } // class geodir_popular_post_category |
121 | 121 | |
122 | 122 | register_widget('geodir_popular_post_category'); |
@@ -130,40 +130,40 @@ discard block |
||
130 | 130 | class geodir_popular_postview extends WP_Widget |
131 | 131 | { |
132 | 132 | |
133 | - /** |
|
133 | + /** |
|
134 | 134 | * Register the popular posts widget. |
135 | 135 | * |
136 | 136 | * @since 1.0.0 |
137 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
137 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
138 | 138 | */ |
139 | - public function __construct() { |
|
140 | - $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | - parent::__construct( |
|
142 | - 'popular_post_view', // Base ID |
|
143 | - __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | - $widget_ops// Args |
|
145 | - ); |
|
146 | - } |
|
139 | + public function __construct() { |
|
140 | + $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | + parent::__construct( |
|
142 | + 'popular_post_view', // Base ID |
|
143 | + __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | + $widget_ops// Args |
|
145 | + ); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Front-end display content for popular posts widget. |
150 | 150 | * |
151 | 151 | * @since 1.0.0 |
152 | - * @since 1.5.1 Declare function public. |
|
152 | + * @since 1.5.1 Declare function public. |
|
153 | 153 | * |
154 | 154 | * @param array $args Widget arguments. |
155 | 155 | * @param array $instance Saved values from database. |
156 | 156 | */ |
157 | 157 | public function widget($args, $instance) |
158 | - { |
|
159 | - geodir_popular_postview_output($args, $instance); |
|
160 | - } |
|
158 | + { |
|
159 | + geodir_popular_postview_output($args, $instance); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Sanitize popular posts widget form values as they are saved. |
164 | 164 | * |
165 | 165 | * @since 1.0.0 |
166 | - * @since 1.5.1 Declare function public. |
|
166 | + * @since 1.5.1 Declare function public. |
|
167 | 167 | * |
168 | 168 | * @param array $new_instance Values just sent to be saved. |
169 | 169 | * @param array $old_instance Previously saved values from database. |
@@ -171,99 +171,99 @@ discard block |
||
171 | 171 | * @return array Updated safe values to be saved. |
172 | 172 | */ |
173 | 173 | public function update($new_instance, $old_instance) |
174 | - { |
|
175 | - //save the widget |
|
176 | - $instance = $old_instance; |
|
177 | - |
|
178 | - if ($new_instance['title'] == '') { |
|
179 | - $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | - //$instance['title'] = $title; |
|
181 | - } |
|
182 | - $instance['title'] = strip_tags($new_instance['title']); |
|
183 | - |
|
184 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | - //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | - $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | - $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | - $instance['character_count'] = $new_instance['character_count']; |
|
193 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
194 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | - else |
|
196 | - $instance['add_location_filter'] = '0'; |
|
197 | - |
|
198 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
199 | - $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
200 | - $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
201 | - $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
202 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
203 | - |
|
204 | - return $instance; |
|
205 | - } |
|
174 | + { |
|
175 | + //save the widget |
|
176 | + $instance = $old_instance; |
|
177 | + |
|
178 | + if ($new_instance['title'] == '') { |
|
179 | + $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | + //$instance['title'] = $title; |
|
181 | + } |
|
182 | + $instance['title'] = strip_tags($new_instance['title']); |
|
183 | + |
|
184 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | + //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | + $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | + $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | + $instance['character_count'] = $new_instance['character_count']; |
|
193 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
194 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | + else |
|
196 | + $instance['add_location_filter'] = '0'; |
|
197 | + |
|
198 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
199 | + $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
200 | + $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
201 | + $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
202 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
203 | + |
|
204 | + return $instance; |
|
205 | + } |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Back-end popular posts widget settings form. |
209 | 209 | * |
210 | 210 | * @since 1.0.0 |
211 | - * @since 1.5.1 Declare function public. |
|
211 | + * @since 1.5.1 Declare function public. |
|
212 | 212 | * |
213 | 213 | * @param array $instance Previously saved values from database. |
214 | 214 | */ |
215 | 215 | public function form($instance) |
216 | - { |
|
217 | - //widgetform in backend |
|
218 | - $instance = wp_parse_args((array)$instance, |
|
219 | - array('title' => '', |
|
220 | - 'post_type' => '', |
|
221 | - 'category' => array(), |
|
222 | - 'category_title' => '', |
|
223 | - 'list_sort' => '', |
|
224 | - 'list_order' => '', |
|
225 | - 'post_number' => '5', |
|
226 | - 'layout' => 'gridview_onehalf', |
|
227 | - 'listing_width' => '', |
|
228 | - 'add_location_filter' => '1', |
|
229 | - 'character_count' => '20', |
|
230 | - 'show_featured_only' => '', |
|
231 | - 'show_special_only' => '', |
|
232 | - 'with_pics_only' => '', |
|
233 | - 'with_videos_only' => '', |
|
234 | - 'use_viewing_post_type' => '' |
|
235 | - ) |
|
236 | - ); |
|
216 | + { |
|
217 | + //widgetform in backend |
|
218 | + $instance = wp_parse_args((array)$instance, |
|
219 | + array('title' => '', |
|
220 | + 'post_type' => '', |
|
221 | + 'category' => array(), |
|
222 | + 'category_title' => '', |
|
223 | + 'list_sort' => '', |
|
224 | + 'list_order' => '', |
|
225 | + 'post_number' => '5', |
|
226 | + 'layout' => 'gridview_onehalf', |
|
227 | + 'listing_width' => '', |
|
228 | + 'add_location_filter' => '1', |
|
229 | + 'character_count' => '20', |
|
230 | + 'show_featured_only' => '', |
|
231 | + 'show_special_only' => '', |
|
232 | + 'with_pics_only' => '', |
|
233 | + 'with_videos_only' => '', |
|
234 | + 'use_viewing_post_type' => '' |
|
235 | + ) |
|
236 | + ); |
|
237 | 237 | |
238 | - $title = strip_tags($instance['title']); |
|
238 | + $title = strip_tags($instance['title']); |
|
239 | 239 | |
240 | - $post_type = strip_tags($instance['post_type']); |
|
240 | + $post_type = strip_tags($instance['post_type']); |
|
241 | 241 | |
242 | - $category = $instance['category']; |
|
242 | + $category = $instance['category']; |
|
243 | 243 | |
244 | - $category_title = strip_tags($instance['category_title']); |
|
244 | + $category_title = strip_tags($instance['category_title']); |
|
245 | 245 | |
246 | - $list_sort = strip_tags($instance['list_sort']); |
|
246 | + $list_sort = strip_tags($instance['list_sort']); |
|
247 | 247 | |
248 | - $list_order = strip_tags($instance['list_order']); |
|
248 | + $list_order = strip_tags($instance['list_order']); |
|
249 | 249 | |
250 | - $post_number = strip_tags($instance['post_number']); |
|
250 | + $post_number = strip_tags($instance['post_number']); |
|
251 | 251 | |
252 | - $layout = strip_tags($instance['layout']); |
|
252 | + $layout = strip_tags($instance['layout']); |
|
253 | 253 | |
254 | - $listing_width = strip_tags($instance['listing_width']); |
|
254 | + $listing_width = strip_tags($instance['listing_width']); |
|
255 | 255 | |
256 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
256 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
257 | 257 | |
258 | - $character_count = $instance['character_count']; |
|
258 | + $character_count = $instance['character_count']; |
|
259 | 259 | |
260 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
261 | - $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
262 | - $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
263 | - $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
264 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
260 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
261 | + $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
262 | + $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
263 | + $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
264 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
265 | 265 | |
266 | - ?> |
|
266 | + ?> |
|
267 | 267 | |
268 | 268 | <p> |
269 | 269 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | <?php foreach ($postypes as $postypes_obj) { ?> |
299 | 299 | |
300 | 300 | <option <?php if ($post_type == $postypes_obj) { |
301 | - echo 'selected="selected"'; |
|
302 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
303 | - echo ucfirst($extvalue[1]); ?></option> |
|
301 | + echo 'selected="selected"'; |
|
302 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
303 | + echo ucfirst($extvalue[1]); ?></option> |
|
304 | 304 | |
305 | 305 | <?php } ?> |
306 | 306 | |
@@ -315,30 +315,30 @@ discard block |
||
315 | 315 | |
316 | 316 | <?php |
317 | 317 | |
318 | - $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
318 | + $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
319 | 319 | |
320 | - $all_postypes = geodir_get_posttypes(); |
|
320 | + $all_postypes = geodir_get_posttypes(); |
|
321 | 321 | |
322 | - if (!in_array($post_type, $all_postypes)) |
|
323 | - $post_type = 'gd_place'; |
|
322 | + if (!in_array($post_type, $all_postypes)) |
|
323 | + $post_type = 'gd_place'; |
|
324 | 324 | |
325 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
326 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
325 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
326 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
327 | 327 | |
328 | - ?> |
|
328 | + ?> |
|
329 | 329 | |
330 | 330 | <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]" |
331 | 331 | onchange="geodir_popular_widget_cat_title(this)"> |
332 | 332 | |
333 | 333 | <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) { |
334 | - echo 'selected="selected"'; |
|
335 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
334 | + echo 'selected="selected"'; |
|
335 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
336 | 336 | <?php foreach ($categories as $category_obj) { |
337 | - $selected = ''; |
|
338 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
339 | - echo $selected = 'selected="selected"'; |
|
337 | + $selected = ''; |
|
338 | + if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
339 | + echo $selected = 'selected="selected"'; |
|
340 | 340 | |
341 | - ?> |
|
341 | + ?> |
|
342 | 342 | |
343 | 343 | <option <?php echo $selected; ?> |
344 | 344 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
@@ -363,28 +363,28 @@ discard block |
||
363 | 363 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
364 | 364 | |
365 | 365 | <option <?php if ($list_sort == 'az') { |
366 | - echo 'selected="selected"'; |
|
367 | - } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option> |
|
366 | + echo 'selected="selected"'; |
|
367 | + } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option> |
|
368 | 368 | |
369 | 369 | <option <?php if ($list_sort == 'latest') { |
370 | - echo 'selected="selected"'; |
|
371 | - } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
370 | + echo 'selected="selected"'; |
|
371 | + } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
372 | 372 | |
373 | 373 | <option <?php if ($list_sort == 'featured') { |
374 | - echo 'selected="selected"'; |
|
375 | - } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
374 | + echo 'selected="selected"'; |
|
375 | + } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
376 | 376 | |
377 | 377 | <option <?php if ($list_sort == 'high_review') { |
378 | - echo 'selected="selected"'; |
|
379 | - } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
378 | + echo 'selected="selected"'; |
|
379 | + } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
380 | 380 | |
381 | 381 | <option <?php if ($list_sort == 'high_rating') { |
382 | - echo 'selected="selected"'; |
|
383 | - } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
382 | + echo 'selected="selected"'; |
|
383 | + } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
384 | 384 | |
385 | 385 | <option <?php if ($list_sort == 'random') { |
386 | - echo 'selected="selected"'; |
|
387 | - } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
386 | + echo 'selected="selected"'; |
|
387 | + } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
388 | 388 | |
389 | 389 | </select> |
390 | 390 | </label> |
@@ -407,24 +407,24 @@ discard block |
||
407 | 407 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
408 | 408 | name="<?php echo $this->get_field_name('layout'); ?>"> |
409 | 409 | <option <?php if ($layout == 'gridview_onehalf') { |
410 | - echo 'selected="selected"'; |
|
411 | - } ?> |
|
410 | + echo 'selected="selected"'; |
|
411 | + } ?> |
|
412 | 412 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
413 | 413 | <option <?php if ($layout == 'gridview_onethird') { |
414 | - echo 'selected="selected"'; |
|
415 | - } ?> |
|
414 | + echo 'selected="selected"'; |
|
415 | + } ?> |
|
416 | 416 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
417 | 417 | <option <?php if ($layout == 'gridview_onefourth') { |
418 | - echo 'selected="selected"'; |
|
419 | - } ?> |
|
418 | + echo 'selected="selected"'; |
|
419 | + } ?> |
|
420 | 420 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
421 | 421 | <option <?php if ($layout == 'gridview_onefifth') { |
422 | - echo 'selected="selected"'; |
|
423 | - } ?> |
|
422 | + echo 'selected="selected"'; |
|
423 | + } ?> |
|
424 | 424 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
425 | 425 | <option <?php if ($layout == 'list') { |
426 | - echo 'selected="selected"'; |
|
427 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
426 | + echo 'selected="selected"'; |
|
427 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
428 | 428 | |
429 | 429 | </select> |
430 | 430 | </label> |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
495 | 495 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
496 | 496 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
497 | - echo 'checked="checked"'; |
|
498 | - } ?> value="1"/> |
|
497 | + echo 'checked="checked"'; |
|
498 | + } ?> value="1"/> |
|
499 | 499 | </label> |
500 | 500 | </p> |
501 | 501 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | </script> |
540 | 540 | |
541 | 541 | <?php |
542 | - } |
|
542 | + } |
|
543 | 543 | } // class geodir_popular_postview |
544 | 544 | |
545 | 545 | register_widget('geodir_popular_postview'); |
546 | 546 | \ No newline at end of file |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //save the widget |
62 | 62 | $instance = $old_instance; |
63 | 63 | $instance['title'] = strip_tags($new_instance['title']); |
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
64 | + $category_limit = (int) $new_instance['category_limit']; |
|
65 | 65 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
66 | 66 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
67 | 67 | $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | public function form($instance) |
82 | 82 | { |
83 | 83 | //widgetform in backend |
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
84 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | 85 | |
86 | 86 | $title = strip_tags($instance['title']); |
87 | - $category_limit = (int)$instance['category_limit']; |
|
87 | + $category_limit = (int) $instance['category_limit']; |
|
88 | 88 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
89 | 89 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
90 | + $parent_only = !empty($instance['parent_only']) ? true : false; |
|
91 | 91 | |
92 | 92 | $post_type_options = geodir_get_posttypes('options'); |
93 | 93 | ?> |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | </label> |
98 | 98 | </p> |
99 | 99 | <p> |
100 | - <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?> |
|
100 | + <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?> |
|
101 | 101 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>"> |
102 | 102 | <?php foreach ($post_type_options as $name => $title) { ?> |
103 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
103 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
104 | 104 | <?php } ?> |
105 | 105 | </select> |
106 | 106 | </label> |
107 | 107 | </p> |
108 | 108 | <p> |
109 | 109 | <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?> |
110 | - <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/> |
|
110 | + <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/> |
|
111 | 111 | <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p> |
112 | 112 | </label> |
113 | 113 | </p> |
114 | 114 | <p> |
115 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" /> |
|
116 | - <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
|
115 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" /> |
|
116 | + <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label> |
|
117 | 117 | </p> |
118 | 118 | <?php |
119 | 119 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | public function form($instance) |
216 | 216 | { |
217 | 217 | //widgetform in backend |
218 | - $instance = wp_parse_args((array)$instance, |
|
218 | + $instance = wp_parse_args((array) $instance, |
|
219 | 219 | array('title' => '', |
220 | 220 | 'post_type' => '', |
221 | 221 | 'category' => array(), |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | ?> |
267 | 267 | |
268 | 268 | <p> |
269 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
269 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
270 | 270 | <small>(%posttype_singular_label% , |
271 | - %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>) |
|
271 | + %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>) |
|
272 | 272 | </small> |
273 | 273 | |
274 | 274 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | <p> |
281 | 281 | <label |
282 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
282 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
283 | 283 | |
284 | 284 | <?php $postypes = geodir_get_posttypes(); |
285 | 285 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | <p id="post_type_cats"> |
313 | 313 | <label |
314 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
314 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
315 | 315 | |
316 | 316 | <?php |
317 | 317 | |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | |
351 | 351 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
352 | 352 | id="<?php echo $this->get_field_id('category_title'); ?>" |
353 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
353 | + value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/> |
|
354 | 354 | |
355 | 355 | </label> |
356 | 356 | </p> |
357 | 357 | |
358 | 358 | <p> |
359 | 359 | <label |
360 | - for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
360 | + for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
361 | 361 | |
362 | 362 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
363 | 363 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | <p> |
394 | 394 | |
395 | 395 | <label |
396 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
396 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
397 | 397 | |
398 | 398 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
399 | 399 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | <p> |
405 | 405 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
406 | - <?php _e('Layout:', 'geodirectory');?> |
|
406 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
407 | 407 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
408 | 408 | name="<?php echo $this->get_field_name('layout'); ?>"> |
409 | 409 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | |
433 | 433 | <p> |
434 | 434 | <label |
435 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
435 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
436 | 436 | |
437 | 437 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
438 | 438 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | <p> |
444 | 444 | <label |
445 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
445 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
446 | 446 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
447 | 447 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
448 | 448 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -451,41 +451,41 @@ discard block |
||
451 | 451 | |
452 | 452 | <p> |
453 | 453 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
454 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
454 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
455 | 455 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
456 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
456 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
457 | 457 | value="1"/> |
458 | 458 | </label> |
459 | 459 | </p> |
460 | 460 | <p> |
461 | 461 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
462 | - <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
|
462 | + <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" |
|
463 | 463 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
464 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
464 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
465 | 465 | value="1"/> |
466 | 466 | </label> |
467 | 467 | </p> |
468 | 468 | <p> |
469 | 469 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
470 | - <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
|
470 | + <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox" |
|
471 | 471 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
472 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
472 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?> |
|
473 | 473 | value="1"/> |
474 | 474 | </label> |
475 | 475 | </p> |
476 | 476 | <p> |
477 | 477 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
478 | - <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
|
478 | + <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox" |
|
479 | 479 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
480 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
480 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?> |
|
481 | 481 | value="1"/> |
482 | 482 | </label> |
483 | 483 | </p> |
484 | 484 | <p> |
485 | 485 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
486 | - <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
|
486 | + <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox" |
|
487 | 487 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
488 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
488 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?> |
|
489 | 489 | value="1"/> |
490 | 490 | </label> |
491 | 491 | </p> |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | } |
533 | 533 | |
534 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
534 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
535 | 535 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
536 | 536 | |
537 | 537 | <?php } ?> |