@@ -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 |
@@ -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 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | function geodir_kelo_title_translation( $args) { |
13 | 13 | if(function_exists('geodir_is_geodir_page') && geodir_is_geodir_page('preview')){ |
14 | 14 | $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
15 | - }elseif(function_exists('geodir_is_geodir_page')){ |
|
15 | + } elseif(function_exists('geodir_is_geodir_page')){ |
|
16 | 16 | $args['title'] = __($args['title'],'geodirectory'); |
17 | 17 | } |
18 | 18 |
@@ -10,13 +10,13 @@ |
||
10 | 10 | |
11 | 11 | // Page titles translatable CPT names |
12 | 12 | function geodir_kelo_title_translation( $args) { |
13 | - if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
14 | - $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
15 | - }elseif(function_exists('geodir_is_geodir_page')){ |
|
16 | - $args['title'] = __($args['title'],'geodirectory'); |
|
17 | - } |
|
13 | + if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
14 | + $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
15 | + }elseif(function_exists('geodir_is_geodir_page')){ |
|
16 | + $args['title'] = __($args['title'],'geodirectory'); |
|
17 | + } |
|
18 | 18 | |
19 | - return $args; |
|
19 | + return $args; |
|
20 | 20 | } |
21 | 21 | add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 ); |
22 | 22 |
@@ -9,15 +9,15 @@ |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Page titles translatable CPT names |
12 | -function geodir_kelo_title_translation( $args) { |
|
13 | - if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
14 | - $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
15 | - }elseif(function_exists('geodir_is_geodir_page')){ |
|
16 | - $args['title'] = __($args['title'],'geodirectory'); |
|
12 | +function geodir_kelo_title_translation($args) { |
|
13 | + if (function_exists('geodir_is_geodir_page') && geodir_is_page('preview')) { |
|
14 | + $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])), 'geodirectory'); |
|
15 | + }elseif (function_exists('geodir_is_geodir_page')) { |
|
16 | + $args['title'] = __($args['title'], 'geodirectory'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | return $args; |
20 | 20 | } |
21 | -add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 ); |
|
21 | +add_filter('kleo_title_args', 'geodir_kelo_title_translation', 10, 1); |
|
22 | 22 | |
23 | 23 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function geodir_core_dequeue_script() |
24 | 24 | { |
25 | - wp_dequeue_script('flexslider'); |
|
25 | + wp_dequeue_script('flexslider'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100); |
@@ -35,168 +35,168 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function geodir_templates_scripts() |
37 | 37 | { |
38 | - $is_detail_page = false; |
|
39 | - $geodir_map_name = geodir_map_name(); |
|
38 | + $is_detail_page = false; |
|
39 | + $geodir_map_name = geodir_map_name(); |
|
40 | 40 | |
41 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
42 | - $is_detail_page = true; |
|
43 | - } |
|
44 | - |
|
45 | - wp_enqueue_script('jquery'); |
|
46 | - |
|
47 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | - wp_enqueue_script('geodirectory-script'); |
|
41 | + if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
42 | + $is_detail_page = true; |
|
43 | + } |
|
49 | 44 | |
50 | - $geodir_vars_data = array( |
|
51 | - 'siteurl' => get_option('siteurl'), |
|
52 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
53 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
54 | - 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
55 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
56 | - 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
|
57 | - ); |
|
45 | + wp_enqueue_script('jquery'); |
|
46 | + |
|
47 | + wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | + wp_enqueue_script('geodirectory-script'); |
|
49 | + |
|
50 | + $geodir_vars_data = array( |
|
51 | + 'siteurl' => get_option('siteurl'), |
|
52 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
53 | + 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
54 | + 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
55 | + 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
56 | + 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
|
57 | + ); |
|
58 | + |
|
59 | + /** |
|
60 | + * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
61 | + * |
|
62 | + * This is used by addons to add JS translatable variables. |
|
63 | + * |
|
64 | + * @since 1.4.4 |
|
65 | + * @param array $geodir_vars_data { |
|
66 | + * geodir var data used by addons to add JS translatable variables. |
|
67 | + * |
|
68 | + * @type string $siteurl Site url. |
|
69 | + * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
70 | + * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
71 | + * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
72 | + * @type int $is_rtl Checks if current locale is RTL. |
|
73 | + * |
|
74 | + * } |
|
75 | + */ |
|
76 | + $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
77 | + |
|
78 | + wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
79 | + |
|
80 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | + if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
82 | + |
|
83 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | + wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
85 | + |
|
86 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | + if ($is_detail_page) { |
|
88 | + wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
89 | + } |
|
58 | 90 | |
59 | - /** |
|
60 | - * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
61 | - * |
|
62 | - * This is used by addons to add JS translatable variables. |
|
63 | - * |
|
64 | - * @since 1.4.4 |
|
65 | - * @param array $geodir_vars_data { |
|
66 | - * geodir var data used by addons to add JS translatable variables. |
|
67 | - * |
|
68 | - * @type string $siteurl Site url. |
|
69 | - * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
70 | - * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
71 | - * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
72 | - * @type int $is_rtl Checks if current locale is RTL. |
|
73 | - * |
|
74 | - * } |
|
75 | - */ |
|
76 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
77 | - |
|
78 | - wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
79 | - |
|
80 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
82 | - |
|
83 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | - wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
85 | - |
|
86 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | - if ($is_detail_page) { |
|
88 | - wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
89 | - } |
|
90 | - |
|
91 | - if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
92 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
94 | - /** |
|
95 | - * Filter the variables that are added to the end of the google maps script call. |
|
96 | - * |
|
97 | - * This i used to change things like google maps language etc. |
|
98 | - * |
|
99 | - * @since 1.0.0 |
|
100 | - * @param string $var The string to filter, default is empty string. |
|
101 | - */ |
|
102 | - $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
103 | - wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
104 | - } |
|
91 | + if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
92 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
94 | + /** |
|
95 | + * Filter the variables that are added to the end of the google maps script call. |
|
96 | + * |
|
97 | + * This i used to change things like google maps language etc. |
|
98 | + * |
|
99 | + * @since 1.0.0 |
|
100 | + * @param string $var The string to filter, default is empty string. |
|
101 | + */ |
|
102 | + $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
103 | + wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
104 | + } |
|
105 | 105 | |
106 | - if ($geodir_map_name == 'osm') { |
|
107 | - // Leaflet OpenStreetMap |
|
108 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
109 | - wp_enqueue_style('geodirectory-leaflet-style'); |
|
106 | + if ($geodir_map_name == 'osm') { |
|
107 | + // Leaflet OpenStreetMap |
|
108 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
109 | + wp_enqueue_style('geodirectory-leaflet-style'); |
|
110 | 110 | |
111 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
112 | - wp_enqueue_script('geodirectory-leaflet-script'); |
|
111 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
112 | + wp_enqueue_script('geodirectory-leaflet-script'); |
|
113 | 113 | |
114 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
115 | - wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
114 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
115 | + wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
116 | 116 | |
117 | - if ($is_detail_page) { |
|
118 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
119 | - wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
117 | + if ($is_detail_page) { |
|
118 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
119 | + wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
120 | 120 | |
121 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
122 | - wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
123 | - } |
|
124 | - } |
|
125 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
121 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
122 | + wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
123 | + } |
|
124 | + } |
|
125 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
126 | 126 | |
127 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true); |
|
128 | - wp_enqueue_script('geodirectory-goMap-script'); |
|
129 | - |
|
130 | - |
|
131 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | - wp_enqueue_script('chosen'); |
|
133 | - |
|
134 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
135 | - wp_enqueue_script('geodirectory-choose-ajax'); |
|
136 | - |
|
137 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
138 | - |
|
139 | - if (is_page() && geodir_is_page('add-listing')) { |
|
140 | - // SCRIPT FOR UPLOAD |
|
141 | - wp_enqueue_script('plupload-all'); |
|
142 | - wp_enqueue_script('jquery-ui-sortable'); |
|
143 | - |
|
144 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
145 | - wp_enqueue_script('geodirectory-plupload-script'); |
|
146 | - // SCRIPT FOR UPLOAD END |
|
147 | - |
|
148 | - // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
149 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
150 | - $ajax_url = admin_url('admin-ajax.php'); |
|
151 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
152 | - $ajax_url = admin_url('admin-ajax.php'); |
|
153 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
154 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
155 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
156 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
157 | - } else { |
|
158 | - $ajax_url = admin_url('admin-ajax.php'); |
|
159 | - } |
|
127 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true); |
|
128 | + wp_enqueue_script('geodirectory-goMap-script'); |
|
129 | + |
|
130 | + |
|
131 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | + wp_enqueue_script('chosen'); |
|
133 | + |
|
134 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
135 | + wp_enqueue_script('geodirectory-choose-ajax'); |
|
136 | + |
|
137 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
138 | + |
|
139 | + if (is_page() && geodir_is_page('add-listing')) { |
|
140 | + // SCRIPT FOR UPLOAD |
|
141 | + wp_enqueue_script('plupload-all'); |
|
142 | + wp_enqueue_script('jquery-ui-sortable'); |
|
143 | + |
|
144 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
145 | + wp_enqueue_script('geodirectory-plupload-script'); |
|
146 | + // SCRIPT FOR UPLOAD END |
|
147 | + |
|
148 | + // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
149 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
150 | + $ajax_url = admin_url('admin-ajax.php'); |
|
151 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
152 | + $ajax_url = admin_url('admin-ajax.php'); |
|
153 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
154 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
155 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
156 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
157 | + } else { |
|
158 | + $ajax_url = admin_url('admin-ajax.php'); |
|
159 | + } |
|
160 | 160 | |
161 | - // place js config array for plupload |
|
162 | - $plupload_init = array( |
|
163 | - 'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4', |
|
164 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
165 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
166 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
167 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
168 | - 'multiple_queues' => true, |
|
169 | - 'max_file_size' => geodir_max_upload_size(), |
|
170 | - 'url' => $ajax_url, |
|
171 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
172 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
173 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
174 | - 'multipart' => true, |
|
175 | - 'urlstream_upload' => true, |
|
176 | - 'multi_selection' => false, // will be added per uploader |
|
177 | - // additional post data to send to our ajax hook |
|
178 | - 'multipart_params' => array( |
|
179 | - '_ajax_nonce' => "", // will be added per uploader |
|
180 | - 'action' => 'plupload_action', // the ajax action name |
|
181 | - 'imgid' => 0 // will be added per uploader |
|
182 | - ) |
|
183 | - ); |
|
184 | - $base_plupload_config = json_encode($plupload_init); |
|
185 | - |
|
186 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
187 | - 'upload_img_size' => geodir_max_upload_size()); |
|
188 | - |
|
189 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
190 | - |
|
191 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
192 | - } // End if for add place page |
|
193 | - |
|
194 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
195 | - if ($is_detail_page) { |
|
161 | + // place js config array for plupload |
|
162 | + $plupload_init = array( |
|
163 | + 'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4', |
|
164 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
165 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
166 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
167 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
168 | + 'multiple_queues' => true, |
|
169 | + 'max_file_size' => geodir_max_upload_size(), |
|
170 | + 'url' => $ajax_url, |
|
171 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
172 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
173 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
174 | + 'multipart' => true, |
|
175 | + 'urlstream_upload' => true, |
|
176 | + 'multi_selection' => false, // will be added per uploader |
|
177 | + // additional post data to send to our ajax hook |
|
178 | + 'multipart_params' => array( |
|
179 | + '_ajax_nonce' => "", // will be added per uploader |
|
180 | + 'action' => 'plupload_action', // the ajax action name |
|
181 | + 'imgid' => 0 // will be added per uploader |
|
182 | + ) |
|
183 | + ); |
|
184 | + $base_plupload_config = json_encode($plupload_init); |
|
185 | + |
|
186 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
187 | + 'upload_img_size' => geodir_max_upload_size()); |
|
188 | + |
|
189 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
190 | + |
|
191 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
192 | + } // End if for add place page |
|
193 | + |
|
194 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
195 | + if ($is_detail_page) { |
|
196 | 196 | wp_enqueue_script('geodirectory-post-custom-js'); |
197 | 197 | } |
198 | 198 | |
199 | - // font awesome rating script |
|
199 | + // font awesome rating script |
|
200 | 200 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
201 | 201 | wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
202 | 202 | wp_enqueue_script('geodir-barrating-js'); |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | wp_enqueue_script('geodir-jRating-js'); |
206 | 206 | } |
207 | 207 | |
208 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
209 | - wp_enqueue_script('geodir-on-document-load'); |
|
208 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
209 | + wp_enqueue_script('geodir-on-document-load'); |
|
210 | 210 | |
211 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
212 | - wp_enqueue_script('google-geometa'); |
|
211 | + wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
212 | + wp_enqueue_script('google-geometa'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function geodir_header_scripts() |
225 | 225 | { |
226 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
227 | - echo stripslashes(get_option('geodir_header_scripts')); |
|
226 | + echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
227 | + echo stripslashes(get_option('geodir_header_scripts')); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | function geodir_footer_scripts() |
241 | 241 | { |
242 | 242 | |
243 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
243 | + if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
244 | 244 | |
245 | 245 | <script> |
246 | 246 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -255,20 +255,20 @@ discard block |
||
255 | 255 | </script> |
256 | 256 | |
257 | 257 | <?php |
258 | - }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
259 | - echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
260 | - } |
|
258 | + }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
259 | + echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
260 | + } |
|
261 | 261 | |
262 | - echo stripslashes(get_option('geodir_footer_scripts')); |
|
262 | + echo stripslashes(get_option('geodir_footer_scripts')); |
|
263 | 263 | |
264 | - /* |
|
264 | + /* |
|
265 | 265 | * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041 |
266 | 266 | * |
267 | 267 | * Flexbox wont wrap on ios for search form items |
268 | 268 | */ |
269 | - if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
270 | - echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
271 | - } |
|
269 | + if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
270 | + echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
271 | + } |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -282,12 +282,12 @@ discard block |
||
282 | 282 | */ |
283 | 283 | function geodir_add_async_forscript($url) |
284 | 284 | { |
285 | - if (strpos($url, '#asyncload')===false) |
|
286 | - return $url; |
|
287 | - else if (is_admin()) |
|
288 | - return str_replace('#asyncload', '', $url); |
|
289 | - else |
|
290 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
285 | + if (strpos($url, '#asyncload')===false) |
|
286 | + return $url; |
|
287 | + else if (is_admin()) |
|
288 | + return str_replace('#asyncload', '', $url); |
|
289 | + else |
|
290 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
291 | 291 | } |
292 | 292 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
293 | 293 | |
@@ -300,17 +300,17 @@ discard block |
||
300 | 300 | function geodir_templates_styles() |
301 | 301 | { |
302 | 302 | |
303 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
304 | - wp_enqueue_style('geodir-core-scss'); |
|
305 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
303 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
304 | + wp_enqueue_style('geodir-core-scss'); |
|
305 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
306 | 306 | |
307 | - if(is_rtl()){ |
|
308 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
309 | - wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
310 | - } |
|
307 | + if(is_rtl()){ |
|
308 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
309 | + wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
310 | + } |
|
311 | 311 | |
312 | - wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
313 | - wp_enqueue_style('font-awesome'); |
|
312 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
313 | + wp_enqueue_style('font-awesome'); |
|
314 | 314 | |
315 | 315 | |
316 | 316 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | function geodir_get_sidebar() |
326 | 326 | { |
327 | - get_sidebar('geodirectory'); |
|
327 | + get_sidebar('geodirectory'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -343,122 +343,122 @@ discard block |
||
343 | 343 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
344 | 344 | */ |
345 | 345 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
346 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
346 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
347 | 347 | |
348 | - if (empty($prelabel)) { |
|
349 | - $prelabel = '<strong>«</strong>'; |
|
350 | - } |
|
348 | + if (empty($prelabel)) { |
|
349 | + $prelabel = '<strong>«</strong>'; |
|
350 | + } |
|
351 | 351 | |
352 | - if (empty($nxtlabel)) { |
|
353 | - $nxtlabel = '<strong>»</strong>'; |
|
354 | - } |
|
352 | + if (empty($nxtlabel)) { |
|
353 | + $nxtlabel = '<strong>»</strong>'; |
|
354 | + } |
|
355 | 355 | |
356 | - $half_pages_to_show = round($pages_to_show / 2); |
|
356 | + $half_pages_to_show = round($pages_to_show / 2); |
|
357 | 357 | |
358 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
359 | - return; |
|
358 | + if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
359 | + return; |
|
360 | 360 | |
361 | - if (!is_single()) { |
|
362 | - if (function_exists('geodir_location_geo_home_link')) { |
|
363 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
364 | - } |
|
365 | - $numposts = $wp_query->found_posts; |
|
361 | + if (!is_single()) { |
|
362 | + if (function_exists('geodir_location_geo_home_link')) { |
|
363 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
364 | + } |
|
365 | + $numposts = $wp_query->found_posts; |
|
366 | 366 | |
367 | - $max_page = ceil($numposts / $posts_per_page); |
|
367 | + $max_page = ceil($numposts / $posts_per_page); |
|
368 | 368 | |
369 | - if (empty($paged)) { |
|
370 | - $paged = 1; |
|
371 | - } |
|
369 | + if (empty($paged)) { |
|
370 | + $paged = 1; |
|
371 | + } |
|
372 | 372 | |
373 | - $post_type = geodir_get_current_posttype(); |
|
374 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
375 | - if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
376 | - $term = array(); |
|
373 | + $post_type = geodir_get_current_posttype(); |
|
374 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
375 | + if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
376 | + $term = array(); |
|
377 | 377 | |
378 | - if (is_tax()) { |
|
379 | - $term_id = get_queried_object_id(); |
|
380 | - $taxonomy = get_query_var('taxonomy'); |
|
378 | + if (is_tax()) { |
|
379 | + $term_id = get_queried_object_id(); |
|
380 | + $taxonomy = get_query_var('taxonomy'); |
|
381 | 381 | |
382 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
383 | - $term = get_term($term_id, $post_type . 'category'); |
|
384 | - } |
|
385 | - } |
|
382 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
383 | + $term = get_term($term_id, $post_type . 'category'); |
|
384 | + } |
|
385 | + } |
|
386 | 386 | |
387 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
388 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
387 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
388 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
389 | 389 | |
390 | - if (!is_array($taxonomy_search)) { |
|
391 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
392 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
393 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
394 | - } |
|
395 | - } |
|
390 | + if (!is_array($taxonomy_search)) { |
|
391 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
392 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
393 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
394 | + } |
|
395 | + } |
|
396 | 396 | |
397 | - if (!empty($term) && !is_wp_error($term)) { |
|
398 | - $listing_type_name = $term->name; |
|
399 | - } |
|
400 | - } |
|
397 | + if (!empty($term) && !is_wp_error($term)) { |
|
398 | + $listing_type_name = $term->name; |
|
399 | + } |
|
400 | + } |
|
401 | 401 | |
402 | - if ($max_page > 1 || $always_show) { |
|
403 | - // Extra pagination info |
|
404 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
405 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
406 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
402 | + if ($max_page > 1 || $always_show) { |
|
403 | + // Extra pagination info |
|
404 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
405 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
406 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
407 | 407 | |
408 | - if ($geodir_pagination_more_info != '') { |
|
409 | - if ($listing_type_name) { |
|
410 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
411 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
412 | - } else { |
|
413 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
414 | - } |
|
415 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
416 | - /** |
|
417 | - * Adds an extra pagination info above/under pagination. |
|
418 | - * |
|
419 | - * @since 1.5.9 |
|
420 | - * |
|
421 | - * @param string $pagination_info Extra pagination info content. |
|
422 | - * @param string $listing_type_name Listing results type. |
|
423 | - * @param string $start_no First result number. |
|
424 | - * @param string $end_no Last result number. |
|
425 | - * @param string $numposts Total number of listings. |
|
426 | - * @param string $post_type The post type. |
|
427 | - */ |
|
428 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
408 | + if ($geodir_pagination_more_info != '') { |
|
409 | + if ($listing_type_name) { |
|
410 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
411 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
412 | + } else { |
|
413 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
414 | + } |
|
415 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
416 | + /** |
|
417 | + * Adds an extra pagination info above/under pagination. |
|
418 | + * |
|
419 | + * @since 1.5.9 |
|
420 | + * |
|
421 | + * @param string $pagination_info Extra pagination info content. |
|
422 | + * @param string $listing_type_name Listing results type. |
|
423 | + * @param string $start_no First result number. |
|
424 | + * @param string $end_no Last result number. |
|
425 | + * @param string $numposts Total number of listings. |
|
426 | + * @param string $post_type The post type. |
|
427 | + */ |
|
428 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
429 | 429 | |
430 | - if ($geodir_pagination_more_info == 'before') { |
|
431 | - $before = $before . $pagination_info; |
|
432 | - } else if ($geodir_pagination_more_info == 'after') { |
|
433 | - $after = $pagination_info . $after; |
|
434 | - } |
|
435 | - } |
|
430 | + if ($geodir_pagination_more_info == 'before') { |
|
431 | + $before = $before . $pagination_info; |
|
432 | + } else if ($geodir_pagination_more_info == 'after') { |
|
433 | + $after = $pagination_info . $after; |
|
434 | + } |
|
435 | + } |
|
436 | 436 | |
437 | - echo "$before <div class='Navi gd-navi'>"; |
|
438 | - if ($paged >= ($pages_to_show - 1)) { |
|
439 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
440 | - } |
|
441 | - previous_posts_link($prelabel); |
|
442 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
443 | - if ($i >= 1 && $i <= $max_page) { |
|
444 | - if ($i == $paged) { |
|
445 | - echo "<strong class='on'>$i</strong>"; |
|
446 | - } else { |
|
447 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
448 | - } |
|
449 | - } |
|
450 | - } |
|
451 | - next_posts_link($nxtlabel, $max_page); |
|
452 | - if (($paged + $half_pages_to_show) < ($max_page)) { |
|
453 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
454 | - } |
|
455 | - echo "</div> $after"; |
|
456 | - } |
|
437 | + echo "$before <div class='Navi gd-navi'>"; |
|
438 | + if ($paged >= ($pages_to_show - 1)) { |
|
439 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
440 | + } |
|
441 | + previous_posts_link($prelabel); |
|
442 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
443 | + if ($i >= 1 && $i <= $max_page) { |
|
444 | + if ($i == $paged) { |
|
445 | + echo "<strong class='on'>$i</strong>"; |
|
446 | + } else { |
|
447 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
448 | + } |
|
449 | + } |
|
450 | + } |
|
451 | + next_posts_link($nxtlabel, $max_page); |
|
452 | + if (($paged + $half_pages_to_show) < ($max_page)) { |
|
453 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
454 | + } |
|
455 | + echo "</div> $after"; |
|
456 | + } |
|
457 | 457 | |
458 | - if (function_exists('geodir_location_geo_home_link')) { |
|
459 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
460 | - } |
|
461 | - } |
|
458 | + if (function_exists('geodir_location_geo_home_link')) { |
|
459 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
460 | + } |
|
461 | + } |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -469,20 +469,20 @@ discard block |
||
469 | 469 | */ |
470 | 470 | function geodir_listingsearch_scripts() |
471 | 471 | { |
472 | - if (get_option('gd_search_dist') != '') { |
|
473 | - $dist = get_option('gd_search_dist'); |
|
474 | - } else { |
|
475 | - $dist = 500; |
|
476 | - } |
|
477 | - $dist_dif = 1000; |
|
478 | - |
|
479 | - if ($dist <= 5000) $dist_dif = 500; |
|
480 | - if ($dist <= 1000) $dist_dif = 100; |
|
481 | - if ($dist <= 500) $dist_dif = 50; |
|
482 | - if ($dist <= 100) $dist_dif = 10; |
|
483 | - if ($dist <= 50) $dist_dif = 5; |
|
484 | - |
|
485 | - ?> |
|
472 | + if (get_option('gd_search_dist') != '') { |
|
473 | + $dist = get_option('gd_search_dist'); |
|
474 | + } else { |
|
475 | + $dist = 500; |
|
476 | + } |
|
477 | + $dist_dif = 1000; |
|
478 | + |
|
479 | + if ($dist <= 5000) $dist_dif = 500; |
|
480 | + if ($dist <= 1000) $dist_dif = 100; |
|
481 | + if ($dist <= 500) $dist_dif = 50; |
|
482 | + if ($dist <= 100) $dist_dif = 10; |
|
483 | + if ($dist <= 50) $dist_dif = 5; |
|
484 | + |
|
485 | + ?> |
|
486 | 486 | <script type="text/javascript"> |
487 | 487 | |
488 | 488 | jQuery(function ($) { |
@@ -540,20 +540,20 @@ discard block |
||
540 | 540 | * @package GeoDirectory |
541 | 541 | */ |
542 | 542 | function geodir_add_sharelocation_scripts() { |
543 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
544 | - if (get_option('geodir_search_field_default_text')) |
|
545 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
543 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
544 | + if (get_option('geodir_search_field_default_text')) |
|
545 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
546 | 546 | |
547 | - $default_near_text = NEAR_TEXT; |
|
548 | - if (get_option('geodir_near_field_default_text')) |
|
549 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
547 | + $default_near_text = NEAR_TEXT; |
|
548 | + if (get_option('geodir_near_field_default_text')) |
|
549 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
550 | 550 | |
551 | - $search_location = geodir_get_default_location(); |
|
551 | + $search_location = geodir_get_default_location(); |
|
552 | 552 | |
553 | - $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
554 | - $default_near_text = addslashes(stripslashes($default_near_text)); |
|
555 | - $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
556 | - ?> |
|
553 | + $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
554 | + $default_near_text = addslashes(stripslashes($default_near_text)); |
|
555 | + $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
556 | + ?> |
|
557 | 557 | <script type="text/javascript"> |
558 | 558 | var default_location = '<?php echo $city ;?>'; |
559 | 559 | var latlng; |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | initialise2(); |
635 | 635 | } else { |
636 | 636 | <?php |
637 | - $near_add = get_option('geodir_search_near_addition'); |
|
638 | - /** |
|
639 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
640 | - * |
|
641 | - * @since 1.0.0 |
|
642 | - */ |
|
643 | - $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
644 | - ?> |
|
637 | + $near_add = get_option('geodir_search_near_addition'); |
|
638 | + /** |
|
639 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
640 | + * |
|
641 | + * @since 1.0.0 |
|
642 | + */ |
|
643 | + $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
644 | + ?> |
|
645 | 645 | if (window.gdMaps === 'google') { |
646 | 646 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
647 | 647 | function (results, status) { |
@@ -744,30 +744,30 @@ discard block |
||
744 | 744 | */ |
745 | 745 | function geodir_show_badges_on_image($which, $post, $link) |
746 | 746 | { |
747 | - $return = ''; |
|
748 | - switch ($which) { |
|
749 | - case 'featured': |
|
750 | - /** |
|
751 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
752 | - * |
|
753 | - * @since 1.0.0 |
|
754 | - * @param object $post The post object. |
|
755 | - * @param string $link The link to the post. |
|
756 | - */ |
|
757 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
758 | - break; |
|
759 | - case 'new' : |
|
760 | - /** |
|
761 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
762 | - * |
|
763 | - * @since 1.0.0 |
|
764 | - * @param object $post The post object. |
|
765 | - * @param string $link The link to the post. |
|
766 | - */ |
|
767 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
768 | - break; |
|
769 | - |
|
770 | - } |
|
747 | + $return = ''; |
|
748 | + switch ($which) { |
|
749 | + case 'featured': |
|
750 | + /** |
|
751 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
752 | + * |
|
753 | + * @since 1.0.0 |
|
754 | + * @param object $post The post object. |
|
755 | + * @param string $link The link to the post. |
|
756 | + */ |
|
757 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
758 | + break; |
|
759 | + case 'new' : |
|
760 | + /** |
|
761 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
762 | + * |
|
763 | + * @since 1.0.0 |
|
764 | + * @param object $post The post object. |
|
765 | + * @param string $link The link to the post. |
|
766 | + */ |
|
767 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
768 | + break; |
|
769 | + |
|
770 | + } |
|
771 | 771 | |
772 | - return $return; |
|
772 | + return $return; |
|
773 | 773 | } |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | $is_detail_page = false; |
39 | 39 | $geodir_map_name = geodir_map_name(); |
40 | 40 | |
41 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
41 | + if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) { |
|
42 | 42 | $is_detail_page = true; |
43 | 43 | } |
44 | 44 | |
45 | 45 | wp_enqueue_script('jquery'); |
46 | 46 | |
47 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
47 | + wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | 48 | wp_enqueue_script('geodirectory-script'); |
49 | 49 | |
50 | 50 | $geodir_vars_data = array( |
51 | 51 | 'siteurl' => get_option('siteurl'), |
52 | 52 | 'geodir_plugin_url' => geodir_plugin_url(), |
53 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
53 | + 'geodir_lazy_load' => get_option('geodir_lazy_load', 1), |
|
54 | 54 | 'geodir_ajax_url' => geodir_get_ajax_url(), |
55 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
55 | + 'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'), |
|
56 | 56 | 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
57 | 57 | ); |
58 | 58 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | * } |
75 | 75 | */ |
76 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
76 | + $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data); |
|
77 | 77 | |
78 | 78 | wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
79 | 79 | |
80 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
80 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true); |
|
81 | + if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); } |
|
82 | 82 | |
83 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
83 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true); |
|
84 | 84 | wp_enqueue_script('geodirectory-lightbox-jquery'); |
85 | 85 | |
86 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
86 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true); |
|
87 | 87 | if ($is_detail_page) { |
88 | 88 | wp_enqueue_script('geodirectory-jquery-simplemodal'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | if (in_array($geodir_map_name, array('auto', 'google'))) { |
92 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
92 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
93 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
94 | 94 | /** |
95 | 95 | * Filter the variables that are added to the end of the google maps script call. |
96 | 96 | * |
@@ -100,48 +100,48 @@ discard block |
||
100 | 100 | * @param string $var The string to filter, default is empty string. |
101 | 101 | */ |
102 | 102 | $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
103 | - wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
103 | + wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if ($geodir_map_name == 'osm') { |
107 | 107 | // Leaflet OpenStreetMap |
108 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
108 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
109 | 109 | wp_enqueue_style('geodirectory-leaflet-style'); |
110 | 110 | |
111 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
111 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
112 | 112 | wp_enqueue_script('geodirectory-leaflet-script'); |
113 | 113 | |
114 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
114 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
115 | 115 | wp_enqueue_script('geodirectory-leaflet-geo-script'); |
116 | 116 | |
117 | 117 | if ($is_detail_page) { |
118 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
118 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
119 | 119 | wp_enqueue_style('geodirectory-leaflet-routing-style'); |
120 | 120 | |
121 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
121 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
122 | 122 | wp_enqueue_script('geodirectory-leaflet-routing-script'); |
123 | 123 | } |
124 | 124 | } |
125 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
125 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
126 | 126 | |
127 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true); |
|
127 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
128 | 128 | wp_enqueue_script('geodirectory-goMap-script'); |
129 | 129 | |
130 | 130 | |
131 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
131 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | 132 | wp_enqueue_script('chosen'); |
133 | 133 | |
134 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
134 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
135 | 135 | wp_enqueue_script('geodirectory-choose-ajax'); |
136 | 136 | |
137 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
137 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
138 | 138 | |
139 | 139 | if (is_page() && geodir_is_page('add-listing')) { |
140 | 140 | // SCRIPT FOR UPLOAD |
141 | 141 | wp_enqueue_script('plupload-all'); |
142 | 142 | wp_enqueue_script('jquery-ui-sortable'); |
143 | 143 | |
144 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
144 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
145 | 145 | wp_enqueue_script('geodirectory-plupload-script'); |
146 | 146 | // SCRIPT FOR UPLOAD END |
147 | 147 | |
@@ -188,27 +188,27 @@ discard block |
||
188 | 188 | |
189 | 189 | wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
190 | 190 | |
191 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
191 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
192 | 192 | } // End if for add place page |
193 | 193 | |
194 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
194 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
195 | 195 | if ($is_detail_page) { |
196 | 196 | wp_enqueue_script('geodirectory-post-custom-js'); |
197 | 197 | } |
198 | 198 | |
199 | 199 | // font awesome rating script |
200 | 200 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
201 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
201 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
202 | 202 | wp_enqueue_script('geodir-barrating-js'); |
203 | 203 | } else { // default rating script |
204 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
204 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
205 | 205 | wp_enqueue_script('geodir-jRating-js'); |
206 | 206 | } |
207 | 207 | |
208 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
208 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
209 | 209 | wp_enqueue_script('geodir-on-document-load'); |
210 | 210 | |
211 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
211 | + wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
212 | 212 | wp_enqueue_script('google-geometa'); |
213 | 213 | } |
214 | 214 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function geodir_header_scripts() |
225 | 225 | { |
226 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
226 | + echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>'; |
|
227 | 227 | echo stripslashes(get_option('geodir_header_scripts')); |
228 | 228 | } |
229 | 229 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | function geodir_footer_scripts() |
241 | 241 | { |
242 | 242 | |
243 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
243 | + if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?> |
|
244 | 244 | |
245 | 245 | <script> |
246 | 246 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -248,14 +248,14 @@ discard block |
||
248 | 248 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
249 | 249 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
250 | 250 | |
251 | - ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto'); |
|
252 | - <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?> |
|
251 | + ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto'); |
|
252 | + <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?> |
|
253 | 253 | ga('send', 'pageview'); |
254 | 254 | |
255 | 255 | </script> |
256 | 256 | |
257 | 257 | <?php |
258 | - }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
258 | + }elseif (get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) { |
|
259 | 259 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
260 | 260 | } |
261 | 261 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * |
267 | 267 | * Flexbox wont wrap on ios for search form items |
268 | 268 | */ |
269 | - if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
269 | + if (preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) { |
|
270 | 270 | echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
271 | 271 | } |
272 | 272 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | function geodir_add_async_forscript($url) |
284 | 284 | { |
285 | - if (strpos($url, '#asyncload')===false) |
|
285 | + if (strpos($url, '#asyncload') === false) |
|
286 | 286 | return $url; |
287 | 287 | else if (is_admin()) |
288 | 288 | return str_replace('#asyncload', '', $url); |
@@ -300,12 +300,12 @@ discard block |
||
300 | 300 | function geodir_templates_styles() |
301 | 301 | { |
302 | 302 | |
303 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
303 | + wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
304 | 304 | wp_enqueue_style('geodir-core-scss'); |
305 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
305 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
306 | 306 | |
307 | - if(is_rtl()){ |
|
308 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
307 | + if (is_rtl()) { |
|
308 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
309 | 309 | wp_enqueue_style('geodirectory-frontend-rtl-style'); |
310 | 310 | } |
311 | 311 | |
@@ -379,18 +379,18 @@ discard block |
||
379 | 379 | $term_id = get_queried_object_id(); |
380 | 380 | $taxonomy = get_query_var('taxonomy'); |
381 | 381 | |
382 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
383 | - $term = get_term($term_id, $post_type . 'category'); |
|
382 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') { |
|
383 | + $term = get_term($term_id, $post_type.'category'); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
388 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
387 | + if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) { |
|
388 | + $taxonomy_search = $_REQUEST['s'.$post_type.'category']; |
|
389 | 389 | |
390 | 390 | if (!is_array($taxonomy_search)) { |
391 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
392 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
393 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
391 | + $term = get_term((int) $taxonomy_search, $post_type.'category'); |
|
392 | + } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
393 | + $term = get_term((int) $taxonomy_search[0], $post_type.'category'); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | if ($max_page > 1 || $always_show) { |
403 | 403 | // Extra pagination info |
404 | 404 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
405 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
405 | + $start_no = ($paged - 1) * $posts_per_page + 1; |
|
406 | 406 | $end_no = min($paged * $posts_per_page, $numposts); |
407 | 407 | |
408 | 408 | if ($geodir_pagination_more_info != '') { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } else { |
413 | 413 | $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
414 | 414 | } |
415 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
415 | + $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>'; |
|
416 | 416 | /** |
417 | 417 | * Adds an extra pagination info above/under pagination. |
418 | 418 | * |
@@ -428,15 +428,15 @@ discard block |
||
428 | 428 | $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
429 | 429 | |
430 | 430 | if ($geodir_pagination_more_info == 'before') { |
431 | - $before = $before . $pagination_info; |
|
431 | + $before = $before.$pagination_info; |
|
432 | 432 | } else if ($geodir_pagination_more_info == 'after') { |
433 | - $after = $pagination_info . $after; |
|
433 | + $after = $pagination_info.$after; |
|
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | 437 | echo "$before <div class='Navi gd-navi'>"; |
438 | 438 | if ($paged >= ($pages_to_show - 1)) { |
439 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
439 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link()).'">«</a>'; |
|
440 | 440 | } |
441 | 441 | previous_posts_link($prelabel); |
442 | 442 | for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | if ($i == $paged) { |
445 | 445 | echo "<strong class='on'>$i</strong>"; |
446 | 446 | } else { |
447 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
447 | + echo ' <a href="'.str_replace('&paged', '&paged', get_pagenum_link($i)).'">'.$i.'</a> '; |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
451 | 451 | next_posts_link($nxtlabel, $max_page); |
452 | 452 | if (($paged + $half_pages_to_show) < ($max_page)) { |
453 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
453 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link($max_page)).'">»</a>'; |
|
454 | 454 | } |
455 | 455 | echo "</div> $after"; |
456 | 456 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | jQuery(function ($) { |
489 | 489 | $("#distance_slider").slider({ |
490 | 490 | range: true, |
491 | - values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
491 | + values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
492 | 492 | min: 0, |
493 | 493 | max: <?php echo $dist; ?>, |
494 | 494 | step: <?php echo $dist_dif; ?>, |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
556 | 556 | ?> |
557 | 557 | <script type="text/javascript"> |
558 | - var default_location = '<?php echo $city ;?>'; |
|
558 | + var default_location = '<?php echo $city; ?>'; |
|
559 | 559 | var latlng; |
560 | 560 | var address; |
561 | 561 | var dist = 0; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | var $form = jQuery(this).closest('form'); |
572 | 572 | |
573 | 573 | if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val(); |
574 | - if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s); |
|
574 | + if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s); |
|
575 | 575 | |
576 | 576 | // Disable location based search for disabled location post type. |
577 | 577 | if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') { |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | } |
586 | 586 | } |
587 | 587 | |
588 | - if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) { |
|
588 | + if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) { |
|
589 | 589 | geodir_setsearch($form); |
590 | 590 | } else { |
591 | 591 | jQuery(".snear", $form).val(''); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | }); |
604 | 604 | |
605 | 605 | function geodir_setsearch($form) { |
606 | - if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location); |
|
606 | + if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location); |
|
607 | 607 | geocodeAddress($form); |
608 | 608 | } |
609 | 609 | |
@@ -622,15 +622,15 @@ discard block |
||
622 | 622 | // Call the geocode function |
623 | 623 | Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
624 | 624 | |
625 | - if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
626 | - if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
625 | + if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
626 | + if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
627 | 627 | jQuery(".snear", $form).val(''); |
628 | 628 | } |
629 | 629 | jQuery($form).submit(); |
630 | 630 | } else { |
631 | 631 | var address = jQuery(".snear", $form).val(); |
632 | 632 | |
633 | - if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') { |
|
633 | + if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') { |
|
634 | 634 | initialise2(); |
635 | 635 | } else { |
636 | 636 | <?php |
@@ -643,12 +643,12 @@ discard block |
||
643 | 643 | $near_add2 = apply_filters('geodir_search_near_addition', ''); |
644 | 644 | ?> |
645 | 645 | if (window.gdMaps === 'google') { |
646 | - Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
|
646 | + Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>}, |
|
647 | 647 | function (results, status) { |
648 | 648 | if (status == google.maps.GeocoderStatus.OK) { |
649 | 649 | updateSearchPosition(results[0].geometry.location, $form); |
650 | 650 | } else { |
651 | - alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status); |
|
651 | + alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status); |
|
652 | 652 | } |
653 | 653 | }); |
654 | 654 | } else if (window.gdMaps === 'osm') { |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | if (typeof geo !== 'undefined' && geo.lat && geo.lon) { |
658 | 658 | updateSearchPosition(geo, $form); |
659 | 659 | } else { |
660 | - alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>"); |
|
660 | + alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>"); |
|
661 | 661 | } |
662 | 662 | }); |
663 | 663 | } else { |
@@ -703,19 +703,19 @@ discard block |
||
703 | 703 | var msg; |
704 | 704 | switch (err.code) { |
705 | 705 | case err.UNKNOWN_ERROR: |
706 | - msg = "<?php _e('Unable to find your location','geodirectory');?>"; |
|
706 | + msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>"; |
|
707 | 707 | break; |
708 | 708 | case err.PERMISSION_DENINED: |
709 | - msg = "<?php _e('Permission denied in finding your location','geodirectory');?>"; |
|
709 | + msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>"; |
|
710 | 710 | break; |
711 | 711 | case err.POSITION_UNAVAILABLE: |
712 | - msg = "<?php _e('Your location is currently unknown','geodirectory');?>"; |
|
712 | + msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>"; |
|
713 | 713 | break; |
714 | 714 | case err.BREAK: |
715 | - msg = "<?php _e('Attempt to find location took too long','geodirectory');?>"; |
|
715 | + msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>"; |
|
716 | 716 | break; |
717 | 717 | default: |
718 | - msg = "<?php _e('Location detection not supported in browser','geodirectory');?>"; |
|
718 | + msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>"; |
|
719 | 719 | } |
720 | 720 | jQuery('#info').html(msg); |
721 | 721 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | * @param object $post The post object. |
755 | 755 | * @param string $link The link to the post. |
756 | 756 | */ |
757 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
757 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img"> </span></a>', $post, $link); |
|
758 | 758 | break; |
759 | 759 | case 'new' : |
760 | 760 | /** |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | * @param object $post The post object. |
765 | 765 | * @param string $link The link to the post. |
766 | 766 | */ |
767 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
767 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing"> </span></a>', $post, $link); |
|
768 | 768 | break; |
769 | 769 | |
770 | 770 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | </script> |
256 | 256 | |
257 | 257 | <?php |
258 | - }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
258 | + } elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
259 | 259 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
260 | 260 | } |
261 | 261 | |
@@ -282,13 +282,14 @@ discard block |
||
282 | 282 | */ |
283 | 283 | function geodir_add_async_forscript($url) |
284 | 284 | { |
285 | - if (strpos($url, '#asyncload')===false) |
|
286 | - return $url; |
|
287 | - else if (is_admin()) |
|
288 | - return str_replace('#asyncload', '', $url); |
|
289 | - else |
|
290 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
291 | -} |
|
285 | + if (strpos($url, '#asyncload')===false) { |
|
286 | + return $url; |
|
287 | + } else if (is_admin()) { |
|
288 | + return str_replace('#asyncload', '', $url); |
|
289 | + } else { |
|
290 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
291 | + } |
|
292 | + } |
|
292 | 293 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
293 | 294 | |
294 | 295 | /** |
@@ -355,8 +356,10 @@ discard block |
||
355 | 356 | |
356 | 357 | $half_pages_to_show = round($pages_to_show / 2); |
357 | 358 | |
358 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
359 | - return; |
|
359 | + if (geodir_is_page('home')) { |
|
360 | + // dont apply default pagination for geodirectory home page. |
|
361 | + return; |
|
362 | + } |
|
360 | 363 | |
361 | 364 | if (!is_single()) { |
362 | 365 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -476,11 +479,21 @@ discard block |
||
476 | 479 | } |
477 | 480 | $dist_dif = 1000; |
478 | 481 | |
479 | - if ($dist <= 5000) $dist_dif = 500; |
|
480 | - if ($dist <= 1000) $dist_dif = 100; |
|
481 | - if ($dist <= 500) $dist_dif = 50; |
|
482 | - if ($dist <= 100) $dist_dif = 10; |
|
483 | - if ($dist <= 50) $dist_dif = 5; |
|
482 | + if ($dist <= 5000) { |
|
483 | + $dist_dif = 500; |
|
484 | + } |
|
485 | + if ($dist <= 1000) { |
|
486 | + $dist_dif = 100; |
|
487 | + } |
|
488 | + if ($dist <= 500) { |
|
489 | + $dist_dif = 50; |
|
490 | + } |
|
491 | + if ($dist <= 100) { |
|
492 | + $dist_dif = 10; |
|
493 | + } |
|
494 | + if ($dist <= 50) { |
|
495 | + $dist_dif = 5; |
|
496 | + } |
|
484 | 497 | |
485 | 498 | ?> |
486 | 499 | <script type="text/javascript"> |
@@ -541,12 +554,14 @@ discard block |
||
541 | 554 | */ |
542 | 555 | function geodir_add_sharelocation_scripts() { |
543 | 556 | $default_search_for_text = SEARCH_FOR_TEXT; |
544 | - if (get_option('geodir_search_field_default_text')) |
|
545 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
557 | + if (get_option('geodir_search_field_default_text')) { |
|
558 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
559 | + } |
|
546 | 560 | |
547 | 561 | $default_near_text = NEAR_TEXT; |
548 | - if (get_option('geodir_near_field_default_text')) |
|
549 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
562 | + if (get_option('geodir_near_field_default_text')) { |
|
563 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
564 | + } |
|
550 | 565 | |
551 | 566 | $search_location = geodir_get_default_location(); |
552 | 567 |
@@ -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 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | function geodir_sc_listing_map($atts) { |
265 | 265 | |
266 | 266 | // if some params are set then we need a new query, if not then we can use the main query |
267 | - if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
267 | + if (isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type'])) { |
|
268 | 268 | |
269 | 269 | global $add_post_in_marker_array, $gd_sc_map_params; |
270 | 270 | $backup_globals = array(); |
@@ -287,34 +287,34 @@ discard block |
||
287 | 287 | 'event_type' => 'all' |
288 | 288 | ); |
289 | 289 | |
290 | - $params = shortcode_atts( $defaults, $atts ); |
|
290 | + $params = shortcode_atts($defaults, $atts); |
|
291 | 291 | |
292 | - if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
292 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
293 | 293 | $params['post_type'] = 'gd_place'; |
294 | 294 | } |
295 | 295 | |
296 | 296 | // Validate the selected category/ies - Grab the current list based on post_type |
297 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
298 | - $categories = get_terms( $category_taxonomy, array( |
|
297 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
298 | + $categories = get_terms($category_taxonomy, array( |
|
299 | 299 | 'orderby' => 'count', |
300 | 300 | 'order' => 'DESC', |
301 | 301 | 'fields' => 'ids' |
302 | - ) ); |
|
302 | + )); |
|
303 | 303 | |
304 | 304 | // Make sure we have an array |
305 | - if ( ! ( is_array( $params['category'] ) ) ) { |
|
306 | - $params['category'] = explode( ',', $params['category'] ); |
|
305 | + if (!(is_array($params['category']))) { |
|
306 | + $params['category'] = explode(',', $params['category']); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // Array_intersect returns only the items in $params['category'] that are also in our category list |
310 | 310 | // Otherwise it becomes empty and later on that will mean "All" |
311 | - $params['category'] = array_intersect( $params['category'], $categories ); |
|
311 | + $params['category'] = array_intersect($params['category'], $categories); |
|
312 | 312 | |
313 | - if ( $params['post_type'] == 'gd_event' ) { |
|
314 | - $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
313 | + if ($params['post_type'] == 'gd_event') { |
|
314 | + $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']); |
|
315 | 315 | } |
316 | 316 | |
317 | - $params = gdsc_validate_map_args( $params ); |
|
317 | + $params = gdsc_validate_map_args($params); |
|
318 | 318 | |
319 | 319 | $gd_sc_map_params = $params; |
320 | 320 | |
@@ -324,12 +324,12 @@ discard block |
||
324 | 324 | 'gd_location' => false, |
325 | 325 | ); |
326 | 326 | |
327 | - if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
328 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
327 | + if (!empty($params['category']) && isset($params['category'][0]) && (int) $params['category'][0] != 0) { |
|
328 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
329 | 329 | |
330 | 330 | ######### WPML ######### |
331 | - if ( function_exists( 'icl_object_id' ) ) { |
|
332 | - $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
331 | + if (function_exists('icl_object_id')) { |
|
332 | + $category = gd_lang_object_ids($params['category'], $category_taxonomy[0]); |
|
333 | 333 | } |
334 | 334 | ######### WPML ######### |
335 | 335 | |
@@ -339,36 +339,36 @@ discard block |
||
339 | 339 | 'terms' => $params['category'] |
340 | 340 | ); |
341 | 341 | |
342 | - $query_args['tax_query'] = array( $tax_query ); |
|
342 | + $query_args['tax_query'] = array($tax_query); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | $add_post_in_marker_array = true; |
346 | 346 | |
347 | - if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
347 | + if ($params['post_type'] == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
348 | 348 | global $geodir_event_widget_listview; |
349 | 349 | $geodir_event_widget_listview = true; |
350 | 350 | |
351 | 351 | $query_args['geodir_event_type'] = $params['event_type']; |
352 | 352 | |
353 | - $listings = geodir_event_get_widget_events( $query_args ); |
|
353 | + $listings = geodir_event_get_widget_events($query_args); |
|
354 | 354 | |
355 | 355 | $geodir_event_widget_listview = false; |
356 | 356 | } else { |
357 | - $listings = geodir_get_widget_listings( $query_args ); |
|
357 | + $listings = geodir_get_widget_listings($query_args); |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( ! empty( $listings ) ) { |
|
361 | - foreach ( $listings as $listing ) { |
|
362 | - create_marker_jason_of_posts( $listing ); |
|
360 | + if (!empty($listings)) { |
|
361 | + foreach ($listings as $listing) { |
|
362 | + create_marker_jason_of_posts($listing); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
366 | 366 | ob_start(); |
367 | - add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
367 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
368 | 368 | |
369 | - add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
369 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
370 | 370 | |
371 | - add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
371 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
372 | 372 | |
373 | 373 | $default_location = geodir_get_default_location(); |
374 | 374 | |
@@ -389,17 +389,17 @@ discard block |
||
389 | 389 | 'enable_location_filters' => false, |
390 | 390 | 'enable_jason_on_load' => true, |
391 | 391 | 'ajax_url' => geodir_get_ajax_url(), |
392 | - 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
393 | - 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
392 | + 'latitude' => isset($default_location->city_latitude) ? $default_location->city_latitude : '', |
|
393 | + 'longitude' => isset($default_location->city_longitude) ? $default_location->city_longitude : '', |
|
394 | 394 | 'streetViewControl' => true, |
395 | 395 | 'showPreview' => '0', |
396 | 396 | 'maxZoom' => 21, |
397 | 397 | 'bubble_size' => 'small', |
398 | 398 | ); |
399 | 399 | |
400 | - if ( is_single() ) { |
|
400 | + if (is_single()) { |
|
401 | 401 | global $post; |
402 | - if ( isset( $post->post_latitude ) ) { |
|
402 | + if (isset($post->post_latitude)) { |
|
403 | 403 | $map_args['latitude'] = $post->post_latitude; |
404 | 404 | $map_args['longitude'] = $post->post_longitude; |
405 | 405 | } |
@@ -410,24 +410,24 @@ discard block |
||
410 | 410 | } |
411 | 411 | |
412 | 412 | // Add marker cluster |
413 | - if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
413 | + if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
414 | 414 | $map_args['enable_marker_cluster'] = true; |
415 | 415 | } else { |
416 | 416 | $map_args['enable_marker_cluster'] = false; |
417 | 417 | } |
418 | 418 | |
419 | - geodir_draw_map( $map_args ); |
|
419 | + geodir_draw_map($map_args); |
|
420 | 420 | |
421 | 421 | $output = ob_get_contents(); |
422 | 422 | |
423 | 423 | ob_end_clean(); |
424 | 424 | |
425 | - foreach ( $backup_globals as $global => $value ) { |
|
425 | + foreach ($backup_globals as $global => $value) { |
|
426 | 426 | ${$global} = $value; |
427 | 427 | } |
428 | 428 | |
429 | 429 | return $output; |
430 | - }else{ |
|
430 | + } else { |
|
431 | 431 | ob_start(); |
432 | 432 | add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
433 | 433 | add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
@@ -1044,20 +1044,20 @@ discard block |
||
1044 | 1044 | |
1045 | 1045 | $show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : ''; |
1046 | 1046 | |
1047 | - if ($show_adv_search != '' ) { |
|
1048 | - $show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' '; |
|
1047 | + if ($show_adv_search != '') { |
|
1048 | + $show_adv_class = 'geodir-advance-search-'.$show_adv_search.' '; |
|
1049 | 1049 | if ($show_adv_search == 'searched' && geodir_is_page('search')) { |
1050 | 1050 | $show_adv_search = 'search'; |
1051 | 1051 | } |
1052 | - $show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"'; |
|
1052 | + $show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"'; |
|
1053 | 1053 | |
1054 | - $params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']); |
|
1054 | + $params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']); |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | ob_start(); |
1058 | 1058 | |
1059 | 1059 | //geodir_get_template_part('listing', 'filter-form'); |
1060 | - the_widget('geodir_advance_search_widget', $params, $params ); |
|
1060 | + the_widget('geodir_advance_search_widget', $params, $params); |
|
1061 | 1061 | |
1062 | 1062 | $output = ob_get_contents(); |
1063 | 1063 | ob_end_clean(); |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | |
1258 | 1258 | // Validate character_count |
1259 | 1259 | //todo: is this necessary? |
1260 | - $params['character_count'] = $params['character_count']; |
|
1260 | + $params['character_count'] = $params['character_count']; |
|
1261 | 1261 | |
1262 | 1262 | // Validate our layout choice |
1263 | 1263 | // Outside of the norm, I added some more simple terms to match the existing |
@@ -1269,7 +1269,7 @@ discard block |
||
1269 | 1269 | |
1270 | 1270 | // Validate Listing width, used in the template widget-listing-listview.php |
1271 | 1271 | // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
1272 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1272 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1273 | 1273 | |
1274 | 1274 | // Validate the checkboxes used on the widget |
1275 | 1275 | $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | if (!empty($params['tags'])) { |
1286 | 1286 | if (!is_array($params['tags'])) { |
1287 | 1287 | $comma = _x(',', 'tag delimiter'); |
1288 | - if ( ',' !== $comma ) { |
|
1288 | + if (',' !== $comma) { |
|
1289 | 1289 | $params['tags'] = str_replace($comma, ',', $params['tags']); |
1290 | 1290 | } |
1291 | 1291 | $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
@@ -1307,13 +1307,13 @@ discard block |
||
1307 | 1307 | unset($atts['pageno']); |
1308 | 1308 | } |
1309 | 1309 | |
1310 | - if ( !empty($atts['shortcode_content']) ) { |
|
1310 | + if (!empty($atts['shortcode_content'])) { |
|
1311 | 1311 | $content = $atts['shortcode_content']; |
1312 | 1312 | } |
1313 | 1313 | $params['shortcode_content'] = trim($content); |
1314 | 1314 | $atts['shortcode_content'] = trim($content); |
1315 | 1315 | |
1316 | - $params['shortcode_atts'] = $atts; |
|
1316 | + $params['shortcode_atts'] = $atts; |
|
1317 | 1317 | |
1318 | 1318 | $output = geodir_sc_gd_listings_output($params); |
1319 | 1319 | |
@@ -1385,8 +1385,8 @@ discard block |
||
1385 | 1385 | // Validate the checkboxes used on the widget |
1386 | 1386 | $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
1387 | 1387 | $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
1388 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1389 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1388 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1389 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1390 | 1390 | |
1391 | 1391 | if ($params['max_count'] != 'all') { |
1392 | 1392 | $params['max_count'] = absint($params['max_count']); |
@@ -353,7 +353,7 @@ |
||
353 | 353 | |
354 | 354 | if(!$cpt_left){ |
355 | 355 | $cpt_left = "gd-cpt-flat"; |
356 | - }else{ |
|
356 | + } else{ |
|
357 | 357 | $cpt_left = ''; |
358 | 358 | } |
359 | 359 |
@@ -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 | |
@@ -263,242 +263,242 @@ discard block |
||
263 | 263 | */ |
264 | 264 | function geodir_sc_listing_map($atts) { |
265 | 265 | |
266 | - // if some params are set then we need a new query, if not then we can use the main query |
|
267 | - if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
268 | - |
|
269 | - global $add_post_in_marker_array, $gd_sc_map_params; |
|
270 | - $backup_globals = array(); |
|
271 | - $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array; |
|
272 | - $backup_globals['gd_sc_map_params'] = $gd_sc_map_params; |
|
273 | - |
|
274 | - $defaults = array( |
|
275 | - 'width' => '294', |
|
276 | - 'height' => '370', |
|
277 | - 'zoom' => '13', |
|
278 | - 'autozoom' => '', |
|
279 | - 'sticky' => '', |
|
280 | - 'showall' => '0', |
|
281 | - 'scrollwheel' => '0', |
|
282 | - 'maptype' => 'ROADMAP', |
|
283 | - 'child_collapse' => 0, |
|
284 | - 'marker_cluster' => false, |
|
285 | - 'post_type' => 'gd_place', |
|
286 | - 'category' => '0', |
|
287 | - 'event_type' => 'all' |
|
288 | - ); |
|
289 | - |
|
290 | - $params = shortcode_atts( $defaults, $atts ); |
|
291 | - |
|
292 | - if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
293 | - $params['post_type'] = 'gd_place'; |
|
294 | - } |
|
295 | - |
|
296 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
297 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
298 | - $categories = get_terms( $category_taxonomy, array( |
|
299 | - 'orderby' => 'count', |
|
300 | - 'order' => 'DESC', |
|
301 | - 'fields' => 'ids' |
|
302 | - ) ); |
|
303 | - |
|
304 | - // Make sure we have an array |
|
305 | - if ( ! ( is_array( $params['category'] ) ) ) { |
|
306 | - $params['category'] = explode( ',', $params['category'] ); |
|
307 | - } |
|
308 | - |
|
309 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
310 | - // Otherwise it becomes empty and later on that will mean "All" |
|
311 | - $params['category'] = array_intersect( $params['category'], $categories ); |
|
312 | - |
|
313 | - if ( $params['post_type'] == 'gd_event' ) { |
|
314 | - $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
315 | - } |
|
316 | - |
|
317 | - $params = gdsc_validate_map_args( $params ); |
|
318 | - |
|
319 | - $gd_sc_map_params = $params; |
|
320 | - |
|
321 | - $query_args = array( |
|
322 | - 'posts_per_page' => 1000000, //@todo kiran why was this added? |
|
323 | - 'is_geodir_loop' => true, |
|
324 | - 'gd_location' => false, |
|
325 | - ); |
|
326 | - |
|
327 | - if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
328 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
329 | - |
|
330 | - ######### WPML ######### |
|
331 | - if ( function_exists( 'icl_object_id' ) ) { |
|
332 | - $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
333 | - } |
|
334 | - ######### WPML ######### |
|
335 | - |
|
336 | - $tax_query = array( |
|
337 | - 'taxonomy' => $category_taxonomy[0], |
|
338 | - 'field' => 'id', |
|
339 | - 'terms' => $params['category'] |
|
340 | - ); |
|
341 | - |
|
342 | - $query_args['tax_query'] = array( $tax_query ); |
|
343 | - } |
|
344 | - |
|
345 | - $add_post_in_marker_array = true; |
|
346 | - |
|
347 | - if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
348 | - global $geodir_event_widget_listview; |
|
349 | - $geodir_event_widget_listview = true; |
|
350 | - |
|
351 | - $query_args['geodir_event_type'] = $params['event_type']; |
|
352 | - |
|
353 | - $listings = geodir_event_get_widget_events( $query_args ); |
|
354 | - |
|
355 | - $geodir_event_widget_listview = false; |
|
356 | - } else { |
|
357 | - $listings = geodir_get_widget_listings( $query_args ); |
|
358 | - } |
|
359 | - |
|
360 | - if ( ! empty( $listings ) ) { |
|
361 | - foreach ( $listings as $listing ) { |
|
362 | - create_marker_jason_of_posts( $listing ); |
|
363 | - } |
|
364 | - } |
|
365 | - |
|
366 | - ob_start(); |
|
367 | - add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
368 | - |
|
369 | - add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
370 | - |
|
371 | - add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
372 | - |
|
373 | - $default_location = geodir_get_default_location(); |
|
374 | - |
|
375 | - $map_args = array( |
|
376 | - 'map_canvas_name' => 'gd_listing_map', |
|
377 | - 'width' => $params['width'], |
|
378 | - 'height' => $params['height'], |
|
379 | - 'zoom' => $params['zoom'], |
|
380 | - 'autozoom' => $params['autozoom'], |
|
381 | - 'sticky' => $params['sticky'], |
|
382 | - 'showall' => $params['showall'], |
|
383 | - 'scrollwheel' => $params['scrollwheel'], |
|
384 | - 'maptype' => $params['maptype'], |
|
385 | - 'child_collapse' => 0, |
|
386 | - 'enable_cat_filters' => false, |
|
387 | - 'enable_text_search' => false, |
|
388 | - 'enable_post_type_filters' => false, |
|
389 | - 'enable_location_filters' => false, |
|
390 | - 'enable_jason_on_load' => true, |
|
391 | - 'ajax_url' => geodir_get_ajax_url(), |
|
392 | - 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
393 | - 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
394 | - 'streetViewControl' => true, |
|
395 | - 'showPreview' => '0', |
|
396 | - 'maxZoom' => 21, |
|
397 | - 'bubble_size' => 'small', |
|
398 | - ); |
|
399 | - |
|
400 | - if ( is_single() ) { |
|
401 | - global $post; |
|
402 | - if ( isset( $post->post_latitude ) ) { |
|
403 | - $map_args['latitude'] = $post->post_latitude; |
|
404 | - $map_args['longitude'] = $post->post_longitude; |
|
405 | - } |
|
406 | - |
|
407 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
408 | - } else { |
|
409 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
410 | - } |
|
411 | - |
|
412 | - // Add marker cluster |
|
413 | - if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
414 | - $map_args['enable_marker_cluster'] = true; |
|
415 | - } else { |
|
416 | - $map_args['enable_marker_cluster'] = false; |
|
417 | - } |
|
418 | - |
|
419 | - geodir_draw_map( $map_args ); |
|
420 | - |
|
421 | - $output = ob_get_contents(); |
|
422 | - |
|
423 | - ob_end_clean(); |
|
424 | - |
|
425 | - foreach ( $backup_globals as $global => $value ) { |
|
426 | - ${$global} = $value; |
|
427 | - } |
|
428 | - |
|
429 | - return $output; |
|
430 | - }else{ |
|
431 | - ob_start(); |
|
432 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
433 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
434 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
435 | - $defaults = array( |
|
436 | - 'width' => '294', |
|
437 | - 'height' => '370', |
|
438 | - 'zoom' => '13', |
|
439 | - 'autozoom' => '', |
|
440 | - 'sticky' => '', |
|
441 | - 'showall' => '0', |
|
442 | - 'scrollwheel' => '0', |
|
443 | - 'maptype' => 'ROADMAP', |
|
444 | - 'child_collapse' => 0, |
|
445 | - 'marker_cluster' => false |
|
446 | - ); |
|
447 | - $params = shortcode_atts($defaults, $atts); |
|
448 | - $params = gdsc_validate_map_args($params); |
|
449 | - $map_args = array( |
|
450 | - 'map_canvas_name' => 'gd_listing_map', |
|
451 | - 'width' => $params['width'], |
|
452 | - 'height' => $params['height'], |
|
453 | - 'zoom' => $params['zoom'], |
|
454 | - 'autozoom' => $params['autozoom'], |
|
455 | - 'sticky' => $params['sticky'], |
|
456 | - 'showall' => $params['showall'], |
|
457 | - 'scrollwheel' => $params['scrollwheel'], |
|
458 | - 'child_collapse' => 0, |
|
459 | - 'enable_cat_filters' => false, |
|
460 | - 'enable_text_search' => false, |
|
461 | - 'enable_post_type_filters' => false, |
|
462 | - 'enable_location_filters' => false, |
|
463 | - 'enable_jason_on_load' => true, |
|
464 | - ); |
|
465 | - if (is_single()) { |
|
466 | - global $post; |
|
467 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
468 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
469 | - $mapview = $post->post_mapview; |
|
470 | - $map_args['zoom'] = $post->post_mapzoom; |
|
471 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
472 | - } else { |
|
473 | - $default_location = geodir_get_default_location(); |
|
474 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
475 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
476 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
477 | - } |
|
478 | - if (empty($mapview)) { |
|
479 | - $mapview = 'ROADMAP'; |
|
480 | - } |
|
481 | - // Set default map options |
|
482 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
483 | - $map_args['latitude'] = $map_default_lat; |
|
484 | - $map_args['longitude'] = $map_default_lng; |
|
485 | - $map_args['streetViewControl'] = true; |
|
486 | - $map_args['maptype'] = $mapview; |
|
487 | - $map_args['showPreview'] = '0'; |
|
488 | - $map_args['maxZoom'] = 21; |
|
489 | - $map_args['bubble_size'] = 'small'; |
|
490 | - |
|
491 | - // Add marker cluster |
|
492 | - if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
493 | - $map_args['enable_marker_cluster'] = true; |
|
494 | - } else { |
|
495 | - $map_args['enable_marker_cluster'] = false; |
|
496 | - } |
|
497 | - geodir_draw_map($map_args); |
|
498 | - $output = ob_get_contents(); |
|
499 | - ob_end_clean(); |
|
500 | - return $output; |
|
501 | - } |
|
266 | + // if some params are set then we need a new query, if not then we can use the main query |
|
267 | + if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
268 | + |
|
269 | + global $add_post_in_marker_array, $gd_sc_map_params; |
|
270 | + $backup_globals = array(); |
|
271 | + $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array; |
|
272 | + $backup_globals['gd_sc_map_params'] = $gd_sc_map_params; |
|
273 | + |
|
274 | + $defaults = array( |
|
275 | + 'width' => '294', |
|
276 | + 'height' => '370', |
|
277 | + 'zoom' => '13', |
|
278 | + 'autozoom' => '', |
|
279 | + 'sticky' => '', |
|
280 | + 'showall' => '0', |
|
281 | + 'scrollwheel' => '0', |
|
282 | + 'maptype' => 'ROADMAP', |
|
283 | + 'child_collapse' => 0, |
|
284 | + 'marker_cluster' => false, |
|
285 | + 'post_type' => 'gd_place', |
|
286 | + 'category' => '0', |
|
287 | + 'event_type' => 'all' |
|
288 | + ); |
|
289 | + |
|
290 | + $params = shortcode_atts( $defaults, $atts ); |
|
291 | + |
|
292 | + if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
293 | + $params['post_type'] = 'gd_place'; |
|
294 | + } |
|
295 | + |
|
296 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
297 | + $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
298 | + $categories = get_terms( $category_taxonomy, array( |
|
299 | + 'orderby' => 'count', |
|
300 | + 'order' => 'DESC', |
|
301 | + 'fields' => 'ids' |
|
302 | + ) ); |
|
303 | + |
|
304 | + // Make sure we have an array |
|
305 | + if ( ! ( is_array( $params['category'] ) ) ) { |
|
306 | + $params['category'] = explode( ',', $params['category'] ); |
|
307 | + } |
|
308 | + |
|
309 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
310 | + // Otherwise it becomes empty and later on that will mean "All" |
|
311 | + $params['category'] = array_intersect( $params['category'], $categories ); |
|
312 | + |
|
313 | + if ( $params['post_type'] == 'gd_event' ) { |
|
314 | + $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
315 | + } |
|
316 | + |
|
317 | + $params = gdsc_validate_map_args( $params ); |
|
318 | + |
|
319 | + $gd_sc_map_params = $params; |
|
320 | + |
|
321 | + $query_args = array( |
|
322 | + 'posts_per_page' => 1000000, //@todo kiran why was this added? |
|
323 | + 'is_geodir_loop' => true, |
|
324 | + 'gd_location' => false, |
|
325 | + ); |
|
326 | + |
|
327 | + if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
328 | + $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
329 | + |
|
330 | + ######### WPML ######### |
|
331 | + if ( function_exists( 'icl_object_id' ) ) { |
|
332 | + $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
333 | + } |
|
334 | + ######### WPML ######### |
|
335 | + |
|
336 | + $tax_query = array( |
|
337 | + 'taxonomy' => $category_taxonomy[0], |
|
338 | + 'field' => 'id', |
|
339 | + 'terms' => $params['category'] |
|
340 | + ); |
|
341 | + |
|
342 | + $query_args['tax_query'] = array( $tax_query ); |
|
343 | + } |
|
344 | + |
|
345 | + $add_post_in_marker_array = true; |
|
346 | + |
|
347 | + if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
348 | + global $geodir_event_widget_listview; |
|
349 | + $geodir_event_widget_listview = true; |
|
350 | + |
|
351 | + $query_args['geodir_event_type'] = $params['event_type']; |
|
352 | + |
|
353 | + $listings = geodir_event_get_widget_events( $query_args ); |
|
354 | + |
|
355 | + $geodir_event_widget_listview = false; |
|
356 | + } else { |
|
357 | + $listings = geodir_get_widget_listings( $query_args ); |
|
358 | + } |
|
359 | + |
|
360 | + if ( ! empty( $listings ) ) { |
|
361 | + foreach ( $listings as $listing ) { |
|
362 | + create_marker_jason_of_posts( $listing ); |
|
363 | + } |
|
364 | + } |
|
365 | + |
|
366 | + ob_start(); |
|
367 | + add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
368 | + |
|
369 | + add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
370 | + |
|
371 | + add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
372 | + |
|
373 | + $default_location = geodir_get_default_location(); |
|
374 | + |
|
375 | + $map_args = array( |
|
376 | + 'map_canvas_name' => 'gd_listing_map', |
|
377 | + 'width' => $params['width'], |
|
378 | + 'height' => $params['height'], |
|
379 | + 'zoom' => $params['zoom'], |
|
380 | + 'autozoom' => $params['autozoom'], |
|
381 | + 'sticky' => $params['sticky'], |
|
382 | + 'showall' => $params['showall'], |
|
383 | + 'scrollwheel' => $params['scrollwheel'], |
|
384 | + 'maptype' => $params['maptype'], |
|
385 | + 'child_collapse' => 0, |
|
386 | + 'enable_cat_filters' => false, |
|
387 | + 'enable_text_search' => false, |
|
388 | + 'enable_post_type_filters' => false, |
|
389 | + 'enable_location_filters' => false, |
|
390 | + 'enable_jason_on_load' => true, |
|
391 | + 'ajax_url' => geodir_get_ajax_url(), |
|
392 | + 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
393 | + 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
394 | + 'streetViewControl' => true, |
|
395 | + 'showPreview' => '0', |
|
396 | + 'maxZoom' => 21, |
|
397 | + 'bubble_size' => 'small', |
|
398 | + ); |
|
399 | + |
|
400 | + if ( is_single() ) { |
|
401 | + global $post; |
|
402 | + if ( isset( $post->post_latitude ) ) { |
|
403 | + $map_args['latitude'] = $post->post_latitude; |
|
404 | + $map_args['longitude'] = $post->post_longitude; |
|
405 | + } |
|
406 | + |
|
407 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
408 | + } else { |
|
409 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
410 | + } |
|
411 | + |
|
412 | + // Add marker cluster |
|
413 | + if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
414 | + $map_args['enable_marker_cluster'] = true; |
|
415 | + } else { |
|
416 | + $map_args['enable_marker_cluster'] = false; |
|
417 | + } |
|
418 | + |
|
419 | + geodir_draw_map( $map_args ); |
|
420 | + |
|
421 | + $output = ob_get_contents(); |
|
422 | + |
|
423 | + ob_end_clean(); |
|
424 | + |
|
425 | + foreach ( $backup_globals as $global => $value ) { |
|
426 | + ${$global} = $value; |
|
427 | + } |
|
428 | + |
|
429 | + return $output; |
|
430 | + }else{ |
|
431 | + ob_start(); |
|
432 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
433 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
434 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
435 | + $defaults = array( |
|
436 | + 'width' => '294', |
|
437 | + 'height' => '370', |
|
438 | + 'zoom' => '13', |
|
439 | + 'autozoom' => '', |
|
440 | + 'sticky' => '', |
|
441 | + 'showall' => '0', |
|
442 | + 'scrollwheel' => '0', |
|
443 | + 'maptype' => 'ROADMAP', |
|
444 | + 'child_collapse' => 0, |
|
445 | + 'marker_cluster' => false |
|
446 | + ); |
|
447 | + $params = shortcode_atts($defaults, $atts); |
|
448 | + $params = gdsc_validate_map_args($params); |
|
449 | + $map_args = array( |
|
450 | + 'map_canvas_name' => 'gd_listing_map', |
|
451 | + 'width' => $params['width'], |
|
452 | + 'height' => $params['height'], |
|
453 | + 'zoom' => $params['zoom'], |
|
454 | + 'autozoom' => $params['autozoom'], |
|
455 | + 'sticky' => $params['sticky'], |
|
456 | + 'showall' => $params['showall'], |
|
457 | + 'scrollwheel' => $params['scrollwheel'], |
|
458 | + 'child_collapse' => 0, |
|
459 | + 'enable_cat_filters' => false, |
|
460 | + 'enable_text_search' => false, |
|
461 | + 'enable_post_type_filters' => false, |
|
462 | + 'enable_location_filters' => false, |
|
463 | + 'enable_jason_on_load' => true, |
|
464 | + ); |
|
465 | + if (is_single()) { |
|
466 | + global $post; |
|
467 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
468 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
469 | + $mapview = $post->post_mapview; |
|
470 | + $map_args['zoom'] = $post->post_mapzoom; |
|
471 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
472 | + } else { |
|
473 | + $default_location = geodir_get_default_location(); |
|
474 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
475 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
476 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
477 | + } |
|
478 | + if (empty($mapview)) { |
|
479 | + $mapview = 'ROADMAP'; |
|
480 | + } |
|
481 | + // Set default map options |
|
482 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
483 | + $map_args['latitude'] = $map_default_lat; |
|
484 | + $map_args['longitude'] = $map_default_lng; |
|
485 | + $map_args['streetViewControl'] = true; |
|
486 | + $map_args['maptype'] = $mapview; |
|
487 | + $map_args['showPreview'] = '0'; |
|
488 | + $map_args['maxZoom'] = 21; |
|
489 | + $map_args['bubble_size'] = 'small'; |
|
490 | + |
|
491 | + // Add marker cluster |
|
492 | + if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
493 | + $map_args['enable_marker_cluster'] = true; |
|
494 | + } else { |
|
495 | + $map_args['enable_marker_cluster'] = false; |
|
496 | + } |
|
497 | + geodir_draw_map($map_args); |
|
498 | + $output = ob_get_contents(); |
|
499 | + ob_end_clean(); |
|
500 | + return $output; |
|
501 | + } |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -531,120 +531,120 @@ discard block |
||
531 | 531 | */ |
532 | 532 | function geodir_sc_listing_slider($atts) |
533 | 533 | { |
534 | - ob_start(); |
|
535 | - $defaults = array( |
|
536 | - 'post_type' => 'gd_place', |
|
537 | - 'category' => '0', |
|
538 | - 'post_number' => '5', |
|
539 | - 'slideshow' => '0', |
|
540 | - 'animation_loop' => 0, |
|
541 | - 'direction_nav' => 0, |
|
542 | - 'slideshow_speed' => 5000, |
|
543 | - 'animation_speed' => 600, |
|
544 | - 'animation' => 'slide', |
|
545 | - 'order_by' => 'latest', |
|
546 | - 'show_title' => '', |
|
547 | - 'show_featured_only' => '', |
|
548 | - 'title' => '', |
|
549 | - ); |
|
550 | - |
|
551 | - $params = shortcode_atts($defaults, $atts); |
|
552 | - |
|
553 | - |
|
554 | - /* |
|
534 | + ob_start(); |
|
535 | + $defaults = array( |
|
536 | + 'post_type' => 'gd_place', |
|
537 | + 'category' => '0', |
|
538 | + 'post_number' => '5', |
|
539 | + 'slideshow' => '0', |
|
540 | + 'animation_loop' => 0, |
|
541 | + 'direction_nav' => 0, |
|
542 | + 'slideshow_speed' => 5000, |
|
543 | + 'animation_speed' => 600, |
|
544 | + 'animation' => 'slide', |
|
545 | + 'order_by' => 'latest', |
|
546 | + 'show_title' => '', |
|
547 | + 'show_featured_only' => '', |
|
548 | + 'title' => '', |
|
549 | + ); |
|
550 | + |
|
551 | + $params = shortcode_atts($defaults, $atts); |
|
552 | + |
|
553 | + |
|
554 | + /* |
|
555 | 555 | * |
556 | 556 | * Now we begin the validation of the attributes. |
557 | 557 | */ |
558 | - // Check we have a valid post_type |
|
559 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
560 | - $params['post_type'] = 'gd_place'; |
|
561 | - } |
|
562 | - |
|
563 | - // Check we have a valid sort_order |
|
564 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
565 | - |
|
566 | - // Match the chosen animation to our options |
|
567 | - $animation_list = array('slide', 'fade'); |
|
568 | - if (!(in_array($params['animation'], $animation_list))) { |
|
569 | - $params['animation'] = 'slide'; |
|
570 | - } |
|
571 | - |
|
572 | - // Post_number needs to be a positive integer |
|
573 | - $params['post_number'] = absint($params['post_number']); |
|
574 | - if (0 == $params['post_number']) { |
|
575 | - $params['post_number'] = 1; |
|
576 | - } |
|
577 | - |
|
578 | - // Manage the entered categories |
|
579 | - if (0 != $params['category'] || '' != $params['category']) { |
|
580 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
581 | - } |
|
582 | - // Convert show_title to a bool |
|
583 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
584 | - |
|
585 | - // Convert show_featured_only to a bool |
|
586 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
587 | - |
|
588 | - /* |
|
558 | + // Check we have a valid post_type |
|
559 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
560 | + $params['post_type'] = 'gd_place'; |
|
561 | + } |
|
562 | + |
|
563 | + // Check we have a valid sort_order |
|
564 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
565 | + |
|
566 | + // Match the chosen animation to our options |
|
567 | + $animation_list = array('slide', 'fade'); |
|
568 | + if (!(in_array($params['animation'], $animation_list))) { |
|
569 | + $params['animation'] = 'slide'; |
|
570 | + } |
|
571 | + |
|
572 | + // Post_number needs to be a positive integer |
|
573 | + $params['post_number'] = absint($params['post_number']); |
|
574 | + if (0 == $params['post_number']) { |
|
575 | + $params['post_number'] = 1; |
|
576 | + } |
|
577 | + |
|
578 | + // Manage the entered categories |
|
579 | + if (0 != $params['category'] || '' != $params['category']) { |
|
580 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
581 | + } |
|
582 | + // Convert show_title to a bool |
|
583 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
584 | + |
|
585 | + // Convert show_featured_only to a bool |
|
586 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
587 | + |
|
588 | + /* |
|
589 | 589 | * Hopefully all attributes are now valid, and safe to pass forward |
590 | 590 | */ |
591 | 591 | |
592 | - // redeclare vars after validation |
|
593 | - |
|
594 | - if (isset($params['direction_nav'])) { |
|
595 | - $params['directionNav'] = $params['direction_nav']; |
|
596 | - } |
|
597 | - if (isset($params['animation_loop'])) { |
|
598 | - $params['animationLoop'] = $params['animation_loop']; |
|
599 | - } |
|
600 | - if (isset($params['slideshow_speed'])) { |
|
601 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
602 | - } |
|
603 | - if (isset($params['animation_speed'])) { |
|
604 | - $params['animationSpeed'] = $params['animation_speed']; |
|
605 | - } |
|
606 | - if (isset($params['order_by'])) { |
|
607 | - $params['list_sort'] = $params['order_by']; |
|
608 | - } |
|
609 | - |
|
610 | - $query_args = array( |
|
611 | - 'post_number' => $params['post_number'], |
|
612 | - 'is_geodir_loop' => true, |
|
613 | - 'post_type' => $params['post_type'], |
|
614 | - 'order_by' => $params['order_by'] |
|
615 | - ); |
|
616 | - |
|
617 | - if (1 == $params['show_featured_only']) { |
|
618 | - $query_args['show_featured_only'] = 1; |
|
619 | - } |
|
620 | - |
|
621 | - if (0 != $params['category'] && '' != $params['category']) { |
|
622 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
623 | - $tax_query = array( |
|
624 | - 'taxonomy' => $category_taxonomy[0], |
|
625 | - 'field' => 'id', |
|
626 | - 'terms' => $params['category'], |
|
627 | - ); |
|
628 | - |
|
629 | - $query_args['tax_query'] = array($tax_query); |
|
630 | - } |
|
631 | - |
|
632 | - $defaults = array( |
|
633 | - 'before_widget' => '', |
|
634 | - 'after_widget' => '', |
|
635 | - 'before_title' => '', |
|
636 | - 'after_title' => '', |
|
637 | - ); |
|
638 | - |
|
639 | - $query_args = array_merge($query_args, $params); |
|
640 | - |
|
641 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
642 | - |
|
643 | - $output = ob_get_contents(); |
|
644 | - |
|
645 | - ob_end_clean(); |
|
646 | - |
|
647 | - return $output; |
|
592 | + // redeclare vars after validation |
|
593 | + |
|
594 | + if (isset($params['direction_nav'])) { |
|
595 | + $params['directionNav'] = $params['direction_nav']; |
|
596 | + } |
|
597 | + if (isset($params['animation_loop'])) { |
|
598 | + $params['animationLoop'] = $params['animation_loop']; |
|
599 | + } |
|
600 | + if (isset($params['slideshow_speed'])) { |
|
601 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
602 | + } |
|
603 | + if (isset($params['animation_speed'])) { |
|
604 | + $params['animationSpeed'] = $params['animation_speed']; |
|
605 | + } |
|
606 | + if (isset($params['order_by'])) { |
|
607 | + $params['list_sort'] = $params['order_by']; |
|
608 | + } |
|
609 | + |
|
610 | + $query_args = array( |
|
611 | + 'post_number' => $params['post_number'], |
|
612 | + 'is_geodir_loop' => true, |
|
613 | + 'post_type' => $params['post_type'], |
|
614 | + 'order_by' => $params['order_by'] |
|
615 | + ); |
|
616 | + |
|
617 | + if (1 == $params['show_featured_only']) { |
|
618 | + $query_args['show_featured_only'] = 1; |
|
619 | + } |
|
620 | + |
|
621 | + if (0 != $params['category'] && '' != $params['category']) { |
|
622 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
623 | + $tax_query = array( |
|
624 | + 'taxonomy' => $category_taxonomy[0], |
|
625 | + 'field' => 'id', |
|
626 | + 'terms' => $params['category'], |
|
627 | + ); |
|
628 | + |
|
629 | + $query_args['tax_query'] = array($tax_query); |
|
630 | + } |
|
631 | + |
|
632 | + $defaults = array( |
|
633 | + 'before_widget' => '', |
|
634 | + 'after_widget' => '', |
|
635 | + 'before_title' => '', |
|
636 | + 'after_title' => '', |
|
637 | + ); |
|
638 | + |
|
639 | + $query_args = array_merge($query_args, $params); |
|
640 | + |
|
641 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
642 | + |
|
643 | + $output = ob_get_contents(); |
|
644 | + |
|
645 | + ob_end_clean(); |
|
646 | + |
|
647 | + return $output; |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -668,22 +668,22 @@ discard block |
||
668 | 668 | */ |
669 | 669 | function geodir_sc_login_box($atts) |
670 | 670 | { |
671 | - ob_start(); |
|
671 | + ob_start(); |
|
672 | 672 | |
673 | - $defaults = array( |
|
674 | - 'before_widget' => '', |
|
675 | - 'after_widget' => '', |
|
676 | - 'before_title' => '', |
|
677 | - 'after_title' => '', |
|
678 | - ); |
|
673 | + $defaults = array( |
|
674 | + 'before_widget' => '', |
|
675 | + 'after_widget' => '', |
|
676 | + 'before_title' => '', |
|
677 | + 'after_title' => '', |
|
678 | + ); |
|
679 | 679 | |
680 | - geodir_loginwidget_output($defaults, $defaults); |
|
680 | + geodir_loginwidget_output($defaults, $defaults); |
|
681 | 681 | |
682 | - $output = ob_get_contents(); |
|
682 | + $output = ob_get_contents(); |
|
683 | 683 | |
684 | - ob_end_clean(); |
|
684 | + ob_end_clean(); |
|
685 | 685 | |
686 | - return $output; |
|
686 | + return $output; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -714,31 +714,31 @@ discard block |
||
714 | 714 | */ |
715 | 715 | function geodir_sc_popular_post_category($atts) |
716 | 716 | { |
717 | - ob_start(); |
|
718 | - global $geodir_post_category_str; |
|
719 | - $defaults = array( |
|
720 | - 'category_limit' => 15, |
|
721 | - 'category_restrict' => false, |
|
722 | - 'before_widget' => '', |
|
723 | - 'after_widget' => '', |
|
724 | - 'before_title' => '', |
|
725 | - 'after_title' => '', |
|
726 | - 'title' => '', |
|
727 | - 'default_post_type' => '', |
|
728 | - 'parent_only' => false, |
|
729 | - ); |
|
730 | - |
|
731 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
732 | - $params['category_limit'] = absint($params['category_limit']); |
|
733 | - $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
734 | - $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
735 | - geodir_popular_post_category_output($params, $params); |
|
736 | - |
|
737 | - $output = ob_get_contents(); |
|
738 | - |
|
739 | - ob_end_clean(); |
|
740 | - |
|
741 | - return $output; |
|
717 | + ob_start(); |
|
718 | + global $geodir_post_category_str; |
|
719 | + $defaults = array( |
|
720 | + 'category_limit' => 15, |
|
721 | + 'category_restrict' => false, |
|
722 | + 'before_widget' => '', |
|
723 | + 'after_widget' => '', |
|
724 | + 'before_title' => '', |
|
725 | + 'after_title' => '', |
|
726 | + 'title' => '', |
|
727 | + 'default_post_type' => '', |
|
728 | + 'parent_only' => false, |
|
729 | + ); |
|
730 | + |
|
731 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
732 | + $params['category_limit'] = absint($params['category_limit']); |
|
733 | + $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
734 | + $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
735 | + geodir_popular_post_category_output($params, $params); |
|
736 | + |
|
737 | + $output = ob_get_contents(); |
|
738 | + |
|
739 | + ob_end_clean(); |
|
740 | + |
|
741 | + return $output; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -778,97 +778,97 @@ discard block |
||
778 | 778 | */ |
779 | 779 | function geodir_sc_popular_post_view($atts) |
780 | 780 | { |
781 | - ob_start(); |
|
782 | - $defaults = array( |
|
783 | - 'post_type' => 'gd_place', |
|
784 | - 'category' => '0', |
|
785 | - 'post_number' => '5', |
|
786 | - 'layout' => 'gridview_onehalf', |
|
787 | - 'add_location_filter' => '0', |
|
788 | - 'list_sort' => 'latest', |
|
789 | - 'use_viewing_post_type' => '1', |
|
790 | - 'character_count' => '20', |
|
791 | - 'listing_width' => '', |
|
792 | - 'show_featured_only' => '0', |
|
793 | - 'show_special_only' => '0', |
|
794 | - 'with_pics_only' => '0', |
|
795 | - 'with_videos_only' => '0', |
|
796 | - 'before_widget' => '', |
|
797 | - 'after_widget' => '', |
|
798 | - 'before_title' => '<h3 class="widget-title">', |
|
799 | - 'after_title' => '</h3>', |
|
800 | - 'title' => '', |
|
801 | - 'category_title' => '', |
|
802 | - ); |
|
803 | - |
|
804 | - $params = shortcode_atts($defaults, $atts); |
|
805 | - |
|
806 | - /** |
|
807 | - * Validate our incoming params |
|
808 | - */ |
|
781 | + ob_start(); |
|
782 | + $defaults = array( |
|
783 | + 'post_type' => 'gd_place', |
|
784 | + 'category' => '0', |
|
785 | + 'post_number' => '5', |
|
786 | + 'layout' => 'gridview_onehalf', |
|
787 | + 'add_location_filter' => '0', |
|
788 | + 'list_sort' => 'latest', |
|
789 | + 'use_viewing_post_type' => '1', |
|
790 | + 'character_count' => '20', |
|
791 | + 'listing_width' => '', |
|
792 | + 'show_featured_only' => '0', |
|
793 | + 'show_special_only' => '0', |
|
794 | + 'with_pics_only' => '0', |
|
795 | + 'with_videos_only' => '0', |
|
796 | + 'before_widget' => '', |
|
797 | + 'after_widget' => '', |
|
798 | + 'before_title' => '<h3 class="widget-title">', |
|
799 | + 'after_title' => '</h3>', |
|
800 | + 'title' => '', |
|
801 | + 'category_title' => '', |
|
802 | + ); |
|
809 | 803 | |
810 | - // Validate the selected post type, default to gd_place on fail |
|
811 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
812 | - $params['post_type'] = 'gd_place'; |
|
813 | - } |
|
814 | - |
|
815 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
816 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
817 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
818 | - |
|
819 | - // Make sure we have an array |
|
820 | - if (!(is_array($params['category']))) { |
|
821 | - $params['category'] = explode(',', $params['category']); |
|
822 | - } |
|
823 | - |
|
824 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
825 | - // Otherwise it becomes empty and later on that will mean "All" |
|
826 | - $params['category'] = array_intersect($params['category'], $categories); |
|
827 | - |
|
828 | - // Post_number needs to be a positive integer |
|
829 | - $params['post_number'] = absint($params['post_number']); |
|
830 | - if (0 == $params['post_number']) { |
|
831 | - $params['post_number'] = 1; |
|
832 | - } |
|
833 | - |
|
834 | - // Validate our layout choice |
|
835 | - // Outside of the norm, I added some more simple terms to match the existing |
|
836 | - // So now I just run the switch to set it properly. |
|
837 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
838 | - |
|
839 | - // Validate our sorting choice |
|
840 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
841 | - |
|
842 | - // Validate character_count |
|
843 | - $params['character_count'] = absint($params['character_count']); |
|
844 | - if (20 > $params['character_count']) { |
|
845 | - $params['character_count'] = 20; |
|
846 | - } |
|
847 | - |
|
848 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
849 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
850 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
851 | - |
|
852 | - // Validate the checkboxes used on the widget |
|
853 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
854 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
855 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
856 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
857 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
858 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
859 | - |
|
860 | - /** |
|
861 | - * End of validation |
|
862 | - */ |
|
804 | + $params = shortcode_atts($defaults, $atts); |
|
805 | + |
|
806 | + /** |
|
807 | + * Validate our incoming params |
|
808 | + */ |
|
863 | 809 | |
864 | - geodir_popular_postview_output($params, $params); |
|
810 | + // Validate the selected post type, default to gd_place on fail |
|
811 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
812 | + $params['post_type'] = 'gd_place'; |
|
813 | + } |
|
865 | 814 | |
815 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
816 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
817 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
866 | 818 | |
867 | - $output = ob_get_contents(); |
|
819 | + // Make sure we have an array |
|
820 | + if (!(is_array($params['category']))) { |
|
821 | + $params['category'] = explode(',', $params['category']); |
|
822 | + } |
|
868 | 823 | |
869 | - ob_end_clean(); |
|
824 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
825 | + // Otherwise it becomes empty and later on that will mean "All" |
|
826 | + $params['category'] = array_intersect($params['category'], $categories); |
|
870 | 827 | |
871 | - return $output; |
|
828 | + // Post_number needs to be a positive integer |
|
829 | + $params['post_number'] = absint($params['post_number']); |
|
830 | + if (0 == $params['post_number']) { |
|
831 | + $params['post_number'] = 1; |
|
832 | + } |
|
833 | + |
|
834 | + // Validate our layout choice |
|
835 | + // Outside of the norm, I added some more simple terms to match the existing |
|
836 | + // So now I just run the switch to set it properly. |
|
837 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
838 | + |
|
839 | + // Validate our sorting choice |
|
840 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
841 | + |
|
842 | + // Validate character_count |
|
843 | + $params['character_count'] = absint($params['character_count']); |
|
844 | + if (20 > $params['character_count']) { |
|
845 | + $params['character_count'] = 20; |
|
846 | + } |
|
847 | + |
|
848 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
849 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
850 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
851 | + |
|
852 | + // Validate the checkboxes used on the widget |
|
853 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
854 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
855 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
856 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
857 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
858 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
859 | + |
|
860 | + /** |
|
861 | + * End of validation |
|
862 | + */ |
|
863 | + |
|
864 | + geodir_popular_postview_output($params, $params); |
|
865 | + |
|
866 | + |
|
867 | + $output = ob_get_contents(); |
|
868 | + |
|
869 | + ob_end_clean(); |
|
870 | + |
|
871 | + return $output; |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -890,37 +890,37 @@ discard block |
||
890 | 890 | * @return string Recent reviews HTML. |
891 | 891 | */ |
892 | 892 | function geodir_sc_recent_reviews($atts) { |
893 | - ob_start(); |
|
894 | - $defaults = array( |
|
893 | + ob_start(); |
|
894 | + $defaults = array( |
|
895 | 895 | 'title' => '', |
896 | 896 | 'count' => 5, |
897 | - ); |
|
897 | + ); |
|
898 | 898 | |
899 | - $params = shortcode_atts($defaults, $atts); |
|
899 | + $params = shortcode_atts($defaults, $atts); |
|
900 | 900 | |
901 | - $count = absint($params['count']); |
|
902 | - if (0 == $count) { |
|
903 | - $count = 1; |
|
904 | - } |
|
901 | + $count = absint($params['count']); |
|
902 | + if (0 == $count) { |
|
903 | + $count = 1; |
|
904 | + } |
|
905 | 905 | |
906 | 906 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
907 | 907 | |
908 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
908 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
909 | 909 | |
910 | - if ($comments_li) { |
|
911 | - if ($title != '') { ?> |
|
910 | + if ($comments_li) { |
|
911 | + if ($title != '') { ?> |
|
912 | 912 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
913 | 913 | <?php } ?> |
914 | 914 | <div class="geodir_sc_recent_reviews_section"> |
915 | 915 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
916 | 916 | </div> |
917 | 917 | <?php |
918 | - } |
|
919 | - $output = ob_get_contents(); |
|
918 | + } |
|
919 | + $output = ob_get_contents(); |
|
920 | 920 | |
921 | - ob_end_clean(); |
|
921 | + ob_end_clean(); |
|
922 | 922 | |
923 | - return $output; |
|
923 | + return $output; |
|
924 | 924 | } |
925 | 925 | |
926 | 926 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -950,64 +950,64 @@ discard block |
||
950 | 950 | */ |
951 | 951 | function geodir_sc_related_listings($atts) |
952 | 952 | { |
953 | - ob_start(); |
|
954 | - $defaults = array( |
|
955 | - 'post_number' => 5, |
|
956 | - 'relate_to' => 'category', |
|
957 | - 'layout' => 'gridview_onehalf', |
|
958 | - 'add_location_filter' => 0, |
|
959 | - 'listing_width' => '', |
|
960 | - 'list_sort' => 'latest', |
|
961 | - 'character_count' => 20, |
|
962 | - 'is_widget' => 1, |
|
963 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
964 | - ); |
|
965 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
966 | - |
|
967 | - $params = shortcode_atts($defaults, $atts); |
|
968 | - |
|
969 | - /** |
|
970 | - * Begin validating parameters |
|
971 | - */ |
|
953 | + ob_start(); |
|
954 | + $defaults = array( |
|
955 | + 'post_number' => 5, |
|
956 | + 'relate_to' => 'category', |
|
957 | + 'layout' => 'gridview_onehalf', |
|
958 | + 'add_location_filter' => 0, |
|
959 | + 'listing_width' => '', |
|
960 | + 'list_sort' => 'latest', |
|
961 | + 'character_count' => 20, |
|
962 | + 'is_widget' => 1, |
|
963 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
964 | + ); |
|
965 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
972 | 966 | |
973 | - // Validate that post_number is a number and is 1 or higher |
|
974 | - $params['post_number'] = absint($params['post_number']); |
|
975 | - if (0 === $params['post_number']) { |
|
976 | - $params['post_number'] = 1; |
|
977 | - } |
|
967 | + $params = shortcode_atts($defaults, $atts); |
|
978 | 968 | |
979 | - // Validate relate_to - only category or tags |
|
980 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
981 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
982 | - $params['relate_to'] = 'category'; |
|
983 | - } |
|
969 | + /** |
|
970 | + * Begin validating parameters |
|
971 | + */ |
|
984 | 972 | |
985 | - // Validate layout selection |
|
986 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
973 | + // Validate that post_number is a number and is 1 or higher |
|
974 | + $params['post_number'] = absint($params['post_number']); |
|
975 | + if (0 === $params['post_number']) { |
|
976 | + $params['post_number'] = 1; |
|
977 | + } |
|
987 | 978 | |
988 | - // Validate sorting option |
|
989 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
979 | + // Validate relate_to - only category or tags |
|
980 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
981 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
982 | + $params['relate_to'] = 'category'; |
|
983 | + } |
|
990 | 984 | |
991 | - // Validate add_location_filter |
|
992 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
985 | + // Validate layout selection |
|
986 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
993 | 987 | |
994 | - // Validate listing_width |
|
995 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
988 | + // Validate sorting option |
|
989 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
996 | 990 | |
997 | - // Validate character_count |
|
998 | - $params['character_count'] = absint($params['character_count']); |
|
999 | - if (20 > $params['character_count']) { |
|
1000 | - $params['character_count'] = 20; |
|
1001 | - } |
|
991 | + // Validate add_location_filter |
|
992 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1002 | 993 | |
1003 | - if ($related_display = geodir_related_posts_display($params)) { |
|
1004 | - echo $related_display; |
|
1005 | - } |
|
1006 | - $output = ob_get_contents(); |
|
994 | + // Validate listing_width |
|
995 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1007 | 996 | |
1008 | - ob_end_clean(); |
|
997 | + // Validate character_count |
|
998 | + $params['character_count'] = absint($params['character_count']); |
|
999 | + if (20 > $params['character_count']) { |
|
1000 | + $params['character_count'] = 20; |
|
1001 | + } |
|
1009 | 1002 | |
1010 | - return $output; |
|
1003 | + if ($related_display = geodir_related_posts_display($params)) { |
|
1004 | + echo $related_display; |
|
1005 | + } |
|
1006 | + $output = ob_get_contents(); |
|
1007 | + |
|
1008 | + ob_end_clean(); |
|
1009 | + |
|
1010 | + return $output; |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | /** |
@@ -1031,13 +1031,13 @@ discard block |
||
1031 | 1031 | * @return string Advanced search widget HTML. |
1032 | 1032 | */ |
1033 | 1033 | function geodir_sc_advanced_search($atts) { |
1034 | - $defaults = array( |
|
1034 | + $defaults = array( |
|
1035 | 1035 | 'title' => '', |
1036 | 1036 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">', |
1037 | - 'after_widget' => '</section>', |
|
1038 | - 'before_title' => '<h3 class="widget-title">', |
|
1039 | - 'after_title' => '</h3>', |
|
1040 | - 'show_adv_search' => 'default', |
|
1037 | + 'after_widget' => '</section>', |
|
1038 | + 'before_title' => '<h3 class="widget-title">', |
|
1039 | + 'after_title' => '</h3>', |
|
1040 | + 'show_adv_search' => 'default', |
|
1041 | 1041 | 'post_type' => '' |
1042 | 1042 | ); |
1043 | 1043 | |
@@ -1061,9 +1061,9 @@ discard block |
||
1061 | 1061 | the_widget('geodir_advance_search_widget', $params, $params ); |
1062 | 1062 | |
1063 | 1063 | $output = ob_get_contents(); |
1064 | - ob_end_clean(); |
|
1064 | + ob_end_clean(); |
|
1065 | 1065 | |
1066 | - return $output; |
|
1066 | + return $output; |
|
1067 | 1067 | } |
1068 | 1068 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
1069 | 1069 | |
@@ -1109,48 +1109,48 @@ discard block |
||
1109 | 1109 | 'add_location_filter' => '1', |
1110 | 1110 | 'tab_layout' => 'bestof-tabs-on-top', |
1111 | 1111 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
1112 | - 'after_widget' => '</section>', |
|
1113 | - 'before_title' => '<h3 class="widget-title">', |
|
1114 | - 'after_title' => '</h3>', |
|
1112 | + 'after_widget' => '</section>', |
|
1113 | + 'before_title' => '<h3 class="widget-title">', |
|
1114 | + 'after_title' => '</h3>', |
|
1115 | 1115 | ); |
1116 | 1116 | $params = shortcode_atts($defaults, $atts); |
1117 | 1117 | |
1118 | - /** |
|
1119 | - * Validate our incoming params |
|
1120 | - */ |
|
1118 | + /** |
|
1119 | + * Validate our incoming params |
|
1120 | + */ |
|
1121 | 1121 | |
1122 | - // Validate the selected post type, default to gd_place on fail |
|
1123 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
1124 | - $params['post_type'] = 'gd_place'; |
|
1125 | - } |
|
1122 | + // Validate the selected post type, default to gd_place on fail |
|
1123 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
1124 | + $params['post_type'] = 'gd_place'; |
|
1125 | + } |
|
1126 | 1126 | |
1127 | 1127 | // Post limit needs to be a positive integer |
1128 | - $params['post_limit'] = absint($params['post_limit']); |
|
1129 | - if (0 == $params['post_limit']) { |
|
1130 | - $params['post_limit'] = 5; |
|
1131 | - } |
|
1128 | + $params['post_limit'] = absint($params['post_limit']); |
|
1129 | + if (0 == $params['post_limit']) { |
|
1130 | + $params['post_limit'] = 5; |
|
1131 | + } |
|
1132 | 1132 | |
1133 | 1133 | // Category limit needs to be a positive integer |
1134 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
1135 | - if (0 == $params['categ_limit']) { |
|
1136 | - $params['categ_limit'] = 3; |
|
1137 | - } |
|
1134 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
1135 | + if (0 == $params['categ_limit']) { |
|
1136 | + $params['categ_limit'] = 3; |
|
1137 | + } |
|
1138 | 1138 | |
1139 | 1139 | // Tab layout validation |
1140 | - $params['tab_layout'] = $params['tab_layout']; |
|
1141 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
1142 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
1143 | - } |
|
1140 | + $params['tab_layout'] = $params['tab_layout']; |
|
1141 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
1142 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
1143 | + } |
|
1144 | 1144 | |
1145 | 1145 | // Validate character_count |
1146 | - $params['character_count'] = $params['character_count']; |
|
1146 | + $params['character_count'] = $params['character_count']; |
|
1147 | 1147 | |
1148 | 1148 | ob_start(); |
1149 | 1149 | the_widget('geodir_bestof_widget', $params, $params); |
1150 | - $output = ob_get_contents(); |
|
1151 | - ob_end_clean(); |
|
1150 | + $output = ob_get_contents(); |
|
1151 | + ob_end_clean(); |
|
1152 | 1152 | |
1153 | - return $output; |
|
1153 | + return $output; |
|
1154 | 1154 | } |
1155 | 1155 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
1156 | 1156 | |
@@ -1198,127 +1198,127 @@ discard block |
||
1198 | 1198 | * @return string HTML content to display geodirectory listings. |
1199 | 1199 | */ |
1200 | 1200 | function geodir_sc_gd_listings($atts, $content = '') { |
1201 | - global $post; |
|
1202 | - $defaults = array( |
|
1203 | - 'title' => '', |
|
1204 | - 'post_type' => 'gd_place', |
|
1205 | - 'category' => 0, |
|
1206 | - 'list_sort' => 'latest', |
|
1207 | - 'event_type' => '', |
|
1208 | - 'post_number' => 10, |
|
1209 | - 'post_author' => '', |
|
1210 | - 'layout' => 'gridview_onehalf', |
|
1211 | - 'listing_width' => '', |
|
1212 | - 'character_count' => 20, |
|
1213 | - 'add_location_filter' => 1, |
|
1214 | - 'show_featured_only' => '', |
|
1215 | - 'show_special_only' => '', |
|
1216 | - 'with_pics_only' => '', |
|
1217 | - 'with_videos_only' => '', |
|
1218 | - 'with_pagination' => '1', |
|
1219 | - 'top_pagination' => '0', |
|
1220 | - 'bottom_pagination' => '1', |
|
1221 | - 'without_no_results' => 0, |
|
1222 | - 'tags' => '' |
|
1223 | - ); |
|
1224 | - $params = shortcode_atts($defaults, $atts); |
|
1225 | - |
|
1226 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
1227 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1228 | - |
|
1229 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
1230 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1231 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1232 | - |
|
1233 | - // Make sure we have an array |
|
1234 | - if (!(is_array($params['category']))) { |
|
1235 | - $params['category'] = explode(',', $params['category']); |
|
1236 | - } |
|
1237 | - |
|
1238 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1239 | - // Otherwise it becomes empty and later on that will mean "All" |
|
1240 | - $params['category'] = array_intersect($params['category'], $categories); |
|
1241 | - |
|
1242 | - // Post_number needs to be a positive integer |
|
1243 | - $params['post_number'] = absint($params['post_number']); |
|
1244 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1201 | + global $post; |
|
1202 | + $defaults = array( |
|
1203 | + 'title' => '', |
|
1204 | + 'post_type' => 'gd_place', |
|
1205 | + 'category' => 0, |
|
1206 | + 'list_sort' => 'latest', |
|
1207 | + 'event_type' => '', |
|
1208 | + 'post_number' => 10, |
|
1209 | + 'post_author' => '', |
|
1210 | + 'layout' => 'gridview_onehalf', |
|
1211 | + 'listing_width' => '', |
|
1212 | + 'character_count' => 20, |
|
1213 | + 'add_location_filter' => 1, |
|
1214 | + 'show_featured_only' => '', |
|
1215 | + 'show_special_only' => '', |
|
1216 | + 'with_pics_only' => '', |
|
1217 | + 'with_videos_only' => '', |
|
1218 | + 'with_pagination' => '1', |
|
1219 | + 'top_pagination' => '0', |
|
1220 | + 'bottom_pagination' => '1', |
|
1221 | + 'without_no_results' => 0, |
|
1222 | + 'tags' => '' |
|
1223 | + ); |
|
1224 | + $params = shortcode_atts($defaults, $atts); |
|
1225 | + |
|
1226 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
1227 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1228 | + |
|
1229 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
1230 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1231 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1232 | + |
|
1233 | + // Make sure we have an array |
|
1234 | + if (!(is_array($params['category']))) { |
|
1235 | + $params['category'] = explode(',', $params['category']); |
|
1236 | + } |
|
1237 | + |
|
1238 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1239 | + // Otherwise it becomes empty and later on that will mean "All" |
|
1240 | + $params['category'] = array_intersect($params['category'], $categories); |
|
1241 | + |
|
1242 | + // Post_number needs to be a positive integer |
|
1243 | + $params['post_number'] = absint($params['post_number']); |
|
1244 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1245 | 1245 | |
1246 | - // Post_number needs to be a positive integer |
|
1247 | - if (!empty($atts['post_author'])) { |
|
1248 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1249 | - $params['post_author'] = $post->post_author; |
|
1250 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1251 | - $params['post_author'] = absint($atts['post_author']); |
|
1252 | - } else { |
|
1253 | - unset($params['post_author']); |
|
1254 | - } |
|
1255 | - } else { |
|
1256 | - unset($params['post_author']); |
|
1257 | - } |
|
1258 | - |
|
1259 | - // Validate character_count |
|
1260 | - //todo: is this necessary? |
|
1261 | - $params['character_count'] = $params['character_count']; |
|
1262 | - |
|
1263 | - // Validate our layout choice |
|
1264 | - // Outside of the norm, I added some more simple terms to match the existing |
|
1265 | - // So now I just run the switch to set it properly. |
|
1266 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1267 | - |
|
1268 | - // Validate our sorting choice |
|
1269 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1270 | - |
|
1271 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
1272 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1273 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1274 | - |
|
1275 | - // Validate the checkboxes used on the widget |
|
1276 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1277 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1278 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1279 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1280 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1281 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1282 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1283 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1284 | - |
|
1285 | - // Clean tags |
|
1286 | - if (!empty($params['tags'])) { |
|
1287 | - if (!is_array($params['tags'])) { |
|
1288 | - $comma = _x(',', 'tag delimiter'); |
|
1289 | - if ( ',' !== $comma ) { |
|
1290 | - $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1291 | - } |
|
1292 | - $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1293 | - $params['tags'] = array_map('trim', $params['tags']); |
|
1294 | - } |
|
1295 | - } else { |
|
1296 | - $params['tags'] = array(); |
|
1297 | - } |
|
1298 | - |
|
1299 | - /** |
|
1300 | - * End of validation |
|
1301 | - */ |
|
1302 | - if (isset($atts['geodir_ajax'])) { |
|
1303 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1304 | - unset($atts['geodir_ajax']); |
|
1305 | - } |
|
1306 | - if (isset($atts['pageno'])) { |
|
1307 | - $params['pageno'] = $atts['pageno']; |
|
1308 | - unset($atts['pageno']); |
|
1309 | - } |
|
1310 | - |
|
1311 | - if ( !empty($atts['shortcode_content']) ) { |
|
1312 | - $content = $atts['shortcode_content']; |
|
1313 | - } |
|
1314 | - $params['shortcode_content'] = trim($content); |
|
1315 | - $atts['shortcode_content'] = trim($content); |
|
1246 | + // Post_number needs to be a positive integer |
|
1247 | + if (!empty($atts['post_author'])) { |
|
1248 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1249 | + $params['post_author'] = $post->post_author; |
|
1250 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1251 | + $params['post_author'] = absint($atts['post_author']); |
|
1252 | + } else { |
|
1253 | + unset($params['post_author']); |
|
1254 | + } |
|
1255 | + } else { |
|
1256 | + unset($params['post_author']); |
|
1257 | + } |
|
1258 | + |
|
1259 | + // Validate character_count |
|
1260 | + //todo: is this necessary? |
|
1261 | + $params['character_count'] = $params['character_count']; |
|
1262 | + |
|
1263 | + // Validate our layout choice |
|
1264 | + // Outside of the norm, I added some more simple terms to match the existing |
|
1265 | + // So now I just run the switch to set it properly. |
|
1266 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1267 | + |
|
1268 | + // Validate our sorting choice |
|
1269 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1270 | + |
|
1271 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
1272 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1273 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1274 | + |
|
1275 | + // Validate the checkboxes used on the widget |
|
1276 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1277 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1278 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1279 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1280 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1281 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1282 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1283 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1284 | + |
|
1285 | + // Clean tags |
|
1286 | + if (!empty($params['tags'])) { |
|
1287 | + if (!is_array($params['tags'])) { |
|
1288 | + $comma = _x(',', 'tag delimiter'); |
|
1289 | + if ( ',' !== $comma ) { |
|
1290 | + $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1291 | + } |
|
1292 | + $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1293 | + $params['tags'] = array_map('trim', $params['tags']); |
|
1294 | + } |
|
1295 | + } else { |
|
1296 | + $params['tags'] = array(); |
|
1297 | + } |
|
1298 | + |
|
1299 | + /** |
|
1300 | + * End of validation |
|
1301 | + */ |
|
1302 | + if (isset($atts['geodir_ajax'])) { |
|
1303 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1304 | + unset($atts['geodir_ajax']); |
|
1305 | + } |
|
1306 | + if (isset($atts['pageno'])) { |
|
1307 | + $params['pageno'] = $atts['pageno']; |
|
1308 | + unset($atts['pageno']); |
|
1309 | + } |
|
1310 | + |
|
1311 | + if ( !empty($atts['shortcode_content']) ) { |
|
1312 | + $content = $atts['shortcode_content']; |
|
1313 | + } |
|
1314 | + $params['shortcode_content'] = trim($content); |
|
1315 | + $atts['shortcode_content'] = trim($content); |
|
1316 | 1316 | |
1317 | - $params['shortcode_atts'] = $atts; |
|
1317 | + $params['shortcode_atts'] = $atts; |
|
1318 | 1318 | |
1319 | - $output = geodir_sc_gd_listings_output($params); |
|
1319 | + $output = geodir_sc_gd_listings_output($params); |
|
1320 | 1320 | |
1321 | - return $output; |
|
1321 | + return $output; |
|
1322 | 1322 | } |
1323 | 1323 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
1324 | 1324 | |
@@ -1358,56 +1358,56 @@ discard block |
||
1358 | 1358 | * @return string HTML content to display CPT categories. |
1359 | 1359 | */ |
1360 | 1360 | function geodir_sc_cpt_categories_widget($atts, $content = '') { |
1361 | - $defaults = array( |
|
1362 | - 'title' => '', |
|
1363 | - 'post_type' => '', // NULL for all |
|
1364 | - 'hide_empty' => '', |
|
1365 | - 'show_count' => '', |
|
1366 | - 'hide_icon' => '', |
|
1367 | - 'cpt_left' => '', |
|
1368 | - 'sort_by' => 'count', |
|
1369 | - 'max_count' => 'all', |
|
1370 | - 'max_level' => '1', |
|
1371 | - 'no_cpt_filter' => '', |
|
1372 | - 'no_cat_filter' => '', |
|
1373 | - 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1374 | - 'after_widget' => '</section>', |
|
1375 | - 'before_title' => '<h3 class="widget-title">', |
|
1376 | - 'after_title' => '</h3>', |
|
1377 | - ); |
|
1378 | - $params = shortcode_atts($defaults, $atts); |
|
1379 | - |
|
1380 | - /** |
|
1381 | - * Validate our incoming params |
|
1382 | - */ |
|
1383 | - // Make sure we have an array |
|
1384 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1385 | - |
|
1386 | - // Validate the checkboxes used on the widget |
|
1387 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1388 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1389 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1390 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1361 | + $defaults = array( |
|
1362 | + 'title' => '', |
|
1363 | + 'post_type' => '', // NULL for all |
|
1364 | + 'hide_empty' => '', |
|
1365 | + 'show_count' => '', |
|
1366 | + 'hide_icon' => '', |
|
1367 | + 'cpt_left' => '', |
|
1368 | + 'sort_by' => 'count', |
|
1369 | + 'max_count' => 'all', |
|
1370 | + 'max_level' => '1', |
|
1371 | + 'no_cpt_filter' => '', |
|
1372 | + 'no_cat_filter' => '', |
|
1373 | + 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1374 | + 'after_widget' => '</section>', |
|
1375 | + 'before_title' => '<h3 class="widget-title">', |
|
1376 | + 'after_title' => '</h3>', |
|
1377 | + ); |
|
1378 | + $params = shortcode_atts($defaults, $atts); |
|
1391 | 1379 | |
1392 | - if ($params['max_count'] != 'all') { |
|
1393 | - $params['max_count'] = absint($params['max_count']); |
|
1394 | - } |
|
1380 | + /** |
|
1381 | + * Validate our incoming params |
|
1382 | + */ |
|
1383 | + // Make sure we have an array |
|
1384 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1385 | + |
|
1386 | + // Validate the checkboxes used on the widget |
|
1387 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1388 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1389 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1390 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1391 | + |
|
1392 | + if ($params['max_count'] != 'all') { |
|
1393 | + $params['max_count'] = absint($params['max_count']); |
|
1394 | + } |
|
1395 | 1395 | |
1396 | - if ($params['max_level'] != 'all') { |
|
1397 | - $params['max_level'] = absint($params['max_level']); |
|
1398 | - } |
|
1396 | + if ($params['max_level'] != 'all') { |
|
1397 | + $params['max_level'] = absint($params['max_level']); |
|
1398 | + } |
|
1399 | 1399 | |
1400 | - $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1401 | - $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1400 | + $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1401 | + $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1402 | 1402 | |
1403 | - $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1403 | + $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1404 | 1404 | |
1405 | - ob_start(); |
|
1406 | - the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1407 | - $output = ob_get_contents(); |
|
1408 | - ob_end_clean(); |
|
1405 | + ob_start(); |
|
1406 | + the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1407 | + $output = ob_get_contents(); |
|
1408 | + ob_end_clean(); |
|
1409 | 1409 | |
1410 | - return $output; |
|
1410 | + return $output; |
|
1411 | 1411 | } |
1412 | 1412 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
1413 | 1413 | |
@@ -1422,6 +1422,6 @@ discard block |
||
1422 | 1422 | * @return string HTML code. |
1423 | 1423 | */ |
1424 | 1424 | function geodir_sc_responsive_videos($atts, $content) { |
1425 | - return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1425 | + return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1426 | 1426 | } |
1427 | 1427 | add_shortcode('gd_video', 'geodir_sc_responsive_videos'); |
1428 | 1428 | \ No newline at end of file |