@@ -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 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | function geodir_sc_listing_map($atts) { |
| 266 | 266 | |
| 267 | 267 | // if some params are set then we need a new query, if not then we can use the main query |
| 268 | - if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
| 268 | + if (isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type'])) { |
|
| 269 | 269 | |
| 270 | 270 | global $add_post_in_marker_array, $gd_sc_map_params; |
| 271 | 271 | $backup_globals = array(); |
@@ -288,34 +288,34 @@ discard block |
||
| 288 | 288 | 'event_type' => 'all' |
| 289 | 289 | ); |
| 290 | 290 | |
| 291 | - $params = shortcode_atts( $defaults, $atts ); |
|
| 291 | + $params = shortcode_atts($defaults, $atts); |
|
| 292 | 292 | |
| 293 | - if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
| 293 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 294 | 294 | $params['post_type'] = 'gd_place'; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // Validate the selected category/ies - Grab the current list based on post_type |
| 298 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
| 299 | - $categories = get_terms( $category_taxonomy, array( |
|
| 298 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 299 | + $categories = get_terms($category_taxonomy, array( |
|
| 300 | 300 | 'orderby' => 'count', |
| 301 | 301 | 'order' => 'DESC', |
| 302 | 302 | 'fields' => 'ids' |
| 303 | - ) ); |
|
| 303 | + )); |
|
| 304 | 304 | |
| 305 | 305 | // Make sure we have an array |
| 306 | - if ( ! ( is_array( $params['category'] ) ) ) { |
|
| 307 | - $params['category'] = explode( ',', $params['category'] ); |
|
| 306 | + if (!(is_array($params['category']))) { |
|
| 307 | + $params['category'] = explode(',', $params['category']); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | // Array_intersect returns only the items in $params['category'] that are also in our category list |
| 311 | 311 | // Otherwise it becomes empty and later on that will mean "All" |
| 312 | - $params['category'] = array_intersect( $params['category'], $categories ); |
|
| 312 | + $params['category'] = array_intersect($params['category'], $categories); |
|
| 313 | 313 | |
| 314 | - if ( $params['post_type'] == 'gd_event' ) { |
|
| 315 | - $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
| 314 | + if ($params['post_type'] == 'gd_event') { |
|
| 315 | + $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - $params = gdsc_validate_map_args( $params ); |
|
| 318 | + $params = gdsc_validate_map_args($params); |
|
| 319 | 319 | |
| 320 | 320 | $gd_sc_map_params = $params; |
| 321 | 321 | |
@@ -326,12 +326,12 @@ discard block |
||
| 326 | 326 | 'post_type' => $params['post_type'], |
| 327 | 327 | ); |
| 328 | 328 | |
| 329 | - if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
| 330 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
| 329 | + if (!empty($params['category']) && isset($params['category'][0]) && (int) $params['category'][0] != 0) { |
|
| 330 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 331 | 331 | |
| 332 | 332 | ######### WPML ######### |
| 333 | - if ( geodir_wpml_is_taxonomy_translated( $category_taxonomy[0] ) ) { |
|
| 334 | - $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
| 333 | + if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) { |
|
| 334 | + $category = gd_lang_object_ids($params['category'], $category_taxonomy[0]); |
|
| 335 | 335 | } |
| 336 | 336 | ######### WPML ######### |
| 337 | 337 | |
@@ -341,36 +341,36 @@ discard block |
||
| 341 | 341 | 'terms' => $params['category'] |
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | - $query_args['tax_query'] = array( $tax_query ); |
|
| 344 | + $query_args['tax_query'] = array($tax_query); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $add_post_in_marker_array = true; |
| 348 | 348 | |
| 349 | - if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
| 349 | + if ($params['post_type'] == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
| 350 | 350 | global $geodir_event_widget_listview; |
| 351 | 351 | $geodir_event_widget_listview = true; |
| 352 | 352 | |
| 353 | 353 | $query_args['geodir_event_type'] = $params['event_type']; |
| 354 | 354 | |
| 355 | - $listings = geodir_event_get_widget_events( $query_args ); |
|
| 355 | + $listings = geodir_event_get_widget_events($query_args); |
|
| 356 | 356 | |
| 357 | 357 | $geodir_event_widget_listview = false; |
| 358 | 358 | } else { |
| 359 | - $listings = geodir_get_widget_listings( $query_args ); |
|
| 359 | + $listings = geodir_get_widget_listings($query_args); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if ( ! empty( $listings ) ) { |
|
| 363 | - foreach ( $listings as $listing ) { |
|
| 364 | - create_marker_jason_of_posts( $listing ); |
|
| 362 | + if (!empty($listings)) { |
|
| 363 | + foreach ($listings as $listing) { |
|
| 364 | + create_marker_jason_of_posts($listing); |
|
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | ob_start(); |
| 369 | - add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
| 369 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
| 370 | 370 | |
| 371 | - add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
| 371 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
| 372 | 372 | |
| 373 | - add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
| 373 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
| 374 | 374 | |
| 375 | 375 | $default_location = geodir_get_default_location(); |
| 376 | 376 | |
@@ -391,17 +391,17 @@ discard block |
||
| 391 | 391 | 'enable_location_filters' => false, |
| 392 | 392 | 'enable_jason_on_load' => true, |
| 393 | 393 | 'ajax_url' => geodir_get_ajax_url(), |
| 394 | - 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
| 395 | - 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
| 394 | + 'latitude' => isset($default_location->city_latitude) ? $default_location->city_latitude : '', |
|
| 395 | + 'longitude' => isset($default_location->city_longitude) ? $default_location->city_longitude : '', |
|
| 396 | 396 | 'streetViewControl' => true, |
| 397 | 397 | 'showPreview' => '0', |
| 398 | 398 | 'maxZoom' => 21, |
| 399 | 399 | 'bubble_size' => 'small', |
| 400 | 400 | ); |
| 401 | 401 | |
| 402 | - if ( is_single() ) { |
|
| 402 | + if (is_single()) { |
|
| 403 | 403 | global $post; |
| 404 | - if ( isset( $post->post_latitude ) ) { |
|
| 404 | + if (isset($post->post_latitude)) { |
|
| 405 | 405 | $map_args['latitude'] = $post->post_latitude; |
| 406 | 406 | $map_args['longitude'] = $post->post_longitude; |
| 407 | 407 | } |
@@ -412,24 +412,24 @@ discard block |
||
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | // Add marker cluster |
| 415 | - if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
| 415 | + if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
| 416 | 416 | $map_args['enable_marker_cluster'] = true; |
| 417 | 417 | } else { |
| 418 | 418 | $map_args['enable_marker_cluster'] = false; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - geodir_draw_map( $map_args ); |
|
| 421 | + geodir_draw_map($map_args); |
|
| 422 | 422 | |
| 423 | 423 | $output = ob_get_contents(); |
| 424 | 424 | |
| 425 | 425 | ob_end_clean(); |
| 426 | 426 | |
| 427 | - foreach ( $backup_globals as $global => $value ) { |
|
| 427 | + foreach ($backup_globals as $global => $value) { |
|
| 428 | 428 | ${$global} = $value; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | return $output; |
| 432 | - }else{ |
|
| 432 | + } else { |
|
| 433 | 433 | ob_start(); |
| 434 | 434 | add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
| 435 | 435 | add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
@@ -1050,20 +1050,20 @@ discard block |
||
| 1050 | 1050 | |
| 1051 | 1051 | $show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : ''; |
| 1052 | 1052 | |
| 1053 | - if ($show_adv_search != '' ) { |
|
| 1054 | - $show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' '; |
|
| 1053 | + if ($show_adv_search != '') { |
|
| 1054 | + $show_adv_class = 'geodir-advance-search-'.$show_adv_search.' '; |
|
| 1055 | 1055 | if ($show_adv_search == 'searched' && geodir_is_page('search')) { |
| 1056 | 1056 | $show_adv_search = 'search'; |
| 1057 | 1057 | } |
| 1058 | - $show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"'; |
|
| 1058 | + $show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"'; |
|
| 1059 | 1059 | |
| 1060 | - $params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']); |
|
| 1060 | + $params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']); |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | ob_start(); |
| 1064 | 1064 | |
| 1065 | 1065 | //geodir_get_template_part('listing', 'filter-form'); |
| 1066 | - the_widget('geodir_advance_search_widget', $params, $params ); |
|
| 1066 | + the_widget('geodir_advance_search_widget', $params, $params); |
|
| 1067 | 1067 | |
| 1068 | 1068 | $output = ob_get_contents(); |
| 1069 | 1069 | ob_end_clean(); |
@@ -1258,13 +1258,13 @@ discard block |
||
| 1258 | 1258 | // Post_number needs to be a positive integer |
| 1259 | 1259 | if (!empty($params['post_author'])) { |
| 1260 | 1260 | // 'current' left for backwards compatibility |
| 1261 | - if ( $params['post_author'] == 'current' || $params['post_author'] == 'current_author') { |
|
| 1261 | + if ($params['post_author'] == 'current' || $params['post_author'] == 'current_author') { |
|
| 1262 | 1262 | if (!empty($post) && $post->post_type != 'page' && isset($post->post_author)) { |
| 1263 | 1263 | $params['post_author'] = $post->post_author; |
| 1264 | 1264 | } else { |
| 1265 | 1265 | $params['post_author'] = -1; // Don't show any listings. |
| 1266 | 1266 | } |
| 1267 | - } else if ($params['post_author'] == 'current_user' ) { |
|
| 1267 | + } else if ($params['post_author'] == 'current_user') { |
|
| 1268 | 1268 | if ($current_user_id = get_current_user_id()) { |
| 1269 | 1269 | $params['post_author'] = $current_user_id; |
| 1270 | 1270 | } else { |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | |
| 1282 | 1282 | // Validate character_count |
| 1283 | 1283 | //todo: is this necessary? |
| 1284 | - $params['character_count'] = $params['character_count']; |
|
| 1284 | + $params['character_count'] = $params['character_count']; |
|
| 1285 | 1285 | |
| 1286 | 1286 | // Validate our layout choice |
| 1287 | 1287 | // Outside of the norm, I added some more simple terms to match the existing |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | |
| 1294 | 1294 | // Validate Listing width, used in the template widget-listing-listview.php |
| 1295 | 1295 | // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
| 1296 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1296 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1297 | 1297 | |
| 1298 | 1298 | // Validate the checkboxes used on the widget |
| 1299 | 1299 | $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | // User favorites |
| 1309 | 1309 | $params['show_favorites_only'] = gdsc_to_bool_val($params['show_favorites_only']); |
| 1310 | 1310 | if (!empty($params['show_favorites_only'])) { |
| 1311 | - if ( $params['favorites_by_user'] == 'current' || $params['favorites_by_user'] == 'current_author') { |
|
| 1311 | + if ($params['favorites_by_user'] == 'current' || $params['favorites_by_user'] == 'current_author') { |
|
| 1312 | 1312 | if (!empty($post) && $post->post_type != 'page' && isset($post->post_author)) { |
| 1313 | 1313 | $params['favorites_by_user'] = $post->post_author; |
| 1314 | 1314 | } else { |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | if (!empty($params['tags'])) { |
| 1332 | 1332 | if (!is_array($params['tags'])) { |
| 1333 | 1333 | $comma = _x(',', 'tag delimiter'); |
| 1334 | - if ( ',' !== $comma ) { |
|
| 1334 | + if (',' !== $comma) { |
|
| 1335 | 1335 | $params['tags'] = str_replace($comma, ',', $params['tags']); |
| 1336 | 1336 | } |
| 1337 | 1337 | $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
@@ -1353,13 +1353,13 @@ discard block |
||
| 1353 | 1353 | unset($atts['pageno']); |
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | - if ( !empty($atts['shortcode_content']) ) { |
|
| 1356 | + if (!empty($atts['shortcode_content'])) { |
|
| 1357 | 1357 | $content = $atts['shortcode_content']; |
| 1358 | 1358 | } |
| 1359 | 1359 | $params['shortcode_content'] = trim($content); |
| 1360 | 1360 | $atts['shortcode_content'] = trim($content); |
| 1361 | 1361 | |
| 1362 | - $params['shortcode_atts'] = $atts; |
|
| 1362 | + $params['shortcode_atts'] = $atts; |
|
| 1363 | 1363 | |
| 1364 | 1364 | $output = geodir_sc_gd_listings_output($params); |
| 1365 | 1365 | |
@@ -1431,8 +1431,8 @@ discard block |
||
| 1431 | 1431 | // Validate the checkboxes used on the widget |
| 1432 | 1432 | $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
| 1433 | 1433 | $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
| 1434 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
| 1435 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
| 1434 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
| 1435 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
| 1436 | 1436 | |
| 1437 | 1437 | if ($params['max_count'] != 'all') { |
| 1438 | 1438 | $params['max_count'] = absint($params['max_count']); |