@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | if (!class_exists('Google_Client')) { |
19 | - require_once dirname(__FILE__) . '/../autoload.php'; |
|
19 | + require_once dirname(__FILE__).'/../autoload.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | if (!class_exists('Google_Client')) { |
19 | - require_once dirname(__FILE__) . '/../autoload.php'; |
|
19 | + require_once dirname(__FILE__).'/../autoload.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | if (!class_exists('Google_Client')) { |
19 | - require_once dirname(__FILE__) . '/../autoload.php'; |
|
19 | + require_once dirname(__FILE__).'/../autoload.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | if (!class_exists('Google_Client')) { |
19 | - require_once dirname(__FILE__) . '/../autoload.php'; |
|
19 | + require_once dirname(__FILE__).'/../autoload.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | if (!class_exists('Google_Client')) { |
19 | - require_once dirname(__FILE__) . '/../autoload.php'; |
|
19 | + require_once dirname(__FILE__).'/../autoload.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -add_filter('post_thumbnail_html','geodir_2017_remove_header',10,5); |
|
5 | -function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr){ |
|
6 | - if($size=='twentyseventeen-featured-image'){ |
|
4 | +add_filter('post_thumbnail_html', 'geodir_2017_remove_header', 10, 5); |
|
5 | +function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr) { |
|
6 | + if ($size == 'twentyseventeen-featured-image') { |
|
7 | 7 | |
8 | - if(geodir_is_page('detail') || geodir_is_page('add-listing')){ |
|
9 | - $html = '';// nothing up top |
|
8 | + if (geodir_is_page('detail') || geodir_is_page('add-listing')) { |
|
9 | + $html = ''; // nothing up top |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | } |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | |
64 | 64 | } |
65 | 65 | |
66 | -function geodir_twentyseventeen_body_classes($classes){ |
|
66 | +function geodir_twentyseventeen_body_classes($classes) { |
|
67 | 67 | |
68 | - if(geodir_is_page('add-listing') |
|
68 | + if (geodir_is_page('add-listing') |
|
69 | 69 | || geodir_is_page('preview') |
70 | 70 | || geodir_is_page('home') |
71 | 71 | || geodir_is_page('location') |
72 | 72 | || geodir_is_page('listing') |
73 | 73 | || geodir_is_page('search') |
74 | 74 | || geodir_is_page('author') |
75 | - ){ |
|
75 | + ) { |
|
76 | 76 | $classes[] = 'has-sidebar'; |
77 | 77 | } |
78 | 78 | return $classes; |
79 | 79 | } |
80 | -add_filter( 'body_class', 'geodir_twentyseventeen_body_classes' ); |
|
80 | +add_filter('body_class', 'geodir_twentyseventeen_body_classes'); |
|
81 | 81 |
@@ -46,17 +46,13 @@ |
||
46 | 46 | |
47 | 47 | if (is_page_geodir_home() || geodir_is_page('location')) { |
48 | 48 | add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8); |
49 | - } |
|
50 | - elseif (geodir_is_page('listing')) { |
|
49 | + } elseif (geodir_is_page('listing')) { |
|
51 | 50 | add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8); |
52 | - } |
|
53 | - elseif (geodir_is_page('detail')) { |
|
51 | + } elseif (geodir_is_page('detail')) { |
|
54 | 52 | add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8); |
55 | - } |
|
56 | - elseif (geodir_is_page('search')) { |
|
53 | + } elseif (geodir_is_page('search')) { |
|
57 | 54 | add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8); |
58 | - } |
|
59 | - elseif (geodir_is_page('author')) { |
|
55 | + } elseif (geodir_is_page('author')) { |
|
60 | 56 | add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8); |
61 | 57 | } |
62 | 58 |
@@ -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 | |
@@ -262,163 +262,163 @@ discard block |
||
262 | 262 | * @return string Map HTML. |
263 | 263 | */ |
264 | 264 | function geodir_sc_listing_map($atts) { |
265 | - global $add_post_in_marker_array, $gd_sc_map_params; |
|
266 | - $backup_globals = array(); |
|
267 | - $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array; |
|
268 | - $backup_globals['gd_sc_map_params'] = $gd_sc_map_params; |
|
265 | + global $add_post_in_marker_array, $gd_sc_map_params; |
|
266 | + $backup_globals = array(); |
|
267 | + $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array; |
|
268 | + $backup_globals['gd_sc_map_params'] = $gd_sc_map_params; |
|
269 | 269 | |
270 | - $defaults = array( |
|
271 | - 'width' => '294', |
|
272 | - 'height' => '370', |
|
273 | - 'zoom' => '13', |
|
274 | - 'autozoom' => '', |
|
275 | - 'sticky' => '', |
|
276 | - 'showall' => '0', |
|
277 | - 'scrollwheel' => '0', |
|
278 | - 'maptype' => 'ROADMAP', |
|
279 | - 'child_collapse' => 0, |
|
280 | - 'marker_cluster' => false, |
|
281 | - 'post_type' => 'gd_place', |
|
282 | - 'category' => '0', |
|
283 | - 'event_type' => 'all' |
|
284 | - ); |
|
285 | - |
|
286 | - $params = shortcode_atts($defaults, $atts); |
|
270 | + $defaults = array( |
|
271 | + 'width' => '294', |
|
272 | + 'height' => '370', |
|
273 | + 'zoom' => '13', |
|
274 | + 'autozoom' => '', |
|
275 | + 'sticky' => '', |
|
276 | + 'showall' => '0', |
|
277 | + 'scrollwheel' => '0', |
|
278 | + 'maptype' => 'ROADMAP', |
|
279 | + 'child_collapse' => 0, |
|
280 | + 'marker_cluster' => false, |
|
281 | + 'post_type' => 'gd_place', |
|
282 | + 'category' => '0', |
|
283 | + 'event_type' => 'all' |
|
284 | + ); |
|
285 | + |
|
286 | + $params = shortcode_atts($defaults, $atts); |
|
287 | 287 | |
288 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
289 | - $params['post_type'] = 'gd_place'; |
|
290 | - } |
|
288 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
289 | + $params['post_type'] = 'gd_place'; |
|
290 | + } |
|
291 | 291 | |
292 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
293 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
294 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
295 | - |
|
296 | - // Make sure we have an array |
|
297 | - if (!(is_array($params['category']))) { |
|
298 | - $params['category'] = explode(',', $params['category']); |
|
299 | - } |
|
300 | - |
|
301 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
302 | - // Otherwise it becomes empty and later on that will mean "All" |
|
303 | - $params['category'] = array_intersect($params['category'], $categories); |
|
292 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
293 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
294 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
295 | + |
|
296 | + // Make sure we have an array |
|
297 | + if (!(is_array($params['category']))) { |
|
298 | + $params['category'] = explode(',', $params['category']); |
|
299 | + } |
|
300 | + |
|
301 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
302 | + // Otherwise it becomes empty and later on that will mean "All" |
|
303 | + $params['category'] = array_intersect($params['category'], $categories); |
|
304 | 304 | |
305 | - if ($params['post_type'] == 'gd_event') { |
|
306 | - $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']); |
|
307 | - } |
|
305 | + if ($params['post_type'] == 'gd_event') { |
|
306 | + $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']); |
|
307 | + } |
|
308 | 308 | |
309 | - $params = gdsc_validate_map_args($params); |
|
309 | + $params = gdsc_validate_map_args($params); |
|
310 | 310 | |
311 | - $gd_sc_map_params = $params; |
|
311 | + $gd_sc_map_params = $params; |
|
312 | 312 | |
313 | - $query_args = array( |
|
314 | - 'posts_per_page' => 1000000, |
|
315 | - 'is_geodir_loop' => true, |
|
316 | - 'gd_location' => false, |
|
317 | - ); |
|
313 | + $query_args = array( |
|
314 | + 'posts_per_page' => 1000000, |
|
315 | + 'is_geodir_loop' => true, |
|
316 | + 'gd_location' => false, |
|
317 | + ); |
|
318 | 318 | |
319 | - if (!empty($params['category']) && isset($params['category'][0]) && (int)$params['category'][0] != 0) { |
|
320 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
321 | - |
|
322 | - ######### WPML ######### |
|
323 | - if (function_exists('icl_object_id')) { |
|
324 | - $category = gd_lang_object_ids($params['category'], $category_taxonomy[0]); |
|
325 | - } |
|
326 | - ######### WPML ######### |
|
327 | - |
|
328 | - $tax_query = array( |
|
329 | - 'taxonomy' => $category_taxonomy[0], |
|
330 | - 'field' => 'id', |
|
331 | - 'terms' => $params['category'] |
|
332 | - ); |
|
333 | - |
|
334 | - $query_args['tax_query'] = array($tax_query); |
|
335 | - } |
|
319 | + if (!empty($params['category']) && isset($params['category'][0]) && (int)$params['category'][0] != 0) { |
|
320 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
321 | + |
|
322 | + ######### WPML ######### |
|
323 | + if (function_exists('icl_object_id')) { |
|
324 | + $category = gd_lang_object_ids($params['category'], $category_taxonomy[0]); |
|
325 | + } |
|
326 | + ######### WPML ######### |
|
327 | + |
|
328 | + $tax_query = array( |
|
329 | + 'taxonomy' => $category_taxonomy[0], |
|
330 | + 'field' => 'id', |
|
331 | + 'terms' => $params['category'] |
|
332 | + ); |
|
333 | + |
|
334 | + $query_args['tax_query'] = array($tax_query); |
|
335 | + } |
|
336 | 336 | |
337 | - $add_post_in_marker_array = true; |
|
337 | + $add_post_in_marker_array = true; |
|
338 | 338 | |
339 | - if ($params['post_type'] == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
340 | - global $geodir_event_widget_listview; |
|
341 | - $geodir_event_widget_listview = true; |
|
339 | + if ($params['post_type'] == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
340 | + global $geodir_event_widget_listview; |
|
341 | + $geodir_event_widget_listview = true; |
|
342 | 342 | |
343 | - $query_args['geodir_event_type'] = $params['event_type']; |
|
343 | + $query_args['geodir_event_type'] = $params['event_type']; |
|
344 | 344 | |
345 | - $listings = geodir_event_get_widget_events($query_args); |
|
345 | + $listings = geodir_event_get_widget_events($query_args); |
|
346 | 346 | |
347 | - $geodir_event_widget_listview = false; |
|
348 | - } else { |
|
349 | - $listings = geodir_get_widget_listings($query_args); |
|
350 | - } |
|
351 | - |
|
352 | - if (!empty($listings)) { |
|
353 | - foreach ($listings as $listing) { |
|
354 | - create_marker_jason_of_posts($listing); |
|
355 | - } |
|
356 | - } |
|
347 | + $geodir_event_widget_listview = false; |
|
348 | + } else { |
|
349 | + $listings = geodir_get_widget_listings($query_args); |
|
350 | + } |
|
351 | + |
|
352 | + if (!empty($listings)) { |
|
353 | + foreach ($listings as $listing) { |
|
354 | + create_marker_jason_of_posts($listing); |
|
355 | + } |
|
356 | + } |
|
357 | 357 | |
358 | - ob_start(); |
|
359 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
358 | + ob_start(); |
|
359 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
360 | 360 | |
361 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
361 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
362 | 362 | |
363 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
363 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
364 | 364 | |
365 | - $default_location = geodir_get_default_location(); |
|
365 | + $default_location = geodir_get_default_location(); |
|
366 | 366 | |
367 | - $map_args = array( |
|
368 | - 'map_canvas_name' => 'gd_listing_map', |
|
369 | - 'width' => $params['width'], |
|
370 | - 'height' => $params['height'], |
|
371 | - 'zoom' => $params['zoom'], |
|
372 | - 'autozoom' => $params['autozoom'], |
|
373 | - 'sticky' => $params['sticky'], |
|
374 | - 'showall' => $params['showall'], |
|
375 | - 'scrollwheel' => $params['scrollwheel'], |
|
376 | - 'maptype' => $params['maptype'], |
|
377 | - 'child_collapse' => 0, |
|
378 | - 'enable_cat_filters' => false, |
|
379 | - 'enable_text_search' => false, |
|
380 | - 'enable_post_type_filters' => false, |
|
381 | - 'enable_location_filters' => false, |
|
382 | - 'enable_jason_on_load' => true, |
|
383 | - 'ajax_url' => geodir_get_ajax_url(), |
|
384 | - 'latitude' => isset($default_location->city_latitude) ? $default_location->city_latitude : '', |
|
385 | - 'longitude' => isset($default_location->city_longitude) ? $default_location->city_longitude : '', |
|
386 | - 'streetViewControl' => true, |
|
387 | - 'showPreview' => '0', |
|
388 | - 'maxZoom' => 21, |
|
389 | - 'bubble_size' => 'small', |
|
390 | - ); |
|
367 | + $map_args = array( |
|
368 | + 'map_canvas_name' => 'gd_listing_map', |
|
369 | + 'width' => $params['width'], |
|
370 | + 'height' => $params['height'], |
|
371 | + 'zoom' => $params['zoom'], |
|
372 | + 'autozoom' => $params['autozoom'], |
|
373 | + 'sticky' => $params['sticky'], |
|
374 | + 'showall' => $params['showall'], |
|
375 | + 'scrollwheel' => $params['scrollwheel'], |
|
376 | + 'maptype' => $params['maptype'], |
|
377 | + 'child_collapse' => 0, |
|
378 | + 'enable_cat_filters' => false, |
|
379 | + 'enable_text_search' => false, |
|
380 | + 'enable_post_type_filters' => false, |
|
381 | + 'enable_location_filters' => false, |
|
382 | + 'enable_jason_on_load' => true, |
|
383 | + 'ajax_url' => geodir_get_ajax_url(), |
|
384 | + 'latitude' => isset($default_location->city_latitude) ? $default_location->city_latitude : '', |
|
385 | + 'longitude' => isset($default_location->city_longitude) ? $default_location->city_longitude : '', |
|
386 | + 'streetViewControl' => true, |
|
387 | + 'showPreview' => '0', |
|
388 | + 'maxZoom' => 21, |
|
389 | + 'bubble_size' => 'small', |
|
390 | + ); |
|
391 | 391 | |
392 | - if (is_single()) { |
|
393 | - global $post; |
|
394 | - if (isset($post->post_latitude)) { |
|
395 | - $map_args['latitude'] = $post->post_latitude; |
|
396 | - $map_args['longitude'] = $post->post_longitude; |
|
397 | - } |
|
392 | + if (is_single()) { |
|
393 | + global $post; |
|
394 | + if (isset($post->post_latitude)) { |
|
395 | + $map_args['latitude'] = $post->post_latitude; |
|
396 | + $map_args['longitude'] = $post->post_longitude; |
|
397 | + } |
|
398 | 398 | |
399 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
400 | - } else { |
|
401 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
402 | - } |
|
399 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
400 | + } else { |
|
401 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
402 | + } |
|
403 | 403 | |
404 | - // Add marker cluster |
|
405 | - if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
406 | - $map_args['enable_marker_cluster'] = true; |
|
407 | - } else { |
|
408 | - $map_args['enable_marker_cluster'] = false; |
|
409 | - } |
|
404 | + // Add marker cluster |
|
405 | + if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
406 | + $map_args['enable_marker_cluster'] = true; |
|
407 | + } else { |
|
408 | + $map_args['enable_marker_cluster'] = false; |
|
409 | + } |
|
410 | 410 | |
411 | - geodir_draw_map($map_args); |
|
411 | + geodir_draw_map($map_args); |
|
412 | 412 | |
413 | - $output = ob_get_contents(); |
|
413 | + $output = ob_get_contents(); |
|
414 | 414 | |
415 | - ob_end_clean(); |
|
415 | + ob_end_clean(); |
|
416 | 416 | |
417 | - foreach ($backup_globals as $global => $value) { |
|
418 | - ${$global} = $value; |
|
419 | - } |
|
417 | + foreach ($backup_globals as $global => $value) { |
|
418 | + ${$global} = $value; |
|
419 | + } |
|
420 | 420 | |
421 | - return $output; |
|
421 | + return $output; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -451,120 +451,120 @@ discard block |
||
451 | 451 | */ |
452 | 452 | function geodir_sc_listing_slider($atts) |
453 | 453 | { |
454 | - ob_start(); |
|
455 | - $defaults = array( |
|
456 | - 'post_type' => 'gd_place', |
|
457 | - 'category' => '0', |
|
458 | - 'post_number' => '5', |
|
459 | - 'slideshow' => '0', |
|
460 | - 'animation_loop' => 0, |
|
461 | - 'direction_nav' => 0, |
|
462 | - 'slideshow_speed' => 5000, |
|
463 | - 'animation_speed' => 600, |
|
464 | - 'animation' => 'slide', |
|
465 | - 'order_by' => 'latest', |
|
466 | - 'show_title' => '', |
|
467 | - 'show_featured_only' => '', |
|
468 | - 'title' => '', |
|
469 | - ); |
|
470 | - |
|
471 | - $params = shortcode_atts($defaults, $atts); |
|
472 | - |
|
473 | - |
|
474 | - /* |
|
454 | + ob_start(); |
|
455 | + $defaults = array( |
|
456 | + 'post_type' => 'gd_place', |
|
457 | + 'category' => '0', |
|
458 | + 'post_number' => '5', |
|
459 | + 'slideshow' => '0', |
|
460 | + 'animation_loop' => 0, |
|
461 | + 'direction_nav' => 0, |
|
462 | + 'slideshow_speed' => 5000, |
|
463 | + 'animation_speed' => 600, |
|
464 | + 'animation' => 'slide', |
|
465 | + 'order_by' => 'latest', |
|
466 | + 'show_title' => '', |
|
467 | + 'show_featured_only' => '', |
|
468 | + 'title' => '', |
|
469 | + ); |
|
470 | + |
|
471 | + $params = shortcode_atts($defaults, $atts); |
|
472 | + |
|
473 | + |
|
474 | + /* |
|
475 | 475 | * |
476 | 476 | * Now we begin the validation of the attributes. |
477 | 477 | */ |
478 | - // Check we have a valid post_type |
|
479 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
480 | - $params['post_type'] = 'gd_place'; |
|
481 | - } |
|
482 | - |
|
483 | - // Check we have a valid sort_order |
|
484 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
485 | - |
|
486 | - // Match the chosen animation to our options |
|
487 | - $animation_list = array('slide', 'fade'); |
|
488 | - if (!(in_array($params['animation'], $animation_list))) { |
|
489 | - $params['animation'] = 'slide'; |
|
490 | - } |
|
491 | - |
|
492 | - // Post_number needs to be a positive integer |
|
493 | - $params['post_number'] = absint($params['post_number']); |
|
494 | - if (0 == $params['post_number']) { |
|
495 | - $params['post_number'] = 1; |
|
496 | - } |
|
497 | - |
|
498 | - // Manage the entered categories |
|
499 | - if (0 != $params['category'] || '' != $params['category']) { |
|
500 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
501 | - } |
|
502 | - // Convert show_title to a bool |
|
503 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
504 | - |
|
505 | - // Convert show_featured_only to a bool |
|
506 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
507 | - |
|
508 | - /* |
|
478 | + // Check we have a valid post_type |
|
479 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
480 | + $params['post_type'] = 'gd_place'; |
|
481 | + } |
|
482 | + |
|
483 | + // Check we have a valid sort_order |
|
484 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
485 | + |
|
486 | + // Match the chosen animation to our options |
|
487 | + $animation_list = array('slide', 'fade'); |
|
488 | + if (!(in_array($params['animation'], $animation_list))) { |
|
489 | + $params['animation'] = 'slide'; |
|
490 | + } |
|
491 | + |
|
492 | + // Post_number needs to be a positive integer |
|
493 | + $params['post_number'] = absint($params['post_number']); |
|
494 | + if (0 == $params['post_number']) { |
|
495 | + $params['post_number'] = 1; |
|
496 | + } |
|
497 | + |
|
498 | + // Manage the entered categories |
|
499 | + if (0 != $params['category'] || '' != $params['category']) { |
|
500 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
501 | + } |
|
502 | + // Convert show_title to a bool |
|
503 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
504 | + |
|
505 | + // Convert show_featured_only to a bool |
|
506 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
507 | + |
|
508 | + /* |
|
509 | 509 | * Hopefully all attributes are now valid, and safe to pass forward |
510 | 510 | */ |
511 | 511 | |
512 | - // redeclare vars after validation |
|
513 | - |
|
514 | - if (isset($params['direction_nav'])) { |
|
515 | - $params['directionNav'] = $params['direction_nav']; |
|
516 | - } |
|
517 | - if (isset($params['animation_loop'])) { |
|
518 | - $params['animationLoop'] = $params['animation_loop']; |
|
519 | - } |
|
520 | - if (isset($params['slideshow_speed'])) { |
|
521 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
522 | - } |
|
523 | - if (isset($params['animation_speed'])) { |
|
524 | - $params['animationSpeed'] = $params['animation_speed']; |
|
525 | - } |
|
526 | - if (isset($params['order_by'])) { |
|
527 | - $params['list_sort'] = $params['order_by']; |
|
528 | - } |
|
529 | - |
|
530 | - $query_args = array( |
|
531 | - 'post_number' => $params['post_number'], |
|
532 | - 'is_geodir_loop' => true, |
|
533 | - 'post_type' => $params['post_type'], |
|
534 | - 'order_by' => $params['order_by'] |
|
535 | - ); |
|
536 | - |
|
537 | - if (1 == $params['show_featured_only']) { |
|
538 | - $query_args['show_featured_only'] = 1; |
|
539 | - } |
|
540 | - |
|
541 | - if (0 != $params['category'] && '' != $params['category']) { |
|
542 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
543 | - $tax_query = array( |
|
544 | - 'taxonomy' => $category_taxonomy[0], |
|
545 | - 'field' => 'id', |
|
546 | - 'terms' => $params['category'], |
|
547 | - ); |
|
548 | - |
|
549 | - $query_args['tax_query'] = array($tax_query); |
|
550 | - } |
|
551 | - |
|
552 | - $defaults = array( |
|
553 | - 'before_widget' => '', |
|
554 | - 'after_widget' => '', |
|
555 | - 'before_title' => '', |
|
556 | - 'after_title' => '', |
|
557 | - ); |
|
558 | - |
|
559 | - $query_args = array_merge($query_args, $params); |
|
560 | - |
|
561 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
562 | - |
|
563 | - $output = ob_get_contents(); |
|
564 | - |
|
565 | - ob_end_clean(); |
|
566 | - |
|
567 | - return $output; |
|
512 | + // redeclare vars after validation |
|
513 | + |
|
514 | + if (isset($params['direction_nav'])) { |
|
515 | + $params['directionNav'] = $params['direction_nav']; |
|
516 | + } |
|
517 | + if (isset($params['animation_loop'])) { |
|
518 | + $params['animationLoop'] = $params['animation_loop']; |
|
519 | + } |
|
520 | + if (isset($params['slideshow_speed'])) { |
|
521 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
522 | + } |
|
523 | + if (isset($params['animation_speed'])) { |
|
524 | + $params['animationSpeed'] = $params['animation_speed']; |
|
525 | + } |
|
526 | + if (isset($params['order_by'])) { |
|
527 | + $params['list_sort'] = $params['order_by']; |
|
528 | + } |
|
529 | + |
|
530 | + $query_args = array( |
|
531 | + 'post_number' => $params['post_number'], |
|
532 | + 'is_geodir_loop' => true, |
|
533 | + 'post_type' => $params['post_type'], |
|
534 | + 'order_by' => $params['order_by'] |
|
535 | + ); |
|
536 | + |
|
537 | + if (1 == $params['show_featured_only']) { |
|
538 | + $query_args['show_featured_only'] = 1; |
|
539 | + } |
|
540 | + |
|
541 | + if (0 != $params['category'] && '' != $params['category']) { |
|
542 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
543 | + $tax_query = array( |
|
544 | + 'taxonomy' => $category_taxonomy[0], |
|
545 | + 'field' => 'id', |
|
546 | + 'terms' => $params['category'], |
|
547 | + ); |
|
548 | + |
|
549 | + $query_args['tax_query'] = array($tax_query); |
|
550 | + } |
|
551 | + |
|
552 | + $defaults = array( |
|
553 | + 'before_widget' => '', |
|
554 | + 'after_widget' => '', |
|
555 | + 'before_title' => '', |
|
556 | + 'after_title' => '', |
|
557 | + ); |
|
558 | + |
|
559 | + $query_args = array_merge($query_args, $params); |
|
560 | + |
|
561 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
562 | + |
|
563 | + $output = ob_get_contents(); |
|
564 | + |
|
565 | + ob_end_clean(); |
|
566 | + |
|
567 | + return $output; |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -588,22 +588,22 @@ discard block |
||
588 | 588 | */ |
589 | 589 | function geodir_sc_login_box($atts) |
590 | 590 | { |
591 | - ob_start(); |
|
591 | + ob_start(); |
|
592 | 592 | |
593 | - $defaults = array( |
|
594 | - 'before_widget' => '', |
|
595 | - 'after_widget' => '', |
|
596 | - 'before_title' => '', |
|
597 | - 'after_title' => '', |
|
598 | - ); |
|
593 | + $defaults = array( |
|
594 | + 'before_widget' => '', |
|
595 | + 'after_widget' => '', |
|
596 | + 'before_title' => '', |
|
597 | + 'after_title' => '', |
|
598 | + ); |
|
599 | 599 | |
600 | - geodir_loginwidget_output($defaults, $defaults); |
|
600 | + geodir_loginwidget_output($defaults, $defaults); |
|
601 | 601 | |
602 | - $output = ob_get_contents(); |
|
602 | + $output = ob_get_contents(); |
|
603 | 603 | |
604 | - ob_end_clean(); |
|
604 | + ob_end_clean(); |
|
605 | 605 | |
606 | - return $output; |
|
606 | + return $output; |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -634,30 +634,30 @@ discard block |
||
634 | 634 | */ |
635 | 635 | function geodir_sc_popular_post_category($atts) |
636 | 636 | { |
637 | - ob_start(); |
|
638 | - global $geodir_post_category_str; |
|
639 | - $defaults = array( |
|
640 | - 'category_limit' => 15, |
|
641 | - 'before_widget' => '', |
|
642 | - 'after_widget' => '', |
|
643 | - 'before_title' => '', |
|
644 | - 'after_title' => '', |
|
645 | - 'title' => '', |
|
646 | - 'default_post_type' => '', |
|
647 | - 'parent_only' => false, |
|
648 | - ); |
|
649 | - |
|
650 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
651 | - $params['category_limit'] = absint($params['category_limit']); |
|
652 | - $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
653 | - $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
654 | - geodir_popular_post_category_output($params, $params); |
|
655 | - |
|
656 | - $output = ob_get_contents(); |
|
657 | - |
|
658 | - ob_end_clean(); |
|
659 | - |
|
660 | - return $output; |
|
637 | + ob_start(); |
|
638 | + global $geodir_post_category_str; |
|
639 | + $defaults = array( |
|
640 | + 'category_limit' => 15, |
|
641 | + 'before_widget' => '', |
|
642 | + 'after_widget' => '', |
|
643 | + 'before_title' => '', |
|
644 | + 'after_title' => '', |
|
645 | + 'title' => '', |
|
646 | + 'default_post_type' => '', |
|
647 | + 'parent_only' => false, |
|
648 | + ); |
|
649 | + |
|
650 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
651 | + $params['category_limit'] = absint($params['category_limit']); |
|
652 | + $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
653 | + $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
654 | + geodir_popular_post_category_output($params, $params); |
|
655 | + |
|
656 | + $output = ob_get_contents(); |
|
657 | + |
|
658 | + ob_end_clean(); |
|
659 | + |
|
660 | + return $output; |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -697,97 +697,97 @@ discard block |
||
697 | 697 | */ |
698 | 698 | function geodir_sc_popular_post_view($atts) |
699 | 699 | { |
700 | - ob_start(); |
|
701 | - $defaults = array( |
|
702 | - 'post_type' => 'gd_place', |
|
703 | - 'category' => '0', |
|
704 | - 'post_number' => '5', |
|
705 | - 'layout' => 'gridview_onehalf', |
|
706 | - 'add_location_filter' => '0', |
|
707 | - 'list_sort' => 'latest', |
|
708 | - 'use_viewing_post_type' => '1', |
|
709 | - 'character_count' => '20', |
|
710 | - 'listing_width' => '', |
|
711 | - 'show_featured_only' => '0', |
|
712 | - 'show_special_only' => '0', |
|
713 | - 'with_pics_only' => '0', |
|
714 | - 'with_videos_only' => '0', |
|
715 | - 'before_widget' => '', |
|
716 | - 'after_widget' => '', |
|
717 | - 'before_title' => '<h3 class="widget-title">', |
|
718 | - 'after_title' => '</h3>', |
|
719 | - 'title' => '', |
|
720 | - 'category_title' => '', |
|
721 | - ); |
|
722 | - |
|
723 | - $params = shortcode_atts($defaults, $atts); |
|
724 | - |
|
725 | - /** |
|
726 | - * Validate our incoming params |
|
727 | - */ |
|
700 | + ob_start(); |
|
701 | + $defaults = array( |
|
702 | + 'post_type' => 'gd_place', |
|
703 | + 'category' => '0', |
|
704 | + 'post_number' => '5', |
|
705 | + 'layout' => 'gridview_onehalf', |
|
706 | + 'add_location_filter' => '0', |
|
707 | + 'list_sort' => 'latest', |
|
708 | + 'use_viewing_post_type' => '1', |
|
709 | + 'character_count' => '20', |
|
710 | + 'listing_width' => '', |
|
711 | + 'show_featured_only' => '0', |
|
712 | + 'show_special_only' => '0', |
|
713 | + 'with_pics_only' => '0', |
|
714 | + 'with_videos_only' => '0', |
|
715 | + 'before_widget' => '', |
|
716 | + 'after_widget' => '', |
|
717 | + 'before_title' => '<h3 class="widget-title">', |
|
718 | + 'after_title' => '</h3>', |
|
719 | + 'title' => '', |
|
720 | + 'category_title' => '', |
|
721 | + ); |
|
728 | 722 | |
729 | - // Validate the selected post type, default to gd_place on fail |
|
730 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
731 | - $params['post_type'] = 'gd_place'; |
|
732 | - } |
|
733 | - |
|
734 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
735 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
736 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
737 | - |
|
738 | - // Make sure we have an array |
|
739 | - if (!(is_array($params['category']))) { |
|
740 | - $params['category'] = explode(',', $params['category']); |
|
741 | - } |
|
742 | - |
|
743 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
744 | - // Otherwise it becomes empty and later on that will mean "All" |
|
745 | - $params['category'] = array_intersect($params['category'], $categories); |
|
746 | - |
|
747 | - // Post_number needs to be a positive integer |
|
748 | - $params['post_number'] = absint($params['post_number']); |
|
749 | - if (0 == $params['post_number']) { |
|
750 | - $params['post_number'] = 1; |
|
751 | - } |
|
752 | - |
|
753 | - // Validate our layout choice |
|
754 | - // Outside of the norm, I added some more simple terms to match the existing |
|
755 | - // So now I just run the switch to set it properly. |
|
756 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
757 | - |
|
758 | - // Validate our sorting choice |
|
759 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
760 | - |
|
761 | - // Validate character_count |
|
762 | - $params['character_count'] = absint($params['character_count']); |
|
763 | - if (20 > $params['character_count']) { |
|
764 | - $params['character_count'] = 20; |
|
765 | - } |
|
766 | - |
|
767 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
768 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
769 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
770 | - |
|
771 | - // Validate the checkboxes used on the widget |
|
772 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
773 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
774 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
775 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
776 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
777 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
778 | - |
|
779 | - /** |
|
780 | - * End of validation |
|
781 | - */ |
|
723 | + $params = shortcode_atts($defaults, $atts); |
|
724 | + |
|
725 | + /** |
|
726 | + * Validate our incoming params |
|
727 | + */ |
|
728 | + |
|
729 | + // Validate the selected post type, default to gd_place on fail |
|
730 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
731 | + $params['post_type'] = 'gd_place'; |
|
732 | + } |
|
782 | 733 | |
783 | - geodir_popular_postview_output($params, $params); |
|
734 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
735 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
736 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
784 | 737 | |
738 | + // Make sure we have an array |
|
739 | + if (!(is_array($params['category']))) { |
|
740 | + $params['category'] = explode(',', $params['category']); |
|
741 | + } |
|
785 | 742 | |
786 | - $output = ob_get_contents(); |
|
743 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
744 | + // Otherwise it becomes empty and later on that will mean "All" |
|
745 | + $params['category'] = array_intersect($params['category'], $categories); |
|
787 | 746 | |
788 | - ob_end_clean(); |
|
747 | + // Post_number needs to be a positive integer |
|
748 | + $params['post_number'] = absint($params['post_number']); |
|
749 | + if (0 == $params['post_number']) { |
|
750 | + $params['post_number'] = 1; |
|
751 | + } |
|
789 | 752 | |
790 | - return $output; |
|
753 | + // Validate our layout choice |
|
754 | + // Outside of the norm, I added some more simple terms to match the existing |
|
755 | + // So now I just run the switch to set it properly. |
|
756 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
757 | + |
|
758 | + // Validate our sorting choice |
|
759 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
760 | + |
|
761 | + // Validate character_count |
|
762 | + $params['character_count'] = absint($params['character_count']); |
|
763 | + if (20 > $params['character_count']) { |
|
764 | + $params['character_count'] = 20; |
|
765 | + } |
|
766 | + |
|
767 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
768 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
769 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
770 | + |
|
771 | + // Validate the checkboxes used on the widget |
|
772 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
773 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
774 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
775 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
776 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
777 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
778 | + |
|
779 | + /** |
|
780 | + * End of validation |
|
781 | + */ |
|
782 | + |
|
783 | + geodir_popular_postview_output($params, $params); |
|
784 | + |
|
785 | + |
|
786 | + $output = ob_get_contents(); |
|
787 | + |
|
788 | + ob_end_clean(); |
|
789 | + |
|
790 | + return $output; |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -809,37 +809,37 @@ discard block |
||
809 | 809 | * @return string Recent reviews HTML. |
810 | 810 | */ |
811 | 811 | function geodir_sc_recent_reviews($atts) { |
812 | - ob_start(); |
|
813 | - $defaults = array( |
|
812 | + ob_start(); |
|
813 | + $defaults = array( |
|
814 | 814 | 'title' => '', |
815 | 815 | 'count' => 5, |
816 | - ); |
|
816 | + ); |
|
817 | 817 | |
818 | - $params = shortcode_atts($defaults, $atts); |
|
818 | + $params = shortcode_atts($defaults, $atts); |
|
819 | 819 | |
820 | - $count = absint($params['count']); |
|
821 | - if (0 == $count) { |
|
822 | - $count = 1; |
|
823 | - } |
|
820 | + $count = absint($params['count']); |
|
821 | + if (0 == $count) { |
|
822 | + $count = 1; |
|
823 | + } |
|
824 | 824 | |
825 | 825 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
826 | 826 | |
827 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
827 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
828 | 828 | |
829 | - if ($comments_li) { |
|
830 | - if ($title != '') { ?> |
|
829 | + if ($comments_li) { |
|
830 | + if ($title != '') { ?> |
|
831 | 831 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
832 | 832 | <?php } ?> |
833 | 833 | <div class="geodir_sc_recent_reviews_section"> |
834 | 834 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
835 | 835 | </div> |
836 | 836 | <?php |
837 | - } |
|
838 | - $output = ob_get_contents(); |
|
837 | + } |
|
838 | + $output = ob_get_contents(); |
|
839 | 839 | |
840 | - ob_end_clean(); |
|
840 | + ob_end_clean(); |
|
841 | 841 | |
842 | - return $output; |
|
842 | + return $output; |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -869,64 +869,64 @@ discard block |
||
869 | 869 | */ |
870 | 870 | function geodir_sc_related_listings($atts) |
871 | 871 | { |
872 | - ob_start(); |
|
873 | - $defaults = array( |
|
874 | - 'post_number' => 5, |
|
875 | - 'relate_to' => 'category', |
|
876 | - 'layout' => 'gridview_onehalf', |
|
877 | - 'add_location_filter' => 0, |
|
878 | - 'listing_width' => '', |
|
879 | - 'list_sort' => 'latest', |
|
880 | - 'character_count' => 20, |
|
881 | - 'is_widget' => 1, |
|
882 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
883 | - ); |
|
884 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
885 | - |
|
886 | - $params = shortcode_atts($defaults, $atts); |
|
887 | - |
|
888 | - /** |
|
889 | - * Begin validating parameters |
|
890 | - */ |
|
872 | + ob_start(); |
|
873 | + $defaults = array( |
|
874 | + 'post_number' => 5, |
|
875 | + 'relate_to' => 'category', |
|
876 | + 'layout' => 'gridview_onehalf', |
|
877 | + 'add_location_filter' => 0, |
|
878 | + 'listing_width' => '', |
|
879 | + 'list_sort' => 'latest', |
|
880 | + 'character_count' => 20, |
|
881 | + 'is_widget' => 1, |
|
882 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
883 | + ); |
|
884 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
891 | 885 | |
892 | - // Validate that post_number is a number and is 1 or higher |
|
893 | - $params['post_number'] = absint($params['post_number']); |
|
894 | - if (0 === $params['post_number']) { |
|
895 | - $params['post_number'] = 1; |
|
896 | - } |
|
886 | + $params = shortcode_atts($defaults, $atts); |
|
897 | 887 | |
898 | - // Validate relate_to - only category or tags |
|
899 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
900 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
901 | - $params['relate_to'] = 'category'; |
|
902 | - } |
|
888 | + /** |
|
889 | + * Begin validating parameters |
|
890 | + */ |
|
903 | 891 | |
904 | - // Validate layout selection |
|
905 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
892 | + // Validate that post_number is a number and is 1 or higher |
|
893 | + $params['post_number'] = absint($params['post_number']); |
|
894 | + if (0 === $params['post_number']) { |
|
895 | + $params['post_number'] = 1; |
|
896 | + } |
|
906 | 897 | |
907 | - // Validate sorting option |
|
908 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
898 | + // Validate relate_to - only category or tags |
|
899 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
900 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
901 | + $params['relate_to'] = 'category'; |
|
902 | + } |
|
909 | 903 | |
910 | - // Validate add_location_filter |
|
911 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
904 | + // Validate layout selection |
|
905 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
912 | 906 | |
913 | - // Validate listing_width |
|
914 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
907 | + // Validate sorting option |
|
908 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
915 | 909 | |
916 | - // Validate character_count |
|
917 | - $params['character_count'] = absint($params['character_count']); |
|
918 | - if (20 > $params['character_count']) { |
|
919 | - $params['character_count'] = 20; |
|
920 | - } |
|
910 | + // Validate add_location_filter |
|
911 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
921 | 912 | |
922 | - if ($related_display = geodir_related_posts_display($params)) { |
|
923 | - echo $related_display; |
|
924 | - } |
|
925 | - $output = ob_get_contents(); |
|
913 | + // Validate listing_width |
|
914 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
926 | 915 | |
927 | - ob_end_clean(); |
|
916 | + // Validate character_count |
|
917 | + $params['character_count'] = absint($params['character_count']); |
|
918 | + if (20 > $params['character_count']) { |
|
919 | + $params['character_count'] = 20; |
|
920 | + } |
|
928 | 921 | |
929 | - return $output; |
|
922 | + if ($related_display = geodir_related_posts_display($params)) { |
|
923 | + echo $related_display; |
|
924 | + } |
|
925 | + $output = ob_get_contents(); |
|
926 | + |
|
927 | + ob_end_clean(); |
|
928 | + |
|
929 | + return $output; |
|
930 | 930 | } |
931 | 931 | |
932 | 932 | /** |
@@ -950,13 +950,13 @@ discard block |
||
950 | 950 | * @return string Advanced search widget HTML. |
951 | 951 | */ |
952 | 952 | function geodir_sc_advanced_search($atts) { |
953 | - $defaults = array( |
|
953 | + $defaults = array( |
|
954 | 954 | 'title' => '', |
955 | 955 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">', |
956 | - 'after_widget' => '</section>', |
|
957 | - 'before_title' => '<h3 class="widget-title">', |
|
958 | - 'after_title' => '</h3>', |
|
959 | - 'show_adv_search' => 'default', |
|
956 | + 'after_widget' => '</section>', |
|
957 | + 'before_title' => '<h3 class="widget-title">', |
|
958 | + 'after_title' => '</h3>', |
|
959 | + 'show_adv_search' => 'default', |
|
960 | 960 | 'post_type' => '' |
961 | 961 | ); |
962 | 962 | |
@@ -980,9 +980,9 @@ discard block |
||
980 | 980 | the_widget('geodir_advance_search_widget', $params, $params ); |
981 | 981 | |
982 | 982 | $output = ob_get_contents(); |
983 | - ob_end_clean(); |
|
983 | + ob_end_clean(); |
|
984 | 984 | |
985 | - return $output; |
|
985 | + return $output; |
|
986 | 986 | } |
987 | 987 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
988 | 988 | |
@@ -1028,48 +1028,48 @@ discard block |
||
1028 | 1028 | 'add_location_filter' => '1', |
1029 | 1029 | 'tab_layout' => 'bestof-tabs-on-top', |
1030 | 1030 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
1031 | - 'after_widget' => '</section>', |
|
1032 | - 'before_title' => '<h3 class="widget-title">', |
|
1033 | - 'after_title' => '</h3>', |
|
1031 | + 'after_widget' => '</section>', |
|
1032 | + 'before_title' => '<h3 class="widget-title">', |
|
1033 | + 'after_title' => '</h3>', |
|
1034 | 1034 | ); |
1035 | 1035 | $params = shortcode_atts($defaults, $atts); |
1036 | 1036 | |
1037 | - /** |
|
1038 | - * Validate our incoming params |
|
1039 | - */ |
|
1037 | + /** |
|
1038 | + * Validate our incoming params |
|
1039 | + */ |
|
1040 | 1040 | |
1041 | - // Validate the selected post type, default to gd_place on fail |
|
1042 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
1043 | - $params['post_type'] = 'gd_place'; |
|
1044 | - } |
|
1041 | + // Validate the selected post type, default to gd_place on fail |
|
1042 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
1043 | + $params['post_type'] = 'gd_place'; |
|
1044 | + } |
|
1045 | 1045 | |
1046 | 1046 | // Post limit needs to be a positive integer |
1047 | - $params['post_limit'] = absint($params['post_limit']); |
|
1048 | - if (0 == $params['post_limit']) { |
|
1049 | - $params['post_limit'] = 5; |
|
1050 | - } |
|
1047 | + $params['post_limit'] = absint($params['post_limit']); |
|
1048 | + if (0 == $params['post_limit']) { |
|
1049 | + $params['post_limit'] = 5; |
|
1050 | + } |
|
1051 | 1051 | |
1052 | 1052 | // Category limit needs to be a positive integer |
1053 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
1054 | - if (0 == $params['categ_limit']) { |
|
1055 | - $params['categ_limit'] = 3; |
|
1056 | - } |
|
1053 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
1054 | + if (0 == $params['categ_limit']) { |
|
1055 | + $params['categ_limit'] = 3; |
|
1056 | + } |
|
1057 | 1057 | |
1058 | 1058 | // Tab layout validation |
1059 | - $params['tab_layout'] = $params['tab_layout']; |
|
1060 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
1061 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
1062 | - } |
|
1059 | + $params['tab_layout'] = $params['tab_layout']; |
|
1060 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
1061 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
1062 | + } |
|
1063 | 1063 | |
1064 | 1064 | // Validate character_count |
1065 | - $params['character_count'] = $params['character_count']; |
|
1065 | + $params['character_count'] = $params['character_count']; |
|
1066 | 1066 | |
1067 | 1067 | ob_start(); |
1068 | 1068 | the_widget('geodir_bestof_widget', $params, $params); |
1069 | - $output = ob_get_contents(); |
|
1070 | - ob_end_clean(); |
|
1069 | + $output = ob_get_contents(); |
|
1070 | + ob_end_clean(); |
|
1071 | 1071 | |
1072 | - return $output; |
|
1072 | + return $output; |
|
1073 | 1073 | } |
1074 | 1074 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
1075 | 1075 | |
@@ -1117,127 +1117,127 @@ discard block |
||
1117 | 1117 | * @return string HTML content to display geodirectory listings. |
1118 | 1118 | */ |
1119 | 1119 | function geodir_sc_gd_listings($atts, $content = '') { |
1120 | - global $post; |
|
1121 | - $defaults = array( |
|
1122 | - 'title' => '', |
|
1123 | - 'post_type' => 'gd_place', |
|
1124 | - 'category' => 0, |
|
1125 | - 'list_sort' => 'latest', |
|
1126 | - 'event_type' => '', |
|
1127 | - 'post_number' => 10, |
|
1128 | - 'post_author' => '', |
|
1129 | - 'layout' => 'gridview_onehalf', |
|
1130 | - 'listing_width' => '', |
|
1131 | - 'character_count' => 20, |
|
1132 | - 'add_location_filter' => 1, |
|
1133 | - 'show_featured_only' => '', |
|
1134 | - 'show_special_only' => '', |
|
1135 | - 'with_pics_only' => '', |
|
1136 | - 'with_videos_only' => '', |
|
1137 | - 'with_pagination' => '1', |
|
1138 | - 'top_pagination' => '0', |
|
1139 | - 'bottom_pagination' => '1', |
|
1140 | - 'without_no_results' => 0, |
|
1141 | - 'tags' => '' |
|
1142 | - ); |
|
1143 | - $params = shortcode_atts($defaults, $atts); |
|
1144 | - |
|
1145 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
1146 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1147 | - |
|
1148 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
1149 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1150 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1151 | - |
|
1152 | - // Make sure we have an array |
|
1153 | - if (!(is_array($params['category']))) { |
|
1154 | - $params['category'] = explode(',', $params['category']); |
|
1155 | - } |
|
1156 | - |
|
1157 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1158 | - // Otherwise it becomes empty and later on that will mean "All" |
|
1159 | - $params['category'] = array_intersect($params['category'], $categories); |
|
1160 | - |
|
1161 | - // Post_number needs to be a positive integer |
|
1162 | - $params['post_number'] = absint($params['post_number']); |
|
1163 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1120 | + global $post; |
|
1121 | + $defaults = array( |
|
1122 | + 'title' => '', |
|
1123 | + 'post_type' => 'gd_place', |
|
1124 | + 'category' => 0, |
|
1125 | + 'list_sort' => 'latest', |
|
1126 | + 'event_type' => '', |
|
1127 | + 'post_number' => 10, |
|
1128 | + 'post_author' => '', |
|
1129 | + 'layout' => 'gridview_onehalf', |
|
1130 | + 'listing_width' => '', |
|
1131 | + 'character_count' => 20, |
|
1132 | + 'add_location_filter' => 1, |
|
1133 | + 'show_featured_only' => '', |
|
1134 | + 'show_special_only' => '', |
|
1135 | + 'with_pics_only' => '', |
|
1136 | + 'with_videos_only' => '', |
|
1137 | + 'with_pagination' => '1', |
|
1138 | + 'top_pagination' => '0', |
|
1139 | + 'bottom_pagination' => '1', |
|
1140 | + 'without_no_results' => 0, |
|
1141 | + 'tags' => '' |
|
1142 | + ); |
|
1143 | + $params = shortcode_atts($defaults, $atts); |
|
1144 | + |
|
1145 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
1146 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1147 | + |
|
1148 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
1149 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1150 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1151 | + |
|
1152 | + // Make sure we have an array |
|
1153 | + if (!(is_array($params['category']))) { |
|
1154 | + $params['category'] = explode(',', $params['category']); |
|
1155 | + } |
|
1156 | + |
|
1157 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1158 | + // Otherwise it becomes empty and later on that will mean "All" |
|
1159 | + $params['category'] = array_intersect($params['category'], $categories); |
|
1160 | + |
|
1161 | + // Post_number needs to be a positive integer |
|
1162 | + $params['post_number'] = absint($params['post_number']); |
|
1163 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1164 | 1164 | |
1165 | - // Post_number needs to be a positive integer |
|
1166 | - if (!empty($atts['post_author'])) { |
|
1167 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1168 | - $params['post_author'] = $post->post_author; |
|
1169 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1170 | - $params['post_author'] = absint($atts['post_author']); |
|
1171 | - } else { |
|
1172 | - unset($params['post_author']); |
|
1173 | - } |
|
1174 | - } else { |
|
1175 | - unset($params['post_author']); |
|
1176 | - } |
|
1177 | - |
|
1178 | - // Validate character_count |
|
1179 | - //todo: is this necessary? |
|
1180 | - $params['character_count'] = $params['character_count']; |
|
1181 | - |
|
1182 | - // Validate our layout choice |
|
1183 | - // Outside of the norm, I added some more simple terms to match the existing |
|
1184 | - // So now I just run the switch to set it properly. |
|
1185 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1186 | - |
|
1187 | - // Validate our sorting choice |
|
1188 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1189 | - |
|
1190 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
1191 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1192 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1193 | - |
|
1194 | - // Validate the checkboxes used on the widget |
|
1195 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1196 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1197 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1198 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1199 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1200 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1201 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1202 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1203 | - |
|
1204 | - // Clean tags |
|
1205 | - if (!empty($params['tags'])) { |
|
1206 | - if (!is_array($params['tags'])) { |
|
1207 | - $comma = _x(',', 'tag delimiter'); |
|
1208 | - if ( ',' !== $comma ) { |
|
1209 | - $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1210 | - } |
|
1211 | - $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1212 | - $params['tags'] = array_map('trim', $params['tags']); |
|
1213 | - } |
|
1214 | - } else { |
|
1215 | - $params['tags'] = array(); |
|
1216 | - } |
|
1217 | - |
|
1218 | - /** |
|
1219 | - * End of validation |
|
1220 | - */ |
|
1221 | - if (isset($atts['geodir_ajax'])) { |
|
1222 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1223 | - unset($atts['geodir_ajax']); |
|
1224 | - } |
|
1225 | - if (isset($atts['pageno'])) { |
|
1226 | - $params['pageno'] = $atts['pageno']; |
|
1227 | - unset($atts['pageno']); |
|
1228 | - } |
|
1229 | - |
|
1230 | - if ( !empty($atts['shortcode_content']) ) { |
|
1231 | - $content = $atts['shortcode_content']; |
|
1232 | - } |
|
1233 | - $params['shortcode_content'] = trim($content); |
|
1234 | - $atts['shortcode_content'] = trim($content); |
|
1165 | + // Post_number needs to be a positive integer |
|
1166 | + if (!empty($atts['post_author'])) { |
|
1167 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1168 | + $params['post_author'] = $post->post_author; |
|
1169 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1170 | + $params['post_author'] = absint($atts['post_author']); |
|
1171 | + } else { |
|
1172 | + unset($params['post_author']); |
|
1173 | + } |
|
1174 | + } else { |
|
1175 | + unset($params['post_author']); |
|
1176 | + } |
|
1177 | + |
|
1178 | + // Validate character_count |
|
1179 | + //todo: is this necessary? |
|
1180 | + $params['character_count'] = $params['character_count']; |
|
1181 | + |
|
1182 | + // Validate our layout choice |
|
1183 | + // Outside of the norm, I added some more simple terms to match the existing |
|
1184 | + // So now I just run the switch to set it properly. |
|
1185 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1186 | + |
|
1187 | + // Validate our sorting choice |
|
1188 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1189 | + |
|
1190 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
1191 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1192 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1193 | + |
|
1194 | + // Validate the checkboxes used on the widget |
|
1195 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1196 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1197 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1198 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1199 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1200 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1201 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1202 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1203 | + |
|
1204 | + // Clean tags |
|
1205 | + if (!empty($params['tags'])) { |
|
1206 | + if (!is_array($params['tags'])) { |
|
1207 | + $comma = _x(',', 'tag delimiter'); |
|
1208 | + if ( ',' !== $comma ) { |
|
1209 | + $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1210 | + } |
|
1211 | + $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1212 | + $params['tags'] = array_map('trim', $params['tags']); |
|
1213 | + } |
|
1214 | + } else { |
|
1215 | + $params['tags'] = array(); |
|
1216 | + } |
|
1217 | + |
|
1218 | + /** |
|
1219 | + * End of validation |
|
1220 | + */ |
|
1221 | + if (isset($atts['geodir_ajax'])) { |
|
1222 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1223 | + unset($atts['geodir_ajax']); |
|
1224 | + } |
|
1225 | + if (isset($atts['pageno'])) { |
|
1226 | + $params['pageno'] = $atts['pageno']; |
|
1227 | + unset($atts['pageno']); |
|
1228 | + } |
|
1229 | + |
|
1230 | + if ( !empty($atts['shortcode_content']) ) { |
|
1231 | + $content = $atts['shortcode_content']; |
|
1232 | + } |
|
1233 | + $params['shortcode_content'] = trim($content); |
|
1234 | + $atts['shortcode_content'] = trim($content); |
|
1235 | 1235 | |
1236 | - $params['shortcode_atts'] = $atts; |
|
1236 | + $params['shortcode_atts'] = $atts; |
|
1237 | 1237 | |
1238 | - $output = geodir_sc_gd_listings_output($params); |
|
1238 | + $output = geodir_sc_gd_listings_output($params); |
|
1239 | 1239 | |
1240 | - return $output; |
|
1240 | + return $output; |
|
1241 | 1241 | } |
1242 | 1242 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
1243 | 1243 | |
@@ -1277,56 +1277,56 @@ discard block |
||
1277 | 1277 | * @return string HTML content to display CPT categories. |
1278 | 1278 | */ |
1279 | 1279 | function geodir_sc_cpt_categories_widget($atts, $content = '') { |
1280 | - $defaults = array( |
|
1281 | - 'title' => '', |
|
1282 | - 'post_type' => '', // NULL for all |
|
1283 | - 'hide_empty' => '', |
|
1284 | - 'show_count' => '', |
|
1285 | - 'hide_icon' => '', |
|
1286 | - 'cpt_left' => '', |
|
1287 | - 'sort_by' => 'count', |
|
1288 | - 'max_count' => 'all', |
|
1289 | - 'max_level' => '1', |
|
1290 | - 'no_cpt_filter' => '', |
|
1291 | - 'no_cat_filter' => '', |
|
1292 | - 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1293 | - 'after_widget' => '</section>', |
|
1294 | - 'before_title' => '<h3 class="widget-title">', |
|
1295 | - 'after_title' => '</h3>', |
|
1296 | - ); |
|
1297 | - $params = shortcode_atts($defaults, $atts); |
|
1298 | - |
|
1299 | - /** |
|
1300 | - * Validate our incoming params |
|
1301 | - */ |
|
1302 | - // Make sure we have an array |
|
1303 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1304 | - |
|
1305 | - // Validate the checkboxes used on the widget |
|
1306 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1307 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1308 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1309 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1280 | + $defaults = array( |
|
1281 | + 'title' => '', |
|
1282 | + 'post_type' => '', // NULL for all |
|
1283 | + 'hide_empty' => '', |
|
1284 | + 'show_count' => '', |
|
1285 | + 'hide_icon' => '', |
|
1286 | + 'cpt_left' => '', |
|
1287 | + 'sort_by' => 'count', |
|
1288 | + 'max_count' => 'all', |
|
1289 | + 'max_level' => '1', |
|
1290 | + 'no_cpt_filter' => '', |
|
1291 | + 'no_cat_filter' => '', |
|
1292 | + 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1293 | + 'after_widget' => '</section>', |
|
1294 | + 'before_title' => '<h3 class="widget-title">', |
|
1295 | + 'after_title' => '</h3>', |
|
1296 | + ); |
|
1297 | + $params = shortcode_atts($defaults, $atts); |
|
1310 | 1298 | |
1311 | - if ($params['max_count'] != 'all') { |
|
1312 | - $params['max_count'] = absint($params['max_count']); |
|
1313 | - } |
|
1299 | + /** |
|
1300 | + * Validate our incoming params |
|
1301 | + */ |
|
1302 | + // Make sure we have an array |
|
1303 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1304 | + |
|
1305 | + // Validate the checkboxes used on the widget |
|
1306 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1307 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1308 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1309 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1310 | + |
|
1311 | + if ($params['max_count'] != 'all') { |
|
1312 | + $params['max_count'] = absint($params['max_count']); |
|
1313 | + } |
|
1314 | 1314 | |
1315 | - if ($params['max_level'] != 'all') { |
|
1316 | - $params['max_level'] = absint($params['max_level']); |
|
1317 | - } |
|
1315 | + if ($params['max_level'] != 'all') { |
|
1316 | + $params['max_level'] = absint($params['max_level']); |
|
1317 | + } |
|
1318 | 1318 | |
1319 | - $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1320 | - $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1319 | + $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1320 | + $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1321 | 1321 | |
1322 | - $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1322 | + $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1323 | 1323 | |
1324 | - ob_start(); |
|
1325 | - the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1326 | - $output = ob_get_contents(); |
|
1327 | - ob_end_clean(); |
|
1324 | + ob_start(); |
|
1325 | + the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1326 | + $output = ob_get_contents(); |
|
1327 | + ob_end_clean(); |
|
1328 | 1328 | |
1329 | - return $output; |
|
1329 | + return $output; |
|
1330 | 1330 | } |
1331 | 1331 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
1332 | 1332 | |
@@ -1341,6 +1341,6 @@ discard block |
||
1341 | 1341 | * @return string HTML code. |
1342 | 1342 | */ |
1343 | 1343 | function geodir_sc_responsive_videos($atts, $content) { |
1344 | - return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1344 | + return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1345 | 1345 | } |
1346 | 1346 | add_shortcode('gd_video', 'geodir_sc_responsive_videos'); |
1347 | 1347 | \ No newline at end of file |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | // Add marker cluster |
198 | 198 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
199 | 199 | $map_args['enable_marker_cluster'] = true; |
200 | - if(get_option('geodir_marker_cluster_type')) { |
|
200 | + if (get_option('geodir_marker_cluster_type')) { |
|
201 | 201 | if ($map_args['autozoom']) { |
202 | 202 | $map_args['enable_marker_cluster_no_reposition'] = false; |
203 | 203 | } else { |
204 | 204 | $map_args['enable_marker_cluster_no_reposition'] = true; |
205 | 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 { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | |
214 | 214 | // if lat and long set in shortcode, hack it so the map is not repositioned |
215 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
215 | + if (!empty($params['latitude']) && !empty($params['longitude'])) { |
|
216 | 216 | $map_args['enable_marker_cluster_no_reposition'] = true; |
217 | 217 | } |
218 | 218 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | // Array_intersect returns only the items in $params['category'] that are also in our category list |
302 | 302 | // Otherwise it becomes empty and later on that will mean "All" |
303 | - $params['category'] = array_intersect($params['category'], $categories); |
|
303 | + $params['category'] = array_intersect($params['category'], $categories); |
|
304 | 304 | |
305 | 305 | if ($params['post_type'] == 'gd_event') { |
306 | 306 | $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | 'gd_location' => false, |
317 | 317 | ); |
318 | 318 | |
319 | - if (!empty($params['category']) && isset($params['category'][0]) && (int)$params['category'][0] != 0) { |
|
319 | + if (!empty($params['category']) && isset($params['category'][0]) && (int) $params['category'][0] != 0) { |
|
320 | 320 | $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
321 | 321 | |
322 | 322 | ######### WPML ######### |
@@ -964,20 +964,20 @@ discard block |
||
964 | 964 | |
965 | 965 | $show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : ''; |
966 | 966 | |
967 | - if ($show_adv_search != '' ) { |
|
968 | - $show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' '; |
|
967 | + if ($show_adv_search != '') { |
|
968 | + $show_adv_class = 'geodir-advance-search-'.$show_adv_search.' '; |
|
969 | 969 | if ($show_adv_search == 'searched' && geodir_is_page('search')) { |
970 | 970 | $show_adv_search = 'search'; |
971 | 971 | } |
972 | - $show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"'; |
|
972 | + $show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"'; |
|
973 | 973 | |
974 | - $params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']); |
|
974 | + $params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']); |
|
975 | 975 | } |
976 | 976 | |
977 | 977 | ob_start(); |
978 | 978 | |
979 | 979 | //geodir_get_template_part('listing', 'filter-form'); |
980 | - the_widget('geodir_advance_search_widget', $params, $params ); |
|
980 | + the_widget('geodir_advance_search_widget', $params, $params); |
|
981 | 981 | |
982 | 982 | $output = ob_get_contents(); |
983 | 983 | ob_end_clean(); |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | |
1178 | 1178 | // Validate character_count |
1179 | 1179 | //todo: is this necessary? |
1180 | - $params['character_count'] = $params['character_count']; |
|
1180 | + $params['character_count'] = $params['character_count']; |
|
1181 | 1181 | |
1182 | 1182 | // Validate our layout choice |
1183 | 1183 | // Outside of the norm, I added some more simple terms to match the existing |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | // Validate Listing width, used in the template widget-listing-listview.php |
1191 | 1191 | // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
1192 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1192 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1193 | 1193 | |
1194 | 1194 | // Validate the checkboxes used on the widget |
1195 | 1195 | $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | if (!empty($params['tags'])) { |
1206 | 1206 | if (!is_array($params['tags'])) { |
1207 | 1207 | $comma = _x(',', 'tag delimiter'); |
1208 | - if ( ',' !== $comma ) { |
|
1208 | + if (',' !== $comma) { |
|
1209 | 1209 | $params['tags'] = str_replace($comma, ',', $params['tags']); |
1210 | 1210 | } |
1211 | 1211 | $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
@@ -1227,13 +1227,13 @@ discard block |
||
1227 | 1227 | unset($atts['pageno']); |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( !empty($atts['shortcode_content']) ) { |
|
1230 | + if (!empty($atts['shortcode_content'])) { |
|
1231 | 1231 | $content = $atts['shortcode_content']; |
1232 | 1232 | } |
1233 | 1233 | $params['shortcode_content'] = trim($content); |
1234 | 1234 | $atts['shortcode_content'] = trim($content); |
1235 | 1235 | |
1236 | - $params['shortcode_atts'] = $atts; |
|
1236 | + $params['shortcode_atts'] = $atts; |
|
1237 | 1237 | |
1238 | 1238 | $output = geodir_sc_gd_listings_output($params); |
1239 | 1239 | |
@@ -1305,8 +1305,8 @@ discard block |
||
1305 | 1305 | // Validate the checkboxes used on the widget |
1306 | 1306 | $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
1307 | 1307 | $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
1308 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1309 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1308 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1309 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1310 | 1310 | |
1311 | 1311 | if ($params['max_count'] != 'all') { |
1312 | 1312 | $params['max_count'] = absint($params['max_count']); |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | * @return int|null Return the page ID if present or null if not. |
15 | 15 | */ |
16 | 16 | function geodir_add_listing_page_id(){ |
17 | - $gd_page_id = get_option('geodir_add_listing_page'); |
|
17 | + $gd_page_id = get_option('geodir_add_listing_page'); |
|
18 | 18 | |
19 | - if (function_exists('icl_object_id')) { |
|
20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | - } |
|
19 | + if (function_exists('icl_object_id')) { |
|
20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | + } |
|
22 | 22 | |
23 | - return $gd_page_id; |
|
23 | + return $gd_page_id; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | * @return int|null Return the page ID if present or null if not. |
32 | 32 | */ |
33 | 33 | function geodir_preview_page_id(){ |
34 | - $gd_page_id = get_option('geodir_preview_page'); |
|
34 | + $gd_page_id = get_option('geodir_preview_page'); |
|
35 | 35 | |
36 | - if (function_exists('icl_object_id')) { |
|
37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | - } |
|
36 | + if (function_exists('icl_object_id')) { |
|
37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | + } |
|
39 | 39 | |
40 | - return $gd_page_id; |
|
40 | + return $gd_page_id; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * @return int|null Return the page ID if present or null if not. |
49 | 49 | */ |
50 | 50 | function geodir_success_page_id(){ |
51 | - $gd_page_id = get_option('geodir_success_page'); |
|
51 | + $gd_page_id = get_option('geodir_success_page'); |
|
52 | 52 | |
53 | - if (function_exists('icl_object_id')) { |
|
54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | - } |
|
53 | + if (function_exists('icl_object_id')) { |
|
54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | + } |
|
56 | 56 | |
57 | - return $gd_page_id; |
|
57 | + return $gd_page_id; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * @return int|null Return the page ID if present or null if not. |
66 | 66 | */ |
67 | 67 | function geodir_location_page_id(){ |
68 | - $gd_page_id = get_option('geodir_location_page'); |
|
68 | + $gd_page_id = get_option('geodir_location_page'); |
|
69 | 69 | |
70 | - if (function_exists('icl_object_id')) { |
|
71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | - } |
|
70 | + if (function_exists('icl_object_id')) { |
|
71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | + } |
|
73 | 73 | |
74 | - return $gd_page_id; |
|
74 | + return $gd_page_id; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | * @return int|null Return the page ID if present or null if not. |
83 | 83 | */ |
84 | 84 | function geodir_home_page_id(){ |
85 | - $gd_page_id = get_option('geodir_home_page'); |
|
85 | + $gd_page_id = get_option('geodir_home_page'); |
|
86 | 86 | |
87 | - if (function_exists('icl_object_id')) { |
|
88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | - } |
|
87 | + if (function_exists('icl_object_id')) { |
|
88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | + } |
|
90 | 90 | |
91 | - return $gd_page_id; |
|
91 | + return $gd_page_id; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @return int|null Return the page ID if present or null if not. |
100 | 100 | */ |
101 | 101 | function geodir_info_page_id(){ |
102 | - $gd_page_id = get_option('geodir_info_page'); |
|
102 | + $gd_page_id = get_option('geodir_info_page'); |
|
103 | 103 | |
104 | - if (function_exists('icl_object_id')) { |
|
105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | - } |
|
104 | + if (function_exists('icl_object_id')) { |
|
105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | + } |
|
107 | 107 | |
108 | - return $gd_page_id; |
|
108 | + return $gd_page_id; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | * @return int|null Return the page ID if present or null if not. |
117 | 117 | */ |
118 | 118 | function geodir_login_page_id(){ |
119 | - $gd_page_id = get_option('geodir_login_page'); |
|
119 | + $gd_page_id = get_option('geodir_login_page'); |
|
120 | 120 | |
121 | - if (function_exists('icl_object_id')) { |
|
122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | - } |
|
121 | + if (function_exists('icl_object_id')) { |
|
122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | + } |
|
124 | 124 | |
125 | - return $gd_page_id; |
|
125 | + return $gd_page_id; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | * @return int|null Return the page ID if present or null if not. |
135 | 135 | */ |
136 | 136 | function geodir_login_url($args=array()){ |
137 | - $gd_page_id = get_option('geodir_login_page'); |
|
137 | + $gd_page_id = get_option('geodir_login_page'); |
|
138 | 138 | |
139 | - if (function_exists('icl_object_id')) { |
|
140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | - } |
|
139 | + if (function_exists('icl_object_id')) { |
|
140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | + } |
|
142 | 142 | |
143 | - if (function_exists('geodir_location_geo_home_link')) { |
|
144 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
145 | - } |
|
143 | + if (function_exists('geodir_location_geo_home_link')) { |
|
144 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
145 | + } |
|
146 | 146 | |
147 | 147 | if (defined('ICL_LANGUAGE_CODE')){ |
148 | 148 | $home_url = icl_get_home_url(); |
@@ -150,35 +150,35 @@ discard block |
||
150 | 150 | $home_url = home_url(); |
151 | 151 | } |
152 | 152 | |
153 | - if (function_exists('geodir_location_geo_home_link')) { |
|
154 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
155 | - } |
|
156 | - |
|
157 | - if($gd_page_id){ |
|
158 | - $post = get_post($gd_page_id); |
|
159 | - $slug = $post->post_name; |
|
160 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
161 | - $login_url = trailingslashit($home_url)."$slug/"; |
|
162 | - }else{ |
|
163 | - $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
164 | - } |
|
165 | - |
|
166 | - if($args){ |
|
167 | - $login_url = add_query_arg($args,$login_url ); |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Filter the GeoDirectory login page url. |
|
172 | - * |
|
173 | - * This filter can be used to change the GeoDirectory page url. |
|
174 | - * |
|
175 | - * @since 1.5.3 |
|
176 | - * @package GeoDirectory |
|
177 | - * @param string $login_url The url of the login page. |
|
178 | - * @param array $args The array of query args used. |
|
179 | - * @param int $gd_page_id The page id of the GD login page. |
|
180 | - */ |
|
181 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
153 | + if (function_exists('geodir_location_geo_home_link')) { |
|
154 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
155 | + } |
|
156 | + |
|
157 | + if($gd_page_id){ |
|
158 | + $post = get_post($gd_page_id); |
|
159 | + $slug = $post->post_name; |
|
160 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
161 | + $login_url = trailingslashit($home_url)."$slug/"; |
|
162 | + }else{ |
|
163 | + $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
164 | + } |
|
165 | + |
|
166 | + if($args){ |
|
167 | + $login_url = add_query_arg($args,$login_url ); |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Filter the GeoDirectory login page url. |
|
172 | + * |
|
173 | + * This filter can be used to change the GeoDirectory page url. |
|
174 | + * |
|
175 | + * @since 1.5.3 |
|
176 | + * @package GeoDirectory |
|
177 | + * @param string $login_url The url of the login page. |
|
178 | + * @param array $args The array of query args used. |
|
179 | + * @param int $gd_page_id The page id of the GD login page. |
|
180 | + */ |
|
181 | + return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | * @return string Info page url. |
191 | 191 | */ |
192 | 192 | function geodir_info_url($args=array()){ |
193 | - $gd_page_id = get_option('geodir_info_page'); |
|
193 | + $gd_page_id = get_option('geodir_info_page'); |
|
194 | 194 | |
195 | - if (function_exists('icl_object_id')) { |
|
196 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
197 | - } |
|
195 | + if (function_exists('icl_object_id')) { |
|
196 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
197 | + } |
|
198 | 198 | |
199 | - if (function_exists('geodir_location_geo_home_link')) { |
|
200 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
201 | - } |
|
199 | + if (function_exists('geodir_location_geo_home_link')) { |
|
200 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
201 | + } |
|
202 | 202 | |
203 | 203 | if (defined('ICL_LANGUAGE_CODE')){ |
204 | 204 | $home_url = icl_get_home_url(); |
@@ -206,24 +206,24 @@ discard block |
||
206 | 206 | $home_url = home_url(); |
207 | 207 | } |
208 | 208 | |
209 | - if (function_exists('geodir_location_geo_home_link')) { |
|
210 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
211 | - } |
|
209 | + if (function_exists('geodir_location_geo_home_link')) { |
|
210 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
211 | + } |
|
212 | 212 | |
213 | - if($gd_page_id){ |
|
214 | - $post = get_post($gd_page_id); |
|
215 | - $slug = $post->post_name; |
|
216 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
217 | - $info_url = trailingslashit($home_url)."$slug/"; |
|
218 | - }else{ |
|
219 | - $info_url = trailingslashit($home_url); |
|
220 | - } |
|
213 | + if($gd_page_id){ |
|
214 | + $post = get_post($gd_page_id); |
|
215 | + $slug = $post->post_name; |
|
216 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
217 | + $info_url = trailingslashit($home_url)."$slug/"; |
|
218 | + }else{ |
|
219 | + $info_url = trailingslashit($home_url); |
|
220 | + } |
|
221 | 221 | |
222 | - if($args){ |
|
223 | - $info_url = add_query_arg($args,$info_url ); |
|
224 | - } |
|
222 | + if($args){ |
|
223 | + $info_url = add_query_arg($args,$info_url ); |
|
224 | + } |
|
225 | 225 | |
226 | - return $info_url; |
|
226 | + return $info_url; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @return string Returns converted string. |
240 | 240 | */ |
241 | 241 | function geodir_ucwords($string, $charset='UTF-8') { |
242 | - if (function_exists('mb_convert_case')) { |
|
243 | - return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
244 | - } else { |
|
245 | - return ucwords($string); |
|
246 | - } |
|
242 | + if (function_exists('mb_convert_case')) { |
|
243 | + return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
244 | + } else { |
|
245 | + return ucwords($string); |
|
246 | + } |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * @return string Returns converted string. |
260 | 260 | */ |
261 | 261 | function geodir_strtolower($string, $charset='UTF-8') { |
262 | - if (function_exists('mb_convert_case')) { |
|
263 | - return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
264 | - } else { |
|
265 | - return strtolower($string); |
|
266 | - } |
|
262 | + if (function_exists('mb_convert_case')) { |
|
263 | + return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
264 | + } else { |
|
265 | + return strtolower($string); |
|
266 | + } |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | * @return string Returns converted string. |
280 | 280 | */ |
281 | 281 | function geodir_strtoupper($string, $charset='UTF-8') { |
282 | - if (function_exists('mb_convert_case')) { |
|
283 | - return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
284 | - } else { |
|
285 | - return strtoupper($string); |
|
286 | - } |
|
282 | + if (function_exists('mb_convert_case')) { |
|
283 | + return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
284 | + } else { |
|
285 | + return strtoupper($string); |
|
286 | + } |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -462,11 +462,11 @@ discard block |
||
462 | 462 | * @package GeoDirectory |
463 | 463 | */ |
464 | 464 | function _gd_die_handler() { |
465 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
466 | - return '_gd_die_handler'; |
|
467 | - } else { |
|
468 | - die(); |
|
469 | - } |
|
465 | + if ( defined( 'GD_TESTING_MODE' ) ) { |
|
466 | + return '_gd_die_handler'; |
|
467 | + } else { |
|
468 | + die(); |
|
469 | + } |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | * @param int $status Optional. Status code. |
482 | 482 | */ |
483 | 483 | function gd_die( $message = '', $title = '', $status = 400 ) { |
484 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
485 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
486 | - wp_die( $message, $title, array( 'response' => $status )); |
|
484 | + add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
485 | + add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
486 | + wp_die( $message, $title, array( 'response' => $status )); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /* |
@@ -652,35 +652,35 @@ discard block |
||
652 | 652 | * @return string The formatted date. |
653 | 653 | */ |
654 | 654 | function geodir_date($date_input, $date_to, $date_from = '') { |
655 | - if (empty($date_input) || empty($date_to)) { |
|
656 | - return NULL; |
|
657 | - } |
|
655 | + if (empty($date_input) || empty($date_to)) { |
|
656 | + return NULL; |
|
657 | + } |
|
658 | 658 | |
659 | - $date = ''; |
|
660 | - if (!empty($date_from)) { |
|
661 | - $datetime = date_create_from_format($date_from, $date_input); |
|
659 | + $date = ''; |
|
660 | + if (!empty($date_from)) { |
|
661 | + $datetime = date_create_from_format($date_from, $date_input); |
|
662 | 662 | |
663 | - if (!empty($datetime)) { |
|
664 | - $date = $datetime->format($date_to); |
|
665 | - } |
|
666 | - } |
|
663 | + if (!empty($datetime)) { |
|
664 | + $date = $datetime->format($date_to); |
|
665 | + } |
|
666 | + } |
|
667 | 667 | |
668 | - if (empty($date)) { |
|
669 | - $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
670 | - $date = date_i18n($date_to, strtotime($date)); |
|
671 | - } |
|
668 | + if (empty($date)) { |
|
669 | + $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
670 | + $date = date_i18n($date_to, strtotime($date)); |
|
671 | + } |
|
672 | 672 | |
673 | - $date = geodir_maybe_untranslate_date($date); |
|
674 | - /** |
|
675 | - * Filter the the date format conversion. |
|
676 | - * |
|
677 | - * @since 1.6.7 |
|
678 | - * @package GeoDirectory |
|
679 | - * |
|
680 | - * @param string $date The date string. |
|
681 | - * @param string $date_input The date input. |
|
682 | - * @param string $date_to The destination date format. |
|
683 | - * @param string $date_from The source date format. |
|
684 | - */ |
|
685 | - return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from); |
|
673 | + $date = geodir_maybe_untranslate_date($date); |
|
674 | + /** |
|
675 | + * Filter the the date format conversion. |
|
676 | + * |
|
677 | + * @since 1.6.7 |
|
678 | + * @package GeoDirectory |
|
679 | + * |
|
680 | + * @param string $date The date string. |
|
681 | + * @param string $date_input The date input. |
|
682 | + * @param string $date_to The destination date format. |
|
683 | + * @param string $date_from The source date format. |
|
684 | + */ |
|
685 | + return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from); |
|
686 | 686 | } |
687 | 687 | \ No newline at end of file |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | * @since 1.4.6 |
14 | 14 | * @return int|null Return the page ID if present or null if not. |
15 | 15 | */ |
16 | -function geodir_add_listing_page_id(){ |
|
16 | +function geodir_add_listing_page_id() { |
|
17 | 17 | $gd_page_id = get_option('geodir_add_listing_page'); |
18 | 18 | |
19 | 19 | if (function_exists('icl_object_id')) { |
20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | return $gd_page_id; |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * @since 1.4.6 |
31 | 31 | * @return int|null Return the page ID if present or null if not. |
32 | 32 | */ |
33 | -function geodir_preview_page_id(){ |
|
33 | +function geodir_preview_page_id() { |
|
34 | 34 | $gd_page_id = get_option('geodir_preview_page'); |
35 | 35 | |
36 | 36 | if (function_exists('icl_object_id')) { |
37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $gd_page_id; |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @since 1.4.6 |
48 | 48 | * @return int|null Return the page ID if present or null if not. |
49 | 49 | */ |
50 | -function geodir_success_page_id(){ |
|
50 | +function geodir_success_page_id() { |
|
51 | 51 | $gd_page_id = get_option('geodir_success_page'); |
52 | 52 | |
53 | 53 | if (function_exists('icl_object_id')) { |
54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return $gd_page_id; |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * @since 1.4.6 |
65 | 65 | * @return int|null Return the page ID if present or null if not. |
66 | 66 | */ |
67 | -function geodir_location_page_id(){ |
|
67 | +function geodir_location_page_id() { |
|
68 | 68 | $gd_page_id = get_option('geodir_location_page'); |
69 | 69 | |
70 | 70 | if (function_exists('icl_object_id')) { |
71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $gd_page_id; |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @since 1.5.4 |
82 | 82 | * @return int|null Return the page ID if present or null if not. |
83 | 83 | */ |
84 | -function geodir_home_page_id(){ |
|
84 | +function geodir_home_page_id() { |
|
85 | 85 | $gd_page_id = get_option('geodir_home_page'); |
86 | 86 | |
87 | 87 | if (function_exists('icl_object_id')) { |
88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $gd_page_id; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @since 1.5.3 |
99 | 99 | * @return int|null Return the page ID if present or null if not. |
100 | 100 | */ |
101 | -function geodir_info_page_id(){ |
|
101 | +function geodir_info_page_id() { |
|
102 | 102 | $gd_page_id = get_option('geodir_info_page'); |
103 | 103 | |
104 | 104 | if (function_exists('icl_object_id')) { |
105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return $gd_page_id; |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | * @since 1.5.3 |
116 | 116 | * @return int|null Return the page ID if present or null if not. |
117 | 117 | */ |
118 | -function geodir_login_page_id(){ |
|
118 | +function geodir_login_page_id() { |
|
119 | 119 | $gd_page_id = get_option('geodir_login_page'); |
120 | 120 | |
121 | 121 | if (function_exists('icl_object_id')) { |
122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $gd_page_id; |
@@ -133,20 +133,20 @@ discard block |
||
133 | 133 | * @since 1.5.3 |
134 | 134 | * @return int|null Return the page ID if present or null if not. |
135 | 135 | */ |
136 | -function geodir_login_url($args=array()){ |
|
136 | +function geodir_login_url($args = array()) { |
|
137 | 137 | $gd_page_id = get_option('geodir_login_page'); |
138 | 138 | |
139 | 139 | if (function_exists('icl_object_id')) { |
140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | if (function_exists('geodir_location_geo_home_link')) { |
144 | 144 | remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
145 | 145 | } |
146 | 146 | |
147 | - if (defined('ICL_LANGUAGE_CODE')){ |
|
147 | + if (defined('ICL_LANGUAGE_CODE')) { |
|
148 | 148 | $home_url = icl_get_home_url(); |
149 | - }else{ |
|
149 | + } else { |
|
150 | 150 | $home_url = home_url(); |
151 | 151 | } |
152 | 152 | |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
155 | 155 | } |
156 | 156 | |
157 | - if($gd_page_id){ |
|
157 | + if ($gd_page_id) { |
|
158 | 158 | $post = get_post($gd_page_id); |
159 | 159 | $slug = $post->post_name; |
160 | 160 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
161 | 161 | $login_url = trailingslashit($home_url)."$slug/"; |
162 | - }else{ |
|
162 | + } else { |
|
163 | 163 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
164 | 164 | } |
165 | 165 | |
166 | - if($args){ |
|
167 | - $login_url = add_query_arg($args,$login_url ); |
|
166 | + if ($args) { |
|
167 | + $login_url = add_query_arg($args, $login_url); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param array $args The array of query args used. |
179 | 179 | * @param int $gd_page_id The page id of the GD login page. |
180 | 180 | */ |
181 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
181 | + return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -189,20 +189,20 @@ discard block |
||
189 | 189 | * @since 1.5.16 Added WPML lang code to url. |
190 | 190 | * @return string Info page url. |
191 | 191 | */ |
192 | -function geodir_info_url($args=array()){ |
|
192 | +function geodir_info_url($args = array()) { |
|
193 | 193 | $gd_page_id = get_option('geodir_info_page'); |
194 | 194 | |
195 | 195 | if (function_exists('icl_object_id')) { |
196 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
196 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | if (function_exists('geodir_location_geo_home_link')) { |
200 | 200 | remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
201 | 201 | } |
202 | 202 | |
203 | - if (defined('ICL_LANGUAGE_CODE')){ |
|
203 | + if (defined('ICL_LANGUAGE_CODE')) { |
|
204 | 204 | $home_url = icl_get_home_url(); |
205 | - }else{ |
|
205 | + } else { |
|
206 | 206 | $home_url = home_url(); |
207 | 207 | } |
208 | 208 | |
@@ -210,17 +210,17 @@ discard block |
||
210 | 210 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
211 | 211 | } |
212 | 212 | |
213 | - if($gd_page_id){ |
|
213 | + if ($gd_page_id) { |
|
214 | 214 | $post = get_post($gd_page_id); |
215 | 215 | $slug = $post->post_name; |
216 | 216 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
217 | 217 | $info_url = trailingslashit($home_url)."$slug/"; |
218 | - }else{ |
|
218 | + } else { |
|
219 | 219 | $info_url = trailingslashit($home_url); |
220 | 220 | } |
221 | 221 | |
222 | - if($args){ |
|
223 | - $info_url = add_query_arg($args,$info_url ); |
|
222 | + if ($args) { |
|
223 | + $info_url = add_query_arg($args, $info_url); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return $info_url; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param string $charset Character set to use for conversion. |
239 | 239 | * @return string Returns converted string. |
240 | 240 | */ |
241 | -function geodir_ucwords($string, $charset='UTF-8') { |
|
241 | +function geodir_ucwords($string, $charset = 'UTF-8') { |
|
242 | 242 | if (function_exists('mb_convert_case')) { |
243 | 243 | return mb_convert_case($string, MB_CASE_TITLE, $charset); |
244 | 244 | } else { |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param string $charset Character set to use for conversion. |
259 | 259 | * @return string Returns converted string. |
260 | 260 | */ |
261 | -function geodir_strtolower($string, $charset='UTF-8') { |
|
261 | +function geodir_strtolower($string, $charset = 'UTF-8') { |
|
262 | 262 | if (function_exists('mb_convert_case')) { |
263 | 263 | return mb_convert_case($string, MB_CASE_LOWER, $charset); |
264 | 264 | } else { |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @param string $charset Character set to use for conversion. |
279 | 279 | * @return string Returns converted string. |
280 | 280 | */ |
281 | -function geodir_strtoupper($string, $charset='UTF-8') { |
|
281 | +function geodir_strtoupper($string, $charset = 'UTF-8') { |
|
282 | 282 | if (function_exists('mb_convert_case')) { |
283 | 283 | return mb_convert_case($string, MB_CASE_UPPER, $charset); |
284 | 284 | } else { |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | |
310 | 310 | $url = trim($parts[0]); |
311 | 311 | if ($formatted && $url != '') { |
312 | - $url = str_replace( ' ', '%20', $url ); |
|
312 | + $url = str_replace(' ', '%20', $url); |
|
313 | 313 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); |
314 | 314 | |
315 | 315 | if (0 !== stripos($url, 'mailto:')) { |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | |
320 | 320 | $url = str_replace(';//', '://', $url); |
321 | 321 | |
322 | - if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
323 | - $url = 'http://' . $url; |
|
322 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
323 | + $url = 'http://'.$url; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | $url = wp_kses_normalize_entities($url); |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | * @package GeoDirectory |
463 | 463 | */ |
464 | 464 | function _gd_die_handler() { |
465 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
465 | + if (defined('GD_TESTING_MODE')) { |
|
466 | 466 | return '_gd_die_handler'; |
467 | 467 | } else { |
468 | 468 | die(); |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | * @param string $title Optional. Error title. |
481 | 481 | * @param int $status Optional. Status code. |
482 | 482 | */ |
483 | -function gd_die( $message = '', $title = '', $status = 400 ) { |
|
484 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
485 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
486 | - wp_die( $message, $title, array( 'response' => $status )); |
|
483 | +function gd_die($message = '', $title = '', $status = 400) { |
|
484 | + add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3); |
|
485 | + add_filter('wp_die_handler', '_gd_die_handler', 10, 3); |
|
486 | + wp_die($message, $title, array('response' => $status)); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /* |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @param string $php_format The PHP date format. |
494 | 494 | * @return string The jQuery format date string. |
495 | 495 | */ |
496 | -function geodir_date_format_php_to_jqueryui( $php_format ) { |
|
496 | +function geodir_date_format_php_to_jqueryui($php_format) { |
|
497 | 497 | $symbols = array( |
498 | 498 | // Day |
499 | 499 | 'd' => 'dd', |
@@ -533,27 +533,27 @@ discard block |
||
533 | 533 | $jqueryui_format = ""; |
534 | 534 | $escaping = false; |
535 | 535 | |
536 | - for ( $i = 0; $i < strlen( $php_format ); $i++ ) { |
|
536 | + for ($i = 0; $i < strlen($php_format); $i++) { |
|
537 | 537 | $char = $php_format[$i]; |
538 | 538 | |
539 | 539 | // PHP date format escaping character |
540 | - if ( $char === '\\' ) { |
|
540 | + if ($char === '\\') { |
|
541 | 541 | $i++; |
542 | 542 | |
543 | - if ( $escaping ) { |
|
543 | + if ($escaping) { |
|
544 | 544 | $jqueryui_format .= $php_format[$i]; |
545 | 545 | } else { |
546 | - $jqueryui_format .= '\'' . $php_format[$i]; |
|
546 | + $jqueryui_format .= '\''.$php_format[$i]; |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | $escaping = true; |
550 | 550 | } else { |
551 | - if ( $escaping ) { |
|
551 | + if ($escaping) { |
|
552 | 552 | $jqueryui_format .= "'"; |
553 | 553 | $escaping = false; |
554 | 554 | } |
555 | 555 | |
556 | - if ( isset( $symbols[$char] ) ) { |
|
556 | + if (isset($symbols[$char])) { |
|
557 | 557 | $jqueryui_format .= $symbols[$char]; |
558 | 558 | } else { |
559 | 559 | $jqueryui_format .= $char; |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * @return string The untranslated date string. |
573 | 573 | * @since 1.6.5 |
574 | 574 | */ |
575 | -function geodir_maybe_untranslate_date($date){ |
|
575 | +function geodir_maybe_untranslate_date($date) { |
|
576 | 576 | $english_long_months = array( |
577 | 577 | 'January', |
578 | 578 | 'February', |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | 'December', |
589 | 589 | ); |
590 | 590 | |
591 | - $non_english_long_months = array( |
|
591 | + $non_english_long_months = array( |
|
592 | 592 | __('January'), |
593 | 593 | __('February'), |
594 | 594 | __('March'), |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | __('November'), |
603 | 603 | __('December'), |
604 | 604 | ); |
605 | - $date = str_replace($non_english_long_months,$english_long_months,$date); |
|
605 | + $date = str_replace($non_english_long_months, $english_long_months, $date); |
|
606 | 606 | |
607 | 607 | |
608 | 608 | $english_short_months = array( |
@@ -621,21 +621,21 @@ discard block |
||
621 | 621 | ); |
622 | 622 | |
623 | 623 | $non_english_short_months = array( |
624 | - ' '._x( 'Jan', 'January abbreviation' ).' ', |
|
625 | - ' '._x( 'Feb', 'February abbreviation' ).' ', |
|
626 | - ' '._x( 'Mar', 'March abbreviation' ).' ', |
|
627 | - ' '._x( 'Apr', 'April abbreviation' ).' ', |
|
628 | - ' '._x( 'May', 'May abbreviation' ).' ', |
|
629 | - ' '._x( 'Jun', 'June abbreviation' ).' ', |
|
630 | - ' '._x( 'Jul', 'July abbreviation' ).' ', |
|
631 | - ' '._x( 'Aug', 'August abbreviation' ).' ', |
|
632 | - ' '._x( 'Sep', 'September abbreviation' ).' ', |
|
633 | - ' '._x( 'Oct', 'October abbreviation' ).' ', |
|
634 | - ' '._x( 'Nov', 'November abbreviation' ).' ', |
|
635 | - ' '._x( 'Dec', 'December abbreviation' ).' ', |
|
624 | + ' '._x('Jan', 'January abbreviation').' ', |
|
625 | + ' '._x('Feb', 'February abbreviation').' ', |
|
626 | + ' '._x('Mar', 'March abbreviation').' ', |
|
627 | + ' '._x('Apr', 'April abbreviation').' ', |
|
628 | + ' '._x('May', 'May abbreviation').' ', |
|
629 | + ' '._x('Jun', 'June abbreviation').' ', |
|
630 | + ' '._x('Jul', 'July abbreviation').' ', |
|
631 | + ' '._x('Aug', 'August abbreviation').' ', |
|
632 | + ' '._x('Sep', 'September abbreviation').' ', |
|
633 | + ' '._x('Oct', 'October abbreviation').' ', |
|
634 | + ' '._x('Nov', 'November abbreviation').' ', |
|
635 | + ' '._x('Dec', 'December abbreviation').' ', |
|
636 | 636 | ); |
637 | 637 | |
638 | - $date = str_replace($non_english_short_months,$english_short_months,$date); |
|
638 | + $date = str_replace($non_english_short_months, $english_short_months, $date); |
|
639 | 639 | |
640 | 640 | |
641 | 641 | return $date; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | if (defined('ICL_LANGUAGE_CODE')){ |
148 | 148 | $home_url = icl_get_home_url(); |
149 | - }else{ |
|
149 | + } else{ |
|
150 | 150 | $home_url = home_url(); |
151 | 151 | } |
152 | 152 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $slug = $post->post_name; |
160 | 160 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
161 | 161 | $login_url = trailingslashit($home_url)."$slug/"; |
162 | - }else{ |
|
162 | + } else{ |
|
163 | 163 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
164 | 164 | } |
165 | 165 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | if (defined('ICL_LANGUAGE_CODE')){ |
204 | 204 | $home_url = icl_get_home_url(); |
205 | - }else{ |
|
205 | + } else{ |
|
206 | 206 | $home_url = home_url(); |
207 | 207 | } |
208 | 208 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $slug = $post->post_name; |
216 | 216 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
217 | 217 | $info_url = trailingslashit($home_url)."$slug/"; |
218 | - }else{ |
|
218 | + } else{ |
|
219 | 219 | $info_url = trailingslashit($home_url); |
220 | 220 | } |
221 | 221 |