@@ -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,13 +876,13 @@ 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>', |
|
885 | - 'show_adv_search' => 'default', |
|
882 | + 'after_widget' => '</section>', |
|
883 | + 'before_title' => '<h3 class="widget-title">', |
|
884 | + 'after_title' => '</h3>', |
|
885 | + 'show_adv_search' => 'default', |
|
886 | 886 | 'post_type' => '' |
887 | 887 | ); |
888 | 888 | |
@@ -906,9 +906,9 @@ discard block |
||
906 | 906 | the_widget('geodir_advance_search_widget', $params, $params ); |
907 | 907 | |
908 | 908 | $output = ob_get_contents(); |
909 | - ob_end_clean(); |
|
909 | + ob_end_clean(); |
|
910 | 910 | |
911 | - return $output; |
|
911 | + return $output; |
|
912 | 912 | } |
913 | 913 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
914 | 914 | |
@@ -954,48 +954,48 @@ discard block |
||
954 | 954 | 'add_location_filter' => '1', |
955 | 955 | 'tab_layout' => 'bestof-tabs-on-top', |
956 | 956 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
957 | - 'after_widget' => '</section>', |
|
958 | - 'before_title' => '<h3 class="widget-title">', |
|
959 | - 'after_title' => '</h3>', |
|
957 | + 'after_widget' => '</section>', |
|
958 | + 'before_title' => '<h3 class="widget-title">', |
|
959 | + 'after_title' => '</h3>', |
|
960 | 960 | ); |
961 | 961 | $params = shortcode_atts($defaults, $atts); |
962 | 962 | |
963 | - /** |
|
964 | - * Validate our incoming params |
|
965 | - */ |
|
963 | + /** |
|
964 | + * Validate our incoming params |
|
965 | + */ |
|
966 | 966 | |
967 | - // Validate the selected post type, default to gd_place on fail |
|
968 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
969 | - $params['post_type'] = 'gd_place'; |
|
970 | - } |
|
967 | + // Validate the selected post type, default to gd_place on fail |
|
968 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
969 | + $params['post_type'] = 'gd_place'; |
|
970 | + } |
|
971 | 971 | |
972 | 972 | // Post limit needs to be a positive integer |
973 | - $params['post_limit'] = absint($params['post_limit']); |
|
974 | - if (0 == $params['post_limit']) { |
|
975 | - $params['post_limit'] = 5; |
|
976 | - } |
|
973 | + $params['post_limit'] = absint($params['post_limit']); |
|
974 | + if (0 == $params['post_limit']) { |
|
975 | + $params['post_limit'] = 5; |
|
976 | + } |
|
977 | 977 | |
978 | 978 | // Category limit needs to be a positive integer |
979 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
980 | - if (0 == $params['categ_limit']) { |
|
981 | - $params['categ_limit'] = 3; |
|
982 | - } |
|
979 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
980 | + if (0 == $params['categ_limit']) { |
|
981 | + $params['categ_limit'] = 3; |
|
982 | + } |
|
983 | 983 | |
984 | 984 | // Tab layout validation |
985 | - $params['tab_layout'] = $params['tab_layout']; |
|
986 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
987 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
988 | - } |
|
985 | + $params['tab_layout'] = $params['tab_layout']; |
|
986 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
987 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
988 | + } |
|
989 | 989 | |
990 | 990 | // Validate character_count |
991 | - $params['character_count'] = $params['character_count']; |
|
991 | + $params['character_count'] = $params['character_count']; |
|
992 | 992 | |
993 | 993 | ob_start(); |
994 | 994 | the_widget('geodir_bestof_widget', $params, $params); |
995 | - $output = ob_get_contents(); |
|
996 | - ob_end_clean(); |
|
995 | + $output = ob_get_contents(); |
|
996 | + ob_end_clean(); |
|
997 | 997 | |
998 | - return $output; |
|
998 | + return $output; |
|
999 | 999 | } |
1000 | 1000 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
1001 | 1001 | |
@@ -1043,127 +1043,127 @@ discard block |
||
1043 | 1043 | * @return string HTML content to display geodirectory listings. |
1044 | 1044 | */ |
1045 | 1045 | function geodir_sc_gd_listings($atts, $content = '') { |
1046 | - global $post; |
|
1047 | - $defaults = array( |
|
1048 | - 'title' => '', |
|
1049 | - 'post_type' => 'gd_place', |
|
1050 | - 'category' => 0, |
|
1051 | - 'list_sort' => 'latest', |
|
1052 | - 'event_type' => '', |
|
1053 | - 'post_number' => 10, |
|
1054 | - 'post_author' => '', |
|
1055 | - 'layout' => 'gridview_onehalf', |
|
1056 | - 'listing_width' => '', |
|
1057 | - 'character_count' => 20, |
|
1058 | - 'add_location_filter' => 1, |
|
1059 | - 'show_featured_only' => '', |
|
1060 | - 'show_special_only' => '', |
|
1061 | - 'with_pics_only' => '', |
|
1062 | - 'with_videos_only' => '', |
|
1063 | - 'with_pagination' => '1', |
|
1064 | - 'top_pagination' => '0', |
|
1065 | - 'bottom_pagination' => '1', |
|
1066 | - 'without_no_results' => 0, |
|
1067 | - 'tags' => '' |
|
1068 | - ); |
|
1069 | - $params = shortcode_atts($defaults, $atts); |
|
1070 | - |
|
1071 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
1072 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1073 | - |
|
1074 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
1075 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1076 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1077 | - |
|
1078 | - // Make sure we have an array |
|
1079 | - if (!(is_array($params['category']))) { |
|
1080 | - $params['category'] = explode(',', $params['category']); |
|
1081 | - } |
|
1082 | - |
|
1083 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1084 | - // Otherwise it becomes empty and later on that will mean "All" |
|
1085 | - $params['category'] = array_intersect($params['category'], $categories); |
|
1086 | - |
|
1087 | - // Post_number needs to be a positive integer |
|
1088 | - $params['post_number'] = absint($params['post_number']); |
|
1089 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1046 | + global $post; |
|
1047 | + $defaults = array( |
|
1048 | + 'title' => '', |
|
1049 | + 'post_type' => 'gd_place', |
|
1050 | + 'category' => 0, |
|
1051 | + 'list_sort' => 'latest', |
|
1052 | + 'event_type' => '', |
|
1053 | + 'post_number' => 10, |
|
1054 | + 'post_author' => '', |
|
1055 | + 'layout' => 'gridview_onehalf', |
|
1056 | + 'listing_width' => '', |
|
1057 | + 'character_count' => 20, |
|
1058 | + 'add_location_filter' => 1, |
|
1059 | + 'show_featured_only' => '', |
|
1060 | + 'show_special_only' => '', |
|
1061 | + 'with_pics_only' => '', |
|
1062 | + 'with_videos_only' => '', |
|
1063 | + 'with_pagination' => '1', |
|
1064 | + 'top_pagination' => '0', |
|
1065 | + 'bottom_pagination' => '1', |
|
1066 | + 'without_no_results' => 0, |
|
1067 | + 'tags' => '' |
|
1068 | + ); |
|
1069 | + $params = shortcode_atts($defaults, $atts); |
|
1070 | + |
|
1071 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
1072 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1073 | + |
|
1074 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
1075 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1076 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1077 | + |
|
1078 | + // Make sure we have an array |
|
1079 | + if (!(is_array($params['category']))) { |
|
1080 | + $params['category'] = explode(',', $params['category']); |
|
1081 | + } |
|
1082 | + |
|
1083 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1084 | + // Otherwise it becomes empty and later on that will mean "All" |
|
1085 | + $params['category'] = array_intersect($params['category'], $categories); |
|
1086 | + |
|
1087 | + // Post_number needs to be a positive integer |
|
1088 | + $params['post_number'] = absint($params['post_number']); |
|
1089 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1090 | 1090 | |
1091 | - // Post_number needs to be a positive integer |
|
1092 | - if (!empty($atts['post_author'])) { |
|
1093 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1094 | - $params['post_author'] = $post->post_author; |
|
1095 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1096 | - $params['post_author'] = absint($atts['post_author']); |
|
1097 | - } else { |
|
1098 | - unset($params['post_author']); |
|
1099 | - } |
|
1100 | - } else { |
|
1101 | - unset($params['post_author']); |
|
1102 | - } |
|
1103 | - |
|
1104 | - // Validate character_count |
|
1105 | - //todo: is this necessary? |
|
1106 | - $params['character_count'] = $params['character_count']; |
|
1107 | - |
|
1108 | - // Validate our layout choice |
|
1109 | - // Outside of the norm, I added some more simple terms to match the existing |
|
1110 | - // So now I just run the switch to set it properly. |
|
1111 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1112 | - |
|
1113 | - // Validate our sorting choice |
|
1114 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1115 | - |
|
1116 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
1117 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1118 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1119 | - |
|
1120 | - // Validate the checkboxes used on the widget |
|
1121 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1122 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1123 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1124 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1125 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1126 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1127 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1128 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1129 | - |
|
1130 | - // Clean tags |
|
1131 | - if (!empty($params['tags'])) { |
|
1132 | - if (!is_array($params['tags'])) { |
|
1133 | - $comma = _x(',', 'tag delimiter'); |
|
1134 | - if ( ',' !== $comma ) { |
|
1135 | - $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1136 | - } |
|
1137 | - $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1138 | - $params['tags'] = array_map('trim', $params['tags']); |
|
1139 | - } |
|
1140 | - } else { |
|
1141 | - $params['tags'] = array(); |
|
1142 | - } |
|
1143 | - |
|
1144 | - /** |
|
1145 | - * End of validation |
|
1146 | - */ |
|
1147 | - if (isset($atts['geodir_ajax'])) { |
|
1148 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1149 | - unset($atts['geodir_ajax']); |
|
1150 | - } |
|
1151 | - if (isset($atts['pageno'])) { |
|
1152 | - $params['pageno'] = $atts['pageno']; |
|
1153 | - unset($atts['pageno']); |
|
1154 | - } |
|
1155 | - |
|
1156 | - if ( !empty($atts['shortcode_content']) ) { |
|
1157 | - $content = $atts['shortcode_content']; |
|
1158 | - } |
|
1159 | - $params['shortcode_content'] = trim($content); |
|
1160 | - $atts['shortcode_content'] = trim($content); |
|
1091 | + // Post_number needs to be a positive integer |
|
1092 | + if (!empty($atts['post_author'])) { |
|
1093 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1094 | + $params['post_author'] = $post->post_author; |
|
1095 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1096 | + $params['post_author'] = absint($atts['post_author']); |
|
1097 | + } else { |
|
1098 | + unset($params['post_author']); |
|
1099 | + } |
|
1100 | + } else { |
|
1101 | + unset($params['post_author']); |
|
1102 | + } |
|
1103 | + |
|
1104 | + // Validate character_count |
|
1105 | + //todo: is this necessary? |
|
1106 | + $params['character_count'] = $params['character_count']; |
|
1107 | + |
|
1108 | + // Validate our layout choice |
|
1109 | + // Outside of the norm, I added some more simple terms to match the existing |
|
1110 | + // So now I just run the switch to set it properly. |
|
1111 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1112 | + |
|
1113 | + // Validate our sorting choice |
|
1114 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1115 | + |
|
1116 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
1117 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1118 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1119 | + |
|
1120 | + // Validate the checkboxes used on the widget |
|
1121 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1122 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1123 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1124 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1125 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1126 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1127 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1128 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1129 | + |
|
1130 | + // Clean tags |
|
1131 | + if (!empty($params['tags'])) { |
|
1132 | + if (!is_array($params['tags'])) { |
|
1133 | + $comma = _x(',', 'tag delimiter'); |
|
1134 | + if ( ',' !== $comma ) { |
|
1135 | + $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1136 | + } |
|
1137 | + $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1138 | + $params['tags'] = array_map('trim', $params['tags']); |
|
1139 | + } |
|
1140 | + } else { |
|
1141 | + $params['tags'] = array(); |
|
1142 | + } |
|
1143 | + |
|
1144 | + /** |
|
1145 | + * End of validation |
|
1146 | + */ |
|
1147 | + if (isset($atts['geodir_ajax'])) { |
|
1148 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1149 | + unset($atts['geodir_ajax']); |
|
1150 | + } |
|
1151 | + if (isset($atts['pageno'])) { |
|
1152 | + $params['pageno'] = $atts['pageno']; |
|
1153 | + unset($atts['pageno']); |
|
1154 | + } |
|
1155 | + |
|
1156 | + if ( !empty($atts['shortcode_content']) ) { |
|
1157 | + $content = $atts['shortcode_content']; |
|
1158 | + } |
|
1159 | + $params['shortcode_content'] = trim($content); |
|
1160 | + $atts['shortcode_content'] = trim($content); |
|
1161 | 1161 | |
1162 | - $params['shortcode_atts'] = $atts; |
|
1162 | + $params['shortcode_atts'] = $atts; |
|
1163 | 1163 | |
1164 | - $output = geodir_sc_gd_listings_output($params); |
|
1164 | + $output = geodir_sc_gd_listings_output($params); |
|
1165 | 1165 | |
1166 | - return $output; |
|
1166 | + return $output; |
|
1167 | 1167 | } |
1168 | 1168 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
1169 | 1169 | |
@@ -1203,56 +1203,56 @@ discard block |
||
1203 | 1203 | * @return string HTML content to display CPT categories. |
1204 | 1204 | */ |
1205 | 1205 | function geodir_sc_cpt_categories_widget($atts, $content = '') { |
1206 | - $defaults = array( |
|
1207 | - 'title' => '', |
|
1208 | - 'post_type' => '', // NULL for all |
|
1209 | - 'hide_empty' => '', |
|
1210 | - 'show_count' => '', |
|
1211 | - 'hide_icon' => '', |
|
1212 | - 'cpt_left' => '', |
|
1213 | - 'sort_by' => 'count', |
|
1214 | - 'max_count' => 'all', |
|
1215 | - 'max_level' => '1', |
|
1216 | - 'no_cpt_filter' => '', |
|
1217 | - 'no_cat_filter' => '', |
|
1218 | - 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1219 | - 'after_widget' => '</section>', |
|
1220 | - 'before_title' => '<h3 class="widget-title">', |
|
1221 | - 'after_title' => '</h3>', |
|
1222 | - ); |
|
1223 | - $params = shortcode_atts($defaults, $atts); |
|
1224 | - |
|
1225 | - /** |
|
1226 | - * Validate our incoming params |
|
1227 | - */ |
|
1228 | - // Make sure we have an array |
|
1229 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1230 | - |
|
1231 | - // Validate the checkboxes used on the widget |
|
1232 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1233 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1234 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1235 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1206 | + $defaults = array( |
|
1207 | + 'title' => '', |
|
1208 | + 'post_type' => '', // NULL for all |
|
1209 | + 'hide_empty' => '', |
|
1210 | + 'show_count' => '', |
|
1211 | + 'hide_icon' => '', |
|
1212 | + 'cpt_left' => '', |
|
1213 | + 'sort_by' => 'count', |
|
1214 | + 'max_count' => 'all', |
|
1215 | + 'max_level' => '1', |
|
1216 | + 'no_cpt_filter' => '', |
|
1217 | + 'no_cat_filter' => '', |
|
1218 | + 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1219 | + 'after_widget' => '</section>', |
|
1220 | + 'before_title' => '<h3 class="widget-title">', |
|
1221 | + 'after_title' => '</h3>', |
|
1222 | + ); |
|
1223 | + $params = shortcode_atts($defaults, $atts); |
|
1236 | 1224 | |
1237 | - if ($params['max_count'] != 'all') { |
|
1238 | - $params['max_count'] = absint($params['max_count']); |
|
1239 | - } |
|
1225 | + /** |
|
1226 | + * Validate our incoming params |
|
1227 | + */ |
|
1228 | + // Make sure we have an array |
|
1229 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1230 | + |
|
1231 | + // Validate the checkboxes used on the widget |
|
1232 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1233 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1234 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1235 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1236 | + |
|
1237 | + if ($params['max_count'] != 'all') { |
|
1238 | + $params['max_count'] = absint($params['max_count']); |
|
1239 | + } |
|
1240 | 1240 | |
1241 | - if ($params['max_level'] != 'all') { |
|
1242 | - $params['max_level'] = absint($params['max_level']); |
|
1243 | - } |
|
1241 | + if ($params['max_level'] != 'all') { |
|
1242 | + $params['max_level'] = absint($params['max_level']); |
|
1243 | + } |
|
1244 | 1244 | |
1245 | - $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1246 | - $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1245 | + $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1246 | + $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1247 | 1247 | |
1248 | - $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1248 | + $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1249 | 1249 | |
1250 | - ob_start(); |
|
1251 | - the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1252 | - $output = ob_get_contents(); |
|
1253 | - ob_end_clean(); |
|
1250 | + ob_start(); |
|
1251 | + the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1252 | + $output = ob_get_contents(); |
|
1253 | + ob_end_clean(); |
|
1254 | 1254 | |
1255 | - return $output; |
|
1255 | + return $output; |
|
1256 | 1256 | } |
1257 | 1257 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
1258 | 1258 | |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | * @return string HTML code. |
1268 | 1268 | */ |
1269 | 1269 | function geodir_sc_responsive_videos($atts, $content) { |
1270 | - return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1270 | + return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1271 | 1271 | } |
1272 | 1272 | add_shortcode('gd_video', 'geodir_sc_responsive_videos'); |
1273 | 1273 | ?> |
1274 | 1274 | \ No newline at end of file |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | $is_detail_page = false; |
39 | 39 | $geodir_map_name = geodir_map_name(); |
40 | 40 | |
41 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
41 | + if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) { |
|
42 | 42 | $is_detail_page = true; |
43 | 43 | } |
44 | 44 | |
45 | 45 | wp_enqueue_script('jquery'); |
46 | 46 | |
47 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION); |
|
47 | + wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION); |
|
48 | 48 | wp_enqueue_script('geodirectory-script'); |
49 | 49 | |
50 | 50 | $geodir_vars_data = array( |
51 | 51 | 'siteurl' => get_option('siteurl'), |
52 | 52 | 'geodir_plugin_url' => geodir_plugin_url(), |
53 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
53 | + 'geodir_lazy_load' => get_option('geodir_lazy_load', 1), |
|
54 | 54 | 'geodir_ajax_url' => geodir_get_ajax_url(), |
55 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
55 | + 'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'), |
|
56 | 56 | 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
57 | 57 | ); |
58 | 58 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | * } |
75 | 75 | */ |
76 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
76 | + $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data); |
|
77 | 77 | |
78 | 78 | wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
79 | 79 | |
80 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
80 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true); |
|
81 | + if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); } |
|
82 | 82 | |
83 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
83 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true); |
|
84 | 84 | wp_enqueue_script('geodirectory-lightbox-jquery'); |
85 | 85 | |
86 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
86 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true); |
|
87 | 87 | if ($is_detail_page) { |
88 | 88 | wp_enqueue_script('geodirectory-jquery-simplemodal'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | if (in_array($geodir_map_name, array('auto', 'google'))) { |
92 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
92 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
93 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
94 | 94 | /** |
95 | 95 | * Filter the variables that are added to the end of the google maps script call. |
96 | 96 | * |
@@ -100,48 +100,48 @@ discard block |
||
100 | 100 | * @param string $var The string to filter, default is empty string. |
101 | 101 | */ |
102 | 102 | $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
103 | - wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
103 | + wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if ($geodir_map_name == 'osm') { |
107 | 107 | // Leaflet OpenStreetMap |
108 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
108 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
109 | 109 | wp_enqueue_style('geodirectory-leaflet-style'); |
110 | 110 | |
111 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
111 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
112 | 112 | wp_enqueue_script('geodirectory-leaflet-script'); |
113 | 113 | |
114 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
114 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
115 | 115 | wp_enqueue_script('geodirectory-leaflet-geo-script'); |
116 | 116 | |
117 | 117 | if ($is_detail_page) { |
118 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
118 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
119 | 119 | wp_enqueue_style('geodirectory-leaflet-routing-style'); |
120 | 120 | |
121 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
121 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
122 | 122 | wp_enqueue_script('geodirectory-leaflet-routing-script'); |
123 | 123 | } |
124 | 124 | } |
125 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
125 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
126 | 126 | |
127 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true); |
|
127 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
128 | 128 | wp_enqueue_script('geodirectory-goMap-script'); |
129 | 129 | |
130 | 130 | |
131 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
131 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | 132 | wp_enqueue_script('chosen'); |
133 | 133 | |
134 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
134 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
135 | 135 | wp_enqueue_script('geodirectory-choose-ajax'); |
136 | 136 | |
137 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
137 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
138 | 138 | |
139 | 139 | if (is_page() && geodir_is_page('add-listing')) { |
140 | 140 | // SCRIPT FOR UPLOAD |
141 | 141 | wp_enqueue_script('plupload-all'); |
142 | 142 | wp_enqueue_script('jquery-ui-sortable'); |
143 | 143 | |
144 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
144 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
145 | 145 | wp_enqueue_script('geodirectory-plupload-script'); |
146 | 146 | // SCRIPT FOR UPLOAD END |
147 | 147 | |
@@ -188,27 +188,27 @@ discard block |
||
188 | 188 | |
189 | 189 | wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
190 | 190 | |
191 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
191 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
192 | 192 | } // End if for add place page |
193 | 193 | |
194 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
194 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
195 | 195 | if ($is_detail_page) { |
196 | 196 | wp_enqueue_script('geodirectory-post-custom-js'); |
197 | 197 | } |
198 | 198 | |
199 | 199 | // font awesome rating script |
200 | 200 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
201 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
201 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
202 | 202 | wp_enqueue_script('geodir-barrating-js'); |
203 | 203 | } else { // default rating script |
204 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
204 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
205 | 205 | wp_enqueue_script('geodir-jRating-js'); |
206 | 206 | } |
207 | 207 | |
208 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
208 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
209 | 209 | wp_enqueue_script('geodir-on-document-load'); |
210 | 210 | |
211 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
211 | + wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
212 | 212 | wp_enqueue_script('google-geometa'); |
213 | 213 | } |
214 | 214 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function geodir_header_scripts() |
225 | 225 | { |
226 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
226 | + echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>'; |
|
227 | 227 | echo stripslashes(get_option('geodir_header_scripts')); |
228 | 228 | } |
229 | 229 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * |
248 | 248 | * Flexbox wont wrap on ios for search form items |
249 | 249 | */ |
250 | - if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
250 | + if (preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) { |
|
251 | 251 | echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}</style>"; |
252 | 252 | } |
253 | 253 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | function geodir_add_async_forscript($url) |
265 | 265 | { |
266 | - if (strpos($url, '#asyncload')===false) |
|
266 | + if (strpos($url, '#asyncload') === false) |
|
267 | 267 | return $url; |
268 | 268 | else if (is_admin()) |
269 | 269 | return str_replace('#asyncload', '', $url); |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | function geodir_templates_styles() |
282 | 282 | { |
283 | 283 | |
284 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
284 | + wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
285 | 285 | wp_enqueue_style('geodir-core-scss'); |
286 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
286 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
287 | 287 | |
288 | - if(is_rtl()){ |
|
289 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
288 | + if (is_rtl()) { |
|
289 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
290 | 290 | wp_enqueue_style('geodirectory-frontend-rtl-style'); |
291 | 291 | } |
292 | 292 | |
@@ -360,18 +360,18 @@ discard block |
||
360 | 360 | $term_id = get_queried_object_id(); |
361 | 361 | $taxonomy = get_query_var('taxonomy'); |
362 | 362 | |
363 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
364 | - $term = get_term($term_id, $post_type . 'category'); |
|
363 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') { |
|
364 | + $term = get_term($term_id, $post_type.'category'); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
368 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
369 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
368 | + if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) { |
|
369 | + $taxonomy_search = $_REQUEST['s'.$post_type.'category']; |
|
370 | 370 | |
371 | 371 | if (!is_array($taxonomy_search)) { |
372 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
373 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
374 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
372 | + $term = get_term((int) $taxonomy_search, $post_type.'category'); |
|
373 | + } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
374 | + $term = get_term((int) $taxonomy_search[0], $post_type.'category'); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | if ($max_page > 1 || $always_show) { |
384 | 384 | // Extra pagination info |
385 | 385 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
386 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
386 | + $start_no = ($paged - 1) * $posts_per_page + 1; |
|
387 | 387 | $end_no = min($paged * $posts_per_page, $numposts); |
388 | 388 | |
389 | 389 | if ($geodir_pagination_more_info != '') { |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | } else { |
394 | 394 | $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
395 | 395 | } |
396 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
396 | + $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>'; |
|
397 | 397 | /** |
398 | 398 | * Adds an extra pagination info above/under pagination. |
399 | 399 | * |
@@ -409,15 +409,15 @@ discard block |
||
409 | 409 | $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
410 | 410 | |
411 | 411 | if ($geodir_pagination_more_info == 'before') { |
412 | - $before = $before . $pagination_info; |
|
412 | + $before = $before.$pagination_info; |
|
413 | 413 | } else if ($geodir_pagination_more_info == 'after') { |
414 | - $after = $pagination_info . $after; |
|
414 | + $after = $pagination_info.$after; |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
418 | 418 | echo "$before <div class='Navi gd-navi'>"; |
419 | 419 | if ($paged >= ($pages_to_show - 1)) { |
420 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
420 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link()).'">«</a>'; |
|
421 | 421 | } |
422 | 422 | previous_posts_link($prelabel); |
423 | 423 | for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | if ($i == $paged) { |
426 | 426 | echo "<strong class='on'>$i</strong>"; |
427 | 427 | } else { |
428 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
428 | + echo ' <a href="'.str_replace('&paged', '&paged', get_pagenum_link($i)).'">'.$i.'</a> '; |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | } |
432 | 432 | next_posts_link($nxtlabel, $max_page); |
433 | 433 | if (($paged + $half_pages_to_show) < ($max_page)) { |
434 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
434 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link($max_page)).'">»</a>'; |
|
435 | 435 | } |
436 | 436 | echo "</div> $after"; |
437 | 437 | } |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | jQuery(function ($) { |
470 | 470 | $("#distance_slider").slider({ |
471 | 471 | range: true, |
472 | - values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
472 | + values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
473 | 473 | min: 0, |
474 | 474 | max: <?php echo $dist; ?>, |
475 | 475 | step: <?php echo $dist_dif; ?>, |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | |
536 | 536 | <script type="text/javascript"> |
537 | - var default_location = '<?php if($search_location = geodir_get_default_location()) echo $search_location->city ;?>'; |
|
537 | + var default_location = '<?php if ($search_location = geodir_get_default_location()) echo $search_location->city; ?>'; |
|
538 | 538 | var latlng; |
539 | 539 | var address; |
540 | 540 | var dist = 0; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | var $form = jQuery(this).closest('form'); |
551 | 551 | |
552 | 552 | if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val(); |
553 | - if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s); |
|
553 | + if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s); |
|
554 | 554 | |
555 | 555 | // Disable location based search for disabled location post type. |
556 | 556 | if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') { |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | } |
565 | 565 | } |
566 | 566 | |
567 | - if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) { |
|
567 | + if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) { |
|
568 | 568 | geodir_setsearch($form); |
569 | 569 | } else { |
570 | 570 | jQuery(".snear", $form).val(''); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | }); |
583 | 583 | |
584 | 584 | function geodir_setsearch($form) { |
585 | - if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location); |
|
585 | + if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location); |
|
586 | 586 | geocodeAddress($form); |
587 | 587 | } |
588 | 588 | |
@@ -601,15 +601,15 @@ discard block |
||
601 | 601 | // Call the geocode function |
602 | 602 | Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
603 | 603 | |
604 | - if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
605 | - if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
604 | + if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
605 | + if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
606 | 606 | jQuery(".snear", $form).val(''); |
607 | 607 | } |
608 | 608 | jQuery($form).submit(); |
609 | 609 | } else { |
610 | 610 | var address = jQuery(".snear", $form).val(); |
611 | 611 | |
612 | - if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') { |
|
612 | + if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') { |
|
613 | 613 | initialise2(); |
614 | 614 | } else { |
615 | 615 | <?php |
@@ -622,12 +622,12 @@ discard block |
||
622 | 622 | $near_add2 = apply_filters('geodir_search_near_addition', ''); |
623 | 623 | ?> |
624 | 624 | if (window.gdMaps === 'google') { |
625 | - Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
|
625 | + Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>}, |
|
626 | 626 | function (results, status) { |
627 | 627 | if (status == google.maps.GeocoderStatus.OK) { |
628 | 628 | updateSearchPosition(results[0].geometry.location, $form); |
629 | 629 | } else { |
630 | - alert("<?php esc_attr_e('Search was not successful for the following reason x:', 'geodirectory');?>" + status); |
|
630 | + alert("<?php esc_attr_e('Search was not successful for the following reason x:', 'geodirectory'); ?>" + status); |
|
631 | 631 | } |
632 | 632 | }); |
633 | 633 | } else if (window.gdMaps === 'osm') { |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | if (typeof geo !== 'undefined' && geo.lat && geo.lon) { |
637 | 637 | updateSearchPosition(geo, $form); |
638 | 638 | } else { |
639 | - alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>"); |
|
639 | + alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>"); |
|
640 | 640 | } |
641 | 641 | }); |
642 | 642 | } else { |
@@ -682,19 +682,19 @@ discard block |
||
682 | 682 | var msg; |
683 | 683 | switch (err.code) { |
684 | 684 | case err.UNKNOWN_ERROR: |
685 | - msg = "<?php _e('Unable to find your location','geodirectory');?>"; |
|
685 | + msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>"; |
|
686 | 686 | break; |
687 | 687 | case err.PERMISSION_DENINED: |
688 | - msg = "<?php _e('Permission denied in finding your location','geodirectory');?>"; |
|
688 | + msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>"; |
|
689 | 689 | break; |
690 | 690 | case err.POSITION_UNAVAILABLE: |
691 | - msg = "<?php _e('Your location is currently unknown','geodirectory');?>"; |
|
691 | + msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>"; |
|
692 | 692 | break; |
693 | 693 | case err.BREAK: |
694 | - msg = "<?php _e('Attempt to find location took too long','geodirectory');?>"; |
|
694 | + msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>"; |
|
695 | 695 | break; |
696 | 696 | default: |
697 | - msg = "<?php _e('Location detection not supported in browser','geodirectory');?>"; |
|
697 | + msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>"; |
|
698 | 698 | } |
699 | 699 | jQuery('#info').html(msg); |
700 | 700 | } |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * @param object $post The post object. |
734 | 734 | * @param string $link The link to the post. |
735 | 735 | */ |
736 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
736 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img"> </span></a>', $post, $link); |
|
737 | 737 | break; |
738 | 738 | case 'new' : |
739 | 739 | /** |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | * @param object $post The post object. |
744 | 744 | * @param string $link The link to the post. |
745 | 745 | */ |
746 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
746 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing"> </span></a>', $post, $link); |
|
747 | 747 | break; |
748 | 748 | |
749 | 749 | } |
@@ -13,29 +13,29 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function geodir_register_taxonomies() |
15 | 15 | { |
16 | - $taxonomies = array(); |
|
17 | - $taxonomies = get_option('geodir_taxonomies'); |
|
18 | - // If custom taxonomies are present, register them |
|
19 | - if (is_array($taxonomies)) { |
|
20 | - // Sort taxonomies |
|
21 | - ksort($taxonomies); |
|
22 | - |
|
23 | - // Register taxonomies |
|
24 | - foreach ($taxonomies as $taxonomy => $args) { |
|
25 | - // Allow taxonomy names to be translated |
|
26 | - if (!empty($args['args']['labels'])) { |
|
27 | - foreach ($args['args']['labels'] as $key => $tax_label) { |
|
28 | - $args['args']['labels'][$key] = __($tax_label, 'geodirectory'); |
|
29 | - } |
|
30 | - } |
|
31 | - |
|
32 | - $tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']); |
|
33 | - |
|
34 | - if (taxonomy_exists($taxonomy)) { |
|
35 | - $tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']); |
|
36 | - } |
|
37 | - } |
|
38 | - } |
|
16 | + $taxonomies = array(); |
|
17 | + $taxonomies = get_option('geodir_taxonomies'); |
|
18 | + // If custom taxonomies are present, register them |
|
19 | + if (is_array($taxonomies)) { |
|
20 | + // Sort taxonomies |
|
21 | + ksort($taxonomies); |
|
22 | + |
|
23 | + // Register taxonomies |
|
24 | + foreach ($taxonomies as $taxonomy => $args) { |
|
25 | + // Allow taxonomy names to be translated |
|
26 | + if (!empty($args['args']['labels'])) { |
|
27 | + foreach ($args['args']['labels'] as $key => $tax_label) { |
|
28 | + $args['args']['labels'][$key] = __($tax_label, 'geodirectory'); |
|
29 | + } |
|
30 | + } |
|
31 | + |
|
32 | + $tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']); |
|
33 | + |
|
34 | + if (taxonomy_exists($taxonomy)) { |
|
35 | + $tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']); |
|
36 | + } |
|
37 | + } |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -53,40 +53,40 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function geodir_register_post_types() |
55 | 55 | { |
56 | - global $wp_post_types; |
|
56 | + global $wp_post_types; |
|
57 | 57 | |
58 | - $post_types = array(); |
|
59 | - $post_types = get_option('geodir_post_types'); |
|
58 | + $post_types = array(); |
|
59 | + $post_types = get_option('geodir_post_types'); |
|
60 | 60 | |
61 | - // Register each post type if array of data is returned |
|
62 | - if (is_array($post_types)): |
|
61 | + // Register each post type if array of data is returned |
|
62 | + if (is_array($post_types)): |
|
63 | 63 | |
64 | - foreach ($post_types as $post_type => $args): |
|
64 | + foreach ($post_types as $post_type => $args): |
|
65 | 65 | |
66 | - if (!empty($args['rewrite']['slug'])) { |
|
67 | - $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory'); |
|
68 | - } |
|
69 | - $args = stripslashes_deep($args); |
|
66 | + if (!empty($args['rewrite']['slug'])) { |
|
67 | + $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory'); |
|
68 | + } |
|
69 | + $args = stripslashes_deep($args); |
|
70 | 70 | |
71 | - if (!empty($args['labels'])) { |
|
72 | - foreach ($args['labels'] as $key => $val) { |
|
73 | - $args['labels'][$key] = __($val, 'geodirectory');// allow translation |
|
74 | - } |
|
75 | - } |
|
71 | + if (!empty($args['labels'])) { |
|
72 | + foreach ($args['labels'] as $key => $val) { |
|
73 | + $args['labels'][$key] = __($val, 'geodirectory');// allow translation |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Filter post type args. |
|
79 | - * |
|
80 | - * @since 1.0.0 |
|
81 | - * @param string $args Post type args. |
|
82 | - * @param string $post_type The post type. |
|
83 | - */ |
|
84 | - $args = apply_filters('geodir_post_type_args', $args, $post_type); |
|
77 | + /** |
|
78 | + * Filter post type args. |
|
79 | + * |
|
80 | + * @since 1.0.0 |
|
81 | + * @param string $args Post type args. |
|
82 | + * @param string $post_type The post type. |
|
83 | + */ |
|
84 | + $args = apply_filters('geodir_post_type_args', $args, $post_type); |
|
85 | 85 | |
86 | - $post_type = register_post_type($post_type, $args); |
|
86 | + $post_type = register_post_type($post_type, $args); |
|
87 | 87 | |
88 | - endforeach; |
|
89 | - endif; |
|
88 | + endforeach; |
|
89 | + endif; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,72 +100,72 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function geodir_post_type_args_modify($args, $post_type) |
102 | 102 | { |
103 | - $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix'); |
|
103 | + $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix'); |
|
104 | 104 | if (isset($_REQUEST['geodir_listing_prefix']) && $_REQUEST['geodir_listing_prefix'] != '' && geodir_strtolower($_REQUEST['geodir_listing_prefix']) != geodir_strtolower($geodir_location_prefix)) { |
105 | 105 | |
106 | - $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix'])); |
|
106 | + $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix'])); |
|
107 | 107 | |
108 | - if ($post_type == 'gd_place') { |
|
109 | - if (array_key_exists('has_archive', $args)) |
|
110 | - $args['has_archive'] = $listing_slug; |
|
108 | + if ($post_type == 'gd_place') { |
|
109 | + if (array_key_exists('has_archive', $args)) |
|
110 | + $args['has_archive'] = $listing_slug; |
|
111 | 111 | |
112 | - if (array_key_exists('rewrite', $args)) { |
|
113 | - if (array_key_exists('slug', $args['rewrite'])) |
|
114 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
115 | - } |
|
112 | + if (array_key_exists('rewrite', $args)) { |
|
113 | + if (array_key_exists('slug', $args['rewrite'])) |
|
114 | + $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
115 | + } |
|
116 | 116 | |
117 | - $geodir_post_types = get_option('geodir_post_types'); |
|
117 | + $geodir_post_types = get_option('geodir_post_types'); |
|
118 | 118 | |
119 | - if (array_key_exists($post_type, $geodir_post_types)) { |
|
119 | + if (array_key_exists($post_type, $geodir_post_types)) { |
|
120 | 120 | |
121 | - if (array_key_exists('has_archive', $geodir_post_types[$post_type])) |
|
122 | - $geodir_post_types[$post_type]['has_archive'] = $listing_slug; |
|
121 | + if (array_key_exists('has_archive', $geodir_post_types[$post_type])) |
|
122 | + $geodir_post_types[$post_type]['has_archive'] = $listing_slug; |
|
123 | 123 | |
124 | - if (array_key_exists('rewrite', $geodir_post_types[$post_type])) |
|
125 | - if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite'])) |
|
126 | - $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
124 | + if (array_key_exists('rewrite', $geodir_post_types[$post_type])) |
|
125 | + if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite'])) |
|
126 | + $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
127 | 127 | |
128 | - update_option('geodir_post_types', $geodir_post_types); |
|
128 | + update_option('geodir_post_types', $geodir_post_types); |
|
129 | 129 | |
130 | - } |
|
130 | + } |
|
131 | 131 | |
132 | - $geodir_post_types = get_option('geodir_post_types'); |
|
132 | + $geodir_post_types = get_option('geodir_post_types'); |
|
133 | 133 | |
134 | - /* --- update taxonomies (category) --- */ |
|
134 | + /* --- update taxonomies (category) --- */ |
|
135 | 135 | |
136 | - $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
136 | + $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
137 | 137 | |
138 | - if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) { |
|
139 | - $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; |
|
138 | + if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) { |
|
139 | + $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; |
|
140 | 140 | |
141 | - if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category'])) |
|
142 | - if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args'])) |
|
143 | - if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite'])) |
|
144 | - $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; |
|
141 | + if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category'])) |
|
142 | + if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args'])) |
|
143 | + if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite'])) |
|
144 | + $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; |
|
145 | 145 | |
146 | - update_option('geodir_taxonomies', $geodir_taxonomies); |
|
146 | + update_option('geodir_taxonomies', $geodir_taxonomies); |
|
147 | 147 | |
148 | - } |
|
148 | + } |
|
149 | 149 | |
150 | - /* --- update taxonomies (tags) --- */ |
|
151 | - $geodir_taxonomies_tag = get_option('geodir_taxonomies'); |
|
152 | - if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) { |
|
153 | - $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; |
|
150 | + /* --- update taxonomies (tags) --- */ |
|
151 | + $geodir_taxonomies_tag = get_option('geodir_taxonomies'); |
|
152 | + if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) { |
|
153 | + $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; |
|
154 | 154 | |
155 | - if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags'])) |
|
156 | - if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args'])) |
|
157 | - if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite'])) |
|
158 | - $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; |
|
155 | + if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags'])) |
|
156 | + if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args'])) |
|
157 | + if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite'])) |
|
158 | + $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; |
|
159 | 159 | |
160 | - update_option('geodir_taxonomies', $geodir_taxonomies_tag); |
|
160 | + update_option('geodir_taxonomies', $geodir_taxonomies_tag); |
|
161 | 161 | |
162 | - } |
|
162 | + } |
|
163 | 163 | |
164 | - } |
|
164 | + } |
|
165 | 165 | |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - return $args; |
|
168 | + return $args; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | */ |
179 | 179 | function geodir_flush_rewrite_rules() |
180 | 180 | { |
181 | - global $wp_rewrite; |
|
182 | - $wp_rewrite->flush_rules(false); |
|
181 | + global $wp_rewrite; |
|
182 | + $wp_rewrite->flush_rules(false); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -194,35 +194,35 @@ discard block |
||
194 | 194 | * @return array Rewrite rules. |
195 | 195 | */ |
196 | 196 | function geodir_listing_rewrite_rules($rules) { |
197 | - $newrules = array(); |
|
198 | - $taxonomies = get_option('geodir_taxonomies'); |
|
199 | - $detail_url_seprator = get_option('geodir_detailurl_separator'); |
|
197 | + $newrules = array(); |
|
198 | + $taxonomies = get_option('geodir_taxonomies'); |
|
199 | + $detail_url_seprator = get_option('geodir_detailurl_separator'); |
|
200 | 200 | |
201 | 201 | // create rules for post listing |
202 | - if (is_array($taxonomies)): |
|
203 | - foreach ($taxonomies as $taxonomy => $args): |
|
204 | - $post_type = $args['object_type']; |
|
205 | - $listing_slug = $args['listing_slug']; |
|
206 | - |
|
207 | - if (strpos($taxonomy, 'tags')) { |
|
208 | - $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]'; |
|
209 | - $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]'; |
|
210 | - } else { |
|
211 | - // use this loop to add paging for details page comments paging |
|
212 | - $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]'; |
|
213 | - } |
|
214 | - endforeach; |
|
215 | - endif; |
|
216 | - |
|
217 | - // create rules for location listing |
|
218 | - $location_page = get_option('geodir_location_page'); |
|
202 | + if (is_array($taxonomies)): |
|
203 | + foreach ($taxonomies as $taxonomy => $args): |
|
204 | + $post_type = $args['object_type']; |
|
205 | + $listing_slug = $args['listing_slug']; |
|
206 | + |
|
207 | + if (strpos($taxonomy, 'tags')) { |
|
208 | + $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]'; |
|
209 | + $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]'; |
|
210 | + } else { |
|
211 | + // use this loop to add paging for details page comments paging |
|
212 | + $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]'; |
|
213 | + } |
|
214 | + endforeach; |
|
215 | + endif; |
|
216 | + |
|
217 | + // create rules for location listing |
|
218 | + $location_page = get_option('geodir_location_page'); |
|
219 | 219 | |
220 | - if($location_page) { |
|
221 | - global $wpdb; |
|
222 | - $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page)); |
|
223 | - } |
|
224 | - if (!isset($location_prefix)) |
|
225 | - $location_prefix = 'location'; |
|
220 | + if($location_page) { |
|
221 | + global $wpdb; |
|
222 | + $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page)); |
|
223 | + } |
|
224 | + if (!isset($location_prefix)) |
|
225 | + $location_prefix = 'location'; |
|
226 | 226 | |
227 | 227 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active. |
228 | 228 | if ($location_manager) { |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]'; |
267 | 267 | } |
268 | 268 | |
269 | - if ($location_page && function_exists('icl_object_id')) { |
|
270 | - foreach(icl_get_languages('skip_missing=N') as $lang){ |
|
271 | - $alt_page_id = ''; |
|
272 | - $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']); |
|
273 | - if($alt_page_id){ |
|
274 | - $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id)); |
|
269 | + if ($location_page && function_exists('icl_object_id')) { |
|
270 | + foreach(icl_get_languages('skip_missing=N') as $lang){ |
|
271 | + $alt_page_id = ''; |
|
272 | + $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']); |
|
273 | + if($alt_page_id){ |
|
274 | + $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id)); |
|
275 | 275 | |
276 | 276 | if ($location_manager && ($hide_country_part || $hide_region_part)) { |
277 | 277 | $matches2 = ''; |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]'; |
308 | 308 | $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]'; |
309 | 309 | } |
310 | - } |
|
311 | - } |
|
312 | - } |
|
310 | + } |
|
311 | + } |
|
312 | + } |
|
313 | 313 | |
314 | - $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page; |
|
314 | + $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page; |
|
315 | 315 | |
316 | - $rules = array_merge($newrules, $rules); |
|
317 | - return $rules; |
|
316 | + $rules = array_merge($newrules, $rules); |
|
317 | + return $rules; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -329,18 +329,18 @@ discard block |
||
329 | 329 | */ |
330 | 330 | function geodir_htaccess_contents($rules) |
331 | 331 | { |
332 | - global $wpdb; |
|
333 | - $location_prefix = get_option('geodir_location_prefix'); |
|
334 | - // if location page slug changed then add redirect |
|
335 | - if ($location_prefix == 'location') { |
|
336 | - return $rules; |
|
337 | - } |
|
338 | - $my_content = <<<EOD |
|
332 | + global $wpdb; |
|
333 | + $location_prefix = get_option('geodir_location_prefix'); |
|
334 | + // if location page slug changed then add redirect |
|
335 | + if ($location_prefix == 'location') { |
|
336 | + return $rules; |
|
337 | + } |
|
338 | + $my_content = <<<EOD |
|
339 | 339 | \n# BEGIN GeoDirectory Rules |
340 | 340 | #Redirect 301 /location/ /$location_prefix/ |
341 | 341 | # END GeoDirectory Rules\n\n |
342 | 342 | EOD; |
343 | - return $my_content . $rules; |
|
343 | + return $my_content . $rules; |
|
344 | 344 | } |
345 | 345 | //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents'); |
346 | 346 | |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | */ |
355 | 355 | function geodir_add_location_var($public_query_vars) |
356 | 356 | { |
357 | - $public_query_vars[] = 'gd_country'; |
|
358 | - $public_query_vars[] = 'gd_region'; |
|
359 | - $public_query_vars[] = 'gd_city'; |
|
360 | - return $public_query_vars; |
|
357 | + $public_query_vars[] = 'gd_country'; |
|
358 | + $public_query_vars[] = 'gd_region'; |
|
359 | + $public_query_vars[] = 'gd_city'; |
|
360 | + return $public_query_vars; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | */ |
371 | 371 | function geodir_add_geodir_page_var($public_query_vars) |
372 | 372 | { |
373 | - $public_query_vars[] = 'gd_is_geodir_page'; |
|
374 | - return $public_query_vars; |
|
373 | + $public_query_vars[] = 'gd_is_geodir_page'; |
|
374 | + return $public_query_vars; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -383,20 +383,20 @@ discard block |
||
383 | 383 | */ |
384 | 384 | function geodir_add_page_id_in_query_var() |
385 | 385 | { |
386 | - global $wp_query; |
|
386 | + global $wp_query; |
|
387 | 387 | |
388 | - $page_id = $wp_query->get_queried_object_id(); |
|
388 | + $page_id = $wp_query->get_queried_object_id(); |
|
389 | 389 | |
390 | - if (!get_query_var('page_id') && !is_archive()) { |
|
391 | - // fix for WP tags conflict with enfold theme |
|
392 | - $theme_name = geodir_strtolower(wp_get_theme()); |
|
393 | - if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) { |
|
394 | - return $wp_query; |
|
395 | - } |
|
396 | - $wp_query->set('page_id', $page_id); |
|
397 | - } |
|
390 | + if (!get_query_var('page_id') && !is_archive()) { |
|
391 | + // fix for WP tags conflict with enfold theme |
|
392 | + $theme_name = geodir_strtolower(wp_get_theme()); |
|
393 | + if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) { |
|
394 | + return $wp_query; |
|
395 | + } |
|
396 | + $wp_query->set('page_id', $page_id); |
|
397 | + } |
|
398 | 398 | |
399 | - return $wp_query; |
|
399 | + return $wp_query; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -411,24 +411,24 @@ discard block |
||
411 | 411 | function geodir_set_location_var_in_session_in_core($wp) { |
412 | 412 | global $gd_session; |
413 | 413 | |
414 | - // Fix for WPML removing page_id query var: |
|
415 | - if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) { |
|
416 | - global $wpdb; |
|
417 | - |
|
418 | - $page_for_posts = get_option('page_for_posts'); |
|
419 | - $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename'])); |
|
420 | - |
|
421 | - if (function_exists('icl_object_id')) { |
|
422 | - $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE); |
|
423 | - } |
|
424 | - if ($real_page_id && $real_page_id!=$page_for_posts) { |
|
425 | - $wp->query_vars['page_id'] = $real_page_id; |
|
426 | - } |
|
427 | - } |
|
414 | + // Fix for WPML removing page_id query var: |
|
415 | + if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) { |
|
416 | + global $wpdb; |
|
417 | + |
|
418 | + $page_for_posts = get_option('page_for_posts'); |
|
419 | + $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename'])); |
|
420 | + |
|
421 | + if (function_exists('icl_object_id')) { |
|
422 | + $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE); |
|
423 | + } |
|
424 | + if ($real_page_id && $real_page_id!=$page_for_posts) { |
|
425 | + $wp->query_vars['page_id'] = $real_page_id; |
|
426 | + } |
|
427 | + } |
|
428 | 428 | |
429 | 429 | // Query Vars will have page_id parameter |
430 | 430 | // check if query var has page_id and that page id is location page |
431 | - geodir_set_is_geodir_page($wp); |
|
431 | + geodir_set_is_geodir_page($wp); |
|
432 | 432 | // if is GD homepage set the page ID |
433 | 433 | if (geodir_is_page('home')) { |
434 | 434 | $wp->query_vars['page_id'] = get_option('page_on_front'); |
@@ -437,118 +437,118 @@ discard block |
||
437 | 437 | // The location url format (all or country_city or region_city or city). |
438 | 438 | $geodir_show_location_url = get_option('geodir_show_location_url'); |
439 | 439 | |
440 | - if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) { |
|
441 | - $gd_country = ''; |
|
442 | - $gd_region = ''; |
|
443 | - $gd_city = ''; |
|
444 | - if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') |
|
445 | - $gd_country = urldecode($wp->query_vars['gd_country']); |
|
446 | - |
|
447 | - if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') |
|
448 | - $gd_region = urldecode($wp->query_vars['gd_region']); |
|
449 | - |
|
450 | - if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') |
|
451 | - $gd_city = urldecode($wp->query_vars['gd_city']); |
|
452 | - |
|
453 | - if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) { |
|
454 | - $default_location = geodir_get_default_location(); |
|
455 | - |
|
456 | - if (get_option('geodir_add_location_url')) { |
|
457 | - if ($geodir_show_location_url != 'all') { |
|
458 | - if ($gd_region == '') { |
|
459 | - if ($gd_ses_region = $gd_session->get('gd_region')) |
|
460 | - $gd_region = $gd_ses_region; |
|
461 | - else |
|
462 | - $gd_region = $default_location->region_slug; |
|
463 | - } |
|
464 | - |
|
465 | - if ($gd_city == '') { |
|
466 | - if ($gd_ses_city = $gd_session->get('gd_city')) |
|
467 | - $gd_city = $gd_ses_city; |
|
468 | - else |
|
469 | - $gd_city = $default_location->city_slug; |
|
470 | - |
|
471 | - $base_location_link = geodir_get_location_link('base'); |
|
472 | - wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); |
|
473 | - exit(); |
|
474 | - } |
|
475 | - } |
|
476 | - } |
|
477 | - |
|
478 | - $args = array( |
|
479 | - 'what' => 'city', |
|
480 | - 'city_val' => $gd_city, |
|
481 | - 'region_val' => $gd_region, |
|
482 | - 'country_val' => $gd_country, |
|
483 | - 'country_column_name' => 'country_slug', |
|
484 | - 'region_column_name' => 'region_slug', |
|
485 | - 'city_column_name' => 'city_slug', |
|
486 | - 'location_link_part' => false, |
|
487 | - 'compare_operator' => '' |
|
488 | - ); |
|
489 | - |
|
490 | - $location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array(); |
|
491 | - if (!empty($location_array)) { |
|
492 | - $gd_session->set('gd_multi_location', 1); |
|
493 | - $gd_session->set('gd_country', $gd_country); |
|
494 | - $gd_session->set('gd_region', $gd_region); |
|
495 | - $gd_session->set('gd_city', $gd_city); |
|
440 | + if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) { |
|
441 | + $gd_country = ''; |
|
442 | + $gd_region = ''; |
|
443 | + $gd_city = ''; |
|
444 | + if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') |
|
445 | + $gd_country = urldecode($wp->query_vars['gd_country']); |
|
446 | + |
|
447 | + if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') |
|
448 | + $gd_region = urldecode($wp->query_vars['gd_region']); |
|
449 | + |
|
450 | + if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') |
|
451 | + $gd_city = urldecode($wp->query_vars['gd_city']); |
|
452 | + |
|
453 | + if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) { |
|
454 | + $default_location = geodir_get_default_location(); |
|
455 | + |
|
456 | + if (get_option('geodir_add_location_url')) { |
|
457 | + if ($geodir_show_location_url != 'all') { |
|
458 | + if ($gd_region == '') { |
|
459 | + if ($gd_ses_region = $gd_session->get('gd_region')) |
|
460 | + $gd_region = $gd_ses_region; |
|
461 | + else |
|
462 | + $gd_region = $default_location->region_slug; |
|
463 | + } |
|
464 | + |
|
465 | + if ($gd_city == '') { |
|
466 | + if ($gd_ses_city = $gd_session->get('gd_city')) |
|
467 | + $gd_city = $gd_ses_city; |
|
468 | + else |
|
469 | + $gd_city = $default_location->city_slug; |
|
470 | + |
|
471 | + $base_location_link = geodir_get_location_link('base'); |
|
472 | + wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); |
|
473 | + exit(); |
|
474 | + } |
|
475 | + } |
|
476 | + } |
|
477 | + |
|
478 | + $args = array( |
|
479 | + 'what' => 'city', |
|
480 | + 'city_val' => $gd_city, |
|
481 | + 'region_val' => $gd_region, |
|
482 | + 'country_val' => $gd_country, |
|
483 | + 'country_column_name' => 'country_slug', |
|
484 | + 'region_column_name' => 'region_slug', |
|
485 | + 'city_column_name' => 'city_slug', |
|
486 | + 'location_link_part' => false, |
|
487 | + 'compare_operator' => '' |
|
488 | + ); |
|
489 | + |
|
490 | + $location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array(); |
|
491 | + if (!empty($location_array)) { |
|
492 | + $gd_session->set('gd_multi_location', 1); |
|
493 | + $gd_session->set('gd_country', $gd_country); |
|
494 | + $gd_session->set('gd_region', $gd_region); |
|
495 | + $gd_session->set('gd_city', $gd_city); |
|
496 | 496 | |
497 | 497 | $wp->query_vars['gd_country'] = $gd_country; |
498 | - $wp->query_vars['gd_region'] = $gd_region; |
|
499 | - $wp->query_vars['gd_city'] = $gd_city; |
|
500 | - } else { |
|
501 | - $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country')); |
|
502 | - } |
|
503 | - } else { |
|
504 | - $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country')); |
|
505 | - } |
|
506 | - |
|
507 | - } else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') { |
|
508 | - if (!is_admin()) { |
|
509 | - $requested_post_type = $wp->query_vars['post_type']; |
|
510 | - // check if this post type is geodirectory post types |
|
511 | - $post_type_array = geodir_get_posttypes(); |
|
498 | + $wp->query_vars['gd_region'] = $gd_region; |
|
499 | + $wp->query_vars['gd_city'] = $gd_city; |
|
500 | + } else { |
|
501 | + $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country')); |
|
502 | + } |
|
503 | + } else { |
|
504 | + $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country')); |
|
505 | + } |
|
506 | + |
|
507 | + } else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') { |
|
508 | + if (!is_admin()) { |
|
509 | + $requested_post_type = $wp->query_vars['post_type']; |
|
510 | + // check if this post type is geodirectory post types |
|
511 | + $post_type_array = geodir_get_posttypes(); |
|
512 | 512 | |
513 | 513 | if (in_array($requested_post_type, $post_type_array)) { |
514 | - // now u can apply geodirectory related manipulation. |
|
515 | - } |
|
516 | - } |
|
517 | - } else { |
|
518 | - // check if a geodirectory taxonomy is set |
|
519 | - $gd_country = ''; |
|
520 | - $gd_region = ''; |
|
521 | - $gd_city = ''; |
|
514 | + // now u can apply geodirectory related manipulation. |
|
515 | + } |
|
516 | + } |
|
517 | + } else { |
|
518 | + // check if a geodirectory taxonomy is set |
|
519 | + $gd_country = ''; |
|
520 | + $gd_region = ''; |
|
521 | + $gd_city = ''; |
|
522 | 522 | |
523 | 523 | $is_geodir_taxonomy = false; |
524 | - $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not |
|
525 | - $is_geodir_location_found = false; |
|
524 | + $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not |
|
525 | + $is_geodir_location_found = false; |
|
526 | 526 | |
527 | 527 | $geodir_taxonomy = ''; |
528 | - $geodir_post_type = ''; |
|
529 | - $geodir_term = ''; |
|
530 | - $geodir_set_location_session = true; |
|
531 | - $geodir_taxonomis = geodir_get_taxonomies('', true); |
|
532 | - |
|
533 | - if(!empty($geodir_taxonomis)){ |
|
534 | - foreach ($geodir_taxonomis as $taxonomy) { |
|
535 | - if (array_key_exists($taxonomy, $wp->query_vars)) { |
|
536 | - $is_geodir_taxonomy = true; |
|
537 | - $geodir_taxonomy = $taxonomy; |
|
538 | - $geodir_post_type = str_replace('category', '', $taxonomy); |
|
539 | - $geodir_post_type = str_replace('_tags', '', $geodir_post_type); |
|
540 | - $geodir_term = $wp->query_vars[$geodir_taxonomy]; |
|
541 | - break; |
|
542 | - } |
|
543 | - } |
|
544 | - } |
|
545 | - |
|
546 | - // now get an array of all terms seperated by '/' |
|
547 | - $geodir_terms = explode('/', $geodir_term); |
|
548 | - $geodir_last_term = end($geodir_terms); |
|
549 | - |
|
550 | - if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy |
|
551 | - $wp->query_vars['post_type'] = $geodir_post_type; |
|
528 | + $geodir_post_type = ''; |
|
529 | + $geodir_term = ''; |
|
530 | + $geodir_set_location_session = true; |
|
531 | + $geodir_taxonomis = geodir_get_taxonomies('', true); |
|
532 | + |
|
533 | + if(!empty($geodir_taxonomis)){ |
|
534 | + foreach ($geodir_taxonomis as $taxonomy) { |
|
535 | + if (array_key_exists($taxonomy, $wp->query_vars)) { |
|
536 | + $is_geodir_taxonomy = true; |
|
537 | + $geodir_taxonomy = $taxonomy; |
|
538 | + $geodir_post_type = str_replace('category', '', $taxonomy); |
|
539 | + $geodir_post_type = str_replace('_tags', '', $geodir_post_type); |
|
540 | + $geodir_term = $wp->query_vars[$geodir_taxonomy]; |
|
541 | + break; |
|
542 | + } |
|
543 | + } |
|
544 | + } |
|
545 | + |
|
546 | + // now get an array of all terms seperated by '/' |
|
547 | + $geodir_terms = explode('/', $geodir_term); |
|
548 | + $geodir_last_term = end($geodir_terms); |
|
549 | + |
|
550 | + if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy |
|
551 | + $wp->query_vars['post_type'] = $geodir_post_type; |
|
552 | 552 | |
553 | 553 | // now check if last term is a post of geodirectory post types |
554 | 554 | $geodir_post = get_posts(array( |
@@ -597,196 +597,196 @@ discard block |
||
597 | 597 | //return ; |
598 | 598 | } |
599 | 599 | |
600 | - $geodir_location_terms = ''; |
|
601 | - // if last term is not a post then check if last term is a term of the specific texonomy or not |
|
602 | - if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) { |
|
603 | - $is_geodir_taxonomy_term = true; |
|
600 | + $geodir_location_terms = ''; |
|
601 | + // if last term is not a post then check if last term is a term of the specific texonomy or not |
|
602 | + if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) { |
|
603 | + $is_geodir_taxonomy_term = true; |
|
604 | 604 | |
605 | - $geodir_set_location_session = false; |
|
606 | - } |
|
605 | + $geodir_set_location_session = false; |
|
606 | + } |
|
607 | 607 | |
608 | 608 | |
609 | - // now check if there is location parts in the url or not |
|
610 | - if (get_option('geodir_add_location_url')) { |
|
609 | + // now check if there is location parts in the url or not |
|
610 | + if (get_option('geodir_add_location_url')) { |
|
611 | 611 | $default_location = geodir_get_default_location(); |
612 | 612 | |
613 | 613 | if ($geodir_show_location_url == 'all') { |
614 | - if (count($geodir_terms) >= 3) { |
|
615 | - $gd_country = urldecode($geodir_terms[0]); |
|
616 | - $gd_region = urldecode($geodir_terms[1]); |
|
617 | - $gd_city = urldecode($geodir_terms[2]); |
|
618 | - } else if (count($geodir_terms) >= 2) { |
|
619 | - $gd_country = urldecode($geodir_terms[0]); |
|
620 | - $gd_region = urldecode($geodir_terms[1]); |
|
621 | - } else if (count($geodir_terms) >= 1) { |
|
622 | - $gd_country = urldecode($geodir_terms[0]); |
|
623 | - } |
|
624 | - |
|
625 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
|
626 | - geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && |
|
627 | - geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city) |
|
628 | - ) |
|
629 | - $is_geodir_location_found = true; |
|
630 | - |
|
631 | - // if location has not been found for country , region and city then search for country and region only |
|
632 | - |
|
633 | - if (!$is_geodir_location_found) { |
|
634 | - $gd_city = ''; |
|
635 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
|
636 | - geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) |
|
637 | - ) |
|
638 | - $is_geodir_location_found = true; |
|
639 | - |
|
640 | - } |
|
641 | - |
|
642 | - // if location has not been found for country , region then search for country only |
|
643 | - if (!$is_geodir_location_found) { |
|
644 | - $gd_city = ''; |
|
645 | - $gd_region = ''; |
|
646 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
|
647 | - $is_geodir_location_found = true; |
|
648 | - } |
|
649 | - } else if ($geodir_show_location_url == 'country_city') { |
|
650 | - if (count($geodir_terms) >= 2) { |
|
651 | - $gd_country = urldecode($geodir_terms[0]); |
|
652 | - $gd_city = urldecode($geodir_terms[1]); |
|
653 | - } else if (count($geodir_terms) >= 1) { |
|
654 | - $gd_country = urldecode($geodir_terms[0]); |
|
655 | - } |
|
656 | - |
|
657 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
658 | - $is_geodir_location_found = true; |
|
659 | - |
|
660 | - // if location has not been found for country and city then search for country only |
|
661 | - if (!$is_geodir_location_found) { |
|
662 | - $gd_city = ''; |
|
614 | + if (count($geodir_terms) >= 3) { |
|
615 | + $gd_country = urldecode($geodir_terms[0]); |
|
616 | + $gd_region = urldecode($geodir_terms[1]); |
|
617 | + $gd_city = urldecode($geodir_terms[2]); |
|
618 | + } else if (count($geodir_terms) >= 2) { |
|
619 | + $gd_country = urldecode($geodir_terms[0]); |
|
620 | + $gd_region = urldecode($geodir_terms[1]); |
|
621 | + } else if (count($geodir_terms) >= 1) { |
|
622 | + $gd_country = urldecode($geodir_terms[0]); |
|
623 | + } |
|
624 | + |
|
625 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
|
626 | + geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && |
|
627 | + geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city) |
|
628 | + ) |
|
629 | + $is_geodir_location_found = true; |
|
630 | + |
|
631 | + // if location has not been found for country , region and city then search for country and region only |
|
632 | + |
|
633 | + if (!$is_geodir_location_found) { |
|
634 | + $gd_city = ''; |
|
635 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
|
636 | + geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) |
|
637 | + ) |
|
638 | + $is_geodir_location_found = true; |
|
639 | + |
|
640 | + } |
|
641 | + |
|
642 | + // if location has not been found for country , region then search for country only |
|
643 | + if (!$is_geodir_location_found) { |
|
644 | + $gd_city = ''; |
|
645 | + $gd_region = ''; |
|
646 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
|
647 | + $is_geodir_location_found = true; |
|
648 | + } |
|
649 | + } else if ($geodir_show_location_url == 'country_city') { |
|
650 | + if (count($geodir_terms) >= 2) { |
|
651 | + $gd_country = urldecode($geodir_terms[0]); |
|
652 | + $gd_city = urldecode($geodir_terms[1]); |
|
653 | + } else if (count($geodir_terms) >= 1) { |
|
654 | + $gd_country = urldecode($geodir_terms[0]); |
|
655 | + } |
|
656 | + |
|
657 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
658 | + $is_geodir_location_found = true; |
|
659 | + |
|
660 | + // if location has not been found for country and city then search for country only |
|
661 | + if (!$is_geodir_location_found) { |
|
662 | + $gd_city = ''; |
|
663 | 663 | |
664 | 664 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
665 | - $is_geodir_location_found = true; |
|
666 | - } |
|
667 | - } else if ($geodir_show_location_url == 'region_city') { |
|
668 | - if (count($geodir_terms) >= 2) { |
|
669 | - $gd_region = urldecode($geodir_terms[0]); |
|
670 | - $gd_city = urldecode($geodir_terms[1]); |
|
671 | - } else if (count($geodir_terms) >= 1) { |
|
672 | - $gd_region = urldecode($geodir_terms[0]); |
|
673 | - } |
|
674 | - |
|
675 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
676 | - $is_geodir_location_found = true; |
|
677 | - |
|
678 | - // if location has not been found for region and city then search for region only |
|
679 | - if (!$is_geodir_location_found) { |
|
680 | - $gd_city = ''; |
|
665 | + $is_geodir_location_found = true; |
|
666 | + } |
|
667 | + } else if ($geodir_show_location_url == 'region_city') { |
|
668 | + if (count($geodir_terms) >= 2) { |
|
669 | + $gd_region = urldecode($geodir_terms[0]); |
|
670 | + $gd_city = urldecode($geodir_terms[1]); |
|
671 | + } else if (count($geodir_terms) >= 1) { |
|
672 | + $gd_region = urldecode($geodir_terms[0]); |
|
673 | + } |
|
674 | + |
|
675 | + if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
676 | + $is_geodir_location_found = true; |
|
677 | + |
|
678 | + // if location has not been found for region and city then search for region only |
|
679 | + if (!$is_geodir_location_found) { |
|
680 | + $gd_city = ''; |
|
681 | 681 | |
682 | 682 | if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) |
683 | - $is_geodir_location_found = true; |
|
684 | - } |
|
685 | - } else { |
|
686 | - $gd_city = $geodir_terms[0]; |
|
687 | - |
|
688 | - if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) { |
|
689 | - $is_geodir_location_found = true; |
|
690 | - $gd_region = $default_location->region_slug; |
|
691 | - $gd_country = $default_location->country_slug; |
|
692 | - } |
|
693 | - } |
|
694 | - // if location still not found then clear location related session variables |
|
695 | - if ($is_geodir_location_found && $geodir_set_location_session) { |
|
696 | - $gd_session->set('gd_multi_location', 1); |
|
697 | - $gd_session->set('gd_country', $gd_country); |
|
698 | - $gd_session->set('gd_region', $gd_region); |
|
699 | - $gd_session->set('gd_city', $gd_city); |
|
700 | - } |
|
701 | - |
|
702 | - if ($geodir_show_location_url == 'all') { |
|
683 | + $is_geodir_location_found = true; |
|
684 | + } |
|
685 | + } else { |
|
686 | + $gd_city = $geodir_terms[0]; |
|
687 | + |
|
688 | + if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) { |
|
689 | + $is_geodir_location_found = true; |
|
690 | + $gd_region = $default_location->region_slug; |
|
691 | + $gd_country = $default_location->country_slug; |
|
692 | + } |
|
693 | + } |
|
694 | + // if location still not found then clear location related session variables |
|
695 | + if ($is_geodir_location_found && $geodir_set_location_session) { |
|
696 | + $gd_session->set('gd_multi_location', 1); |
|
697 | + $gd_session->set('gd_country', $gd_country); |
|
698 | + $gd_session->set('gd_region', $gd_region); |
|
699 | + $gd_session->set('gd_city', $gd_city); |
|
700 | + } |
|
701 | + |
|
702 | + if ($geodir_show_location_url == 'all') { |
|
703 | 703 | } else if ($geodir_show_location_url == 'country_city') { |
704 | 704 | $gd_region = ''; |
705 | 705 | } else if ($geodir_show_location_url == 'region_city') { |
706 | 706 | $gd_country = ''; |
707 | 707 | } else { |
708 | 708 | $gd_country = ''; |
709 | - $gd_region = ''; |
|
709 | + $gd_region = ''; |
|
710 | 710 | } |
711 | 711 | |
712 | - if ($is_geodir_location_found) { |
|
713 | - $wp->query_vars['gd_country'] = $gd_country; |
|
714 | - $wp->query_vars['gd_region'] = $gd_region; |
|
715 | - $wp->query_vars['gd_city'] = $gd_city; |
|
716 | - } else { |
|
717 | - $gd_country = ''; |
|
718 | - $gd_region = ''; |
|
719 | - $gd_city = ''; |
|
720 | - } |
|
721 | - } |
|
722 | - |
|
723 | - $wp->query_vars[$geodir_taxonomy] = $geodir_term; |
|
724 | - // eliminate location related terms from taxonomy term |
|
725 | - if ($gd_country != '') |
|
726 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
727 | - |
|
728 | - if ($gd_region != '') |
|
729 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
730 | - |
|
731 | - if ($gd_city != '') |
|
732 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
733 | - |
|
734 | - |
|
735 | - $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]); |
|
736 | - $wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]); |
|
737 | - |
|
738 | - $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/'); |
|
739 | - |
|
740 | - if ($wp->query_vars[$geodir_taxonomy] == '') { |
|
741 | - unset($wp->query_vars[$geodir_taxonomy]); |
|
742 | - } else { |
|
743 | - if (!$is_geodir_taxonomy_term) { |
|
744 | - foreach ($wp->query_vars as $key => $vars) { |
|
745 | - unset($wp->query_vars[$key]); |
|
746 | - } |
|
747 | - $wp->query_vars['error'] = '404'; |
|
748 | - } |
|
749 | - } |
|
750 | - } |
|
751 | - } |
|
712 | + if ($is_geodir_location_found) { |
|
713 | + $wp->query_vars['gd_country'] = $gd_country; |
|
714 | + $wp->query_vars['gd_region'] = $gd_region; |
|
715 | + $wp->query_vars['gd_city'] = $gd_city; |
|
716 | + } else { |
|
717 | + $gd_country = ''; |
|
718 | + $gd_region = ''; |
|
719 | + $gd_city = ''; |
|
720 | + } |
|
721 | + } |
|
722 | + |
|
723 | + $wp->query_vars[$geodir_taxonomy] = $geodir_term; |
|
724 | + // eliminate location related terms from taxonomy term |
|
725 | + if ($gd_country != '') |
|
726 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
727 | + |
|
728 | + if ($gd_region != '') |
|
729 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
730 | + |
|
731 | + if ($gd_city != '') |
|
732 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
733 | + |
|
734 | + |
|
735 | + $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]); |
|
736 | + $wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]); |
|
737 | + |
|
738 | + $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/'); |
|
739 | + |
|
740 | + if ($wp->query_vars[$geodir_taxonomy] == '') { |
|
741 | + unset($wp->query_vars[$geodir_taxonomy]); |
|
742 | + } else { |
|
743 | + if (!$is_geodir_taxonomy_term) { |
|
744 | + foreach ($wp->query_vars as $key => $vars) { |
|
745 | + unset($wp->query_vars[$key]); |
|
746 | + } |
|
747 | + $wp->query_vars['error'] = '404'; |
|
748 | + } |
|
749 | + } |
|
750 | + } |
|
751 | + } |
|
752 | 752 | |
753 | 753 | // Unset location session if gd page and location not set. |
754 | 754 | if (isset($wp->query_vars['gd_is_geodir_page']) && !isset($wp->query_vars['gd_country'])) { |
755 | 755 | $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country')); |
756 | 756 | } |
757 | 757 | |
758 | - if ($gd_session->get('gd_multi_location') == 1) { |
|
759 | - $wp->query_vars['gd_country'] = $gd_session->get('gd_country'); |
|
760 | - $wp->query_vars['gd_region'] = $gd_session->get('gd_region'); |
|
761 | - $wp->query_vars['gd_city'] = $gd_session->get('gd_city'); |
|
762 | - } |
|
758 | + if ($gd_session->get('gd_multi_location') == 1) { |
|
759 | + $wp->query_vars['gd_country'] = $gd_session->get('gd_country'); |
|
760 | + $wp->query_vars['gd_region'] = $gd_session->get('gd_region'); |
|
761 | + $wp->query_vars['gd_city'] = $gd_session->get('gd_city'); |
|
762 | + } |
|
763 | 763 | |
764 | - // now check if there is location parts in the url or not |
|
765 | - if (get_option('geodir_add_location_url')) { |
|
764 | + // now check if there is location parts in the url or not |
|
765 | + if (get_option('geodir_add_location_url')) { |
|
766 | 766 | if ($geodir_show_location_url == 'all') { |
767 | 767 | } else if ($geodir_show_location_url == 'country_city') { |
768 | 768 | if (isset($wp->query_vars['gd_region'])) |
769 | - $wp->query_vars['gd_region'] = ''; |
|
769 | + $wp->query_vars['gd_region'] = ''; |
|
770 | 770 | } else if ($geodir_show_location_url == 'region_city') { |
771 | 771 | if (isset($wp->query_vars['gd_country'])) |
772 | - $wp->query_vars['gd_country'] = ''; |
|
772 | + $wp->query_vars['gd_country'] = ''; |
|
773 | 773 | } else { |
774 | 774 | if (isset($wp->query_vars['gd_country'])) |
775 | - $wp->query_vars['gd_country'] = ''; |
|
775 | + $wp->query_vars['gd_country'] = ''; |
|
776 | 776 | |
777 | - if (isset($wp->query_vars['gd_region'])) |
|
778 | - $wp->query_vars['gd_region'] = ''; |
|
777 | + if (isset($wp->query_vars['gd_region'])) |
|
778 | + $wp->query_vars['gd_region'] = ''; |
|
779 | 779 | } |
780 | - } else { |
|
781 | - if (isset($wp->query_vars['gd_country'])) |
|
782 | - $wp->query_vars['gd_country'] = ''; |
|
780 | + } else { |
|
781 | + if (isset($wp->query_vars['gd_country'])) |
|
782 | + $wp->query_vars['gd_country'] = ''; |
|
783 | 783 | |
784 | - if (isset($wp->query_vars['gd_region'])) |
|
785 | - $wp->query_vars['gd_region'] = ''; |
|
784 | + if (isset($wp->query_vars['gd_region'])) |
|
785 | + $wp->query_vars['gd_region'] = ''; |
|
786 | 786 | |
787 | - if (isset($wp->query_vars['gd_city'])) |
|
788 | - $wp->query_vars['gd_city'] = ''; |
|
789 | - } |
|
787 | + if (isset($wp->query_vars['gd_city'])) |
|
788 | + $wp->query_vars['gd_city'] = ''; |
|
789 | + } |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | /** |
@@ -800,24 +800,24 @@ discard block |
||
800 | 800 | */ |
801 | 801 | function geodir_custom_post_status() |
802 | 802 | { |
803 | - // Virtual Page Status |
|
804 | - register_post_status('virtual', array( |
|
805 | - 'label' => _x('Virtual', 'page', 'geodirectory'), |
|
806 | - 'public' => true, |
|
807 | - 'exclude_from_search' => true, |
|
808 | - 'show_in_admin_all_list' => true, |
|
809 | - 'show_in_admin_status_list' => true, |
|
810 | - 'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'), |
|
811 | - )); |
|
812 | - |
|
813 | - /** |
|
814 | - * Called after we register the custom post status 'Virtual'. |
|
815 | - * |
|
816 | - * Can be use to add more post statuses. |
|
817 | - * |
|
818 | - * @since 1.0.0 |
|
819 | - */ |
|
820 | - do_action('geodir_custom_post_status'); |
|
803 | + // Virtual Page Status |
|
804 | + register_post_status('virtual', array( |
|
805 | + 'label' => _x('Virtual', 'page', 'geodirectory'), |
|
806 | + 'public' => true, |
|
807 | + 'exclude_from_search' => true, |
|
808 | + 'show_in_admin_all_list' => true, |
|
809 | + 'show_in_admin_status_list' => true, |
|
810 | + 'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'), |
|
811 | + )); |
|
812 | + |
|
813 | + /** |
|
814 | + * Called after we register the custom post status 'Virtual'. |
|
815 | + * |
|
816 | + * Can be use to add more post statuses. |
|
817 | + * |
|
818 | + * @since 1.0.0 |
|
819 | + */ |
|
820 | + do_action('geodir_custom_post_status'); |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | /** |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | */ |
833 | 833 | function geodir_get_term_link($termlink, $term, $taxonomy) |
834 | 834 | { |
835 | - return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php |
|
835 | + return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | /** |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | */ |
847 | 847 | function geodir_get_posttype_link($link, $post_type) |
848 | 848 | { |
849 | - return geodir_posttype_link($link, $post_type); // taxonomy_functions.php |
|
849 | + return geodir_posttype_link($link, $post_type); // taxonomy_functions.php |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | /** |
@@ -861,13 +861,13 @@ discard block |
||
861 | 861 | */ |
862 | 862 | function exclude_from_wp_list_pages($exclude_array) |
863 | 863 | { |
864 | - $pages_ids = array(); |
|
865 | - $pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual')); |
|
866 | - foreach ($pages_array as $page) { |
|
867 | - $pages_ids[] = $page->ID; |
|
868 | - } |
|
869 | - $exclude_array = $exclude_array + $pages_ids; |
|
870 | - return $exclude_array; |
|
864 | + $pages_ids = array(); |
|
865 | + $pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual')); |
|
866 | + foreach ($pages_array as $page) { |
|
867 | + $pages_ids[] = $page->ID; |
|
868 | + } |
|
869 | + $exclude_array = $exclude_array + $pages_ids; |
|
870 | + return $exclude_array; |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | /** |
@@ -880,8 +880,8 @@ discard block |
||
880 | 880 | */ |
881 | 881 | function geodir_exclude_page($query) |
882 | 882 | { |
883 | - add_filter('posts_where', 'geodir_exclude_page_where', 100); |
|
884 | - return $query; |
|
883 | + add_filter('posts_where', 'geodir_exclude_page_where', 100); |
|
884 | + return $query; |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | /** |
@@ -896,11 +896,11 @@ discard block |
||
896 | 896 | */ |
897 | 897 | function geodir_exclude_page_where($where) |
898 | 898 | { |
899 | - global $wpdb; |
|
900 | - if (is_admin()) |
|
901 | - $where .= " AND $wpdb->posts.post_status != 'virtual'"; |
|
899 | + global $wpdb; |
|
900 | + if (is_admin()) |
|
901 | + $where .= " AND $wpdb->posts.post_status != 'virtual'"; |
|
902 | 902 | |
903 | - return $where; |
|
903 | + return $where; |
|
904 | 904 | } |
905 | 905 | |
906 | 906 | /** |
@@ -915,20 +915,20 @@ discard block |
||
915 | 915 | * @return mixed The taxonomy option value. |
916 | 916 | */ |
917 | 917 | function geodir_wpseo_taxonomy_meta( $value, $option = '' ) { |
918 | - global $wp_query; |
|
918 | + global $wp_query; |
|
919 | 919 | |
920 | - if ( !empty( $value ) && ( is_category() || is_tax() ) ) { |
|
921 | - $term = $wp_query->get_queried_object(); |
|
920 | + if ( !empty( $value ) && ( is_category() || is_tax() ) ) { |
|
921 | + $term = $wp_query->get_queried_object(); |
|
922 | 922 | |
923 | - if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) { |
|
924 | - $image = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) ); |
|
923 | + if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) { |
|
924 | + $image = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) ); |
|
925 | 925 | |
926 | - if ( !empty( $image['src'] ) ) { |
|
927 | - $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src']; |
|
928 | - $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src']; |
|
929 | - } |
|
930 | - } |
|
931 | - } |
|
932 | - return $value; |
|
926 | + if ( !empty( $image['src'] ) ) { |
|
927 | + $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src']; |
|
928 | + $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src']; |
|
929 | + } |
|
930 | + } |
|
931 | + } |
|
932 | + return $value; |
|
933 | 933 | } |
934 | 934 | add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 ); |
@@ -52,31 +52,31 @@ discard block |
||
52 | 52 | jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600); |
53 | 53 | } |
54 | 54 | |
55 | - jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) { |
|
55 | + jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) { |
|
56 | 56 | //alert(data ); |
57 | 57 | }); |
58 | 58 | } |
59 | 59 | </script> |
60 | 60 | <div class="geodir-list-view-select"> |
61 | 61 | <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);"> |
62 | - <?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?> |
|
63 | - <option value=""><?php _e( 'View:', 'geodirectory' ); ?></option> |
|
62 | + <?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?> |
|
63 | + <option value=""><?php _e('View:', 'geodirectory'); ?></option> |
|
64 | 64 | <option |
65 | - value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option> |
|
65 | + value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option> |
|
66 | 66 | <option |
67 | - value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option> |
|
67 | + value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option> |
|
68 | 68 | <option |
69 | - value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option> |
|
69 | + value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option> |
|
70 | 70 | <option |
71 | - value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option> |
|
71 | + value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option> |
|
72 | 72 | <option |
73 | - value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option> |
|
73 | + value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option> |
|
74 | 74 | </select> |
75 | 75 | </div> |
76 | 76 | <?php |
77 | 77 | } |
78 | 78 | |
79 | -add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 ); |
|
79 | +add_action('geodir_before_listing', 'geodir_list_view_select', 100); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Limit the listing excerpt. |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | * @global object $post The current post object. |
92 | 92 | * @return string The modified excerpt. |
93 | 93 | */ |
94 | -function geodir_max_excerpt( $charlength ) { |
|
94 | +function geodir_max_excerpt($charlength) { |
|
95 | 95 | global $post; |
96 | - if ( $charlength == '0' ) { |
|
96 | + if ($charlength == '0') { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | $out = ''; |
@@ -101,46 +101,46 @@ discard block |
||
101 | 101 | $temp_post = $post; |
102 | 102 | $excerpt = get_the_excerpt(); |
103 | 103 | |
104 | - $charlength ++; |
|
105 | - $excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' ); |
|
106 | - if ( mb_strlen( $excerpt ) > $charlength ) { |
|
107 | - if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) { |
|
108 | - $excut = - ( mb_strlen( $excerpt_more ) ); |
|
109 | - $subex = mb_substr( $excerpt, 0, $excut ); |
|
110 | - if ( $charlength > 0 && mb_strlen( $subex ) > $charlength ) { |
|
111 | - $subex = mb_substr( $subex, 0, $charlength ); |
|
104 | + $charlength++; |
|
105 | + $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more(''); |
|
106 | + if (mb_strlen($excerpt) > $charlength) { |
|
107 | + if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) { |
|
108 | + $excut = - (mb_strlen($excerpt_more)); |
|
109 | + $subex = mb_substr($excerpt, 0, $excut); |
|
110 | + if ($charlength > 0 && mb_strlen($subex) > $charlength) { |
|
111 | + $subex = mb_substr($subex, 0, $charlength); |
|
112 | 112 | } |
113 | 113 | $out .= $subex; |
114 | 114 | } else { |
115 | - $subex = mb_substr( $excerpt, 0, $charlength - 5 ); |
|
116 | - $exwords = explode( ' ', $subex ); |
|
117 | - $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); |
|
118 | - if ( $excut < 0 ) { |
|
119 | - $out .= mb_substr( $subex, 0, $excut ); |
|
115 | + $subex = mb_substr($excerpt, 0, $charlength - 5); |
|
116 | + $exwords = explode(' ', $subex); |
|
117 | + $excut = - (mb_strlen($exwords[count($exwords) - 1])); |
|
118 | + if ($excut < 0) { |
|
119 | + $out .= mb_substr($subex, 0, $excut); |
|
120 | 120 | } else { |
121 | 121 | $out .= $subex; |
122 | 122 | } |
123 | 123 | } |
124 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
124 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
125 | 125 | /** |
126 | 126 | * Filter excerpt read more text. |
127 | 127 | * |
128 | 128 | * @since 1.0.0 |
129 | 129 | */ |
130 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
130 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory')); |
|
131 | 131 | $out .= '</a>'; |
132 | 132 | |
133 | 133 | } else { |
134 | - if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) { |
|
135 | - $excut = - ( mb_strlen( $excerpt_more ) ); |
|
136 | - $out .= mb_substr( $excerpt, 0, $excut ); |
|
137 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
134 | + if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) { |
|
135 | + $excut = - (mb_strlen($excerpt_more)); |
|
136 | + $out .= mb_substr($excerpt, 0, $excut); |
|
137 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
138 | 138 | /** |
139 | 139 | * Filter excerpt read more text. |
140 | 140 | * |
141 | 141 | * @since 1.0.0 |
142 | 142 | */ |
143 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
143 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory')); |
|
144 | 144 | $out .= '</a>'; |
145 | 145 | } else { |
146 | 146 | $out .= $excerpt; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return object Returns filtered package info as an object. |
165 | 165 | */ |
166 | -function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) { |
|
166 | +function geodir_post_package_info($package_info, $post = '', $post_type = '') { |
|
167 | 167 | $package_info['pid'] = 0; |
168 | 168 | $package_info['days'] = 0; |
169 | 169 | $package_info['amount'] = 0; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param object|string $post The post object. |
193 | 193 | * @param string $post_type The post type. |
194 | 194 | */ |
195 | - return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type ); |
|
195 | + return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | * |
221 | 221 | * } |
222 | 222 | */ |
223 | -function geodir_send_inquiry( $request ) { |
|
223 | +function geodir_send_inquiry($request) { |
|
224 | 224 | global $wpdb; |
225 | 225 | |
226 | 226 | // strip slashes from text |
227 | - $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; |
|
227 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
228 | 228 | |
229 | 229 | $yourname = $request['inq_name']; |
230 | 230 | $youremail = $request['inq_email']; |
@@ -235,26 +235,26 @@ discard block |
||
235 | 235 | $author_id = ''; |
236 | 236 | $post_title = ''; |
237 | 237 | |
238 | - if ( $request['pid'] ) { |
|
238 | + if ($request['pid']) { |
|
239 | 239 | |
240 | 240 | $productinfosql = $wpdb->prepare( |
241 | 241 | "select ID,post_author,post_title from $wpdb->posts where ID =%d", |
242 | - array( $request['pid'] ) |
|
242 | + array($request['pid']) |
|
243 | 243 | ); |
244 | - $productinfo = $wpdb->get_row( $productinfosql ); |
|
244 | + $productinfo = $wpdb->get_row($productinfosql); |
|
245 | 245 | |
246 | 246 | $author_id = $productinfo->post_author; |
247 | 247 | $post_title = $productinfo->post_title; |
248 | 248 | } |
249 | 249 | |
250 | - $post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>'; |
|
250 | + $post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>'; |
|
251 | 251 | |
252 | - $user_info = get_userdata( $author_id ); |
|
253 | - $to_email = geodir_get_post_meta( $pid, 'geodir_email', true ); |
|
254 | - $to_name = geodir_get_client_name( $author_id ); |
|
252 | + $user_info = get_userdata($author_id); |
|
253 | + $to_email = geodir_get_post_meta($pid, 'geodir_email', true); |
|
254 | + $to_name = geodir_get_client_name($author_id); |
|
255 | 255 | |
256 | - if ( $to_email == '' ) { |
|
257 | - $to_email = get_option( 'admin_email' ); |
|
256 | + if ($to_email == '') { |
|
257 | + $to_email = get_option('admin_email'); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | * } |
276 | 276 | * @param string $type The form type, default: `Enquiry`. |
277 | 277 | */ |
278 | - do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' ); |
|
278 | + do_action('geodir_after_send_enquiry', $request, 'Enquiry'); |
|
279 | 279 | |
280 | 280 | $client_message = $frnd_comments; |
281 | - $client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.'; |
|
281 | + $client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.'; |
|
282 | 282 | /** |
283 | 283 | * Filter client message text. |
284 | 284 | * |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @param string $client_message Client message text. |
288 | 288 | */ |
289 | - $client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message ); |
|
289 | + $client_message = apply_filters('geodir_inquiry_email_msg', $client_message); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Called before the send enquiry email is sent. |
@@ -305,12 +305,12 @@ discard block |
||
305 | 305 | * |
306 | 306 | * } |
307 | 307 | */ |
308 | - do_action( 'geodir_before_send_enquiry_email', $request ); |
|
309 | - if ( $to_email ) { |
|
308 | + do_action('geodir_before_send_enquiry_email', $request); |
|
309 | + if ($to_email) { |
|
310 | 310 | // strip slashes message |
311 | - $client_message = stripslashes_deep( $client_message ); |
|
311 | + $client_message = stripslashes_deep($client_message); |
|
312 | 312 | |
313 | - geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email |
|
313 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | * |
331 | 331 | * } |
332 | 332 | */ |
333 | - do_action( 'geodir_after_send_enquiry_email', $request ); |
|
334 | - $url = get_permalink( $pid ); |
|
335 | - if ( strstr( $url, '?' ) ) { |
|
336 | - $url = $url . "&send_inquiry=success"; |
|
333 | + do_action('geodir_after_send_enquiry_email', $request); |
|
334 | + $url = get_permalink($pid); |
|
335 | + if (strstr($url, '?')) { |
|
336 | + $url = $url."&send_inquiry=success"; |
|
337 | 337 | } else { |
338 | - $url = $url . "?send_inquiry=success"; |
|
338 | + $url = $url."?send_inquiry=success"; |
|
339 | 339 | } |
340 | 340 | /** |
341 | 341 | * Filter redirect url after the send enquiry email is sent. |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @param string $url Redirect url. |
346 | 346 | */ |
347 | - $url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url ); |
|
348 | - wp_redirect( $url ); |
|
347 | + $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url); |
|
348 | + wp_redirect($url); |
|
349 | 349 | gd_die(); |
350 | 350 | |
351 | 351 | } |
@@ -374,11 +374,11 @@ discard block |
||
374 | 374 | * } |
375 | 375 | * @global object $wpdb WordPress Database object. |
376 | 376 | */ |
377 | -function geodir_send_friend( $request ) { |
|
377 | +function geodir_send_friend($request) { |
|
378 | 378 | global $wpdb; |
379 | 379 | |
380 | 380 | // strip slashes from text |
381 | - $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; |
|
381 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
382 | 382 | |
383 | 383 | $yourname = $request['yourname']; |
384 | 384 | $youremail = $request['youremail']; |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | $pid = $request['pid']; |
388 | 388 | $to_email = $request['to_email']; |
389 | 389 | $to_name = $request['to_name']; |
390 | - if ( $request['pid'] ) { |
|
390 | + if ($request['pid']) { |
|
391 | 391 | $productinfosql = $wpdb->prepare( |
392 | 392 | "select ID,post_title from $wpdb->posts where ID =%d", |
393 | - array( $request['pid'] ) |
|
393 | + array($request['pid']) |
|
394 | 394 | ); |
395 | - $productinfo = $wpdb->get_results( $productinfosql ); |
|
396 | - foreach ( $productinfo as $productinfoObj ) { |
|
395 | + $productinfo = $wpdb->get_results($productinfosql); |
|
396 | + foreach ($productinfo as $productinfoObj) { |
|
397 | 397 | $post_title = $productinfoObj->post_title; |
398 | 398 | } |
399 | 399 | } |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | * |
418 | 418 | * } |
419 | 419 | */ |
420 | - do_action( 'geodir_before_send_to_friend_email', $request ); |
|
421 | - geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email |
|
420 | + do_action('geodir_before_send_to_friend_email', $request); |
|
421 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email |
|
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Called after the send to friend email is sent. |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | * |
440 | 440 | * } |
441 | 441 | */ |
442 | - do_action( 'geodir_after_send_to_friend_email', $request ); |
|
442 | + do_action('geodir_after_send_to_friend_email', $request); |
|
443 | 443 | |
444 | - $url = get_permalink( $pid ); |
|
445 | - if ( strstr( $url, '?' ) ) { |
|
446 | - $url = $url . "&sendtofrnd=success"; |
|
444 | + $url = get_permalink($pid); |
|
445 | + if (strstr($url, '?')) { |
|
446 | + $url = $url."&sendtofrnd=success"; |
|
447 | 447 | } else { |
448 | - $url = $url . "?sendtofrnd=success"; |
|
448 | + $url = $url."?sendtofrnd=success"; |
|
449 | 449 | } |
450 | 450 | /** |
451 | 451 | * Filter redirect url after the send to friend email is sent. |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @param string $url Redirect url. |
456 | 456 | */ |
457 | - $url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url ); |
|
458 | - wp_redirect( $url ); |
|
457 | + $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url); |
|
458 | + wp_redirect($url); |
|
459 | 459 | gd_die(); |
460 | 460 | } |
461 | 461 | |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | * |
470 | 470 | * @param string $hash_key |
471 | 471 | */ |
472 | -function geodir_before_tab_content( $hash_key ) { |
|
473 | - switch ( $hash_key ) { |
|
472 | +function geodir_before_tab_content($hash_key) { |
|
473 | + switch ($hash_key) { |
|
474 | 474 | case 'post_info' : |
475 | 475 | echo '<div class="geodir-company_info field-group">'; |
476 | 476 | break; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @since 1.0.0 |
482 | 482 | */ |
483 | - echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >'; |
|
483 | + echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >'; |
|
484 | 484 | break; |
485 | 485 | case 'reviews' : |
486 | 486 | echo '<div id="reviews-wrap" class="clearfix"> '; |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | * |
505 | 505 | * @param string $hash_key |
506 | 506 | */ |
507 | -function geodir_after_tab_content( $hash_key ) { |
|
508 | - switch ( $hash_key ) { |
|
507 | +function geodir_after_tab_content($hash_key) { |
|
508 | + switch ($hash_key) { |
|
509 | 509 | case 'post_info' : |
510 | 510 | echo '</div>'; |
511 | 511 | break; |
@@ -536,25 +536,25 @@ discard block |
||
536 | 536 | * @global object $wpdb WordPress Database object. |
537 | 537 | * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false. |
538 | 538 | */ |
539 | -function geodir_get_posts_default_sort( $post_type ) { |
|
539 | +function geodir_get_posts_default_sort($post_type) { |
|
540 | 540 | |
541 | 541 | global $wpdb; |
542 | 542 | |
543 | - if ( $post_type != '' ) { |
|
543 | + if ($post_type != '') { |
|
544 | 544 | |
545 | 545 | $all_postypes = geodir_get_posttypes(); |
546 | 546 | |
547 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
547 | + if (!in_array($post_type, $all_postypes)) { |
|
548 | 548 | return false; |
549 | 549 | } |
550 | 550 | |
551 | - $sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type= %s and is_active=%d and is_default=%d", array( |
|
551 | + $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type= %s and is_active=%d and is_default=%d", array( |
|
552 | 552 | $post_type, |
553 | 553 | 1, |
554 | 554 | 1 |
555 | - ) ) ); |
|
555 | + ))); |
|
556 | 556 | |
557 | - if ( ! empty( $sort_field_info ) ) { |
|
557 | + if (!empty($sort_field_info)) { |
|
558 | 558 | return $sort_field_info; |
559 | 559 | } |
560 | 560 | |
@@ -574,20 +574,20 @@ discard block |
||
574 | 574 | * @global object $wpdb WordPress Database object. |
575 | 575 | * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false. |
576 | 576 | */ |
577 | -function geodir_get_sort_options( $post_type ) { |
|
577 | +function geodir_get_sort_options($post_type) { |
|
578 | 578 | global $wpdb; |
579 | 579 | |
580 | - if ( $post_type != '' ) { |
|
580 | + if ($post_type != '') { |
|
581 | 581 | $all_postypes = geodir_get_posttypes(); |
582 | 582 | |
583 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
583 | + if (!in_array($post_type, $all_postypes)) { |
|
584 | 584 | return false; |
585 | 585 | } |
586 | 586 | |
587 | - $sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array( |
|
587 | + $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array( |
|
588 | 588 | $post_type, |
589 | 589 | 1 |
590 | - ) ) ); |
|
590 | + ))); |
|
591 | 591 | |
592 | 592 | /** |
593 | 593 | * Filter post sort options. |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @param array $sort_field_info Unfiltered sort field array. |
598 | 598 | * @param string $post_type Post type. |
599 | 599 | */ |
600 | - return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type ); |
|
600 | + return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | } |
@@ -618,63 +618,63 @@ discard block |
||
618 | 618 | * |
619 | 619 | * @since 1.4.4 |
620 | 620 | */ |
621 | - if ( is_search() ) { |
|
621 | + if (is_search()) { |
|
622 | 622 | return; |
623 | 623 | } |
624 | 624 | |
625 | 625 | $sort_by = ''; |
626 | 626 | |
627 | - if ( isset( $_REQUEST['sort_by'] ) ) { |
|
627 | + if (isset($_REQUEST['sort_by'])) { |
|
628 | 628 | $sort_by = $_REQUEST['sort_by']; |
629 | 629 | } |
630 | 630 | |
631 | 631 | $gd_post_type = geodir_get_current_posttype(); |
632 | 632 | |
633 | - $sort_options = geodir_get_sort_options( $gd_post_type ); |
|
633 | + $sort_options = geodir_get_sort_options($gd_post_type); |
|
634 | 634 | |
635 | 635 | |
636 | 636 | $sort_field_options = ''; |
637 | 637 | |
638 | - if ( ! empty( $sort_options ) ) { |
|
639 | - foreach ( $sort_options as $sort ) { |
|
640 | - $sort = stripslashes_deep( $sort ); // strip slashes |
|
638 | + if (!empty($sort_options)) { |
|
639 | + foreach ($sort_options as $sort) { |
|
640 | + $sort = stripslashes_deep($sort); // strip slashes |
|
641 | 641 | |
642 | - $label = __( $sort->site_title, 'geodirectory' ); |
|
642 | + $label = __($sort->site_title, 'geodirectory'); |
|
643 | 643 | |
644 | - if ( $sort->field_type == 'random' ) { |
|
644 | + if ($sort->field_type == 'random') { |
|
645 | 645 | $key = $sort->field_type; |
646 | - ( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
647 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
646 | + ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
647 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
648 | 648 | } |
649 | 649 | |
650 | - if ( $sort->htmlvar_name == 'comment_count' ) { |
|
650 | + if ($sort->htmlvar_name == 'comment_count') { |
|
651 | 651 | $sort->htmlvar_name = 'rating_count'; |
652 | 652 | } |
653 | 653 | |
654 | - if ( $sort->sort_asc ) { |
|
655 | - $key = $sort->htmlvar_name . '_asc'; |
|
654 | + if ($sort->sort_asc) { |
|
655 | + $key = $sort->htmlvar_name.'_asc'; |
|
656 | 656 | $label = $sort->site_title; |
657 | - if ( $sort->asc_title ) { |
|
657 | + if ($sort->asc_title) { |
|
658 | 658 | $label = $sort->asc_title; |
659 | 659 | } |
660 | - ( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
661 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
660 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
661 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
662 | 662 | } |
663 | 663 | |
664 | - if ( $sort->sort_desc ) { |
|
665 | - $key = $sort->htmlvar_name . '_desc'; |
|
664 | + if ($sort->sort_desc) { |
|
665 | + $key = $sort->htmlvar_name.'_desc'; |
|
666 | 666 | $label = $sort->site_title; |
667 | - if ( $sort->desc_title ) { |
|
667 | + if ($sort->desc_title) { |
|
668 | 668 | $label = $sort->desc_title; |
669 | 669 | } |
670 | - ( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
671 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
670 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
671 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>'; |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | } |
675 | 675 | } |
676 | 676 | |
677 | - if ( $sort_field_options != '' ) { |
|
677 | + if ($sort_field_options != '') { |
|
678 | 678 | |
679 | 679 | ?> |
680 | 680 | |
@@ -683,9 +683,9 @@ discard block |
||
683 | 683 | <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;"> |
684 | 684 | |
685 | 685 | <option |
686 | - value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) { |
|
686 | + value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') { |
|
687 | 687 | echo 'selected="selected"'; |
688 | - } ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php |
|
688 | + } ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php |
|
689 | 689 | |
690 | 690 | echo $sort_field_options; ?> |
691 | 691 | |
@@ -713,9 +713,9 @@ discard block |
||
713 | 713 | * |
714 | 714 | * @return string Returns the section title. |
715 | 715 | */ |
716 | -function geodir_advance_customfields_heading( $title, $field_type ) { |
|
716 | +function geodir_advance_customfields_heading($title, $field_type) { |
|
717 | 717 | |
718 | - if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) { |
|
718 | + if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) { |
|
719 | 719 | $title = ''; |
720 | 720 | } |
721 | 721 | |
@@ -737,19 +737,19 @@ discard block |
||
737 | 737 | * @global object $gd_session GeoDirectory Session object. |
738 | 738 | * @return string Returns related posts html. |
739 | 739 | */ |
740 | -function geodir_related_posts_display( $request ) { |
|
741 | - if ( ! empty( $request ) ) { |
|
742 | - $before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : ''; |
|
743 | - $after_title = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : ''; |
|
744 | - |
|
745 | - $title = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' ); |
|
746 | - $post_number = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5'; |
|
747 | - $relate_to = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category'; |
|
748 | - $layout = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf'; |
|
749 | - $add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0'; |
|
750 | - $listing_width = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : ''; |
|
751 | - $list_sort = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest'; |
|
752 | - $character_count = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : ''; |
|
740 | +function geodir_related_posts_display($request) { |
|
741 | + if (!empty($request)) { |
|
742 | + $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : ''; |
|
743 | + $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : ''; |
|
744 | + |
|
745 | + $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory'); |
|
746 | + $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5'; |
|
747 | + $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category'; |
|
748 | + $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf'; |
|
749 | + $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0'; |
|
750 | + $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : ''; |
|
751 | + $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest'; |
|
752 | + $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : ''; |
|
753 | 753 | |
754 | 754 | global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon; |
755 | 755 | $related_parent_lat = $post->post_latitude; |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | $arr_detail_page_tabs = geodir_detail_page_tabs_list(); |
758 | 758 | |
759 | 759 | $related_listing_array = array(); |
760 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) { |
|
761 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
760 | + if (get_option('geodir_add_related_listing_posttypes')) { |
|
761 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes'); |
|
762 | 762 | } |
763 | - if ( in_array( $post->post_type, $related_listing_array ) ) { |
|
763 | + if (in_array($post->post_type, $related_listing_array)) { |
|
764 | 764 | $arr_detail_page_tabs['related_listing']['is_display'] = true; |
765 | 765 | } |
766 | 766 | |
@@ -772,90 +772,90 @@ discard block |
||
772 | 772 | $tax_field = 'id'; |
773 | 773 | $category = array(); |
774 | 774 | |
775 | - if ( isset( $_REQUEST['backandedit'] ) ) { |
|
776 | - $post = (object) $gd_session->get( 'listing' ); |
|
775 | + if (isset($_REQUEST['backandedit'])) { |
|
776 | + $post = (object) $gd_session->get('listing'); |
|
777 | 777 | $post_type = $post->listing_type; |
778 | - if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) { |
|
778 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
779 | 779 | $post_id = $_REQUEST['pid']; |
780 | 780 | } |
781 | - } elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) { |
|
782 | - $post = geodir_get_post_info( $_REQUEST['pid'] ); |
|
781 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
782 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
783 | 783 | $post_type = $post->post_type; |
784 | 784 | $post_id = $_REQUEST['pid']; |
785 | - } elseif ( isset( $post->post_type ) && $post->post_type != '' ) { |
|
785 | + } elseif (isset($post->post_type) && $post->post_type != '') { |
|
786 | 786 | $post_type = $post->post_type; |
787 | 787 | $post_id = $post->ID; |
788 | 788 | } |
789 | 789 | |
790 | - if ( $relate_to == 'category' ) { |
|
790 | + if ($relate_to == 'category') { |
|
791 | 791 | |
792 | - $category_taxonomy = $post_type . $relate_to; |
|
793 | - if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) { |
|
794 | - $category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) ); |
|
792 | + $category_taxonomy = $post_type.$relate_to; |
|
793 | + if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') { |
|
794 | + $category = explode(',', trim($post->{$category_taxonomy}, ',')); |
|
795 | 795 | } |
796 | 796 | |
797 | - } elseif ( $relate_to == 'tags' ) { |
|
797 | + } elseif ($relate_to == 'tags') { |
|
798 | 798 | |
799 | - $category_taxonomy = $post_type . '_' . $relate_to; |
|
800 | - if ( $post->post_tags != '' ) { |
|
801 | - $category = explode( ',', trim( $post->post_tags, ',' ) ); |
|
799 | + $category_taxonomy = $post_type.'_'.$relate_to; |
|
800 | + if ($post->post_tags != '') { |
|
801 | + $category = explode(',', trim($post->post_tags, ',')); |
|
802 | 802 | } |
803 | 803 | $tax_field = 'name'; |
804 | 804 | } |
805 | 805 | |
806 | 806 | /* --- return false in invalid request --- */ |
807 | - if ( empty( $category ) ) { |
|
807 | + if (empty($category)) { |
|
808 | 808 | return false; |
809 | 809 | } |
810 | 810 | |
811 | 811 | $all_postypes = geodir_get_posttypes(); |
812 | 812 | |
813 | - if ( ! in_array( $post_type, $all_postypes ) ) { |
|
813 | + if (!in_array($post_type, $all_postypes)) { |
|
814 | 814 | return false; |
815 | 815 | } |
816 | 816 | |
817 | 817 | /* --- return false in invalid request --- */ |
818 | 818 | |
819 | 819 | $location_url = ''; |
820 | - if ( $add_location_filter != '0' ) { |
|
820 | + if ($add_location_filter != '0') { |
|
821 | 821 | $location_url = array(); |
822 | - $geodir_show_location_url = get_option( 'geodir_show_location_url' ); |
|
822 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
823 | 823 | |
824 | - $gd_city = get_query_var( 'gd_city' ); |
|
824 | + $gd_city = get_query_var('gd_city'); |
|
825 | 825 | |
826 | - if ( $gd_city ) { |
|
827 | - $gd_country = get_query_var( 'gd_country' ); |
|
828 | - $gd_region = get_query_var( 'gd_region' ); |
|
826 | + if ($gd_city) { |
|
827 | + $gd_country = get_query_var('gd_country'); |
|
828 | + $gd_region = get_query_var('gd_region'); |
|
829 | 829 | } else { |
830 | 830 | $location = geodir_get_default_location(); |
831 | 831 | |
832 | - $gd_country = isset( $location->country_slug ) ? $location->country_slug : ''; |
|
833 | - $gd_region = isset( $location->region_slug ) ? $location->region_slug : ''; |
|
834 | - $gd_city = isset( $location->city_slug ) ? $location->city_slug : ''; |
|
832 | + $gd_country = isset($location->country_slug) ? $location->country_slug : ''; |
|
833 | + $gd_region = isset($location->region_slug) ? $location->region_slug : ''; |
|
834 | + $gd_city = isset($location->city_slug) ? $location->city_slug : ''; |
|
835 | 835 | } |
836 | 836 | |
837 | - if ( $geodir_show_location_url == 'all' ) { |
|
837 | + if ($geodir_show_location_url == 'all') { |
|
838 | 838 | $location_url[] = $gd_country; |
839 | 839 | $location_url[] = $gd_region; |
840 | - } else if ( $geodir_show_location_url == 'country_city' ) { |
|
840 | + } else if ($geodir_show_location_url == 'country_city') { |
|
841 | 841 | $location_url[] = $gd_country; |
842 | - } else if ( $geodir_show_location_url == 'region_city' ) { |
|
842 | + } else if ($geodir_show_location_url == 'region_city') { |
|
843 | 843 | $location_url[] = $gd_region; |
844 | 844 | } |
845 | 845 | |
846 | 846 | $location_url[] = $gd_city; |
847 | 847 | |
848 | - $location_url = implode( '/', $location_url ); |
|
848 | + $location_url = implode('/', $location_url); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | |
852 | - if ( ! empty( $category ) ) { |
|
852 | + if (!empty($category)) { |
|
853 | 853 | global $geodir_add_location_url; |
854 | 854 | $geodir_add_location_url = '0'; |
855 | - if ( $add_location_filter != '0' ) { |
|
855 | + if ($add_location_filter != '0') { |
|
856 | 856 | $geodir_add_location_url = '1'; |
857 | 857 | } |
858 | - $viewall_url = get_term_link( (int) $category[0], $post_type . $category_taxonomy ); |
|
858 | + $viewall_url = get_term_link((int) $category[0], $post_type.$category_taxonomy); |
|
859 | 859 | $geodir_add_location_url = null; |
860 | 860 | } |
861 | 861 | ob_start(); |
@@ -865,24 +865,24 @@ discard block |
||
865 | 865 | <div class="geodir_locations geodir_location_listing"> |
866 | 866 | |
867 | 867 | <?php |
868 | - if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) { |
|
868 | + if (isset($request['is_widget']) && $request['is_widget'] == '1') { |
|
869 | 869 | /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
870 | - $before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' ); |
|
870 | + $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
871 | 871 | /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
872 | - $after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' ); |
|
872 | + $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>'); |
|
873 | 873 | ?> |
874 | 874 | <div class="location_list_heading clearfix"> |
875 | - <?php echo $before_title . $title . $after_title; ?> |
|
875 | + <?php echo $before_title.$title.$after_title; ?> |
|
876 | 876 | </div> |
877 | 877 | <?php |
878 | 878 | } |
879 | 879 | $query_args = array( |
880 | 880 | 'posts_per_page' => $post_number, |
881 | 881 | 'is_geodir_loop' => true, |
882 | - 'gd_location' => ( $add_location_filter ) ? true : false, |
|
882 | + 'gd_location' => ($add_location_filter) ? true : false, |
|
883 | 883 | 'post_type' => $post_type, |
884 | 884 | 'order_by' => $list_sort, |
885 | - 'post__not_in' => array( $post_id ), |
|
885 | + 'post__not_in' => array($post_id), |
|
886 | 886 | 'excerpt_length' => $character_count, |
887 | 887 | 'related_listings' => $is_display |
888 | 888 | ); |
@@ -893,24 +893,24 @@ discard block |
||
893 | 893 | 'terms' => $category |
894 | 894 | ); |
895 | 895 | |
896 | - $query_args['tax_query'] = array( $tax_query ); |
|
896 | + $query_args['tax_query'] = array($tax_query); |
|
897 | 897 | |
898 | 898 | global $gridview_columns, $post; |
899 | 899 | |
900 | 900 | |
901 | - query_posts( $query_args ); |
|
901 | + query_posts($query_args); |
|
902 | 902 | |
903 | - if ( strstr( $layout, 'gridview' ) ) { |
|
904 | - $listing_view_exp = explode( '_', $layout ); |
|
903 | + if (strstr($layout, 'gridview')) { |
|
904 | + $listing_view_exp = explode('_', $layout); |
|
905 | 905 | $gridview_columns = $layout; |
906 | 906 | $layout = $listing_view_exp[0]; |
907 | - } else if ( $layout == 'list' ) { |
|
907 | + } else if ($layout == 'list') { |
|
908 | 908 | $gridview_columns = ''; |
909 | 909 | } |
910 | 910 | $related_posts = true; |
911 | 911 | |
912 | 912 | $related_nearest = false; |
913 | - if ( $list_sort == 'nearest' ) { |
|
913 | + if ($list_sort == 'nearest') { |
|
914 | 914 | $related_nearest = true; |
915 | 915 | } |
916 | 916 | |
@@ -920,14 +920,14 @@ discard block |
||
920 | 920 | * |
921 | 921 | * @since 1.0.0 |
922 | 922 | */ |
923 | - $template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) ); |
|
923 | + $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview')); |
|
924 | 924 | |
925 | 925 | /** |
926 | 926 | * Includes related listing listview template. |
927 | 927 | * |
928 | 928 | * @since 1.0.0 |
929 | 929 | */ |
930 | - include( $template ); |
|
930 | + include($template); |
|
931 | 931 | |
932 | 932 | wp_reset_query(); |
933 | 933 | $post = $origi_post; |
@@ -955,12 +955,12 @@ discard block |
||
955 | 955 | function geodir_category_count_script() { |
956 | 956 | global $geodir_post_category_str; |
957 | 957 | |
958 | - if ( ! empty( $geodir_post_category_str ) ) { |
|
959 | - $geodir_post_category_str = serialize( $geodir_post_category_str ); |
|
958 | + if (!empty($geodir_post_category_str)) { |
|
959 | + $geodir_post_category_str = serialize($geodir_post_category_str); |
|
960 | 960 | } |
961 | 961 | |
962 | - $all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' ); |
|
963 | - $script = "var post_category_array = " . json_encode( $all_var ) . ';'; |
|
962 | + $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
963 | + $script = "var post_category_array = ".json_encode($all_var).';'; |
|
964 | 964 | echo '<script>'; |
965 | 965 | echo $script; |
966 | 966 | echo '</script>'; |
@@ -975,8 +975,8 @@ discard block |
||
975 | 975 | * @return string Returns the default language. |
976 | 976 | */ |
977 | 977 | function geodir_get_map_default_language() { |
978 | - $geodir_default_map_language = get_option( 'geodir_default_map_language' ); |
|
979 | - if ( empty( $geodir_default_map_language ) ) { |
|
978 | + $geodir_default_map_language = get_option('geodir_default_map_language'); |
|
979 | + if (empty($geodir_default_map_language)) { |
|
980 | 980 | $geodir_default_map_language = 'en'; |
981 | 981 | } |
982 | 982 | |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | * |
988 | 988 | * @param string $geodir_default_map_language Default map language. |
989 | 989 | */ |
990 | - return apply_filters( 'geodir_default_map_language', $geodir_default_map_language ); |
|
990 | + return apply_filters('geodir_default_map_language', $geodir_default_map_language); |
|
991 | 991 | } |
992 | 992 | |
993 | 993 | /** |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | * @return string Returns the api key. |
999 | 999 | */ |
1000 | 1000 | function geodir_get_map_api_key() { |
1001 | - $key = get_option( 'geodir_google_api_key' ); |
|
1001 | + $key = get_option('geodir_google_api_key'); |
|
1002 | 1002 | |
1003 | 1003 | /** |
1004 | 1004 | * Filter Google maps api key. |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | * |
1008 | 1008 | * @param string $key Google maps api key. |
1009 | 1009 | */ |
1010 | - return apply_filters( 'geodir_google_api_key', $key ); |
|
1010 | + return apply_filters('geodir_google_api_key', $key); |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | |
@@ -1026,20 +1026,20 @@ discard block |
||
1026 | 1026 | global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
1027 | 1027 | |
1028 | 1028 | $is_geodir_page = geodir_is_geodir_page(); |
1029 | - if ( ! $is_geodir_page ) { |
|
1029 | + if (!$is_geodir_page) { |
|
1030 | 1030 | return; |
1031 | 1031 | }// if non GD page, bail |
1032 | 1032 | |
1033 | 1033 | $use_gd_meta = true; |
1034 | - if ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) { |
|
1034 | + if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) { |
|
1035 | 1035 | $use_gd_meta = false; |
1036 | 1036 | |
1037 | - if ( geodir_is_page( 'search' ) ) { |
|
1037 | + if (geodir_is_page('search')) { |
|
1038 | 1038 | $use_gd_meta = true; |
1039 | 1039 | } |
1040 | 1040 | } |
1041 | 1041 | |
1042 | - if ( ! $use_gd_meta ) { |
|
1042 | + if (!$use_gd_meta) { |
|
1043 | 1043 | return; |
1044 | 1044 | }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active. |
1045 | 1045 | |
@@ -1047,170 +1047,170 @@ discard block |
||
1047 | 1047 | |
1048 | 1048 | $all_postypes = geodir_get_posttypes(); |
1049 | 1049 | |
1050 | - $geodir_taxonomies = geodir_get_taxonomies( '', true ); |
|
1050 | + $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1051 | 1051 | |
1052 | 1052 | $meta_desc = ''; |
1053 | 1053 | $meta_key = ''; |
1054 | - if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) { |
|
1054 | + if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) { |
|
1055 | 1055 | /** |
1056 | 1056 | * Filter SEO meta location description. |
1057 | 1057 | * |
1058 | 1058 | * @since 1.0.0 |
1059 | 1059 | */ |
1060 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' ); |
|
1060 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', ''); |
|
1061 | 1061 | $meta_desc .= ''; |
1062 | 1062 | } |
1063 | - if ( have_posts() && is_single() OR is_page() ) { |
|
1064 | - while ( have_posts() ) { |
|
1063 | + if (have_posts() && is_single() OR is_page()) { |
|
1064 | + while (have_posts()) { |
|
1065 | 1065 | the_post(); |
1066 | 1066 | |
1067 | - if ( has_excerpt() ) { |
|
1068 | - $out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) ); |
|
1069 | - if ( empty( $out_excerpt ) ) { |
|
1070 | - $out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) ); |
|
1067 | + if (has_excerpt()) { |
|
1068 | + $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
1069 | + if (empty($out_excerpt)) { |
|
1070 | + $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
1071 | 1071 | } |
1072 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt ); |
|
1072 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt); |
|
1073 | 1073 | } else { |
1074 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content ); |
|
1075 | - $out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) ); |
|
1076 | - if ( empty( $out_excerpt ) ) { |
|
1077 | - $out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content |
|
1074 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content); |
|
1075 | + $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
1076 | + if (empty($out_excerpt)) { |
|
1077 | + $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
1078 | 1078 | } |
1079 | - $out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' ); |
|
1079 | + $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | $meta_desc .= $out_excerpt; |
1083 | 1083 | } |
1084 | - } elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) { |
|
1085 | - if ( is_category() ) { |
|
1086 | - $meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ); |
|
1087 | - } elseif ( is_tag() ) { |
|
1088 | - $meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ); |
|
1084 | + } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) { |
|
1085 | + if (is_category()) { |
|
1086 | + $meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false)); |
|
1087 | + } elseif (is_tag()) { |
|
1088 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false)); |
|
1089 | 1089 | } |
1090 | - } elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) { |
|
1091 | - $meta_desc .= isset( $current_term->description ) ? $current_term->description : ''; |
|
1090 | + } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) { |
|
1091 | + $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | |
1095 | 1095 | $geodir_post_type = geodir_get_current_posttype(); |
1096 | - $geodir_post_type_info = get_post_type_object( $geodir_post_type ); |
|
1097 | - $geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false; |
|
1098 | - |
|
1099 | - $category_taxonomy = geodir_get_taxonomies( $geodir_post_type ); |
|
1100 | - $tag_taxonomy = geodir_get_taxonomies( $geodir_post_type, true ); |
|
1101 | - |
|
1102 | - $geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false; |
|
1103 | - $geodir_is_tag = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false; |
|
1104 | - |
|
1105 | - $geodir_is_search = geodir_is_page( 'search' ) ? true : false; |
|
1106 | - $geodir_is_location = geodir_is_page( 'location' ) ? true : false; |
|
1107 | - $geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
1108 | - $godir_location_terms = geodir_get_current_location_terms( 'query_vars' ); |
|
1109 | - $gd_city = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null; |
|
1110 | - $gd_region = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null; |
|
1111 | - $gd_country = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null; |
|
1112 | - $replace_location = __( 'Everywhere', 'geodirectory' ); |
|
1096 | + $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
1097 | + $geodir_is_page_listing = geodir_is_page('listing') ? true : false; |
|
1098 | + |
|
1099 | + $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
1100 | + $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
1101 | + |
|
1102 | + $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
1103 | + $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
1104 | + |
|
1105 | + $geodir_is_search = geodir_is_page('search') ? true : false; |
|
1106 | + $geodir_is_location = geodir_is_page('location') ? true : false; |
|
1107 | + $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
1108 | + $godir_location_terms = geodir_get_current_location_terms('query_vars'); |
|
1109 | + $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null; |
|
1110 | + $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null; |
|
1111 | + $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null; |
|
1112 | + $replace_location = __('Everywhere', 'geodirectory'); |
|
1113 | 1113 | $location_id = null; |
1114 | - if ( $geodir_location_manager ) { |
|
1115 | - $sql = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) ); |
|
1116 | - $location_id = (int) $wpdb->get_var( $sql ); |
|
1114 | + if ($geodir_location_manager) { |
|
1115 | + $sql = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city)); |
|
1116 | + $location_id = (int) $wpdb->get_var($sql); |
|
1117 | 1117 | $location_type = geodir_what_is_current_location(); |
1118 | - if ( $location_type == 'city' ) { |
|
1119 | - $replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) ); |
|
1120 | - } elseif ( $location_type == 'region' ) { |
|
1121 | - $replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) ); |
|
1122 | - } elseif ( $location_type == 'country' ) { |
|
1123 | - $replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) ); |
|
1124 | - $replace_location = __( $replace_location, 'geodirectory' ); |
|
1118 | + if ($location_type == 'city') { |
|
1119 | + $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false)); |
|
1120 | + } elseif ($location_type == 'region') { |
|
1121 | + $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false)); |
|
1122 | + } elseif ($location_type == 'country') { |
|
1123 | + $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false)); |
|
1124 | + $replace_location = __($replace_location, 'geodirectory'); |
|
1125 | 1125 | } |
1126 | - $country = get_query_var( 'gd_country' ); |
|
1127 | - $region = get_query_var( 'gd_region' ); |
|
1128 | - $city = get_query_var( 'gd_city' ); |
|
1126 | + $country = get_query_var('gd_country'); |
|
1127 | + $region = get_query_var('gd_region'); |
|
1128 | + $city = get_query_var('gd_city'); |
|
1129 | 1129 | $current_location = ''; |
1130 | - if ( $country != '' ) { |
|
1131 | - $current_location = get_actual_location_name( 'country', $country, true ); |
|
1130 | + if ($country != '') { |
|
1131 | + $current_location = get_actual_location_name('country', $country, true); |
|
1132 | 1132 | } |
1133 | - if ( $region != '' ) { |
|
1134 | - $current_location = get_actual_location_name( 'region', $region ); |
|
1133 | + if ($region != '') { |
|
1134 | + $current_location = get_actual_location_name('region', $region); |
|
1135 | 1135 | } |
1136 | - if ( $city != '' ) { |
|
1137 | - $current_location = get_actual_location_name( 'city', $city ); |
|
1136 | + if ($city != '') { |
|
1137 | + $current_location = get_actual_location_name('city', $city); |
|
1138 | 1138 | } |
1139 | 1139 | $replace_location = $current_location != '' ? $current_location : $replace_location; |
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | $geodir_meta_keys = ''; |
1143 | 1143 | $geodir_meta_desc = ''; |
1144 | - if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) { |
|
1145 | - if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) { |
|
1146 | - $geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
1144 | + if ($is_geodir_page && !empty($geodir_post_type_info)) { |
|
1145 | + if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) { |
|
1146 | + $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
1147 | 1147 | |
1148 | - $geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
1149 | - $geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
1148 | + $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
1149 | + $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
1150 | 1150 | |
1151 | - if ( $geodir_is_category ) { |
|
1152 | - $category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null; |
|
1153 | - if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) { |
|
1151 | + if ($geodir_is_category) { |
|
1152 | + $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null; |
|
1153 | + if (isset($category->term_id) && !empty($category->term_id)) { |
|
1154 | 1154 | $category_id = $category->term_id; |
1155 | - $category_desc = trim( $category->description ) != '' ? trim( $category->description ) : get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type ); |
|
1156 | - if ( $location_id ) { |
|
1157 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
1158 | - $cat_loc_option = get_option( $option_name ); |
|
1159 | - |
|
1160 | - $gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
1161 | - if ( ! $gd_cat_loc_default ) { |
|
1162 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
1163 | - $option = get_option( $option_name ); |
|
1164 | - $category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc; |
|
1155 | + $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
1156 | + if ($location_id) { |
|
1157 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id; |
|
1158 | + $cat_loc_option = get_option($option_name); |
|
1159 | + |
|
1160 | + $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
1161 | + if (!$gd_cat_loc_default) { |
|
1162 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id; |
|
1163 | + $option = get_option($option_name); |
|
1164 | + $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
1165 | 1165 | } |
1166 | 1166 | } |
1167 | - $geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc; |
|
1167 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false)).'. '.$category_desc; |
|
1168 | 1168 | } |
1169 | - } else if ( $geodir_is_tag ) { |
|
1170 | - $geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc; |
|
1169 | + } else if ($geodir_is_tag) { |
|
1170 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc; |
|
1171 | 1171 | } |
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | 1176 | $gd_page = ''; |
1177 | - if ( geodir_is_page( 'home' ) ) { |
|
1177 | + if (geodir_is_page('home')) { |
|
1178 | 1178 | $gd_page = 'home'; |
1179 | - $meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc; |
|
1180 | - } elseif ( geodir_is_page( 'detail' ) ) { |
|
1179 | + $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc; |
|
1180 | + } elseif (geodir_is_page('detail')) { |
|
1181 | 1181 | $gd_page = 'detail'; |
1182 | - $meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc; |
|
1183 | - } elseif ( geodir_is_page( 'pt' ) ) { |
|
1182 | + $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc; |
|
1183 | + } elseif (geodir_is_page('pt')) { |
|
1184 | 1184 | $gd_page = 'pt'; |
1185 | - $meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc; |
|
1186 | - } elseif ( geodir_is_page( 'listing' ) ) { |
|
1185 | + $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc; |
|
1186 | + } elseif (geodir_is_page('listing')) { |
|
1187 | 1187 | $gd_page = 'listing'; |
1188 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc; |
|
1189 | - } elseif ( geodir_is_page( 'location' ) ) { |
|
1188 | + $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc; |
|
1189 | + } elseif (geodir_is_page('location')) { |
|
1190 | 1190 | $gd_page = 'location'; |
1191 | - $meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc; |
|
1192 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc ); |
|
1191 | + $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc; |
|
1192 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc); |
|
1193 | 1193 | |
1194 | - } elseif ( geodir_is_page( 'search' ) ) { |
|
1194 | + } elseif (geodir_is_page('search')) { |
|
1195 | 1195 | $gd_page = 'search'; |
1196 | - $meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc; |
|
1197 | - } elseif ( geodir_is_page( 'add-listing' ) ) { |
|
1196 | + $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc; |
|
1197 | + } elseif (geodir_is_page('add-listing')) { |
|
1198 | 1198 | $gd_page = 'add-listing'; |
1199 | - $meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc; |
|
1200 | - } elseif ( geodir_is_page( 'author' ) ) { |
|
1199 | + $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc; |
|
1200 | + } elseif (geodir_is_page('author')) { |
|
1201 | 1201 | $gd_page = 'author'; |
1202 | - $meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc; |
|
1203 | - } elseif ( geodir_is_page( 'login' ) ) { |
|
1202 | + $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc; |
|
1203 | + } elseif (geodir_is_page('login')) { |
|
1204 | 1204 | $gd_page = 'login'; |
1205 | - $meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc; |
|
1206 | - } elseif ( geodir_is_page( 'listing-success' ) ) { |
|
1205 | + $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc; |
|
1206 | + } elseif (geodir_is_page('listing-success')) { |
|
1207 | 1207 | $gd_page = 'listing-success'; |
1208 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc; |
|
1208 | + $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc; |
|
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | |
1212 | - if ( $meta_desc ) { |
|
1213 | - $meta_desc = stripslashes_deep( $meta_desc ); |
|
1212 | + if ($meta_desc) { |
|
1213 | + $meta_desc = stripslashes_deep($meta_desc); |
|
1214 | 1214 | /** |
1215 | 1215 | * Filter page description to replace variables. |
1216 | 1216 | * |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | * @param string $title The page description including variables. |
1220 | 1220 | * @param string $gd_page The GeoDirectory page type if any. |
1221 | 1221 | */ |
1222 | - $meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' ); |
|
1222 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, ''); |
|
1223 | 1223 | |
1224 | 1224 | /** |
1225 | 1225 | * Filter SEO meta description. |
@@ -1228,49 +1228,49 @@ discard block |
||
1228 | 1228 | * |
1229 | 1229 | * @param string $meta_desc Meta description content. |
1230 | 1230 | */ |
1231 | - echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc ); |
|
1231 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc); |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | // meta keywords |
1235 | - if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) { |
|
1236 | - $place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) ); |
|
1237 | - $place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) ); |
|
1235 | + if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) { |
|
1236 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names")); |
|
1237 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names")); |
|
1238 | 1238 | |
1239 | - $meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) ); |
|
1239 | + $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags)); |
|
1240 | 1240 | } else { |
1241 | 1241 | $posttags = get_the_tags(); |
1242 | - if ( $posttags ) { |
|
1243 | - foreach ( $posttags as $tag ) { |
|
1244 | - $meta_key .= $tag->name . ' '; |
|
1242 | + if ($posttags) { |
|
1243 | + foreach ($posttags as $tag) { |
|
1244 | + $meta_key .= $tag->name.' '; |
|
1245 | 1245 | } |
1246 | 1246 | } else { |
1247 | - $tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) ); |
|
1247 | + $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC')); |
|
1248 | 1248 | $xt = 1; |
1249 | 1249 | |
1250 | - foreach ( $tags as $tag ) { |
|
1251 | - if ( $xt <= 20 ) { |
|
1252 | - $meta_key .= $tag->name . ", "; |
|
1250 | + foreach ($tags as $tag) { |
|
1251 | + if ($xt <= 20) { |
|
1252 | + $meta_key .= $tag->name.", "; |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | - $xt ++; |
|
1255 | + $xt++; |
|
1256 | 1256 | } |
1257 | 1257 | } |
1258 | 1258 | } |
1259 | 1259 | |
1260 | - $meta_key = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key; |
|
1261 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key; |
|
1262 | - if ( $geodir_meta_keys != '' ) { |
|
1263 | - $geodir_meta_keys = strip_tags( $geodir_meta_keys ); |
|
1264 | - $geodir_meta_keys = esc_html( $geodir_meta_keys ); |
|
1265 | - $geodir_meta_keys = geodir_strtolower( $geodir_meta_keys ); |
|
1266 | - $geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' ); |
|
1267 | - $geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys ); |
|
1260 | + $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
1261 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
1262 | + if ($geodir_meta_keys != '') { |
|
1263 | + $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
1264 | + $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
1265 | + $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
1266 | + $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
1267 | + $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys); |
|
1268 | 1268 | |
1269 | - $meta_key = rtrim( trim( $geodir_meta_keys ), "," ); |
|
1269 | + $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
1270 | 1270 | } |
1271 | 1271 | |
1272 | - if ( $meta_key ) { |
|
1273 | - $meta_key = stripslashes_deep( $meta_key ); |
|
1272 | + if ($meta_key) { |
|
1273 | + $meta_key = stripslashes_deep($meta_key); |
|
1274 | 1274 | /** |
1275 | 1275 | * Filter SEO meta keywords. |
1276 | 1276 | * |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | * |
1279 | 1279 | * @param string $meta_desc Meta keywords. |
1280 | 1280 | */ |
1281 | - echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key ); |
|
1281 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key); |
|
1282 | 1282 | } |
1283 | 1283 | |
1284 | 1284 | } |
@@ -1298,8 +1298,8 @@ discard block |
||
1298 | 1298 | |
1299 | 1299 | $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
1300 | 1300 | |
1301 | - foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) { |
|
1302 | - $geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text']; |
|
1301 | + foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) { |
|
1302 | + $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
1303 | 1303 | } |
1304 | 1304 | |
1305 | 1305 | return $geodir_detail_page_tabs_key_value_array; |
@@ -1321,57 +1321,57 @@ discard block |
||
1321 | 1321 | * @since 1.0.0 |
1322 | 1322 | */ |
1323 | 1323 | $arr_tabs['post_profile'] = array( |
1324 | - 'heading_text' => __( 'Profile', 'geodirectory' ), |
|
1324 | + 'heading_text' => __('Profile', 'geodirectory'), |
|
1325 | 1325 | 'is_active_tab' => true, |
1326 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ), |
|
1326 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'), |
|
1327 | 1327 | 'tab_content' => '' |
1328 | 1328 | ); |
1329 | - $arr_tabs['post_info'] = array( |
|
1330 | - 'heading_text' => __( 'More Info', 'geodirectory' ), |
|
1329 | + $arr_tabs['post_info'] = array( |
|
1330 | + 'heading_text' => __('More Info', 'geodirectory'), |
|
1331 | 1331 | 'is_active_tab' => false, |
1332 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ), |
|
1332 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'), |
|
1333 | 1333 | 'tab_content' => '' |
1334 | 1334 | ); |
1335 | 1335 | |
1336 | 1336 | $arr_tabs['post_images'] = array( |
1337 | - 'heading_text' => __( 'Photo', 'geodirectory' ), |
|
1337 | + 'heading_text' => __('Photo', 'geodirectory'), |
|
1338 | 1338 | 'is_active_tab' => false, |
1339 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ), |
|
1339 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'), |
|
1340 | 1340 | 'tab_content' => '' |
1341 | 1341 | ); |
1342 | 1342 | |
1343 | 1343 | $arr_tabs['post_video'] = array( |
1344 | - 'heading_text' => __( 'Video', 'geodirectory' ), |
|
1344 | + 'heading_text' => __('Video', 'geodirectory'), |
|
1345 | 1345 | 'is_active_tab' => false, |
1346 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ), |
|
1346 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'), |
|
1347 | 1347 | 'tab_content' => '' |
1348 | 1348 | ); |
1349 | 1349 | |
1350 | 1350 | $arr_tabs['special_offers'] = array( |
1351 | - 'heading_text' => __( 'Special Offers', 'geodirectory' ), |
|
1351 | + 'heading_text' => __('Special Offers', 'geodirectory'), |
|
1352 | 1352 | 'is_active_tab' => false, |
1353 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ), |
|
1353 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'), |
|
1354 | 1354 | 'tab_content' => '' |
1355 | 1355 | ); |
1356 | 1356 | |
1357 | 1357 | $arr_tabs['post_map'] = array( |
1358 | - 'heading_text' => __( 'Map', 'geodirectory' ), |
|
1358 | + 'heading_text' => __('Map', 'geodirectory'), |
|
1359 | 1359 | 'is_active_tab' => false, |
1360 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ), |
|
1360 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'), |
|
1361 | 1361 | 'tab_content' => '' |
1362 | 1362 | ); |
1363 | 1363 | |
1364 | 1364 | $arr_tabs['reviews'] = array( |
1365 | - 'heading_text' => __( 'Reviews', 'geodirectory' ), |
|
1365 | + 'heading_text' => __('Reviews', 'geodirectory'), |
|
1366 | 1366 | 'is_active_tab' => false, |
1367 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ), |
|
1367 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'), |
|
1368 | 1368 | 'tab_content' => 'review display' |
1369 | 1369 | ); |
1370 | 1370 | |
1371 | 1371 | $arr_tabs['related_listing'] = array( |
1372 | - 'heading_text' => __( 'Related Listing', 'geodirectory' ), |
|
1372 | + 'heading_text' => __('Related Listing', 'geodirectory'), |
|
1373 | 1373 | 'is_active_tab' => false, |
1374 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ), |
|
1374 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'), |
|
1375 | 1375 | 'tab_content' => '' |
1376 | 1376 | ); |
1377 | 1377 | |
@@ -1380,7 +1380,7 @@ discard block |
||
1380 | 1380 | * |
1381 | 1381 | * @since 1.0.0 |
1382 | 1382 | */ |
1383 | - return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs ); |
|
1383 | + return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs); |
|
1384 | 1384 | |
1385 | 1385 | |
1386 | 1386 | } |
@@ -1394,13 +1394,13 @@ discard block |
||
1394 | 1394 | * @return mixed|array Tabs array. |
1395 | 1395 | */ |
1396 | 1396 | function geodir_detail_page_tabs_list() { |
1397 | - $tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
1397 | + $tabs_excluded = get_option('geodir_detail_page_tabs_excluded'); |
|
1398 | 1398 | $tabs_array = geodir_detail_page_tabs_array(); |
1399 | 1399 | |
1400 | - if ( ! empty( $tabs_excluded ) ) { |
|
1401 | - foreach ( $tabs_excluded as $tab ) { |
|
1402 | - if ( array_key_exists( $tab, $tabs_array ) ) { |
|
1403 | - unset( $tabs_array[ $tab ] ); |
|
1400 | + if (!empty($tabs_excluded)) { |
|
1401 | + foreach ($tabs_excluded as $tab) { |
|
1402 | + if (array_key_exists($tab, $tabs_array)) { |
|
1403 | + unset($tabs_array[$tab]); |
|
1404 | 1404 | } |
1405 | 1405 | } |
1406 | 1406 | } |
@@ -1424,58 +1424,58 @@ discard block |
||
1424 | 1424 | function geodir_show_detail_page_tabs() { |
1425 | 1425 | global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview; |
1426 | 1426 | |
1427 | - $post_id = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0; |
|
1428 | - $request_post_id = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0; |
|
1429 | - $is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend |
|
1427 | + $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0; |
|
1428 | + $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0; |
|
1429 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
1430 | 1430 | |
1431 | - if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) { |
|
1432 | - $post = geodir_get_post_info( $request_post_id ); |
|
1433 | - setup_postdata( $post ); |
|
1431 | + if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) { |
|
1432 | + $post = geodir_get_post_info($request_post_id); |
|
1433 | + setup_postdata($post); |
|
1434 | 1434 | } |
1435 | 1435 | |
1436 | - $geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' ); |
|
1436 | + $geodir_post_detail_fields = geodir_show_listing_info('moreinfo'); |
|
1437 | 1437 | |
1438 | 1438 | |
1439 | - if ( geodir_is_page( 'detail' ) ) { |
|
1440 | - $video = geodir_get_video( $post->ID ); |
|
1441 | - $special_offers = geodir_get_special_offers( $post->ID ); |
|
1439 | + if (geodir_is_page('detail')) { |
|
1440 | + $video = geodir_get_video($post->ID); |
|
1441 | + $special_offers = geodir_get_special_offers($post->ID); |
|
1442 | 1442 | $related_listing_array = array(); |
1443 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) { |
|
1444 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
1443 | + if (get_option('geodir_add_related_listing_posttypes')) { |
|
1444 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes'); |
|
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | |
1448 | - $excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
1449 | - if ( ! $excluded_tabs ) { |
|
1448 | + $excluded_tabs = get_option('geodir_detail_page_tabs_excluded'); |
|
1449 | + if (!$excluded_tabs) { |
|
1450 | 1450 | $excluded_tabs = array(); |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | $related_listing = ''; |
1454 | - if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) { |
|
1454 | + if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) { |
|
1455 | 1455 | $request = array( |
1456 | - 'post_number' => get_option( 'geodir_related_post_count' ), |
|
1457 | - 'relate_to' => get_option( 'geodir_related_post_relate_to' ), |
|
1458 | - 'layout' => get_option( 'geodir_related_post_listing_view' ), |
|
1459 | - 'add_location_filter' => get_option( 'geodir_related_post_location_filter' ), |
|
1460 | - 'list_sort' => get_option( 'geodir_related_post_sortby' ), |
|
1461 | - 'character_count' => get_option( 'geodir_related_post_excerpt' ) |
|
1456 | + 'post_number' => get_option('geodir_related_post_count'), |
|
1457 | + 'relate_to' => get_option('geodir_related_post_relate_to'), |
|
1458 | + 'layout' => get_option('geodir_related_post_listing_view'), |
|
1459 | + 'add_location_filter' => get_option('geodir_related_post_location_filter'), |
|
1460 | + 'list_sort' => get_option('geodir_related_post_sortby'), |
|
1461 | + 'character_count' => get_option('geodir_related_post_excerpt') |
|
1462 | 1462 | ); |
1463 | 1463 | |
1464 | - if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) { |
|
1465 | - $related_listing = geodir_get_detail_page_related_events( $request ); |
|
1464 | + if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) { |
|
1465 | + $related_listing = geodir_get_detail_page_related_events($request); |
|
1466 | 1466 | } else { |
1467 | - $related_listing = geodir_related_posts_display( $request ); |
|
1467 | + $related_listing = geodir_related_posts_display($request); |
|
1468 | 1468 | } |
1469 | 1469 | |
1470 | 1470 | } |
1471 | 1471 | |
1472 | - $post_images = geodir_get_images( $post->ID, 'thumbnail' ); |
|
1472 | + $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
1473 | 1473 | $thumb_image = ''; |
1474 | - if ( ! empty( $post_images ) ) { |
|
1475 | - foreach ( $post_images as $image ) { |
|
1476 | - $caption = ( ! empty( $image->caption ) ) ? $image->caption : ''; |
|
1477 | - $thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">'; |
|
1478 | - $thumb_image .= geodir_show_image( $image, 'thumbnail', true, false ); |
|
1474 | + if (!empty($post_images)) { |
|
1475 | + foreach ($post_images as $image) { |
|
1476 | + $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
1477 | + $thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">'; |
|
1478 | + $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
1479 | 1479 | $thumb_image .= '</a>'; |
1480 | 1480 | } |
1481 | 1481 | } |
@@ -1484,11 +1484,11 @@ discard block |
||
1484 | 1484 | $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
1485 | 1485 | $map_args['width'] = '600'; |
1486 | 1486 | $map_args['height'] = '300'; |
1487 | - if ( $post->post_mapzoom ) { |
|
1488 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
1487 | + if ($post->post_mapzoom) { |
|
1488 | + $map_args['zoom'] = ''.$post->post_mapzoom.''; |
|
1489 | 1489 | } |
1490 | 1490 | $map_args['autozoom'] = false; |
1491 | - $map_args['scrollwheel'] = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1; |
|
1491 | + $map_args['scrollwheel'] = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1; |
|
1492 | 1492 | $map_args['child_collapse'] = '0'; |
1493 | 1493 | $map_args['enable_cat_filters'] = false; |
1494 | 1494 | $map_args['enable_text_search'] = false; |
@@ -1497,43 +1497,43 @@ discard block |
||
1497 | 1497 | $map_args['enable_jason_on_load'] = true; |
1498 | 1498 | $map_args['enable_map_direction'] = true; |
1499 | 1499 | $map_args['map_class_name'] = 'geodir-map-detail-page'; |
1500 | - $map_args['maptype'] = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP'; |
|
1501 | - } else if ( geodir_is_page( 'preview' ) ) { |
|
1502 | - $video = isset( $post->geodir_video ) ? $post->geodir_video : ''; |
|
1503 | - $special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : ''; |
|
1500 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
1501 | + } else if (geodir_is_page('preview')) { |
|
1502 | + $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
1503 | + $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
1504 | 1504 | |
1505 | - if ( isset( $post->post_images ) ) { |
|
1506 | - $post->post_images = trim( $post->post_images, "," ); |
|
1505 | + if (isset($post->post_images)) { |
|
1506 | + $post->post_images = trim($post->post_images, ","); |
|
1507 | 1507 | } |
1508 | 1508 | |
1509 | - if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) { |
|
1510 | - $post_images = explode( ",", $post->post_images ); |
|
1509 | + if (isset($post->post_images) && !empty($post->post_images)) { |
|
1510 | + $post_images = explode(",", $post->post_images); |
|
1511 | 1511 | } |
1512 | 1512 | |
1513 | 1513 | $thumb_image = ''; |
1514 | - if ( ! empty( $post_images ) ) { |
|
1515 | - foreach ( $post_images as $image ) { |
|
1516 | - if ( $image != '' ) { |
|
1517 | - $thumb_image .= '<a href="' . $image . '">'; |
|
1518 | - $thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false ); |
|
1514 | + if (!empty($post_images)) { |
|
1515 | + foreach ($post_images as $image) { |
|
1516 | + if ($image != '') { |
|
1517 | + $thumb_image .= '<a href="'.$image.'">'; |
|
1518 | + $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false); |
|
1519 | 1519 | $thumb_image .= '</a>'; |
1520 | 1520 | } |
1521 | 1521 | } |
1522 | 1522 | } |
1523 | 1523 | |
1524 | 1524 | global $map_jason; |
1525 | - $marker_json = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array(); |
|
1526 | - $marker_icon = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : ''; |
|
1527 | - $icon_size = geodir_get_marker_size( $marker_icon ); |
|
1525 | + $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
1526 | + $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
1527 | + $icon_size = geodir_get_marker_size($marker_icon); |
|
1528 | 1528 | $marker_json['w'] = $icon_size['w']; |
1529 | 1529 | $marker_json['h'] = $icon_size['h']; |
1530 | - $map_jason[] = json_encode( $marker_json ); |
|
1530 | + $map_jason[] = json_encode($marker_json); |
|
1531 | 1531 | |
1532 | - $address_latitude = isset( $post->post_latitude ) ? $post->post_latitude : ''; |
|
1533 | - $address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : ''; |
|
1534 | - $mapview = isset( $post->post_mapview ) ? $post->post_mapview : ''; |
|
1535 | - $mapzoom = isset( $post->post_mapzoom ) ? $post->post_mapzoom : ''; |
|
1536 | - if ( ! $mapzoom ) { |
|
1532 | + $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
1533 | + $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
1534 | + $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
1535 | + $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
1536 | + if (!$mapzoom) { |
|
1537 | 1537 | $mapzoom = 12; |
1538 | 1538 | } |
1539 | 1539 | |
@@ -1556,37 +1556,37 @@ discard block |
||
1556 | 1556 | $map_args['map_class_name'] = 'geodir-map-preview-page'; |
1557 | 1557 | } |
1558 | 1558 | |
1559 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
1559 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user |
|
1560 | 1560 | |
1561 | 1561 | $active_tab = ''; |
1562 | 1562 | $active_tab_name = ''; |
1563 | 1563 | $default_tab = ''; |
1564 | 1564 | $default_tab_name = ''; |
1565 | - foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) { |
|
1566 | - if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) { |
|
1565 | + foreach ($arr_detail_page_tabs as $tab_index => $tabs) { |
|
1566 | + if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) { |
|
1567 | 1567 | $active_tab = $tab_index; |
1568 | - $active_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
1568 | + $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
1569 | 1569 | } |
1570 | 1570 | |
1571 | - if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) { |
|
1571 | + if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) { |
|
1572 | 1572 | $default_tab = $tab_index; |
1573 | - $default_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
1573 | + $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
1574 | 1574 | } |
1575 | 1575 | } |
1576 | 1576 | |
1577 | - if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab acs a active tab if not any tab is active. |
|
1578 | - if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) { |
|
1579 | - $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false; |
|
1577 | + if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active. |
|
1578 | + if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) { |
|
1579 | + $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
1580 | 1580 | } |
1581 | 1581 | |
1582 | - $arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true; |
|
1582 | + $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
1583 | 1583 | $active_tab = $default_tab; |
1584 | 1584 | $active_tab_name = $default_tab_name; |
1585 | 1585 | } |
1586 | - $tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false; |
|
1586 | + $tab_list = (get_option('geodir_disable_tabs', false)) ? true : false; |
|
1587 | 1587 | ?> |
1588 | 1588 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
1589 | - <?php if ( ! $tab_list ){ ?> |
|
1589 | + <?php if (!$tab_list) { ?> |
|
1590 | 1590 | <div id="geodir-tab-mobile-menu"> |
1591 | 1591 | <i class="fa fa-bars"></i> |
1592 | 1592 | <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span> |
@@ -1601,26 +1601,26 @@ discard block |
||
1601 | 1601 | * @since 1.0.0 |
1602 | 1602 | * @see 'geodir_after_tab_list' |
1603 | 1603 | */ |
1604 | - do_action( 'geodir_before_tab_list' ); ?> |
|
1604 | + do_action('geodir_before_tab_list'); ?> |
|
1605 | 1605 | <?php |
1606 | 1606 | |
1607 | - foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) { |
|
1608 | - if ( $detail_page_tab['is_display'] ) { |
|
1607 | + foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) { |
|
1608 | + if ($detail_page_tab['is_display']) { |
|
1609 | 1609 | |
1610 | - if ( ! $tab_list ) { |
|
1610 | + if (!$tab_list) { |
|
1611 | 1611 | ?> |
1612 | 1612 | <dt></dt> <!-- added to comply with validation --> |
1613 | - <dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a |
|
1613 | + <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a |
|
1614 | 1614 | data-tab="#<?php echo $tab_index; ?>" |
1615 | - data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a> |
|
1615 | + data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
|
1616 | 1616 | </dd> |
1617 | 1617 | <?php |
1618 | 1618 | } |
1619 | 1619 | ob_start() // start tab content buffering |
1620 | 1620 | ?> |
1621 | 1621 | <li id="<?php echo $tab_index; ?>Tab"> |
1622 | - <?php if ( $tab_list ) { |
|
1623 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />'; |
|
1622 | + <?php if ($tab_list) { |
|
1623 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />'; |
|
1624 | 1624 | /** |
1625 | 1625 | * Filter the tab list title html. |
1626 | 1626 | * |
@@ -1630,7 +1630,7 @@ discard block |
||
1630 | 1630 | * @param string $tab_index The tab index type. |
1631 | 1631 | * @param array $detail_page_tab The array of values including title text. |
1632 | 1632 | */ |
1633 | - echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab ); |
|
1633 | + echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab); |
|
1634 | 1634 | } ?> |
1635 | 1635 | <div id="<?php echo $tab_index; ?>" class="hash-offset"></div> |
1636 | 1636 | <?php |
@@ -1641,7 +1641,7 @@ discard block |
||
1641 | 1641 | * |
1642 | 1642 | * @param string $tab_index The tab name ID. |
1643 | 1643 | */ |
1644 | - do_action( 'geodir_before_tab_content', $tab_index ); |
|
1644 | + do_action('geodir_before_tab_content', $tab_index); |
|
1645 | 1645 | |
1646 | 1646 | /** |
1647 | 1647 | * Called before the details tab content is output per tab. |
@@ -1651,21 +1651,21 @@ discard block |
||
1651 | 1651 | * @since 1.0.0 |
1652 | 1652 | * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
1653 | 1653 | */ |
1654 | - do_action( 'geodir_before_' . $tab_index . '_tab_content' ); |
|
1654 | + do_action('geodir_before_'.$tab_index.'_tab_content'); |
|
1655 | 1655 | /// write a code to generate content of each tab |
1656 | - switch ( $tab_index ) { |
|
1656 | + switch ($tab_index) { |
|
1657 | 1657 | case 'post_profile': |
1658 | 1658 | /** |
1659 | 1659 | * Called before the listing description content on the details page tab. |
1660 | 1660 | * |
1661 | 1661 | * @since 1.0.0 |
1662 | 1662 | */ |
1663 | - do_action( 'geodir_before_description_on_listing_detail' ); |
|
1664 | - if ( geodir_is_page( 'detail' ) ) { |
|
1663 | + do_action('geodir_before_description_on_listing_detail'); |
|
1664 | + if (geodir_is_page('detail')) { |
|
1665 | 1665 | the_content(); |
1666 | 1666 | } else { |
1667 | 1667 | /** This action is documented in geodirectory_template_actions.php */ |
1668 | - echo apply_filters( 'the_content', stripslashes( $post->post_desc ) ); |
|
1668 | + echo apply_filters('the_content', stripslashes($post->post_desc)); |
|
1669 | 1669 | } |
1670 | 1670 | |
1671 | 1671 | /** |
@@ -1673,7 +1673,7 @@ discard block |
||
1673 | 1673 | * |
1674 | 1674 | * @since 1.0.0 |
1675 | 1675 | */ |
1676 | - do_action( 'geodir_after_description_on_listing_detail' ); |
|
1676 | + do_action('geodir_after_description_on_listing_detail'); |
|
1677 | 1677 | break; |
1678 | 1678 | case 'post_info': |
1679 | 1679 | echo $geodir_post_detail_fields; |
@@ -1683,21 +1683,21 @@ discard block |
||
1683 | 1683 | break; |
1684 | 1684 | case 'post_video': |
1685 | 1685 | // some browsers hide $_POST data if used for embeds so we repalce with a placeholder |
1686 | - if ( $preview ) { |
|
1687 | - if ( $video ) { |
|
1688 | - echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>"; |
|
1686 | + if ($preview) { |
|
1687 | + if ($video) { |
|
1688 | + echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>"; |
|
1689 | 1689 | } |
1690 | 1690 | } else { |
1691 | 1691 | /** This action is documented in geodirectory_template_actions.php */ |
1692 | - echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also; |
|
1692 | + echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also; |
|
1693 | 1693 | } |
1694 | 1694 | break; |
1695 | 1695 | case 'special_offers': |
1696 | - echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) ); |
|
1696 | + echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers))); |
|
1697 | 1697 | |
1698 | 1698 | break; |
1699 | 1699 | case 'post_map': |
1700 | - geodir_draw_map( $map_args ); |
|
1700 | + geodir_draw_map($map_args); |
|
1701 | 1701 | break; |
1702 | 1702 | case 'reviews': |
1703 | 1703 | comments_template(); |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | echo $related_listing; |
1707 | 1707 | break; |
1708 | 1708 | default: { |
1709 | - if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) { |
|
1709 | + if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) { |
|
1710 | 1710 | echo $detail_page_tab['tab_content']; |
1711 | 1711 | } |
1712 | 1712 | } |
@@ -1718,7 +1718,7 @@ discard block |
||
1718 | 1718 | * |
1719 | 1719 | * @since 1.0.0 |
1720 | 1720 | */ |
1721 | - do_action( 'geodir_after_tab_content', $tab_index ); |
|
1721 | + do_action('geodir_after_tab_content', $tab_index); |
|
1722 | 1722 | |
1723 | 1723 | /** |
1724 | 1724 | * Called after the details tab content is output per tab. |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | * @since 1.0.0 |
1729 | 1729 | * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
1730 | 1730 | */ |
1731 | - do_action( 'geodir_after_' . $tab_index . '_tab_content' ); |
|
1731 | + do_action('geodir_after_'.$tab_index.'_tab_content'); |
|
1732 | 1732 | ?> </li> |
1733 | 1733 | <?php |
1734 | 1734 | /** |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | * |
1737 | 1737 | * @since 1.0.0 |
1738 | 1738 | */ |
1739 | - $arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() ); |
|
1739 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean()); |
|
1740 | 1740 | } // end of if for is_display |
1741 | 1741 | }// end of foreach |
1742 | 1742 | |
@@ -1746,14 +1746,14 @@ discard block |
||
1746 | 1746 | * @since 1.0.0 |
1747 | 1747 | * @see 'geodir_before_tab_list' |
1748 | 1748 | */ |
1749 | - do_action( 'geodir_after_tab_list' ); |
|
1749 | + do_action('geodir_after_tab_list'); |
|
1750 | 1750 | ?> |
1751 | - <?php if ( ! $tab_list ){ ?></dl><?php } ?> |
|
1752 | - <ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>" |
|
1751 | + <?php if (!$tab_list) { ?></dl><?php } ?> |
|
1752 | + <ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>" |
|
1753 | 1753 | style="position:relative;"> |
1754 | 1754 | <?php |
1755 | - foreach ( $arr_detail_page_tabs as $detail_page_tab ) { |
|
1756 | - if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) { |
|
1755 | + foreach ($arr_detail_page_tabs as $detail_page_tab) { |
|
1756 | + if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) { |
|
1757 | 1757 | echo $detail_page_tab['tab_content']; |
1758 | 1758 | }// end of if |
1759 | 1759 | }// end of foreach |
@@ -1763,11 +1763,11 @@ discard block |
||
1763 | 1763 | * |
1764 | 1764 | * @since 1.0.0 |
1765 | 1765 | */ |
1766 | - do_action( 'geodir_add_tab_content' ); ?> |
|
1766 | + do_action('geodir_add_tab_content'); ?> |
|
1767 | 1767 | </ul> |
1768 | 1768 | <!--gd-tabs-content ul end--> |
1769 | 1769 | </div> |
1770 | - <?php if ( ! $tab_list ) { ?> |
|
1770 | + <?php if (!$tab_list) { ?> |
|
1771 | 1771 | <script> |
1772 | 1772 | if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) { |
1773 | 1773 | hashVal = window.location.hash; |
@@ -1799,31 +1799,31 @@ discard block |
||
1799 | 1799 | * |
1800 | 1800 | * @return mixed Image file. |
1801 | 1801 | */ |
1802 | -function geodir_exif( $file ) { |
|
1803 | - if ( empty( $file ) || ! is_array( $file ) ) { |
|
1802 | +function geodir_exif($file) { |
|
1803 | + if (empty($file) || !is_array($file)) { |
|
1804 | 1804 | return $file; |
1805 | 1805 | } |
1806 | 1806 | |
1807 | - $file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : ''; |
|
1808 | - if ( ! ( $file_path && file_exists( $file_path ) ) ) { |
|
1807 | + $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
1808 | + if (!($file_path && file_exists($file_path))) { |
|
1809 | 1809 | return $file; |
1810 | 1810 | } |
1811 | 1811 | $file['file'] = $file_path; |
1812 | 1812 | |
1813 | - if ( ! file_is_valid_image( $file_path ) ) { |
|
1813 | + if (!file_is_valid_image($file_path)) { |
|
1814 | 1814 | return $file; // Bail if file is not an image. |
1815 | 1815 | } |
1816 | 1816 | |
1817 | - if ( ! function_exists( 'wp_get_image_editor' ) ) { |
|
1817 | + if (!function_exists('wp_get_image_editor')) { |
|
1818 | 1818 | return $file; |
1819 | 1819 | } |
1820 | 1820 | |
1821 | 1821 | $mime_type = $file['type']; |
1822 | 1822 | $exif = array(); |
1823 | - if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) { |
|
1823 | + if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) { |
|
1824 | 1824 | try { |
1825 | - $exif = exif_read_data( $file_path ); |
|
1826 | - } catch ( Exception $e ) { |
|
1825 | + $exif = exif_read_data($file_path); |
|
1826 | + } catch (Exception $e) { |
|
1827 | 1827 | $exif = array(); |
1828 | 1828 | } |
1829 | 1829 | } |
@@ -1832,13 +1832,13 @@ discard block |
||
1832 | 1832 | $flip = false; |
1833 | 1833 | $modify = false; |
1834 | 1834 | $orientation = 0; |
1835 | - if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) { |
|
1836 | - switch ( (int) $exif['Orientation'] ) { |
|
1835 | + if (!empty($exif) && isset($exif['Orientation'])) { |
|
1836 | + switch ((int) $exif['Orientation']) { |
|
1837 | 1837 | case 1: |
1838 | 1838 | // do nothing |
1839 | 1839 | break; |
1840 | 1840 | case 2: |
1841 | - $flip = array( false, true ); |
|
1841 | + $flip = array(false, true); |
|
1842 | 1842 | $modify = true; |
1843 | 1843 | break; |
1844 | 1844 | case 3: |
@@ -1847,13 +1847,13 @@ discard block |
||
1847 | 1847 | $modify = true; |
1848 | 1848 | break; |
1849 | 1849 | case 4: |
1850 | - $flip = array( true, false ); |
|
1850 | + $flip = array(true, false); |
|
1851 | 1851 | $modify = true; |
1852 | 1852 | break; |
1853 | 1853 | case 5: |
1854 | 1854 | $orientation = - 90; |
1855 | 1855 | $rotate = true; |
1856 | - $flip = array( false, true ); |
|
1856 | + $flip = array(false, true); |
|
1857 | 1857 | $modify = true; |
1858 | 1858 | break; |
1859 | 1859 | case 6: |
@@ -1864,7 +1864,7 @@ discard block |
||
1864 | 1864 | case 7: |
1865 | 1865 | $orientation = - 270; |
1866 | 1866 | $rotate = true; |
1867 | - $flip = array( false, true ); |
|
1867 | + $flip = array(false, true); |
|
1868 | 1868 | $modify = true; |
1869 | 1869 | break; |
1870 | 1870 | case 8: |
@@ -1890,31 +1890,31 @@ discard block |
||
1890 | 1890 | * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
1891 | 1891 | * @param string $quality Image mime type. |
1892 | 1892 | */ |
1893 | - $quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type ); |
|
1894 | - if ( $quality !== null ) { |
|
1893 | + $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type); |
|
1894 | + if ($quality !== null) { |
|
1895 | 1895 | $modify = true; |
1896 | 1896 | } |
1897 | 1897 | |
1898 | - if ( ! $modify ) { |
|
1898 | + if (!$modify) { |
|
1899 | 1899 | return $file; // no change |
1900 | 1900 | } |
1901 | 1901 | |
1902 | - $image = wp_get_image_editor( $file_path ); |
|
1903 | - if ( ! is_wp_error( $image ) ) { |
|
1904 | - if ( $rotate ) { |
|
1905 | - $image->rotate( $orientation ); |
|
1902 | + $image = wp_get_image_editor($file_path); |
|
1903 | + if (!is_wp_error($image)) { |
|
1904 | + if ($rotate) { |
|
1905 | + $image->rotate($orientation); |
|
1906 | 1906 | } |
1907 | 1907 | |
1908 | - if ( ! empty( $flip ) ) { |
|
1909 | - $image->flip( $flip[0], $flip[1] ); |
|
1908 | + if (!empty($flip)) { |
|
1909 | + $image->flip($flip[0], $flip[1]); |
|
1910 | 1910 | } |
1911 | 1911 | |
1912 | - if ( $quality !== null ) { |
|
1913 | - $image->set_quality( (int) $quality ); |
|
1912 | + if ($quality !== null) { |
|
1913 | + $image->set_quality((int) $quality); |
|
1914 | 1914 | } |
1915 | 1915 | |
1916 | - $result = $image->save( $file_path ); |
|
1917 | - if ( ! is_wp_error( $result ) ) { |
|
1916 | + $result = $image->save($file_path); |
|
1917 | + if (!is_wp_error($result)) { |
|
1918 | 1918 | $file['file'] = $result['path']; |
1919 | 1919 | $file['tmp_name'] = $result['path']; |
1920 | 1920 | } |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | * |
1942 | 1942 | * @return string Returns the recent reviews html. |
1943 | 1943 | */ |
1944 | -function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) { |
|
1944 | +function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) { |
|
1945 | 1945 | global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
1946 | 1946 | $tablecomments = $wpdb->comments; |
1947 | 1947 | $tableposts = $wpdb->posts; |
@@ -1951,28 +1951,28 @@ discard block |
||
1951 | 1951 | $region_filter = ''; |
1952 | 1952 | $country_filter = ''; |
1953 | 1953 | |
1954 | - if ( $gd_session->get( 'gd_multi_location' ) ) { |
|
1955 | - if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) { |
|
1956 | - $country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) ); |
|
1954 | + if ($gd_session->get('gd_multi_location')) { |
|
1955 | + if ($gd_ses_country = $gd_session->get('gd_country')) { |
|
1956 | + $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country)); |
|
1957 | 1957 | } |
1958 | 1958 | |
1959 | - if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) { |
|
1960 | - $region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) ); |
|
1959 | + if ($gd_ses_region = $gd_session->get('gd_region')) { |
|
1960 | + $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region)); |
|
1961 | 1961 | } |
1962 | 1962 | |
1963 | - if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) { |
|
1964 | - $city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) ); |
|
1963 | + if ($gd_ses_city = $gd_session->get('gd_city')) { |
|
1964 | + $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city)); |
|
1965 | 1965 | } |
1966 | 1966 | } |
1967 | 1967 | |
1968 | 1968 | $review_table = GEODIR_REVIEW_TABLE; |
1969 | 1969 | $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments"; |
1970 | 1970 | |
1971 | - $comments = $wpdb->get_results( $request ); |
|
1971 | + $comments = $wpdb->get_results($request); |
|
1972 | 1972 | |
1973 | - foreach ( $comments as $comment ) { |
|
1973 | + foreach ($comments as $comment) { |
|
1974 | 1974 | // Set the extra comment info needed. |
1975 | - $comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" ); |
|
1975 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
1976 | 1976 | //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
1977 | 1977 | $comment->comment_content = $comment_extra->comment_content; |
1978 | 1978 | $comment->comment_author = $comment_extra->comment_author; |
@@ -1980,75 +1980,75 @@ discard block |
||
1980 | 1980 | |
1981 | 1981 | $comment_id = ''; |
1982 | 1982 | $comment_id = $comment->comment_ID; |
1983 | - $comment_content = strip_tags( $comment->comment_content ); |
|
1983 | + $comment_content = strip_tags($comment->comment_content); |
|
1984 | 1984 | |
1985 | - $comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content ); |
|
1985 | + $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content); |
|
1986 | 1986 | |
1987 | - $permalink = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID; |
|
1987 | + $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; |
|
1988 | 1988 | $comment_author_email = $comment->comment_author_email; |
1989 | 1989 | $comment_post_ID = $comment->post_id; |
1990 | 1990 | |
1991 | 1991 | $na = true; |
1992 | - if ( function_exists( 'icl_object_id' ) && icl_object_id( $comment_post_ID, $comment->post_type, true ) ) { |
|
1993 | - $comment_post_ID2 = icl_object_id( $comment_post_ID, $comment->post_type, false ); |
|
1994 | - if ( $comment_post_ID == $comment_post_ID2 ) { |
|
1992 | + if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) { |
|
1993 | + $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
1994 | + if ($comment_post_ID == $comment_post_ID2) { |
|
1995 | 1995 | } else { |
1996 | 1996 | $na = false; |
1997 | 1997 | } |
1998 | 1998 | } |
1999 | 1999 | |
2000 | - $post_title = get_the_title( $comment_post_ID ); |
|
2001 | - $permalink = get_permalink( $comment_post_ID ); |
|
2002 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
2003 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>'; |
|
2000 | + $post_title = get_the_title($comment_post_ID); |
|
2001 | + $permalink = get_permalink($comment_post_ID); |
|
2002 | + $comment_permalink = $permalink."#comment-".$comment->comment_ID; |
|
2003 | + $read_more = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>'; |
|
2004 | 2004 | |
2005 | - $comment_content_length = strlen( $comment_content ); |
|
2006 | - if ( $comment_content_length > $comment_lenth ) { |
|
2007 | - $comment_excerpt = mb_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more; |
|
2005 | + $comment_content_length = strlen($comment_content); |
|
2006 | + if ($comment_content_length > $comment_lenth) { |
|
2007 | + $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth).'... '.$read_more; |
|
2008 | 2008 | } else { |
2009 | 2009 | $comment_excerpt = $comment_content; |
2010 | 2010 | } |
2011 | 2011 | |
2012 | - if ( $comment->user_id ) { |
|
2013 | - $user_profile_url = get_author_posts_url( $comment->user_id ); |
|
2012 | + if ($comment->user_id) { |
|
2013 | + $user_profile_url = get_author_posts_url($comment->user_id); |
|
2014 | 2014 | } else { |
2015 | 2015 | $user_profile_url = ''; |
2016 | 2016 | } |
2017 | 2017 | |
2018 | - if ( $comment_id && $na ) { |
|
2018 | + if ($comment_id && $na) { |
|
2019 | 2019 | $comments_echo .= '<li class="clearfix">'; |
2020 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
2021 | - if ( function_exists( 'get_avatar' ) ) { |
|
2022 | - if ( ! isset( $comment->comment_type ) ) { |
|
2023 | - if ( $user_profile_url ) { |
|
2024 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2020 | + $comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">"; |
|
2021 | + if (function_exists('get_avatar')) { |
|
2022 | + if (!isset($comment->comment_type)) { |
|
2023 | + if ($user_profile_url) { |
|
2024 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2025 | 2025 | } |
2026 | - $comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2027 | - if ( $user_profile_url ) { |
|
2026 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2027 | + if ($user_profile_url) { |
|
2028 | 2028 | $comments_echo .= '</a>'; |
2029 | 2029 | } |
2030 | - } elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) { |
|
2031 | - if ( $user_profile_url ) { |
|
2032 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2030 | + } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) { |
|
2031 | + if ($user_profile_url) { |
|
2032 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2033 | 2033 | } |
2034 | - $comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2034 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2035 | 2035 | } |
2036 | - } elseif ( function_exists( 'gravatar' ) ) { |
|
2037 | - if ( $user_profile_url ) { |
|
2038 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2036 | + } elseif (function_exists('gravatar')) { |
|
2037 | + if ($user_profile_url) { |
|
2038 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2039 | 2039 | } |
2040 | 2040 | $comments_echo .= "<img src=\""; |
2041 | - if ( '' == $comment->comment_type ) { |
|
2042 | - $comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2043 | - if ( $user_profile_url ) { |
|
2041 | + if ('' == $comment->comment_type) { |
|
2042 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2043 | + if ($user_profile_url) { |
|
2044 | 2044 | $comments_echo .= '</a>'; |
2045 | 2045 | } |
2046 | - } elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) { |
|
2047 | - if ( $user_profile_url ) { |
|
2048 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
2046 | + } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) { |
|
2047 | + if ($user_profile_url) { |
|
2048 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
2049 | 2049 | } |
2050 | - $comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
2051 | - if ( $user_profile_url ) { |
|
2050 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
2051 | + if ($user_profile_url) { |
|
2052 | 2052 | $comments_echo .= '</a>'; |
2053 | 2053 | } |
2054 | 2054 | } |
@@ -2058,17 +2058,17 @@ discard block |
||
2058 | 2058 | $comments_echo .= "</span>\n"; |
2059 | 2059 | |
2060 | 2060 | $comments_echo .= '<span class="geodir_reviewer_content">'; |
2061 | - if ( $comment->user_id ) { |
|
2062 | - $comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">'; |
|
2061 | + if ($comment->user_id) { |
|
2062 | + $comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">'; |
|
2063 | 2063 | } |
2064 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
2065 | - if ( $comment->user_id ) { |
|
2064 | + $comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> '; |
|
2065 | + if ($comment->user_id) { |
|
2066 | 2066 | $comments_echo .= '</a>'; |
2067 | 2067 | } |
2068 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> '; |
|
2069 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
2070 | - $comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID ); |
|
2071 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
2068 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> '; |
|
2069 | + $comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>'; |
|
2070 | + $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
2071 | + $comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.''; |
|
2072 | 2072 | //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt); |
2073 | 2073 | $comments_echo .= '</p>'; |
2074 | 2074 | |
@@ -2088,25 +2088,25 @@ discard block |
||
2088 | 2088 | * @return array Returns post categories as an array. |
2089 | 2089 | */ |
2090 | 2090 | function geodir_home_map_cats_key_value_array() { |
2091 | - $post_types = geodir_get_posttypes( 'object' ); |
|
2091 | + $post_types = geodir_get_posttypes('object'); |
|
2092 | 2092 | |
2093 | 2093 | $return = array(); |
2094 | - if ( ! empty( $post_types ) ) { |
|
2095 | - foreach ( $post_types as $key => $post_type ) { |
|
2096 | - $cpt_name = __( $post_type->labels->singular_name, 'geodirectory' ); |
|
2097 | - $post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ); |
|
2098 | - $taxonomies = geodir_get_taxonomies( $key ); |
|
2099 | - $cat_taxonomy = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null; |
|
2100 | - $cat_terms = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null; |
|
2101 | - |
|
2102 | - if ( ! empty( $cat_terms ) ) { |
|
2103 | - $return[ 'optgroup_start-' . $key ] = $post_type_name; |
|
2104 | - |
|
2105 | - foreach ( $cat_terms as $cat_term ) { |
|
2106 | - $return[ $key . '_' . $cat_term->term_id ] = $cat_term->name; |
|
2094 | + if (!empty($post_types)) { |
|
2095 | + foreach ($post_types as $key => $post_type) { |
|
2096 | + $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
2097 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name); |
|
2098 | + $taxonomies = geodir_get_taxonomies($key); |
|
2099 | + $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : null; |
|
2100 | + $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : null; |
|
2101 | + |
|
2102 | + if (!empty($cat_terms)) { |
|
2103 | + $return['optgroup_start-'.$key] = $post_type_name; |
|
2104 | + |
|
2105 | + foreach ($cat_terms as $cat_term) { |
|
2106 | + $return[$key.'_'.$cat_term->term_id] = $cat_term->name; |
|
2107 | 2107 | } |
2108 | 2108 | |
2109 | - $return[ 'optgroup_end-' . $key ] = $post_type_name; |
|
2109 | + $return['optgroup_end-'.$key] = $post_type_name; |
|
2110 | 2110 | } |
2111 | 2111 | } |
2112 | 2112 | } |
@@ -2122,14 +2122,14 @@ discard block |
||
2122 | 2122 | * @package GeoDirectory |
2123 | 2123 | */ |
2124 | 2124 | function geodir_twitter_tweet_button() { |
2125 | - if ( isset( $_GET['gde'] ) ) { |
|
2126 | - $link = '?url=' . urlencode( geodir_curPageURL() ); |
|
2125 | + if (isset($_GET['gde'])) { |
|
2126 | + $link = '?url='.urlencode(geodir_curPageURL()); |
|
2127 | 2127 | } else { |
2128 | 2128 | $link = ''; |
2129 | 2129 | } |
2130 | 2130 | ?> |
2131 | 2131 | <a href="http://twitter.com/share<?php echo $link; ?>" |
2132 | - class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a> |
|
2132 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a> |
|
2133 | 2133 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
2134 | 2134 | <?php |
2135 | 2135 | } |
@@ -2146,10 +2146,10 @@ discard block |
||
2146 | 2146 | function geodir_fb_like_button() { |
2147 | 2147 | global $post; |
2148 | 2148 | ?> |
2149 | - <iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) { |
|
2149 | + <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { |
|
2150 | 2150 | echo 'allowtransparency="true"'; |
2151 | 2151 | } ?> class="facebook" |
2152 | - src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
2152 | + src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
2153 | 2153 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
2154 | 2154 | <?php |
2155 | 2155 | } |
@@ -2203,10 +2203,10 @@ discard block |
||
2203 | 2203 | stWidget.addEntry({ |
2204 | 2204 | "service": "sharethis", |
2205 | 2205 | "element": document.getElementById('st_sharethis'), |
2206 | - "url": "<?php echo geodir_curPageURL();?>", |
|
2207 | - "title": "<?php echo $post->post_title;?>", |
|
2206 | + "url": "<?php echo geodir_curPageURL(); ?>", |
|
2207 | + "title": "<?php echo $post->post_title; ?>", |
|
2208 | 2208 | "type": "chicklet", |
2209 | - "text": "<?php _e( 'Share', 'geodirectory' );?>" |
|
2209 | + "text": "<?php _e('Share', 'geodirectory'); ?>" |
|
2210 | 2210 | }); |
2211 | 2211 | </script> |
2212 | 2212 | </div> |
@@ -2214,7 +2214,7 @@ discard block |
||
2214 | 2214 | } |
2215 | 2215 | |
2216 | 2216 | function geodir_listing_bounce_map_pin_on_hover() { |
2217 | - if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) { |
|
2217 | + if (get_option('geodir_listing_hover_bounce_map_pin', true)) { |
|
2218 | 2218 | ?> |
2219 | 2219 | <script> |
2220 | 2220 | jQuery(function ($) { |
@@ -2237,44 +2237,44 @@ discard block |
||
2237 | 2237 | } |
2238 | 2238 | } |
2239 | 2239 | |
2240 | -add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 ); |
|
2240 | +add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10); |
|
2241 | 2241 | |
2242 | -add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 ); |
|
2243 | -function geodir_output_favourite_html_listings( $post_id ) { |
|
2244 | - geodir_favourite_html( '', $post_id ); |
|
2242 | +add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1); |
|
2243 | +function geodir_output_favourite_html_listings($post_id) { |
|
2244 | + geodir_favourite_html('', $post_id); |
|
2245 | 2245 | } |
2246 | 2246 | |
2247 | -add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 ); |
|
2248 | -function geodir_output_pinpoint_html_listings( $post_id, $post ) { |
|
2247 | +add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2); |
|
2248 | +function geodir_output_pinpoint_html_listings($post_id, $post) { |
|
2249 | 2249 | global $wp_query; |
2250 | 2250 | |
2251 | 2251 | $show_pin_point = $wp_query->is_main_query(); |
2252 | 2252 | |
2253 | - if ( ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) { |
|
2254 | - $term_icon_url = get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type ); |
|
2255 | - $marker_icon = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' ); |
|
2253 | + if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) { |
|
2254 | + $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
2255 | + $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon'); |
|
2256 | 2256 | ?> |
2257 | 2257 | <span class="geodir-pinpoint" |
2258 | - style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span> |
|
2258 | + style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span> |
|
2259 | 2259 | <a class="geodir-pinpoint-link" href="javascript:void(0)" |
2260 | 2260 | onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')" |
2261 | 2261 | onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')" |
2262 | - onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a> |
|
2262 | + onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a> |
|
2263 | 2263 | <?php |
2264 | 2264 | } |
2265 | 2265 | } |
2266 | 2266 | |
2267 | 2267 | function geodir_search_form_submit_button() { |
2268 | 2268 | |
2269 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
2269 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
|
2270 | 2270 | |
2271 | - if ( $new_style ) { |
|
2271 | + if ($new_style) { |
|
2272 | 2272 | $default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>'; |
2273 | - }else{ |
|
2273 | + } else { |
|
2274 | 2274 | $default_search_button_label = 'Search'; |
2275 | 2275 | } |
2276 | - if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) { |
|
2277 | - $default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' ); |
|
2276 | + if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') { |
|
2277 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory'); |
|
2278 | 2278 | } |
2279 | 2279 | |
2280 | 2280 | /** |
@@ -2286,78 +2286,78 @@ discard block |
||
2286 | 2286 | * |
2287 | 2287 | * @param string $default_search_button_label The current search button text. |
2288 | 2288 | */ |
2289 | - $default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label ); |
|
2289 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label); |
|
2290 | 2290 | |
2291 | 2291 | $fa_class = ''; |
2292 | - if ( strpos( $default_search_button_label, '&#' ) !== false ) { |
|
2292 | + if (strpos($default_search_button_label, '&#') !== false) { |
|
2293 | 2293 | $fa_class = 'fa'; |
2294 | 2294 | } |
2295 | 2295 | |
2296 | 2296 | |
2297 | - if ( $new_style ) { |
|
2297 | + if ($new_style) { |
|
2298 | 2298 | ?> |
2299 | - <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button> |
|
2300 | -<?php }else{?> |
|
2301 | - <input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>" |
|
2299 | + <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button> |
|
2300 | +<?php } else {?> |
|
2301 | + <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" |
|
2302 | 2302 | class="geodir_submit_search <?php echo $fa_class; ?>"/> |
2303 | 2303 | <?php } |
2304 | 2304 | } |
2305 | 2305 | |
2306 | -add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 ); |
|
2306 | +add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000); |
|
2307 | 2307 | |
2308 | 2308 | function geodir_search_form_post_type_input() { |
2309 | 2309 | global $geodir_search_post_type; |
2310 | - $post_types = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) ); |
|
2310 | + $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object')); |
|
2311 | 2311 | $curr_post_type = $geodir_search_post_type; |
2312 | 2312 | |
2313 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) { |
|
2313 | + if (!empty($post_types) && count((array) $post_types) > 1) { |
|
2314 | 2314 | |
2315 | - foreach ( $post_types as $post_type => $info ){ |
|
2315 | + foreach ($post_types as $post_type => $info) { |
|
2316 | 2316 | global $wpdb; |
2317 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
2318 | - if ( ! $has_posts ) { |
|
2317 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type)); |
|
2318 | + if (!$has_posts) { |
|
2319 | 2319 | unset($post_types->{$post_type}); |
2320 | 2320 | } |
2321 | 2321 | } |
2322 | 2322 | |
2323 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) { |
|
2323 | + if (!empty($post_types) && count((array) $post_types) > 1) { |
|
2324 | 2324 | |
2325 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
2326 | - if ( $new_style ) { |
|
2325 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
|
2326 | + if ($new_style) { |
|
2327 | 2327 | echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>"; |
2328 | 2328 | } |
2329 | 2329 | ?> |
2330 | 2330 | <select name="stype" class="search_by_post"> |
2331 | - <?php foreach ( $post_types as $post_type => $info ): |
|
2331 | + <?php foreach ($post_types as $post_type => $info): |
|
2332 | 2332 | global $wpdb; |
2333 | 2333 | ?> |
2334 | 2334 | |
2335 | - <option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>" |
|
2336 | - value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) { |
|
2337 | - if ( $post_type == $_REQUEST['stype'] ) { |
|
2335 | + <option data-label="<?php echo get_post_type_archive_link($post_type); ?>" |
|
2336 | + value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) { |
|
2337 | + if ($post_type == $_REQUEST['stype']) { |
|
2338 | 2338 | echo 'selected="selected"'; |
2339 | 2339 | } |
2340 | - } elseif ( $curr_post_type == $post_type ) { |
|
2340 | + } elseif ($curr_post_type == $post_type) { |
|
2341 | 2341 | echo 'selected="selected"'; |
2342 | - } ?>><?php _e( ucfirst( $info->labels->name ), 'geodirectory' ); ?></option> |
|
2342 | + } ?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option> |
|
2343 | 2343 | |
2344 | 2344 | <?php endforeach; ?> |
2345 | 2345 | </select> |
2346 | 2346 | <?php |
2347 | - if ( $new_style ) { |
|
2347 | + if ($new_style) { |
|
2348 | 2348 | echo "</div>"; |
2349 | 2349 | } |
2350 | - }else{ |
|
2351 | - if(! empty( $post_types )){ |
|
2352 | - $pt_arr = (array)$post_types; |
|
2353 | - echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" />'; |
|
2354 | - }else{ |
|
2350 | + } else { |
|
2351 | + if (!empty($post_types)) { |
|
2352 | + $pt_arr = (array) $post_types; |
|
2353 | + echo '<input type="hidden" name="stype" value="'.key($pt_arr).'" />'; |
|
2354 | + } else { |
|
2355 | 2355 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2356 | 2356 | } |
2357 | 2357 | |
2358 | 2358 | } |
2359 | 2359 | |
2360 | - }elseif ( ! empty( $post_types ) ) { |
|
2360 | + }elseif (!empty($post_types)) { |
|
2361 | 2361 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
2362 | 2362 | } |
2363 | 2363 | } |
@@ -2365,26 +2365,26 @@ discard block |
||
2365 | 2365 | function geodir_search_form_search_input() { |
2366 | 2366 | |
2367 | 2367 | $default_search_for_text = SEARCH_FOR_TEXT; |
2368 | - if ( get_option( 'geodir_search_field_default_text' ) ) { |
|
2369 | - $default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' ); |
|
2368 | + if (get_option('geodir_search_field_default_text')) { |
|
2369 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
2370 | 2370 | } |
2371 | 2371 | |
2372 | 2372 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
2373 | - if($new_style){ |
|
2373 | + if ($new_style) { |
|
2374 | 2374 | echo "<div class='gd-search-input-wrapper gd-search-field-search'>"; |
2375 | 2375 | } |
2376 | 2376 | ?> |
2377 | 2377 | <input class="search_text" name="s" |
2378 | - value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) { |
|
2379 | - echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
2378 | + value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') { |
|
2379 | + echo esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
2380 | 2380 | } else { |
2381 | 2381 | echo $default_search_for_text; |
2382 | 2382 | } ?>" type="text" |
2383 | - onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}" |
|
2384 | - onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}" |
|
2383 | + onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}" |
|
2384 | + onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}" |
|
2385 | 2385 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
2386 | 2386 | <?php |
2387 | - if($new_style){ |
|
2387 | + if ($new_style) { |
|
2388 | 2388 | echo "</div>"; |
2389 | 2389 | } |
2390 | 2390 | } |
@@ -2392,12 +2392,12 @@ discard block |
||
2392 | 2392 | function geodir_search_form_near_input() { |
2393 | 2393 | |
2394 | 2394 | $default_near_text = NEAR_TEXT; |
2395 | - if ( get_option( 'geodir_near_field_default_text' ) ) { |
|
2396 | - $default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' ); |
|
2395 | + if (get_option('geodir_near_field_default_text')) { |
|
2396 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
2397 | 2397 | } |
2398 | 2398 | |
2399 | - if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) { |
|
2400 | - $near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) ); |
|
2399 | + if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') { |
|
2400 | + $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
2401 | 2401 | } else { |
2402 | 2402 | $near = $default_near_text; |
2403 | 2403 | } |
@@ -2411,7 +2411,7 @@ discard block |
||
2411 | 2411 | * @since 1.6.9 |
2412 | 2412 | * @param string $curr_post_type The current post type. |
2413 | 2413 | */ |
2414 | - $near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type); |
|
2414 | + $near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type); |
|
2415 | 2415 | |
2416 | 2416 | |
2417 | 2417 | /** |
@@ -2424,7 +2424,7 @@ discard block |
||
2424 | 2424 | * @param string $near The current near value. |
2425 | 2425 | * @param string $default_near_text The default near value. |
2426 | 2426 | */ |
2427 | - $near = apply_filters( 'geodir_search_near_text', $near, $default_near_text ); |
|
2427 | + $near = apply_filters('geodir_search_near_text', $near, $default_near_text); |
|
2428 | 2428 | /** |
2429 | 2429 | * Filter the default "Near" text value for the search form. |
2430 | 2430 | * |
@@ -2435,7 +2435,7 @@ discard block |
||
2435 | 2435 | * @param string $near The current near value. |
2436 | 2436 | * @param string $default_near_text The default near value. |
2437 | 2437 | */ |
2438 | - $default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near ); |
|
2438 | + $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near); |
|
2439 | 2439 | /** |
2440 | 2440 | * Filter the class for the near search input. |
2441 | 2441 | * |
@@ -2443,10 +2443,10 @@ discard block |
||
2443 | 2443 | * |
2444 | 2444 | * @param string $class The class for the HTML near input, default is blank. |
2445 | 2445 | */ |
2446 | - $near_class = apply_filters( 'geodir_search_near_class', '' ); |
|
2446 | + $near_class = apply_filters('geodir_search_near_class', ''); |
|
2447 | 2447 | |
2448 | 2448 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true; |
2449 | - if($new_style){ |
|
2449 | + if ($new_style) { |
|
2450 | 2450 | echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>"; |
2451 | 2451 | |
2452 | 2452 | do_action('geodir_before_near_input'); |
@@ -2454,30 +2454,30 @@ discard block |
||
2454 | 2454 | |
2455 | 2455 | ?> |
2456 | 2456 | <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>" |
2457 | - onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}" |
|
2458 | - onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}" |
|
2459 | - onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/> |
|
2457 | + onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}" |
|
2458 | + onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}" |
|
2459 | + onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/> |
|
2460 | 2460 | <?php |
2461 | - if($new_style){ |
|
2461 | + if ($new_style) { |
|
2462 | 2462 | do_action('geodir_after_near_input'); |
2463 | 2463 | |
2464 | 2464 | echo "</div>"; |
2465 | 2465 | } |
2466 | 2466 | } |
2467 | 2467 | |
2468 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 ); |
|
2469 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 ); |
|
2470 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 ); |
|
2468 | +add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10); |
|
2469 | +add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20); |
|
2470 | +add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30); |
|
2471 | 2471 | |
2472 | -function geodir_get_search_post_type($pt=''){ |
|
2472 | +function geodir_get_search_post_type($pt = '') { |
|
2473 | 2473 | global $geodir_search_post_type; |
2474 | 2474 | |
2475 | - if($pt!=''){return $geodir_search_post_type = $pt;} |
|
2476 | - if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;} |
|
2475 | + if ($pt != '') {return $geodir_search_post_type = $pt; } |
|
2476 | + if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; } |
|
2477 | 2477 | |
2478 | 2478 | $geodir_search_post_type = geodir_get_current_posttype(); |
2479 | 2479 | |
2480 | - if(!$geodir_search_post_type) { |
|
2480 | + if (!$geodir_search_post_type) { |
|
2481 | 2481 | $geodir_search_post_type = geodir_get_default_posttype(); |
2482 | 2482 | } |
2483 | 2483 | |
@@ -2485,7 +2485,7 @@ discard block |
||
2485 | 2485 | return $geodir_search_post_type; |
2486 | 2486 | } |
2487 | 2487 | |
2488 | -function geodir_search_form(){ |
|
2488 | +function geodir_search_form() { |
|
2489 | 2489 | |
2490 | 2490 | geodir_get_search_post_type(); |
2491 | 2491 | |
@@ -2495,5 +2495,5 @@ discard block |
||
2495 | 2495 | die(); |
2496 | 2496 | } |
2497 | 2497 | |
2498 | -add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' ); |
|
2499 | -add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' ); |
|
2500 | 2498 | \ No newline at end of file |
2499 | +add_action('wp_ajax_geodir_search_form', 'geodir_search_form'); |
|
2500 | +add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form'); |
|
2501 | 2501 | \ No newline at end of file |
@@ -15,296 +15,296 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function geodir_register_sidebar() |
17 | 17 | { |
18 | - global $geodir_sidebars; |
|
19 | - |
|
20 | - if (function_exists('register_sidebar')) { |
|
21 | - /*===========================*/ |
|
22 | - /* Home page sidebars start*/ |
|
23 | - /*===========================*/ |
|
24 | - |
|
25 | - /** |
|
26 | - * Filter the `$before_widget` widget opening HTML tag. |
|
27 | - * |
|
28 | - * @since 1.0.0 |
|
29 | - * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
30 | - * @see 'geodir_after_widget' |
|
31 | - */ |
|
32 | - $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">'); |
|
33 | - /** |
|
34 | - * Filter the `$after_widget` widget closing HTML tag. |
|
35 | - * |
|
36 | - * @since 1.0.0 |
|
37 | - * @param string $var The HTML string to filter. Default = '</section>'. |
|
38 | - * @see 'geodir_before_widget' |
|
39 | - */ |
|
40 | - $after_widget = apply_filters('geodir_after_widget', '</section>'); |
|
41 | - /** |
|
42 | - * Filter the `$before_title` widget title opening HTML tag. |
|
43 | - * |
|
44 | - * @since 1.0.0 |
|
45 | - * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
46 | - * @see 'geodir_after_title' |
|
47 | - */ |
|
48 | - $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
49 | - /** |
|
50 | - * Filter the `$after_title` widget title closing HTML tag. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * @param string $var The HTML string to filter. Default = '</h3>'. |
|
54 | - * @see 'geodir_before_title' |
|
55 | - */ |
|
56 | - $after_title = apply_filters('geodir_after_title', '</h3>'); |
|
57 | - |
|
58 | - if (get_option('geodir_show_home_top_section')) { |
|
59 | - register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
60 | - |
|
61 | - $geodir_sidebars[] = 'geodir_home_top'; |
|
62 | - } |
|
63 | - |
|
64 | - if (get_option('geodir_show_home_contant_section')) { |
|
65 | - register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
18 | + global $geodir_sidebars; |
|
66 | 19 | |
67 | - $geodir_sidebars[] = 'geodir_home_content'; |
|
68 | - } |
|
20 | + if (function_exists('register_sidebar')) { |
|
21 | + /*===========================*/ |
|
22 | + /* Home page sidebars start*/ |
|
23 | + /*===========================*/ |
|
69 | 24 | |
70 | - if (get_option('geodir_show_home_right_section')) { |
|
71 | - register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
25 | + /** |
|
26 | + * Filter the `$before_widget` widget opening HTML tag. |
|
27 | + * |
|
28 | + * @since 1.0.0 |
|
29 | + * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
30 | + * @see 'geodir_after_widget' |
|
31 | + */ |
|
32 | + $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">'); |
|
33 | + /** |
|
34 | + * Filter the `$after_widget` widget closing HTML tag. |
|
35 | + * |
|
36 | + * @since 1.0.0 |
|
37 | + * @param string $var The HTML string to filter. Default = '</section>'. |
|
38 | + * @see 'geodir_before_widget' |
|
39 | + */ |
|
40 | + $after_widget = apply_filters('geodir_after_widget', '</section>'); |
|
41 | + /** |
|
42 | + * Filter the `$before_title` widget title opening HTML tag. |
|
43 | + * |
|
44 | + * @since 1.0.0 |
|
45 | + * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
46 | + * @see 'geodir_after_title' |
|
47 | + */ |
|
48 | + $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">'); |
|
49 | + /** |
|
50 | + * Filter the `$after_title` widget title closing HTML tag. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * @param string $var The HTML string to filter. Default = '</h3>'. |
|
54 | + * @see 'geodir_before_title' |
|
55 | + */ |
|
56 | + $after_title = apply_filters('geodir_after_title', '</h3>'); |
|
57 | + |
|
58 | + if (get_option('geodir_show_home_top_section')) { |
|
59 | + register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
72 | 60 | |
73 | - $geodir_sidebars[] = 'geodir_home_right'; |
|
74 | - } |
|
61 | + $geodir_sidebars[] = 'geodir_home_top'; |
|
62 | + } |
|
75 | 63 | |
76 | - if (get_option('geodir_show_home_left_section')) { |
|
77 | - register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
64 | + if (get_option('geodir_show_home_contant_section')) { |
|
65 | + register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
78 | 66 | |
79 | - $geodir_sidebars[] = 'geodir_home_left'; |
|
80 | - } |
|
67 | + $geodir_sidebars[] = 'geodir_home_content'; |
|
68 | + } |
|
81 | 69 | |
82 | - if (get_option('geodir_show_home_bottom_section')) { |
|
83 | - register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
70 | + if (get_option('geodir_show_home_right_section')) { |
|
71 | + register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
84 | 72 | |
85 | - $geodir_sidebars[] = 'geodir_home_bottom'; |
|
86 | - } |
|
73 | + $geodir_sidebars[] = 'geodir_home_right'; |
|
74 | + } |
|
87 | 75 | |
88 | - /*===========================*/ |
|
89 | - /* Home page sidebars end*/ |
|
90 | - /*===========================*/ |
|
76 | + if (get_option('geodir_show_home_left_section')) { |
|
77 | + register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
91 | 78 | |
92 | - /*===========================*/ |
|
93 | - /* Listing page sidebars start*/ |
|
94 | - /*===========================*/ |
|
79 | + $geodir_sidebars[] = 'geodir_home_left'; |
|
80 | + } |
|
95 | 81 | |
96 | - if (get_option('geodir_show_listing_top_section')) { |
|
97 | - register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
82 | + if (get_option('geodir_show_home_bottom_section')) { |
|
83 | + register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
98 | 84 | |
99 | - $geodir_sidebars[] = 'geodir_listing_top'; |
|
100 | - } |
|
85 | + $geodir_sidebars[] = 'geodir_home_bottom'; |
|
86 | + } |
|
101 | 87 | |
102 | - if (get_option('geodir_show_listing_left_section')) { |
|
103 | - register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
88 | + /*===========================*/ |
|
89 | + /* Home page sidebars end*/ |
|
90 | + /*===========================*/ |
|
104 | 91 | |
105 | - $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
106 | - } |
|
92 | + /*===========================*/ |
|
93 | + /* Listing page sidebars start*/ |
|
94 | + /*===========================*/ |
|
107 | 95 | |
108 | - if (get_option('geodir_show_listing_right_section')) { |
|
109 | - register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
96 | + if (get_option('geodir_show_listing_top_section')) { |
|
97 | + register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
110 | 98 | |
111 | - $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
112 | - } |
|
99 | + $geodir_sidebars[] = 'geodir_listing_top'; |
|
100 | + } |
|
113 | 101 | |
114 | - if (get_option('geodir_show_listing_bottom_section')) { |
|
115 | - register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
102 | + if (get_option('geodir_show_listing_left_section')) { |
|
103 | + register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
116 | 104 | |
117 | - $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
118 | - } |
|
105 | + $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
106 | + } |
|
119 | 107 | |
120 | - /*===========================*/ |
|
121 | - /* Listing page sidebars start*/ |
|
122 | - /*===========================*/ |
|
108 | + if (get_option('geodir_show_listing_right_section')) { |
|
109 | + register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
123 | 110 | |
124 | - /*===========================*/ |
|
125 | - /* Search page sidebars start*/ |
|
126 | - /*===========================*/ |
|
111 | + $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
112 | + } |
|
127 | 113 | |
128 | - if (get_option('geodir_show_search_top_section')) { |
|
129 | - register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
114 | + if (get_option('geodir_show_listing_bottom_section')) { |
|
115 | + register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
130 | 116 | |
131 | - $geodir_sidebars[] = 'geodir_search_top'; |
|
132 | - } |
|
117 | + $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
118 | + } |
|
133 | 119 | |
134 | - if (get_option('geodir_show_search_left_section')) { |
|
135 | - register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
120 | + /*===========================*/ |
|
121 | + /* Listing page sidebars start*/ |
|
122 | + /*===========================*/ |
|
136 | 123 | |
137 | - $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
138 | - } |
|
124 | + /*===========================*/ |
|
125 | + /* Search page sidebars start*/ |
|
126 | + /*===========================*/ |
|
139 | 127 | |
140 | - if (get_option('geodir_show_search_right_section')) { |
|
141 | - register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
128 | + if (get_option('geodir_show_search_top_section')) { |
|
129 | + register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
142 | 130 | |
143 | - $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
144 | - } |
|
131 | + $geodir_sidebars[] = 'geodir_search_top'; |
|
132 | + } |
|
145 | 133 | |
146 | - if (get_option('geodir_show_search_bottom_section')) { |
|
147 | - register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
134 | + if (get_option('geodir_show_search_left_section')) { |
|
135 | + register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
148 | 136 | |
149 | - $geodir_sidebars[] = 'geodir_search_bottom'; |
|
150 | - } |
|
137 | + $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
138 | + } |
|
151 | 139 | |
152 | - /*===========================*/ |
|
153 | - /* Search page sidebars end*/ |
|
154 | - /*===========================*/ |
|
140 | + if (get_option('geodir_show_search_right_section')) { |
|
141 | + register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
155 | 142 | |
156 | - /*==================================*/ |
|
157 | - /* Detail/Single page sidebars start*/ |
|
158 | - /*==================================*/ |
|
159 | - if (get_option('geodir_show_detail_top_section')) { |
|
160 | - register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
143 | + $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
144 | + } |
|
161 | 145 | |
162 | - $geodir_sidebars[] = 'geodir_detail_top'; |
|
163 | - } |
|
146 | + if (get_option('geodir_show_search_bottom_section')) { |
|
147 | + register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
164 | 148 | |
165 | - register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
149 | + $geodir_sidebars[] = 'geodir_search_bottom'; |
|
150 | + } |
|
166 | 151 | |
167 | - $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
152 | + /*===========================*/ |
|
153 | + /* Search page sidebars end*/ |
|
154 | + /*===========================*/ |
|
168 | 155 | |
169 | - if (get_option('geodir_show_detail_bottom_section')) { |
|
170 | - register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
156 | + /*==================================*/ |
|
157 | + /* Detail/Single page sidebars start*/ |
|
158 | + /*==================================*/ |
|
159 | + if (get_option('geodir_show_detail_top_section')) { |
|
160 | + register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
171 | 161 | |
172 | - $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
173 | - } |
|
162 | + $geodir_sidebars[] = 'geodir_detail_top'; |
|
163 | + } |
|
174 | 164 | |
175 | - /*==================================*/ |
|
176 | - /* Detail/Single page sidebars end*/ |
|
177 | - /*==================================*/ |
|
165 | + register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
178 | 166 | |
179 | - /*==================================*/ |
|
180 | - /* Author page sidebars start */ |
|
181 | - /*==================================*/ |
|
167 | + $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
182 | 168 | |
183 | - if (get_option('geodir_show_author_top_section')) { |
|
184 | - register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
169 | + if (get_option('geodir_show_detail_bottom_section')) { |
|
170 | + register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
185 | 171 | |
186 | - $geodir_sidebars[] = 'geodir_author_top'; |
|
187 | - } |
|
172 | + $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
173 | + } |
|
188 | 174 | |
189 | - if (get_option('geodir_show_author_left_section')) { |
|
190 | - register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
175 | + /*==================================*/ |
|
176 | + /* Detail/Single page sidebars end*/ |
|
177 | + /*==================================*/ |
|
191 | 178 | |
192 | - $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
193 | - } |
|
179 | + /*==================================*/ |
|
180 | + /* Author page sidebars start */ |
|
181 | + /*==================================*/ |
|
194 | 182 | |
195 | - if (get_option('geodir_show_author_right_section')) { |
|
196 | - register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
183 | + if (get_option('geodir_show_author_top_section')) { |
|
184 | + register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
197 | 185 | |
198 | - $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
199 | - } |
|
186 | + $geodir_sidebars[] = 'geodir_author_top'; |
|
187 | + } |
|
200 | 188 | |
201 | - if (get_option('geodir_show_author_bottom_section')) { |
|
202 | - register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
189 | + if (get_option('geodir_show_author_left_section')) { |
|
190 | + register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
203 | 191 | |
204 | - $geodir_sidebars[] = 'geodir_author_bottom'; |
|
205 | - } |
|
192 | + $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
193 | + } |
|
206 | 194 | |
207 | - /*==================================*/ |
|
208 | - /* Author page sidebars end */ |
|
209 | - /*==================================*/ |
|
195 | + if (get_option('geodir_show_author_right_section')) { |
|
196 | + register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
210 | 197 | |
211 | - /*==================================*/ |
|
212 | - /* Add listing page sidebars start */ |
|
213 | - /*==================================*/ |
|
198 | + $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
199 | + } |
|
214 | 200 | |
215 | - register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
201 | + if (get_option('geodir_show_author_bottom_section')) { |
|
202 | + register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
216 | 203 | |
217 | - $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
204 | + $geodir_sidebars[] = 'geodir_author_bottom'; |
|
205 | + } |
|
218 | 206 | |
219 | - /*==================================*/ |
|
220 | - /* Add listing page sidebars end */ |
|
221 | - /*==================================*/ |
|
207 | + /*==================================*/ |
|
208 | + /* Author page sidebars end */ |
|
209 | + /*==================================*/ |
|
222 | 210 | |
223 | - } |
|
211 | + /*==================================*/ |
|
212 | + /* Add listing page sidebars start */ |
|
213 | + /*==================================*/ |
|
214 | + |
|
215 | + register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); |
|
216 | + |
|
217 | + $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
218 | + |
|
219 | + /*==================================*/ |
|
220 | + /* Add listing page sidebars end */ |
|
221 | + /*==================================*/ |
|
222 | + |
|
223 | + } |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
227 | 227 | if (!function_exists('register_geodir_widgets')) { |
228 | - /** |
|
229 | - * Registers all Widgets. |
|
230 | - * |
|
231 | - * @since 1.0.0 |
|
232 | - * @package GeoDirectory |
|
233 | - */ |
|
234 | - function register_geodir_widgets() |
|
235 | - { |
|
236 | - /** |
|
237 | - * Login Widget. |
|
238 | - * |
|
239 | - * @since 1.0.0 |
|
240 | - */ |
|
241 | - class geodir_loginwidget extends WP_Widget |
|
242 | - { |
|
243 | - /** |
|
244 | - * Register the login widget with WordPress. |
|
245 | - * |
|
246 | - * @since 1.0.0 |
|
247 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
248 | - */ |
|
249 | - public function __construct() { |
|
250 | - $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory')); |
|
251 | - parent::__construct( |
|
252 | - 'geodir_loginbox', // Base ID |
|
253 | - __('GD > Loginbox', 'geodirectory'), // Name |
|
254 | - $widget_ops// Args |
|
255 | - ); |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * Front-end display content for login widget. |
|
260 | - * |
|
261 | - * @since 1.0.0 |
|
262 | - * @since 1.5.1 Declare function public. |
|
263 | - * |
|
264 | - * @param array $args Widget arguments. |
|
265 | - * @param array $instance Saved values from database. |
|
266 | - */ |
|
267 | - public function widget($args, $instance) |
|
268 | - { |
|
269 | - geodir_loginwidget_output($args, $instance); |
|
270 | - } |
|
271 | - |
|
272 | - /** |
|
273 | - * Sanitize login widget form values as they are saved. |
|
274 | - * |
|
275 | - * @since 1.0.0 |
|
276 | - * @since 1.5.1 Declare function public. |
|
277 | - * |
|
278 | - * @param array $new_instance Values just sent to be saved. |
|
279 | - * @param array $old_instance Previously saved values from database. |
|
280 | - * |
|
281 | - * @return array Updated safe values to be saved. |
|
282 | - */ |
|
283 | - public function update($new_instance, $old_instance) |
|
284 | - { |
|
285 | - //save the widget |
|
286 | - $instance = $old_instance; |
|
287 | - $instance['title'] = strip_tags($new_instance['title']); |
|
288 | - |
|
289 | - return $instance; |
|
290 | - } |
|
291 | - |
|
292 | - /** |
|
293 | - * Back-end login widget settings form. |
|
294 | - * |
|
295 | - * @since 1.0.0 |
|
296 | - * @since 1.5.1 Declare function public. |
|
297 | - * |
|
298 | - * @param array $instance Previously saved values from database. |
|
299 | - * @return string|void |
|
300 | - */ |
|
301 | - public function form($instance) |
|
302 | - { |
|
303 | - //widgetform in backend |
|
304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | - $title = strip_tags($instance['title']); |
|
306 | - |
|
307 | - ?> |
|
228 | + /** |
|
229 | + * Registers all Widgets. |
|
230 | + * |
|
231 | + * @since 1.0.0 |
|
232 | + * @package GeoDirectory |
|
233 | + */ |
|
234 | + function register_geodir_widgets() |
|
235 | + { |
|
236 | + /** |
|
237 | + * Login Widget. |
|
238 | + * |
|
239 | + * @since 1.0.0 |
|
240 | + */ |
|
241 | + class geodir_loginwidget extends WP_Widget |
|
242 | + { |
|
243 | + /** |
|
244 | + * Register the login widget with WordPress. |
|
245 | + * |
|
246 | + * @since 1.0.0 |
|
247 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
248 | + */ |
|
249 | + public function __construct() { |
|
250 | + $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory')); |
|
251 | + parent::__construct( |
|
252 | + 'geodir_loginbox', // Base ID |
|
253 | + __('GD > Loginbox', 'geodirectory'), // Name |
|
254 | + $widget_ops// Args |
|
255 | + ); |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * Front-end display content for login widget. |
|
260 | + * |
|
261 | + * @since 1.0.0 |
|
262 | + * @since 1.5.1 Declare function public. |
|
263 | + * |
|
264 | + * @param array $args Widget arguments. |
|
265 | + * @param array $instance Saved values from database. |
|
266 | + */ |
|
267 | + public function widget($args, $instance) |
|
268 | + { |
|
269 | + geodir_loginwidget_output($args, $instance); |
|
270 | + } |
|
271 | + |
|
272 | + /** |
|
273 | + * Sanitize login widget form values as they are saved. |
|
274 | + * |
|
275 | + * @since 1.0.0 |
|
276 | + * @since 1.5.1 Declare function public. |
|
277 | + * |
|
278 | + * @param array $new_instance Values just sent to be saved. |
|
279 | + * @param array $old_instance Previously saved values from database. |
|
280 | + * |
|
281 | + * @return array Updated safe values to be saved. |
|
282 | + */ |
|
283 | + public function update($new_instance, $old_instance) |
|
284 | + { |
|
285 | + //save the widget |
|
286 | + $instance = $old_instance; |
|
287 | + $instance['title'] = strip_tags($new_instance['title']); |
|
288 | + |
|
289 | + return $instance; |
|
290 | + } |
|
291 | + |
|
292 | + /** |
|
293 | + * Back-end login widget settings form. |
|
294 | + * |
|
295 | + * @since 1.0.0 |
|
296 | + * @since 1.5.1 Declare function public. |
|
297 | + * |
|
298 | + * @param array $instance Previously saved values from database. |
|
299 | + * @return string|void |
|
300 | + */ |
|
301 | + public function form($instance) |
|
302 | + { |
|
303 | + //widgetform in backend |
|
304 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | + $title = strip_tags($instance['title']); |
|
306 | + |
|
307 | + ?> |
|
308 | 308 | <p><label |
309 | 309 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?> |
310 | 310 | : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -313,64 +313,64 @@ discard block |
||
313 | 313 | |
314 | 314 | |
315 | 315 | <?php |
316 | - } |
|
317 | - } |
|
318 | - |
|
319 | - register_widget('geodir_loginwidget'); |
|
320 | - |
|
321 | - |
|
322 | - /** |
|
323 | - * GeoDirectory Social Like Widget. |
|
324 | - * |
|
325 | - * @since 1.0.0 |
|
326 | - */ |
|
327 | - class geodir_social_like_widget extends WP_Widget |
|
328 | - { |
|
329 | - |
|
330 | - /** |
|
331 | - * Register the social like widget with WordPress. |
|
332 | - * |
|
333 | - * @since 1.0.0 |
|
334 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
335 | - */ |
|
336 | - public function __construct() { |
|
337 | - $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory')); |
|
338 | - parent::__construct( |
|
339 | - 'social_like_widget', // Base ID |
|
340 | - __('GD > Social Like', 'geodirectory'), // Name |
|
341 | - $widget_ops// Args |
|
342 | - ); |
|
343 | - } |
|
344 | - |
|
345 | - /** |
|
346 | - * Front-end display content for social like widget. |
|
347 | - * |
|
348 | - * @since 1.0.0 |
|
349 | - * @since 1.5.1 Declare function public. |
|
350 | - * |
|
351 | - * @param array $args Widget arguments. |
|
352 | - * @param array $instance Saved values from database. |
|
353 | - */ |
|
354 | - public function widget($args, $instance) |
|
355 | - { |
|
356 | - // prints the widget |
|
357 | - extract($args, EXTR_SKIP); |
|
358 | - |
|
359 | - /** |
|
360 | - * Filter the widget title text. |
|
361 | - * |
|
362 | - * @since 1.0.0 |
|
363 | - * @global object $current_user Current user object. |
|
364 | - * @param string $title The widget title text. |
|
365 | - */ |
|
366 | - $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); |
|
367 | - |
|
368 | - global $current_user, $post; |
|
369 | - echo $before_widget; |
|
370 | - ?> |
|
316 | + } |
|
317 | + } |
|
318 | + |
|
319 | + register_widget('geodir_loginwidget'); |
|
320 | + |
|
321 | + |
|
322 | + /** |
|
323 | + * GeoDirectory Social Like Widget. |
|
324 | + * |
|
325 | + * @since 1.0.0 |
|
326 | + */ |
|
327 | + class geodir_social_like_widget extends WP_Widget |
|
328 | + { |
|
329 | + |
|
330 | + /** |
|
331 | + * Register the social like widget with WordPress. |
|
332 | + * |
|
333 | + * @since 1.0.0 |
|
334 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
335 | + */ |
|
336 | + public function __construct() { |
|
337 | + $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory')); |
|
338 | + parent::__construct( |
|
339 | + 'social_like_widget', // Base ID |
|
340 | + __('GD > Social Like', 'geodirectory'), // Name |
|
341 | + $widget_ops// Args |
|
342 | + ); |
|
343 | + } |
|
344 | + |
|
345 | + /** |
|
346 | + * Front-end display content for social like widget. |
|
347 | + * |
|
348 | + * @since 1.0.0 |
|
349 | + * @since 1.5.1 Declare function public. |
|
350 | + * |
|
351 | + * @param array $args Widget arguments. |
|
352 | + * @param array $instance Saved values from database. |
|
353 | + */ |
|
354 | + public function widget($args, $instance) |
|
355 | + { |
|
356 | + // prints the widget |
|
357 | + extract($args, EXTR_SKIP); |
|
358 | + |
|
359 | + /** |
|
360 | + * Filter the widget title text. |
|
361 | + * |
|
362 | + * @since 1.0.0 |
|
363 | + * @global object $current_user Current user object. |
|
364 | + * @param string $title The widget title text. |
|
365 | + */ |
|
366 | + $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); |
|
367 | + |
|
368 | + global $current_user, $post; |
|
369 | + echo $before_widget; |
|
370 | + ?> |
|
371 | 371 | |
372 | 372 | <?php //if ( get_option('gd_tweet_button') ) { |
373 | - ?> |
|
373 | + ?> |
|
374 | 374 | |
375 | 375 | <a href="http://twitter.com/share" |
376 | 376 | class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a> |
@@ -378,23 +378,23 @@ discard block |
||
378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
379 | 379 | |
380 | 380 | <?php //} |
381 | - ?> |
|
381 | + ?> |
|
382 | 382 | |
383 | 383 | <?php // if ( get_option('gd_facebook_button') ) { |
384 | - ?> |
|
384 | + ?> |
|
385 | 385 | |
386 | 386 | <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { |
387 | - echo 'allowtransparency="true"'; |
|
388 | - }?> class="facebook" |
|
387 | + echo 'allowtransparency="true"'; |
|
388 | + }?> class="facebook" |
|
389 | 389 | src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
390 | 390 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
391 | 391 | |
392 | 392 | |
393 | 393 | <?php //} |
394 | - ?> |
|
394 | + ?> |
|
395 | 395 | |
396 | 396 | <?php //if ( get_option('gd_google_button') ) { |
397 | - ?> |
|
397 | + ?> |
|
398 | 398 | <script> |
399 | 399 | window.___gcfg = { |
400 | 400 | parsetags: 'explicit' |
@@ -408,118 +408,118 @@ discard block |
||
408 | 408 | "count": "true" |
409 | 409 | });</script> |
410 | 410 | <?php //} |
411 | - echo $after_widget; |
|
412 | - |
|
413 | - } |
|
414 | - |
|
415 | - /** |
|
416 | - * Sanitize social like widget form values as they are saved. |
|
417 | - * |
|
418 | - * @since 1.0.0 |
|
419 | - * @since 1.5.1 Declare function public. |
|
420 | - * |
|
421 | - * @param array $new_instance Values just sent to be saved. |
|
422 | - * @param array $old_instance Previously saved values from database. |
|
423 | - * |
|
424 | - * @return array Updated safe values to be saved. |
|
425 | - */ |
|
426 | - public function update($new_instance, $old_instance) |
|
427 | - { |
|
428 | - //save the widget |
|
429 | - $instance = $old_instance; |
|
430 | - $instance['title'] = strip_tags($new_instance['title']); |
|
431 | - return $instance; |
|
432 | - } |
|
433 | - |
|
434 | - /** |
|
435 | - * Back-end social like widget settings form. |
|
436 | - * |
|
437 | - * @since 1.0.0 |
|
438 | - * @since 1.5.1 Declare function public. |
|
439 | - * |
|
440 | - * @param array $instance Previously saved values from database. |
|
441 | - * @return string|void |
|
442 | - */ |
|
443 | - public function form($instance) |
|
444 | - { |
|
445 | - //widgetform in backend |
|
446 | - $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
447 | - $title = strip_tags($instance['title']); |
|
448 | - ?> |
|
411 | + echo $after_widget; |
|
412 | + |
|
413 | + } |
|
414 | + |
|
415 | + /** |
|
416 | + * Sanitize social like widget form values as they are saved. |
|
417 | + * |
|
418 | + * @since 1.0.0 |
|
419 | + * @since 1.5.1 Declare function public. |
|
420 | + * |
|
421 | + * @param array $new_instance Values just sent to be saved. |
|
422 | + * @param array $old_instance Previously saved values from database. |
|
423 | + * |
|
424 | + * @return array Updated safe values to be saved. |
|
425 | + */ |
|
426 | + public function update($new_instance, $old_instance) |
|
427 | + { |
|
428 | + //save the widget |
|
429 | + $instance = $old_instance; |
|
430 | + $instance['title'] = strip_tags($new_instance['title']); |
|
431 | + return $instance; |
|
432 | + } |
|
433 | + |
|
434 | + /** |
|
435 | + * Back-end social like widget settings form. |
|
436 | + * |
|
437 | + * @since 1.0.0 |
|
438 | + * @since 1.5.1 Declare function public. |
|
439 | + * |
|
440 | + * @param array $instance Previously saved values from database. |
|
441 | + * @return string|void |
|
442 | + */ |
|
443 | + public function form($instance) |
|
444 | + { |
|
445 | + //widgetform in backend |
|
446 | + $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
447 | + $title = strip_tags($instance['title']); |
|
448 | + ?> |
|
449 | 449 | <p>No settings for this widget</p> |
450 | 450 | |
451 | 451 | |
452 | 452 | <?php |
453 | - } |
|
454 | - } |
|
455 | - |
|
456 | - register_widget('geodir_social_like_widget'); |
|
457 | - |
|
458 | - |
|
459 | - /** |
|
460 | - * GeoDirectory Feedburner Subscribe widget. |
|
461 | - * |
|
462 | - * @since 1.0.0 |
|
463 | - */ |
|
464 | - class geodirsubscribeWidget extends WP_Widget |
|
465 | - { |
|
466 | - |
|
467 | - /** |
|
468 | - * Register the feedburner subscribe widget with WordPress. |
|
469 | - * |
|
470 | - * @since 1.0.0 |
|
471 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
472 | - */ |
|
473 | - public function __construct() { |
|
474 | - $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory')); |
|
475 | - parent::__construct( |
|
476 | - 'widget_subscribeWidget', // Base ID |
|
477 | - __('GD > Subscribe', 'geodirectory'), // Name |
|
478 | - $widget_ops// Args |
|
479 | - ); |
|
480 | - } |
|
481 | - |
|
482 | - /** |
|
483 | - * Front-end display content for feedburner subscribe widget. |
|
484 | - * |
|
485 | - * @since 1.0.0 |
|
486 | - * @since 1.5.1 Declare function public. |
|
487 | - * |
|
488 | - * @param array $args Widget arguments. |
|
489 | - * @param array $instance Saved values from database. |
|
490 | - */ |
|
491 | - public function widget($args, $instance) |
|
492 | - { |
|
493 | - // prints the widget |
|
494 | - extract($args, EXTR_SKIP); |
|
495 | - |
|
496 | - /** |
|
497 | - * Filter the widget instance id. |
|
498 | - * |
|
499 | - * @since 1.0.0 |
|
500 | - * @param string $id The widget instance id. |
|
501 | - */ |
|
502 | - $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']); |
|
503 | - |
|
504 | - /** This filter is documented in geodirectory_widgets.php */ |
|
505 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
506 | - |
|
507 | - /** |
|
508 | - * Filter the widget text. |
|
509 | - * |
|
510 | - * @since 1.0.0 |
|
511 | - * @param string $text The widget text. |
|
512 | - */ |
|
513 | - $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']); |
|
514 | - |
|
515 | - echo $before_widget; |
|
516 | - ?> |
|
453 | + } |
|
454 | + } |
|
455 | + |
|
456 | + register_widget('geodir_social_like_widget'); |
|
457 | + |
|
458 | + |
|
459 | + /** |
|
460 | + * GeoDirectory Feedburner Subscribe widget. |
|
461 | + * |
|
462 | + * @since 1.0.0 |
|
463 | + */ |
|
464 | + class geodirsubscribeWidget extends WP_Widget |
|
465 | + { |
|
466 | + |
|
467 | + /** |
|
468 | + * Register the feedburner subscribe widget with WordPress. |
|
469 | + * |
|
470 | + * @since 1.0.0 |
|
471 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
472 | + */ |
|
473 | + public function __construct() { |
|
474 | + $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory')); |
|
475 | + parent::__construct( |
|
476 | + 'widget_subscribeWidget', // Base ID |
|
477 | + __('GD > Subscribe', 'geodirectory'), // Name |
|
478 | + $widget_ops// Args |
|
479 | + ); |
|
480 | + } |
|
481 | + |
|
482 | + /** |
|
483 | + * Front-end display content for feedburner subscribe widget. |
|
484 | + * |
|
485 | + * @since 1.0.0 |
|
486 | + * @since 1.5.1 Declare function public. |
|
487 | + * |
|
488 | + * @param array $args Widget arguments. |
|
489 | + * @param array $instance Saved values from database. |
|
490 | + */ |
|
491 | + public function widget($args, $instance) |
|
492 | + { |
|
493 | + // prints the widget |
|
494 | + extract($args, EXTR_SKIP); |
|
495 | + |
|
496 | + /** |
|
497 | + * Filter the widget instance id. |
|
498 | + * |
|
499 | + * @since 1.0.0 |
|
500 | + * @param string $id The widget instance id. |
|
501 | + */ |
|
502 | + $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']); |
|
503 | + |
|
504 | + /** This filter is documented in geodirectory_widgets.php */ |
|
505 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
506 | + |
|
507 | + /** |
|
508 | + * Filter the widget text. |
|
509 | + * |
|
510 | + * @since 1.0.0 |
|
511 | + * @param string $text The widget text. |
|
512 | + */ |
|
513 | + $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']); |
|
514 | + |
|
515 | + echo $before_widget; |
|
516 | + ?> |
|
517 | 517 | |
518 | 518 | <?php echo $before_title . $title; ?> <a href="<?php if ($id) { |
519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
520 | - } else { |
|
521 | - bloginfo('rss_url'); |
|
522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
519 | + echo 'http://feeds2.feedburner.com/' . $id; |
|
520 | + } else { |
|
521 | + bloginfo('rss_url'); |
|
522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
523 | 523 | |
524 | 524 | <?php if ($text <> "") { ?> |
525 | 525 | |
@@ -544,57 +544,57 @@ discard block |
||
544 | 544 | </form> |
545 | 545 | |
546 | 546 | <?php |
547 | - echo $after_widget; |
|
547 | + echo $after_widget; |
|
548 | 548 | |
549 | - } |
|
549 | + } |
|
550 | 550 | |
551 | - /** |
|
552 | - * Sanitize feedburner subscribe widget form values as they are saved. |
|
553 | - * |
|
554 | - * @since 1.0.0 |
|
555 | - * @since 1.5.1 Declare function public. |
|
556 | - * |
|
557 | - * @param array $new_instance Values just sent to be saved. |
|
558 | - * @param array $old_instance Previously saved values from database. |
|
559 | - * |
|
560 | - * @return array Updated safe values to be saved. |
|
561 | - */ |
|
562 | - public function update($new_instance, $old_instance) |
|
563 | - { |
|
551 | + /** |
|
552 | + * Sanitize feedburner subscribe widget form values as they are saved. |
|
553 | + * |
|
554 | + * @since 1.0.0 |
|
555 | + * @since 1.5.1 Declare function public. |
|
556 | + * |
|
557 | + * @param array $new_instance Values just sent to be saved. |
|
558 | + * @param array $old_instance Previously saved values from database. |
|
559 | + * |
|
560 | + * @return array Updated safe values to be saved. |
|
561 | + */ |
|
562 | + public function update($new_instance, $old_instance) |
|
563 | + { |
|
564 | 564 | |
565 | - //save the widget |
|
566 | - $instance = $old_instance; |
|
567 | - $instance['id'] = strip_tags($new_instance['id']); |
|
568 | - $instance['title'] = ($new_instance['title']); |
|
569 | - $instance['text'] = ($new_instance['text']); |
|
565 | + //save the widget |
|
566 | + $instance = $old_instance; |
|
567 | + $instance['id'] = strip_tags($new_instance['id']); |
|
568 | + $instance['title'] = ($new_instance['title']); |
|
569 | + $instance['text'] = ($new_instance['text']); |
|
570 | 570 | |
571 | 571 | |
572 | - return $instance; |
|
573 | - } |
|
572 | + return $instance; |
|
573 | + } |
|
574 | 574 | |
575 | - /** |
|
576 | - * Back-end feedburner subscribe widget settings form. |
|
577 | - * |
|
578 | - * @since 1.0.0 |
|
579 | - * @since 1.5.1 Declare function public. |
|
580 | - * |
|
581 | - * @param array $instance Previously saved values from database. |
|
582 | - * @return string|void |
|
583 | - */ |
|
584 | - public function form($instance) |
|
585 | - { |
|
586 | - //widgetform in backend |
|
587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
575 | + /** |
|
576 | + * Back-end feedburner subscribe widget settings form. |
|
577 | + * |
|
578 | + * @since 1.0.0 |
|
579 | + * @since 1.5.1 Declare function public. |
|
580 | + * |
|
581 | + * @param array $instance Previously saved values from database. |
|
582 | + * @return string|void |
|
583 | + */ |
|
584 | + public function form($instance) |
|
585 | + { |
|
586 | + //widgetform in backend |
|
587 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
588 | 588 | |
589 | - $id = strip_tags($instance['id']); |
|
589 | + $id = strip_tags($instance['id']); |
|
590 | 590 | |
591 | - $title = strip_tags($instance['title']); |
|
591 | + $title = strip_tags($instance['title']); |
|
592 | 592 | |
593 | - $text = strip_tags($instance['text']); |
|
593 | + $text = strip_tags($instance['text']); |
|
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | - ?> |
|
597 | + ?> |
|
598 | 598 | <p><label |
599 | 599 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>: |
600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -613,101 +613,101 @@ discard block |
||
613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label> |
614 | 614 | </p> |
615 | 615 | <?php |
616 | - } |
|
617 | - } |
|
618 | - |
|
619 | - register_widget('geodirsubscribeWidget'); |
|
620 | - |
|
621 | - /** |
|
622 | - * GeoDirectory advertise widget. |
|
623 | - * |
|
624 | - * @since 1.0.0 |
|
625 | - */ |
|
626 | - class geodiradvtwidget extends WP_Widget |
|
627 | - { |
|
628 | - |
|
629 | - /** |
|
630 | - * Register the advertise widget with WordPress. |
|
631 | - * |
|
632 | - * @since 1.0.0 |
|
633 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
634 | - */ |
|
635 | - public function __construct() { |
|
636 | - $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory')); |
|
637 | - parent::__construct( |
|
638 | - 'advtwidget', // Base ID |
|
639 | - __('GD > Advertise', 'geodirectory'), // Name |
|
640 | - $widget_ops// Args |
|
641 | - ); |
|
642 | - } |
|
643 | - |
|
644 | - |
|
645 | - /** |
|
646 | - * Front-end display content for advertise widget. |
|
647 | - * |
|
648 | - * @since 1.0.0 |
|
649 | - * @since 1.5.1 Declare function public. |
|
650 | - * |
|
651 | - * @param array $args Widget arguments. |
|
652 | - * @param array $instance Saved values from database. |
|
653 | - */ |
|
654 | - public function widget($args, $instance) |
|
655 | - { |
|
656 | - |
|
657 | - // prints the widget |
|
658 | - |
|
659 | - extract($args, EXTR_SKIP); |
|
660 | - |
|
661 | - /** |
|
662 | - * Filter the description text. |
|
663 | - * |
|
664 | - * @since 1.0.0 |
|
665 | - * @param string $desc1 The widget description text. |
|
666 | - */ |
|
667 | - $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']); |
|
668 | - echo $before_widget; |
|
669 | - ?> |
|
616 | + } |
|
617 | + } |
|
618 | + |
|
619 | + register_widget('geodirsubscribeWidget'); |
|
620 | + |
|
621 | + /** |
|
622 | + * GeoDirectory advertise widget. |
|
623 | + * |
|
624 | + * @since 1.0.0 |
|
625 | + */ |
|
626 | + class geodiradvtwidget extends WP_Widget |
|
627 | + { |
|
628 | + |
|
629 | + /** |
|
630 | + * Register the advertise widget with WordPress. |
|
631 | + * |
|
632 | + * @since 1.0.0 |
|
633 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
634 | + */ |
|
635 | + public function __construct() { |
|
636 | + $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory')); |
|
637 | + parent::__construct( |
|
638 | + 'advtwidget', // Base ID |
|
639 | + __('GD > Advertise', 'geodirectory'), // Name |
|
640 | + $widget_ops// Args |
|
641 | + ); |
|
642 | + } |
|
643 | + |
|
644 | + |
|
645 | + /** |
|
646 | + * Front-end display content for advertise widget. |
|
647 | + * |
|
648 | + * @since 1.0.0 |
|
649 | + * @since 1.5.1 Declare function public. |
|
650 | + * |
|
651 | + * @param array $args Widget arguments. |
|
652 | + * @param array $instance Saved values from database. |
|
653 | + */ |
|
654 | + public function widget($args, $instance) |
|
655 | + { |
|
656 | + |
|
657 | + // prints the widget |
|
658 | + |
|
659 | + extract($args, EXTR_SKIP); |
|
660 | + |
|
661 | + /** |
|
662 | + * Filter the description text. |
|
663 | + * |
|
664 | + * @since 1.0.0 |
|
665 | + * @param string $desc1 The widget description text. |
|
666 | + */ |
|
667 | + $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']); |
|
668 | + echo $before_widget; |
|
669 | + ?> |
|
670 | 670 | <?php if ($desc1 <> "") { ?> |
671 | 671 | <?php echo $desc1; ?> |
672 | 672 | <?php } |
673 | - echo $after_widget; |
|
674 | - } |
|
675 | - |
|
676 | - /** |
|
677 | - * Sanitize advertise widget form values as they are saved. |
|
678 | - * |
|
679 | - * @since 1.0.0 |
|
680 | - * @since 1.5.1 Declare function public. |
|
681 | - * |
|
682 | - * @param array $new_instance Values just sent to be saved. |
|
683 | - * @param array $old_instance Previously saved values from database. |
|
684 | - * |
|
685 | - * @return array Updated safe values to be saved. |
|
686 | - */ |
|
687 | - public function update($new_instance, $old_instance) |
|
688 | - { |
|
689 | - //save the widget |
|
690 | - $instance = $old_instance; |
|
691 | - $instance['desc1'] = ($new_instance['desc1']); |
|
692 | - return $instance; |
|
693 | - } |
|
694 | - |
|
695 | - /** |
|
696 | - * Back-end advertise widget settings form. |
|
697 | - * |
|
698 | - * @since 1.0.0 |
|
699 | - * @since 1.5.1 Declare function public. |
|
700 | - * |
|
701 | - * @param array $instance Previously saved values from database. |
|
702 | - * @return string|void |
|
703 | - */ |
|
704 | - public function form($instance) |
|
705 | - { |
|
706 | - //widgetform in backend |
|
707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | - |
|
709 | - $desc1 = ($instance['desc1']); |
|
710 | - ?> |
|
673 | + echo $after_widget; |
|
674 | + } |
|
675 | + |
|
676 | + /** |
|
677 | + * Sanitize advertise widget form values as they are saved. |
|
678 | + * |
|
679 | + * @since 1.0.0 |
|
680 | + * @since 1.5.1 Declare function public. |
|
681 | + * |
|
682 | + * @param array $new_instance Values just sent to be saved. |
|
683 | + * @param array $old_instance Previously saved values from database. |
|
684 | + * |
|
685 | + * @return array Updated safe values to be saved. |
|
686 | + */ |
|
687 | + public function update($new_instance, $old_instance) |
|
688 | + { |
|
689 | + //save the widget |
|
690 | + $instance = $old_instance; |
|
691 | + $instance['desc1'] = ($new_instance['desc1']); |
|
692 | + return $instance; |
|
693 | + } |
|
694 | + |
|
695 | + /** |
|
696 | + * Back-end advertise widget settings form. |
|
697 | + * |
|
698 | + * @since 1.0.0 |
|
699 | + * @since 1.5.1 Declare function public. |
|
700 | + * |
|
701 | + * @param array $instance Previously saved values from database. |
|
702 | + * @return string|void |
|
703 | + */ |
|
704 | + public function form($instance) |
|
705 | + { |
|
706 | + //widgetform in backend |
|
707 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | + |
|
709 | + $desc1 = ($instance['desc1']); |
|
710 | + ?> |
|
711 | 711 | <p><label |
712 | 712 | for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?> |
713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>" |
@@ -715,65 +715,65 @@ discard block |
||
715 | 715 | </p> |
716 | 716 | |
717 | 717 | <?php |
718 | - } |
|
719 | - } |
|
720 | - |
|
721 | - register_widget('geodiradvtwidget'); |
|
722 | - |
|
723 | - /** |
|
724 | - * GeoDirectory Flickr widget. |
|
725 | - * |
|
726 | - * @since 1.0.0 |
|
727 | - */ |
|
728 | - class GeodirFlickrWidget extends WP_Widget |
|
729 | - { |
|
730 | - |
|
731 | - /** |
|
732 | - * Register the flickr widget with WordPress. |
|
733 | - * |
|
734 | - * @since 1.0.0 |
|
735 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
736 | - */ |
|
737 | - public function __construct() { |
|
738 | - $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory')); |
|
739 | - parent::__construct( |
|
740 | - 'widget_flickrwidget', // Base ID |
|
741 | - __('GD > Flickr Photos', 'geodirectory'), // Name |
|
742 | - $widget_ops// Args |
|
743 | - ); |
|
744 | - } |
|
745 | - |
|
746 | - /** |
|
747 | - * Front-end display content for flickr widget. |
|
748 | - * |
|
749 | - * @since 1.0.0 |
|
750 | - * @since 1.5.1 Declare function public. |
|
751 | - * |
|
752 | - * @param array $args Widget arguments. |
|
753 | - * @param array $instance Saved values from database. |
|
754 | - */ |
|
755 | - public function widget($args, $instance) |
|
756 | - { |
|
757 | - |
|
758 | - // prints the widget |
|
759 | - extract($args, EXTR_SKIP); |
|
760 | - |
|
761 | - echo $before_widget; |
|
762 | - |
|
763 | - /** This filter is documented in geodirectory_widgets.php */ |
|
764 | - $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']); |
|
765 | - |
|
766 | - /** |
|
767 | - * Filter the widget number. |
|
768 | - * |
|
769 | - * This is used in the flicker widget to show how many images to show. |
|
770 | - * |
|
771 | - * @since 1.0.0 |
|
772 | - * @param string $number The image count. |
|
773 | - */ |
|
774 | - $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
|
775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
776 | - ?> |
|
718 | + } |
|
719 | + } |
|
720 | + |
|
721 | + register_widget('geodiradvtwidget'); |
|
722 | + |
|
723 | + /** |
|
724 | + * GeoDirectory Flickr widget. |
|
725 | + * |
|
726 | + * @since 1.0.0 |
|
727 | + */ |
|
728 | + class GeodirFlickrWidget extends WP_Widget |
|
729 | + { |
|
730 | + |
|
731 | + /** |
|
732 | + * Register the flickr widget with WordPress. |
|
733 | + * |
|
734 | + * @since 1.0.0 |
|
735 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
736 | + */ |
|
737 | + public function __construct() { |
|
738 | + $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory')); |
|
739 | + parent::__construct( |
|
740 | + 'widget_flickrwidget', // Base ID |
|
741 | + __('GD > Flickr Photos', 'geodirectory'), // Name |
|
742 | + $widget_ops// Args |
|
743 | + ); |
|
744 | + } |
|
745 | + |
|
746 | + /** |
|
747 | + * Front-end display content for flickr widget. |
|
748 | + * |
|
749 | + * @since 1.0.0 |
|
750 | + * @since 1.5.1 Declare function public. |
|
751 | + * |
|
752 | + * @param array $args Widget arguments. |
|
753 | + * @param array $instance Saved values from database. |
|
754 | + */ |
|
755 | + public function widget($args, $instance) |
|
756 | + { |
|
757 | + |
|
758 | + // prints the widget |
|
759 | + extract($args, EXTR_SKIP); |
|
760 | + |
|
761 | + echo $before_widget; |
|
762 | + |
|
763 | + /** This filter is documented in geodirectory_widgets.php */ |
|
764 | + $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']); |
|
765 | + |
|
766 | + /** |
|
767 | + * Filter the widget number. |
|
768 | + * |
|
769 | + * This is used in the flicker widget to show how many images to show. |
|
770 | + * |
|
771 | + * @since 1.0.0 |
|
772 | + * @param string $number The image count. |
|
773 | + */ |
|
774 | + $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
|
775 | + echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
776 | + ?> |
|
777 | 777 | |
778 | 778 | <div class="geodir-flickr clearfix"> |
779 | 779 | |
@@ -784,45 +784,45 @@ discard block |
||
784 | 784 | |
785 | 785 | |
786 | 786 | <?php echo $after_widget; |
787 | - } |
|
788 | - |
|
789 | - /** |
|
790 | - * Sanitize flickr widget form values as they are saved. |
|
791 | - * |
|
792 | - * @since 1.0.0 |
|
793 | - * @since 1.5.1 Declare function public. |
|
794 | - * |
|
795 | - * @param array $new_instance Values just sent to be saved. |
|
796 | - * @param array $old_instance Previously saved values from database. |
|
797 | - * |
|
798 | - * @return array Updated safe values to be saved. |
|
799 | - */ |
|
800 | - public function update($new_instance, $old_instance) |
|
801 | - { |
|
802 | - //save the widget |
|
803 | - $instance = $old_instance; |
|
804 | - $instance['id'] = strip_tags($new_instance['id']); |
|
805 | - $instance['number'] = strip_tags($new_instance['number']); |
|
806 | - return $instance; |
|
807 | - } |
|
808 | - |
|
809 | - /** |
|
810 | - * Back-end flickr widget settings form. |
|
811 | - * |
|
812 | - * @since 1.0.0 |
|
813 | - * @since 1.5.1 Declare function public. |
|
814 | - * |
|
815 | - * @param array $instance Previously saved values from database. |
|
816 | - * @return string|void |
|
817 | - */ |
|
818 | - public function form($instance) |
|
819 | - { |
|
820 | - |
|
821 | - //widgetform in backend |
|
822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | - $id = strip_tags($instance['id']); |
|
824 | - $number = strip_tags($instance['number']); |
|
825 | - ?> |
|
787 | + } |
|
788 | + |
|
789 | + /** |
|
790 | + * Sanitize flickr widget form values as they are saved. |
|
791 | + * |
|
792 | + * @since 1.0.0 |
|
793 | + * @since 1.5.1 Declare function public. |
|
794 | + * |
|
795 | + * @param array $new_instance Values just sent to be saved. |
|
796 | + * @param array $old_instance Previously saved values from database. |
|
797 | + * |
|
798 | + * @return array Updated safe values to be saved. |
|
799 | + */ |
|
800 | + public function update($new_instance, $old_instance) |
|
801 | + { |
|
802 | + //save the widget |
|
803 | + $instance = $old_instance; |
|
804 | + $instance['id'] = strip_tags($new_instance['id']); |
|
805 | + $instance['number'] = strip_tags($new_instance['number']); |
|
806 | + return $instance; |
|
807 | + } |
|
808 | + |
|
809 | + /** |
|
810 | + * Back-end flickr widget settings form. |
|
811 | + * |
|
812 | + * @since 1.0.0 |
|
813 | + * @since 1.5.1 Declare function public. |
|
814 | + * |
|
815 | + * @param array $instance Previously saved values from database. |
|
816 | + * @return string|void |
|
817 | + */ |
|
818 | + public function form($instance) |
|
819 | + { |
|
820 | + |
|
821 | + //widgetform in backend |
|
822 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | + $id = strip_tags($instance['id']); |
|
824 | + $number = strip_tags($instance['number']); |
|
825 | + ?> |
|
826 | 826 | |
827 | 827 | <p> |
828 | 828 | <label |
@@ -843,99 +843,99 @@ discard block |
||
843 | 843 | </label> |
844 | 844 | </p> |
845 | 845 | <?php |
846 | - } |
|
847 | - } |
|
848 | - |
|
849 | - register_widget('GeodirFlickrWidget'); |
|
850 | - |
|
851 | - /** |
|
852 | - * GeoDirectory Twitter widget. |
|
853 | - * |
|
854 | - * @since 1.0.0 |
|
855 | - */ |
|
856 | - class geodir_twitter extends WP_Widget |
|
857 | - { |
|
858 | - /** |
|
859 | - * Register the Twitter widget with WordPress. |
|
860 | - * |
|
861 | - * @since 1.0.0 |
|
862 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
863 | - */ |
|
864 | - public function __construct() { |
|
865 | - $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory')); |
|
866 | - parent::__construct( |
|
867 | - 'widget_Twidget', // Base ID |
|
868 | - __('GD > Twitter', 'geodirectory'), // Name |
|
869 | - $widget_ops// Args |
|
870 | - ); |
|
871 | - } |
|
872 | - |
|
873 | - |
|
874 | - /** |
|
875 | - * Front-end display content for Twitter widget. |
|
876 | - * |
|
877 | - * @since 1.0.0 |
|
878 | - * @since 1.5.1 Declare function public. |
|
879 | - * |
|
880 | - * @param array $args Widget arguments. |
|
881 | - * @param array $instance Saved values from database. |
|
882 | - */ |
|
883 | - public function widget($args, $instance) |
|
884 | - { |
|
885 | - |
|
886 | - // prints the widget |
|
887 | - |
|
888 | - extract($args, EXTR_SKIP); |
|
889 | - |
|
890 | - /** |
|
891 | - * Filter the twitter widget description text. |
|
892 | - * |
|
893 | - * @since 1.0.0 |
|
894 | - * @param string $desc1 The widget description text. |
|
895 | - */ |
|
896 | - $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']); |
|
897 | - echo $before_widget; |
|
898 | - if ($desc1 <> "") { |
|
899 | - echo $desc1; |
|
900 | - } |
|
901 | - echo $after_widget; |
|
902 | - } |
|
903 | - |
|
904 | - /** |
|
905 | - * Sanitize twitter widget form values as they are saved. |
|
906 | - * |
|
907 | - * @since 1.0.0 |
|
908 | - * @since 1.5.1 Declare function public. |
|
909 | - * |
|
910 | - * @param array $new_instance Values just sent to be saved. |
|
911 | - * @param array $old_instance Previously saved values from database. |
|
912 | - * |
|
913 | - * @return array Updated safe values to be saved. |
|
914 | - */ |
|
915 | - public function update($new_instance, $old_instance) |
|
916 | - { |
|
917 | - //save the widget |
|
918 | - $instance = $old_instance; |
|
919 | - $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
920 | - return $instance; |
|
921 | - } |
|
922 | - |
|
923 | - /** |
|
924 | - * Back-end twitter widget settings form. |
|
925 | - * |
|
926 | - * @since 1.0.0 |
|
927 | - * @since 1.5.1 Declare function public. |
|
928 | - * |
|
929 | - * @param array $instance Previously saved values from database. |
|
930 | - * @return string|void |
|
931 | - */ |
|
932 | - public function form($instance) |
|
933 | - { |
|
934 | - //widgetform in backend |
|
935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | - |
|
937 | - $desc1 = ($instance['gd_tw_desc1']); |
|
938 | - ?> |
|
846 | + } |
|
847 | + } |
|
848 | + |
|
849 | + register_widget('GeodirFlickrWidget'); |
|
850 | + |
|
851 | + /** |
|
852 | + * GeoDirectory Twitter widget. |
|
853 | + * |
|
854 | + * @since 1.0.0 |
|
855 | + */ |
|
856 | + class geodir_twitter extends WP_Widget |
|
857 | + { |
|
858 | + /** |
|
859 | + * Register the Twitter widget with WordPress. |
|
860 | + * |
|
861 | + * @since 1.0.0 |
|
862 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
863 | + */ |
|
864 | + public function __construct() { |
|
865 | + $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory')); |
|
866 | + parent::__construct( |
|
867 | + 'widget_Twidget', // Base ID |
|
868 | + __('GD > Twitter', 'geodirectory'), // Name |
|
869 | + $widget_ops// Args |
|
870 | + ); |
|
871 | + } |
|
872 | + |
|
873 | + |
|
874 | + /** |
|
875 | + * Front-end display content for Twitter widget. |
|
876 | + * |
|
877 | + * @since 1.0.0 |
|
878 | + * @since 1.5.1 Declare function public. |
|
879 | + * |
|
880 | + * @param array $args Widget arguments. |
|
881 | + * @param array $instance Saved values from database. |
|
882 | + */ |
|
883 | + public function widget($args, $instance) |
|
884 | + { |
|
885 | + |
|
886 | + // prints the widget |
|
887 | + |
|
888 | + extract($args, EXTR_SKIP); |
|
889 | + |
|
890 | + /** |
|
891 | + * Filter the twitter widget description text. |
|
892 | + * |
|
893 | + * @since 1.0.0 |
|
894 | + * @param string $desc1 The widget description text. |
|
895 | + */ |
|
896 | + $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']); |
|
897 | + echo $before_widget; |
|
898 | + if ($desc1 <> "") { |
|
899 | + echo $desc1; |
|
900 | + } |
|
901 | + echo $after_widget; |
|
902 | + } |
|
903 | + |
|
904 | + /** |
|
905 | + * Sanitize twitter widget form values as they are saved. |
|
906 | + * |
|
907 | + * @since 1.0.0 |
|
908 | + * @since 1.5.1 Declare function public. |
|
909 | + * |
|
910 | + * @param array $new_instance Values just sent to be saved. |
|
911 | + * @param array $old_instance Previously saved values from database. |
|
912 | + * |
|
913 | + * @return array Updated safe values to be saved. |
|
914 | + */ |
|
915 | + public function update($new_instance, $old_instance) |
|
916 | + { |
|
917 | + //save the widget |
|
918 | + $instance = $old_instance; |
|
919 | + $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
920 | + return $instance; |
|
921 | + } |
|
922 | + |
|
923 | + /** |
|
924 | + * Back-end twitter widget settings form. |
|
925 | + * |
|
926 | + * @since 1.0.0 |
|
927 | + * @since 1.5.1 Declare function public. |
|
928 | + * |
|
929 | + * @param array $instance Previously saved values from database. |
|
930 | + * @return string|void |
|
931 | + */ |
|
932 | + public function form($instance) |
|
933 | + { |
|
934 | + //widgetform in backend |
|
935 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | + |
|
937 | + $desc1 = ($instance['gd_tw_desc1']); |
|
938 | + ?> |
|
939 | 939 | <p><label |
940 | 940 | for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?> |
941 | 941 | <textarea class="widefat" rows="6" cols="20" |
@@ -944,179 +944,179 @@ discard block |
||
944 | 944 | </p> |
945 | 945 | |
946 | 946 | <?php |
947 | - } |
|
948 | - } |
|
949 | - |
|
950 | - register_widget('geodir_twitter'); |
|
951 | - |
|
952 | - /** |
|
953 | - * GeoDirectory Advanced Search widget. |
|
954 | - * |
|
955 | - * @since 1.0.0 |
|
956 | - */ |
|
957 | - class geodir_advance_search_widget extends WP_Widget |
|
958 | - { |
|
959 | - /** |
|
960 | - * Register the advanced search widget with WordPress. |
|
961 | - * |
|
962 | - * @since 1.0.0 |
|
963 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
964 | - */ |
|
965 | - public function __construct() { |
|
966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
967 | - parent::__construct( |
|
968 | - 'geodir_advance_search', // Base ID |
|
969 | - __('GD > Search', 'geodirectory'), // Name |
|
970 | - $widget_ops// Args |
|
971 | - ); |
|
972 | - } |
|
973 | - |
|
974 | - |
|
975 | - /** |
|
976 | - * Front-end display content for advanced search widget. |
|
977 | - * |
|
978 | - * @since 1.0.0 |
|
979 | - * @since 1.5.1 Declare function public. |
|
980 | - * |
|
981 | - * @param array $args Widget arguments. |
|
982 | - * @param array $instance Saved values from database. |
|
983 | - */ |
|
984 | - public function widget($args, $instance) |
|
985 | - { |
|
986 | - /** |
|
987 | - * Filter the search widget arguments. |
|
988 | - * |
|
989 | - * @since 1.5.7 |
|
990 | - * @param array $args The widget arguments. |
|
991 | - * @param array $instance The widget instance. |
|
992 | - */ |
|
993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
994 | - |
|
995 | - // prints the widget |
|
996 | - extract($args, EXTR_SKIP); |
|
997 | - |
|
998 | - if(isset($post_type) && $post_type){ |
|
999 | - geodir_get_search_post_type($post_type);// set the post type |
|
1000 | - }else{ |
|
1001 | - geodir_get_search_post_type();// set the post type |
|
1002 | - } |
|
1003 | - |
|
1004 | - echo $before_widget; |
|
1005 | - |
|
1006 | - /** This filter is documented in geodirectory_widgets.php */ |
|
1007 | - $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
1008 | - |
|
1009 | - geodir_get_template_part('listing', 'filter-form'); |
|
1010 | - |
|
1011 | - echo $after_widget; |
|
1012 | - |
|
1013 | - // after outputing the search reset the CPT |
|
1014 | - global $geodir_search_post_type; |
|
1015 | - $geodir_search_post_type = ''; |
|
1016 | - } |
|
1017 | - |
|
1018 | - /** |
|
1019 | - * Sanitize advanced search widget form values as they are saved. |
|
1020 | - * |
|
1021 | - * @since 1.0.0 |
|
1022 | - * @since 1.5.1 Declare function public. |
|
1023 | - * |
|
1024 | - * @param array $new_instance Values just sent to be saved. |
|
1025 | - * @param array $old_instance Previously saved values from database. |
|
1026 | - * |
|
1027 | - * @return array Updated safe values to be saved. |
|
1028 | - */ |
|
1029 | - public function update($new_instance, $old_instance) |
|
1030 | - { |
|
1031 | - //save the widget |
|
1032 | - //Nothing to save |
|
1033 | - return isset($instance) ? $instance : array(); |
|
1034 | - } |
|
1035 | - |
|
1036 | - /** |
|
1037 | - * Back-end advanced search widget settings form. |
|
1038 | - * |
|
1039 | - * @since 1.0.0 |
|
1040 | - * @since 1.5.1 Declare function public. |
|
1041 | - * |
|
1042 | - * @param array $instance Previously saved values from database. |
|
1043 | - * @return string|void |
|
1044 | - */ |
|
1045 | - public function form($instance) |
|
1046 | - { |
|
1047 | - //widgetform in backend |
|
1048 | - echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory'); |
|
1049 | - } |
|
1050 | - } |
|
1051 | - |
|
1052 | - register_widget('geodir_advance_search_widget'); |
|
1053 | - |
|
1054 | - |
|
1055 | - /** |
|
1056 | - * Contains all functions for popular widget. |
|
1057 | - * |
|
1058 | - * @since 1.0.0 |
|
1059 | - * @package GeoDirectory |
|
1060 | - */ |
|
1061 | - include_once('geodirectory-widgets/geodirectory_popular_widget.php'); |
|
1062 | - /** |
|
1063 | - * Contains all functions for listing slider widget. |
|
1064 | - * |
|
1065 | - * @since 1.0.0 |
|
1066 | - * @package GeoDirectory |
|
1067 | - */ |
|
1068 | - include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php'); |
|
1069 | - /** |
|
1070 | - * Contains all functions for home map widget. |
|
1071 | - * |
|
1072 | - * @since 1.0.0 |
|
1073 | - * @package GeoDirectory |
|
1074 | - */ |
|
1075 | - include_once('geodirectory-widgets/home_map_widget.php'); |
|
1076 | - /** |
|
1077 | - * Contains all functions for listing map widget. |
|
1078 | - * |
|
1079 | - * @since 1.0.0 |
|
1080 | - * @package GeoDirectory |
|
1081 | - */ |
|
1082 | - include_once('geodirectory-widgets/listing_map_widget.php'); |
|
1083 | - /** |
|
1084 | - * Contains all functions for reviews widget. |
|
1085 | - * |
|
1086 | - * @since 1.0.0 |
|
1087 | - * @package GeoDirectory |
|
1088 | - */ |
|
1089 | - include_once('geodirectory-widgets/geodirectory_reviews_widget.php'); |
|
1090 | - /** |
|
1091 | - * Contains all functions for related listing widget. |
|
1092 | - * |
|
1093 | - * @since 1.0.0 |
|
1094 | - * @package GeoDirectory |
|
1095 | - */ |
|
1096 | - include_once('geodirectory-widgets/geodirectory_related_listing_widget.php'); |
|
1097 | - /** |
|
1098 | - * Contains all functions for bestof widget. |
|
1099 | - * |
|
1100 | - * @since 1.0.0 |
|
1101 | - * @package GeoDirectory |
|
1102 | - */ |
|
1103 | - include_once('geodirectory-widgets/geodirectory_bestof_widget.php'); |
|
947 | + } |
|
948 | + } |
|
949 | + |
|
950 | + register_widget('geodir_twitter'); |
|
951 | + |
|
952 | + /** |
|
953 | + * GeoDirectory Advanced Search widget. |
|
954 | + * |
|
955 | + * @since 1.0.0 |
|
956 | + */ |
|
957 | + class geodir_advance_search_widget extends WP_Widget |
|
958 | + { |
|
959 | + /** |
|
960 | + * Register the advanced search widget with WordPress. |
|
961 | + * |
|
962 | + * @since 1.0.0 |
|
963 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
964 | + */ |
|
965 | + public function __construct() { |
|
966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
967 | + parent::__construct( |
|
968 | + 'geodir_advance_search', // Base ID |
|
969 | + __('GD > Search', 'geodirectory'), // Name |
|
970 | + $widget_ops// Args |
|
971 | + ); |
|
972 | + } |
|
973 | + |
|
974 | + |
|
975 | + /** |
|
976 | + * Front-end display content for advanced search widget. |
|
977 | + * |
|
978 | + * @since 1.0.0 |
|
979 | + * @since 1.5.1 Declare function public. |
|
980 | + * |
|
981 | + * @param array $args Widget arguments. |
|
982 | + * @param array $instance Saved values from database. |
|
983 | + */ |
|
984 | + public function widget($args, $instance) |
|
985 | + { |
|
986 | + /** |
|
987 | + * Filter the search widget arguments. |
|
988 | + * |
|
989 | + * @since 1.5.7 |
|
990 | + * @param array $args The widget arguments. |
|
991 | + * @param array $instance The widget instance. |
|
992 | + */ |
|
993 | + $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
994 | + |
|
995 | + // prints the widget |
|
996 | + extract($args, EXTR_SKIP); |
|
997 | + |
|
998 | + if(isset($post_type) && $post_type){ |
|
999 | + geodir_get_search_post_type($post_type);// set the post type |
|
1000 | + }else{ |
|
1001 | + geodir_get_search_post_type();// set the post type |
|
1002 | + } |
|
1003 | + |
|
1004 | + echo $before_widget; |
|
1005 | + |
|
1006 | + /** This filter is documented in geodirectory_widgets.php */ |
|
1007 | + $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
1008 | + |
|
1009 | + geodir_get_template_part('listing', 'filter-form'); |
|
1010 | + |
|
1011 | + echo $after_widget; |
|
1012 | + |
|
1013 | + // after outputing the search reset the CPT |
|
1014 | + global $geodir_search_post_type; |
|
1015 | + $geodir_search_post_type = ''; |
|
1016 | + } |
|
1017 | + |
|
1018 | + /** |
|
1019 | + * Sanitize advanced search widget form values as they are saved. |
|
1020 | + * |
|
1021 | + * @since 1.0.0 |
|
1022 | + * @since 1.5.1 Declare function public. |
|
1023 | + * |
|
1024 | + * @param array $new_instance Values just sent to be saved. |
|
1025 | + * @param array $old_instance Previously saved values from database. |
|
1026 | + * |
|
1027 | + * @return array Updated safe values to be saved. |
|
1028 | + */ |
|
1029 | + public function update($new_instance, $old_instance) |
|
1030 | + { |
|
1031 | + //save the widget |
|
1032 | + //Nothing to save |
|
1033 | + return isset($instance) ? $instance : array(); |
|
1034 | + } |
|
1035 | + |
|
1036 | + /** |
|
1037 | + * Back-end advanced search widget settings form. |
|
1038 | + * |
|
1039 | + * @since 1.0.0 |
|
1040 | + * @since 1.5.1 Declare function public. |
|
1041 | + * |
|
1042 | + * @param array $instance Previously saved values from database. |
|
1043 | + * @return string|void |
|
1044 | + */ |
|
1045 | + public function form($instance) |
|
1046 | + { |
|
1047 | + //widgetform in backend |
|
1048 | + echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory'); |
|
1049 | + } |
|
1050 | + } |
|
1051 | + |
|
1052 | + register_widget('geodir_advance_search_widget'); |
|
1053 | + |
|
1054 | + |
|
1055 | + /** |
|
1056 | + * Contains all functions for popular widget. |
|
1057 | + * |
|
1058 | + * @since 1.0.0 |
|
1059 | + * @package GeoDirectory |
|
1060 | + */ |
|
1061 | + include_once('geodirectory-widgets/geodirectory_popular_widget.php'); |
|
1062 | + /** |
|
1063 | + * Contains all functions for listing slider widget. |
|
1064 | + * |
|
1065 | + * @since 1.0.0 |
|
1066 | + * @package GeoDirectory |
|
1067 | + */ |
|
1068 | + include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php'); |
|
1069 | + /** |
|
1070 | + * Contains all functions for home map widget. |
|
1071 | + * |
|
1072 | + * @since 1.0.0 |
|
1073 | + * @package GeoDirectory |
|
1074 | + */ |
|
1075 | + include_once('geodirectory-widgets/home_map_widget.php'); |
|
1076 | + /** |
|
1077 | + * Contains all functions for listing map widget. |
|
1078 | + * |
|
1079 | + * @since 1.0.0 |
|
1080 | + * @package GeoDirectory |
|
1081 | + */ |
|
1082 | + include_once('geodirectory-widgets/listing_map_widget.php'); |
|
1083 | + /** |
|
1084 | + * Contains all functions for reviews widget. |
|
1085 | + * |
|
1086 | + * @since 1.0.0 |
|
1087 | + * @package GeoDirectory |
|
1088 | + */ |
|
1089 | + include_once('geodirectory-widgets/geodirectory_reviews_widget.php'); |
|
1090 | + /** |
|
1091 | + * Contains all functions for related listing widget. |
|
1092 | + * |
|
1093 | + * @since 1.0.0 |
|
1094 | + * @package GeoDirectory |
|
1095 | + */ |
|
1096 | + include_once('geodirectory-widgets/geodirectory_related_listing_widget.php'); |
|
1097 | + /** |
|
1098 | + * Contains all functions for bestof widget. |
|
1099 | + * |
|
1100 | + * @since 1.0.0 |
|
1101 | + * @package GeoDirectory |
|
1102 | + */ |
|
1103 | + include_once('geodirectory-widgets/geodirectory_bestof_widget.php'); |
|
1104 | + /** |
|
1105 | + * Contains all functions for cpt categories widget. |
|
1106 | + * |
|
1107 | + * @since 1.5.4 |
|
1108 | + * @package GeoDirectory |
|
1109 | + */ |
|
1110 | + include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php'); |
|
1104 | 1111 | /** |
1105 | - * Contains all functions for cpt categories widget. |
|
1106 | - * |
|
1107 | - * @since 1.5.4 |
|
1108 | - * @package GeoDirectory |
|
1109 | - */ |
|
1110 | - include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php'); |
|
1111 | - /** |
|
1112 | - * Contains all functions for features widget. |
|
1113 | - * |
|
1114 | - * @since 1.5.6 |
|
1115 | - * @package GeoDirectory |
|
1116 | - * @todo make the image field recurring |
|
1117 | - */ |
|
1118 | - include_once('geodirectory-widgets/geodirectory_features_widget.php'); |
|
1119 | - } |
|
1112 | + * Contains all functions for features widget. |
|
1113 | + * |
|
1114 | + * @since 1.5.6 |
|
1115 | + * @package GeoDirectory |
|
1116 | + * @todo make the image field recurring |
|
1117 | + */ |
|
1118 | + include_once('geodirectory-widgets/geodirectory_features_widget.php'); |
|
1119 | + } |
|
1120 | 1120 | |
1121 | 1121 | } |
1122 | 1122 |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | public function form($instance) |
302 | 302 | { |
303 | 303 | //widgetform in backend |
304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
304 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
305 | 305 | $title = strip_tags($instance['title']); |
306 | 306 | |
307 | 307 | ?> |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | ?> |
374 | 374 | |
375 | 375 | <a href="http://twitter.com/share" |
376 | - class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a> |
|
376 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a> |
|
377 | 377 | |
378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
379 | 379 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | public function form($instance) |
444 | 444 | { |
445 | 445 | //widgetform in backend |
446 | - $instance = wp_parse_args((array)$instance, array('title' => '')); |
|
446 | + $instance = wp_parse_args((array) $instance, array('title' => '')); |
|
447 | 447 | $title = strip_tags($instance['title']); |
448 | 448 | ?> |
449 | 449 | <p>No settings for this widget</p> |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | echo $before_widget; |
516 | 516 | ?> |
517 | 517 | |
518 | - <?php echo $before_title . $title; ?> <a href="<?php if ($id) { |
|
519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
518 | + <?php echo $before_title.$title; ?> <a href="<?php if ($id) { |
|
519 | + echo 'http://feeds2.feedburner.com/'.$id; |
|
520 | 520 | } else { |
521 | 521 | bloginfo('rss_url'); |
522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title; ?> |
|
523 | 523 | |
524 | 524 | <?php if ($text <> "") { ?> |
525 | 525 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | public function form($instance) |
585 | 585 | { |
586 | 586 | //widgetform in backend |
587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
587 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => '')); |
|
588 | 588 | |
589 | 589 | $id = strip_tags($instance['id']); |
590 | 590 | |
@@ -596,19 +596,19 @@ discard block |
||
596 | 596 | |
597 | 597 | ?> |
598 | 598 | <p><label |
599 | - for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>: |
|
599 | + for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory'); ?>: |
|
600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
601 | 601 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
602 | 602 | value="<?php echo esc_attr($title); ?>"/></label></p> |
603 | 603 | |
604 | 604 | <p><label |
605 | - for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory');?> |
|
605 | + for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory'); ?> |
|
606 | 606 | : <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>" |
607 | 607 | name="<?php echo $this->get_field_name('id'); ?>" type="text" |
608 | 608 | value="<?php echo esc_attr($id); ?>"/></label></p> |
609 | 609 | |
610 | 610 | <p><label |
611 | - for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory');?> |
|
611 | + for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory'); ?> |
|
612 | 612 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>" |
613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label> |
614 | 614 | </p> |
@@ -704,12 +704,12 @@ discard block |
||
704 | 704 | public function form($instance) |
705 | 705 | { |
706 | 706 | //widgetform in backend |
707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
707 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => '')); |
|
708 | 708 | |
709 | 709 | $desc1 = ($instance['desc1']); |
710 | 710 | ?> |
711 | 711 | <p><label |
712 | - for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?> |
|
712 | + for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory'); ?> |
|
713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>" |
714 | 714 | name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label> |
715 | 715 | </p> |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | * @param string $number The image count. |
773 | 773 | */ |
774 | 774 | $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']); |
775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title; |
|
775 | + echo $before_title.__('Photo Gallery', 'geodirectory').$after_title; |
|
776 | 776 | ?> |
777 | 777 | |
778 | 778 | <div class="geodir-flickr clearfix"> |
@@ -819,14 +819,14 @@ discard block |
||
819 | 819 | { |
820 | 820 | |
821 | 821 | //widgetform in backend |
822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => '')); |
|
822 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => '')); |
|
823 | 823 | $id = strip_tags($instance['id']); |
824 | 824 | $number = strip_tags($instance['number']); |
825 | 825 | ?> |
826 | 826 | |
827 | 827 | <p> |
828 | 828 | <label |
829 | - for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory');?> |
|
829 | + for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory'); ?> |
|
830 | 830 | (<a href="http://www.idgettr.com">idGettr</a>): |
831 | 831 | <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>" |
832 | 832 | name="<?php echo $this->get_field_name('id'); ?>" type="text" |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | |
837 | 837 | <p> |
838 | 838 | <label |
839 | - for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory');?> |
|
839 | + for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory'); ?> |
|
840 | 840 | <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" |
841 | 841 | name="<?php echo $this->get_field_name('number'); ?>" type="text" |
842 | 842 | value="<?php echo esc_attr($number); ?>"/> |
@@ -932,12 +932,12 @@ discard block |
||
932 | 932 | public function form($instance) |
933 | 933 | { |
934 | 934 | //widgetform in backend |
935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
935 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => '')); |
|
936 | 936 | |
937 | 937 | $desc1 = ($instance['gd_tw_desc1']); |
938 | 938 | ?> |
939 | 939 | <p><label |
940 | - for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?> |
|
940 | + for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory'); ?> |
|
941 | 941 | <textarea class="widefat" rows="6" cols="20" |
942 | 942 | id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>" |
943 | 943 | name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label> |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
964 | 964 | */ |
965 | 965 | public function __construct() { |
966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>''); |
|
966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'), 'post_type'=>''); |
|
967 | 967 | parent::__construct( |
968 | 968 | 'geodir_advance_search', // Base ID |
969 | 969 | __('GD > Search', 'geodirectory'), // Name |
@@ -990,15 +990,15 @@ discard block |
||
990 | 990 | * @param array $args The widget arguments. |
991 | 991 | * @param array $instance The widget instance. |
992 | 992 | */ |
993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance); |
|
993 | + $args = apply_filters('widget_geodir_advance_search_args', $args, $instance); |
|
994 | 994 | |
995 | 995 | // prints the widget |
996 | 996 | extract($args, EXTR_SKIP); |
997 | 997 | |
998 | - if(isset($post_type) && $post_type){ |
|
999 | - geodir_get_search_post_type($post_type);// set the post type |
|
1000 | - }else{ |
|
1001 | - geodir_get_search_post_type();// set the post type |
|
998 | + if (isset($post_type) && $post_type) { |
|
999 | + geodir_get_search_post_type($post_type); // set the post type |
|
1000 | + } else { |
|
1001 | + geodir_get_search_post_type(); // set the post type |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | echo $before_widget; |
@@ -997,7 +997,7 @@ |
||
997 | 997 | |
998 | 998 | if(isset($post_type) && $post_type){ |
999 | 999 | geodir_get_search_post_type($post_type);// set the post type |
1000 | - }else{ |
|
1000 | + } else{ |
|
1001 | 1001 | geodir_get_search_post_type();// set the post type |
1002 | 1002 | } |
1003 | 1003 |