| @@ -40,8 +40,9 @@ | ||
| 40 | 40 | $geodir_active_nav_locations = get_nav_menu_locations(); | 
| 41 | 41 |      if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
 | 
| 42 | 42 |          foreach ($geodir_active_nav_locations as $key => $theme_location) {
 | 
| 43 | - if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) | |
| 44 | - $post_type_arr[$key] = $geodir_all_nav_locations[$key]; | |
| 43 | +            if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) { | |
| 44 | + $post_type_arr[$key] = $geodir_all_nav_locations[$key]; | |
| 45 | + } | |
| 45 | 46 | } | 
| 46 | 47 | } | 
| 47 | 48 | |
| @@ -204,8 +204,9 @@ discard block | ||
| 204 | 204 | ############################################################# | 
| 205 | 205 | function manage_category_custom_fields($deprecated, $column_name, $term_id) | 
| 206 | 206 |  { | 
| 207 | - if ($column_name == 'cat_ID_num') | |
| 208 | - echo $term_id; | |
| 207 | +    if ($column_name == 'cat_ID_num') { | |
| 208 | + echo $term_id; | |
| 209 | + } | |
| 209 | 210 | |
| 210 | 211 |      if ($column_name == 'cat_icon') { | 
| 211 | 212 | $term_icon_url = get_tax_meta($term_id, 'ct_cat_icon'); | 
| @@ -214,9 +215,9 @@ discard block | ||
| 214 | 215 | |
| 215 | 216 | $file_info = pathinfo($term_icon_url['src']); | 
| 216 | 217 | |
| 217 | - if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') | |
| 218 | - $sub_dir = $file_info['dirname']; | |
| 219 | -            else{$sub_dir = '';} | |
| 218 | +            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') { | |
| 219 | + $sub_dir = $file_info['dirname']; | |
| 220 | +            } else{$sub_dir = '';} | |
| 220 | 221 | |
| 221 | 222 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs | 
| 222 | 223 | $uploads_baseurl = $uploads['baseurl']; | 
| @@ -236,8 +237,9 @@ discard block | ||
| 236 | 237 | |
| 237 | 238 |      if ($column_name == 'cat_default_img') { | 
| 238 | 239 | $cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img'); | 
| 239 | - if ($cat_default_img != '') | |
| 240 | - echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>'; | |
| 240 | +        if ($cat_default_img != '') { | |
| 241 | + echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>'; | |
| 242 | + } | |
| 241 | 243 | |
| 242 | 244 | } | 
| 243 | 245 | } | 
| @@ -245,11 +247,12 @@ discard block | ||
| 245 | 247 | function geodir_get_default_catimage($term_id, $post_type = 'gd_place') | 
| 246 | 248 |  { | 
| 247 | 249 | |
| 248 | - if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) | |
| 249 | - return $cat_default_img; | |
| 250 | - else | |
| 251 | - return false; | |
| 252 | -} | |
| 250 | +    if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) { | |
| 251 | + return $cat_default_img; | |
| 252 | +    } else { | |
| 253 | + return false; | |
| 254 | + } | |
| 255 | + } | |
| 253 | 256 | |
| 254 | 257 | //Clear custom fields | 
| 255 | 258 |  add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field'); | 
| @@ -248,8 +248,9 @@ discard block | ||
| 248 | 248 | |
| 249 | 249 | $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : ''; | 
| 250 | 250 | |
| 251 | - if (!empty($comment_info)) | |
| 252 | - $status = $comment_info->comment_approved; | |
| 251 | +    if (!empty($comment_info)) { | |
| 252 | + $status = $comment_info->comment_approved; | |
| 253 | + } | |
| 253 | 254 | |
| 254 | 255 |      if ($status == 'approve' || $status == 1) {
 | 
| 255 | 256 | $status = 1; | 
| @@ -381,12 +382,14 @@ discard block | ||
| 381 | 382 | function geodir_wrap_comment_text($content, $comment = '') | 
| 382 | 383 |  {
 | 
| 383 | 384 | $rating = 0; | 
| 384 | - if (!empty($comment)) | |
| 385 | - $rating = geodir_get_commentoverall($comment->comment_ID); | |
| 385 | +    if (!empty($comment)) { | |
| 386 | + $rating = geodir_get_commentoverall($comment->comment_ID); | |
| 387 | + } | |
| 386 | 388 |      if ($rating != 0 && !is_admin()) {
 | 
| 387 | 389 |          return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
 | 
| 388 | - } else | |
| 389 | - return $content; | |
| 390 | +    } else { | |
| 391 | + return $content; | |
| 392 | + } | |
| 390 | 393 | |
| 391 | 394 | } | 
| 392 | 395 | |
| @@ -475,11 +478,12 @@ discard block | ||
| 475 | 478 | $post_ratings = get_post_meta($post_id, 'overall_rating'); | 
| 476 | 479 | } | 
| 477 | 480 | |
| 478 | - if ($post_ratings) | |
| 479 | - return $post_ratings; | |
| 480 | - else | |
| 481 | - return false; | |
| 482 | -} | |
| 481 | +    if ($post_ratings) { | |
| 482 | + return $post_ratings; | |
| 483 | +    } else { | |
| 484 | + return false; | |
| 485 | + } | |
| 486 | + } | |
| 483 | 487 | |
| 484 | 488 | |
| 485 | 489 | /** | 
| @@ -504,11 +508,12 @@ discard block | ||
| 504 | 508 | ) | 
| 505 | 509 | ); | 
| 506 | 510 | |
| 507 | - if (!empty($reatings)) | |
| 508 | - return $reatings; | |
| 509 | - else | |
| 510 | - return false; | |
| 511 | -} | |
| 511 | +    if (!empty($reatings)) { | |
| 512 | + return $reatings; | |
| 513 | +    } else { | |
| 514 | + return false; | |
| 515 | + } | |
| 516 | + } | |
| 512 | 517 | |
| 513 | 518 | /** | 
| 514 | 519 | * Get review total of a Post. | 
| @@ -532,11 +537,12 @@ discard block | ||
| 532 | 537 | ) | 
| 533 | 538 | ); | 
| 534 | 539 | |
| 535 | - if (!empty($results)) | |
| 536 | - return $results; | |
| 537 | - else | |
| 538 | - return false; | |
| 539 | -} | |
| 540 | +    if (!empty($results)) { | |
| 541 | + return $results; | |
| 542 | +    } else { | |
| 543 | + return false; | |
| 544 | + } | |
| 545 | + } | |
| 540 | 546 | |
| 541 | 547 | /** | 
| 542 | 548 | * Get review count by user ID. | 
| @@ -559,11 +565,12 @@ discard block | ||
| 559 | 565 | ) | 
| 560 | 566 | ); | 
| 561 | 567 | |
| 562 | - if (!empty($results)) | |
| 563 | - return $results; | |
| 564 | - else | |
| 565 | - return false; | |
| 566 | -} | |
| 568 | +    if (!empty($results)) { | |
| 569 | + return $results; | |
| 570 | +    } else { | |
| 571 | + return false; | |
| 572 | + } | |
| 573 | + } | |
| 567 | 574 | |
| 568 | 575 | /** | 
| 569 | 576 | * Get average overall rating of a Post. | 
| @@ -597,11 +604,12 @@ discard block | ||
| 597 | 604 | ) | 
| 598 | 605 | ); | 
| 599 | 606 | |
| 600 | - if (!empty($results)) | |
| 601 | - return $results; | |
| 602 | - else | |
| 603 | - return false; | |
| 604 | -} | |
| 607 | +    if (!empty($results)) { | |
| 608 | + return $results; | |
| 609 | +    } else { | |
| 610 | + return false; | |
| 611 | + } | |
| 612 | + } | |
| 605 | 613 | |
| 606 | 614 | /** | 
| 607 | 615 | * Get review count of a Post. | 
| @@ -625,11 +633,12 @@ discard block | ||
| 625 | 633 | ) | 
| 626 | 634 | ); | 
| 627 | 635 | |
| 628 | - if (!empty($results)) | |
| 629 | - return $results; | |
| 630 | - else | |
| 631 | - return false; | |
| 632 | -} | |
| 636 | +    if (!empty($results)) { | |
| 637 | + return $results; | |
| 638 | +    } else { | |
| 639 | + return false; | |
| 640 | + } | |
| 641 | + } | |
| 633 | 642 | |
| 634 | 643 | /** | 
| 635 | 644 | * Get comments count of a Post. | 
| @@ -655,11 +664,12 @@ discard block | ||
| 655 | 664 | ); | 
| 656 | 665 | |
| 657 | 666 | |
| 658 | - if (!empty($results)) | |
| 659 | - return $results; | |
| 660 | - else | |
| 661 | - return false; | |
| 662 | -} | |
| 667 | +    if (!empty($results)) { | |
| 668 | + return $results; | |
| 669 | +    } else { | |
| 670 | + return false; | |
| 671 | + } | |
| 672 | + } | |
| 663 | 673 | |
| 664 | 674 | /** | 
| 665 | 675 | * Get overall rating of a comment. | 
| @@ -683,11 +693,12 @@ discard block | ||
| 683 | 693 | ) | 
| 684 | 694 | ); | 
| 685 | 695 | |
| 686 | - if ($reatings) | |
| 687 | - return $reatings; | |
| 688 | - else | |
| 689 | - return false; | |
| 690 | -} | |
| 696 | +    if ($reatings) { | |
| 697 | + return $reatings; | |
| 698 | +    } else { | |
| 699 | + return false; | |
| 700 | + } | |
| 701 | + } | |
| 691 | 702 | |
| 692 | 703 | /** | 
| 693 | 704 | * Returns average overall rating of a Post. Depreciated since ver 1.3.6. | 
| @@ -930,8 +941,9 @@ discard block | ||
| 930 | 941 |      $active_tabs = get_option('geodir_detail_page_tabs_excluded');
 | 
| 931 | 942 | |
| 932 | 943 | $is_display = true; | 
| 933 | -    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
 | |
| 934 | - $is_display = false; | |
| 944 | +    if (!empty($active_tabs) && in_array('reviews', $active_tabs)) { | |
| 945 | + $is_display = false; | |
| 946 | + } | |
| 935 | 947 | |
| 936 | 948 | /** | 
| 937 | 949 | * Filter to change display value. | 
| @@ -106,24 +106,30 @@ discard block | ||
| 106 | 106 | $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix'])); | 
| 107 | 107 | |
| 108 | 108 |          if ($post_type == 'gd_place') {
 | 
| 109 | -            if (array_key_exists('has_archive', $args))
 | |
| 110 | - $args['has_archive'] = $listing_slug; | |
| 109 | +            if (array_key_exists('has_archive', $args)) { | |
| 110 | + $args['has_archive'] = $listing_slug; | |
| 111 | + } | |
| 111 | 112 | |
| 112 | 113 |              if (array_key_exists('rewrite', $args)) {
 | 
| 113 | -                if (array_key_exists('slug', $args['rewrite']))
 | |
| 114 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; | |
| 114 | +                if (array_key_exists('slug', $args['rewrite'])) { | |
| 115 | + $args['rewrite']['slug'] = $listing_slug; | |
| 116 | + } | |
| 117 | + // . '/%gd_taxonomy%'; | |
| 115 | 118 | } | 
| 116 | 119 | |
| 117 | 120 |              $geodir_post_types = get_option('geodir_post_types');
 | 
| 118 | 121 | |
| 119 | 122 |              if (array_key_exists($post_type, $geodir_post_types)) {
 | 
| 120 | 123 | |
| 121 | -                if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
 | |
| 122 | - $geodir_post_types[$post_type]['has_archive'] = $listing_slug; | |
| 124 | +                if (array_key_exists('has_archive', $geodir_post_types[$post_type])) { | |
| 125 | + $geodir_post_types[$post_type]['has_archive'] = $listing_slug; | |
| 126 | + } | |
| 123 | 127 | |
| 124 | -                if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
 | |
| 125 | -                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
 | |
| 126 | - $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; | |
| 128 | +                if (array_key_exists('rewrite', $geodir_post_types[$post_type])) { | |
| 129 | +                                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
 | |
| 130 | + $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug; | |
| 131 | + } | |
| 132 | + // . '/%gd_taxonomy%'; | |
| 127 | 133 | |
| 128 | 134 |                  update_option('geodir_post_types', $geodir_post_types);
 | 
| 129 | 135 | |
| @@ -138,10 +144,11 @@ discard block | ||
| 138 | 144 |              if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
 | 
| 139 | 145 | $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; | 
| 140 | 146 | |
| 141 | -                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
 | |
| 142 | -                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
 | |
| 147 | +                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category'])) { | |
| 148 | +                                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
 | |
| 143 | 149 |                          if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
 | 
| 144 | - $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; | |
| 150 | + $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; | |
| 151 | + } | |
| 145 | 152 | |
| 146 | 153 |                  update_option('geodir_taxonomies', $geodir_taxonomies);
 | 
| 147 | 154 | |
| @@ -152,10 +159,11 @@ discard block | ||
| 152 | 159 |              if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
 | 
| 153 | 160 | $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; | 
| 154 | 161 | |
| 155 | -                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
 | |
| 156 | -                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
 | |
| 162 | +                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags'])) { | |
| 163 | +                                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
 | |
| 157 | 164 |                          if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
 | 
| 158 | - $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; | |
| 165 | + $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; | |
| 166 | + } | |
| 159 | 167 | |
| 160 | 168 |                  update_option('geodir_taxonomies', $geodir_taxonomies_tag);
 | 
| 161 | 169 | |
| @@ -221,8 +229,9 @@ discard block | ||
| 221 | 229 | global $wpdb; | 
| 222 | 230 |          $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
 | 
| 223 | 231 | } | 
| 224 | - if (!isset($location_prefix)) | |
| 225 | - $location_prefix = 'location'; | |
| 232 | +    if (!isset($location_prefix)) { | |
| 233 | + $location_prefix = 'location'; | |
| 234 | + } | |
| 226 | 235 | |
| 227 | 236 |  	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
 | 
| 228 | 237 |  	if ($location_manager) {
 | 
| @@ -441,14 +450,17 @@ discard block | ||
| 441 | 450 | $gd_country = ''; | 
| 442 | 451 | $gd_region = ''; | 
| 443 | 452 | $gd_city = ''; | 
| 444 | - if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') | |
| 445 | - $gd_country = urldecode($wp->query_vars['gd_country']); | |
| 453 | +        if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') { | |
| 454 | + $gd_country = urldecode($wp->query_vars['gd_country']); | |
| 455 | + } | |
| 446 | 456 | |
| 447 | - if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') | |
| 448 | - $gd_region = urldecode($wp->query_vars['gd_region']); | |
| 457 | +        if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') { | |
| 458 | + $gd_region = urldecode($wp->query_vars['gd_region']); | |
| 459 | + } | |
| 449 | 460 | |
| 450 | - if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') | |
| 451 | - $gd_city = urldecode($wp->query_vars['gd_city']); | |
| 461 | +        if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') { | |
| 462 | + $gd_city = urldecode($wp->query_vars['gd_city']); | |
| 463 | + } | |
| 452 | 464 | |
| 453 | 465 |          if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
 | 
| 454 | 466 | $default_location = geodir_get_default_location(); | 
| @@ -456,17 +468,19 @@ discard block | ||
| 456 | 468 |              if (get_option('geodir_add_location_url')) {
 | 
| 457 | 469 |                  if ($geodir_show_location_url != 'all') {
 | 
| 458 | 470 |                      if ($gd_region == '') {
 | 
| 459 | -                        if ($gd_ses_region = $gd_session->get('gd_region'))
 | |
| 460 | - $gd_region = $gd_ses_region; | |
| 461 | - else | |
| 462 | - $gd_region = $default_location->region_slug; | |
| 471 | +                        if ($gd_ses_region = $gd_session->get('gd_region')) { | |
| 472 | + $gd_region = $gd_ses_region; | |
| 473 | +                        } else { | |
| 474 | + $gd_region = $default_location->region_slug; | |
| 475 | + } | |
| 463 | 476 | } | 
| 464 | 477 | |
| 465 | 478 |                      if ($gd_city == '') {
 | 
| 466 | -                        if ($gd_ses_city = $gd_session->get('gd_city'))
 | |
| 467 | - $gd_city = $gd_ses_city; | |
| 468 | - else | |
| 469 | - $gd_city = $default_location->city_slug; | |
| 479 | +                        if ($gd_ses_city = $gd_session->get('gd_city')) { | |
| 480 | + $gd_city = $gd_ses_city; | |
| 481 | +                        } else { | |
| 482 | + $gd_city = $default_location->city_slug; | |
| 483 | + } | |
| 470 | 484 | |
| 471 | 485 |                          $base_location_link = geodir_get_location_link('base');
 | 
| 472 | 486 | wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); | 
| @@ -585,8 +599,9 @@ discard block | ||
| 585 | 599 | |
| 586 | 600 | |
| 587 | 601 |  				$geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
 | 
| 588 | - if (!$post_title_replace_count) | |
| 589 | - $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count); | |
| 602 | +				if (!$post_title_replace_count) { | |
| 603 | + $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count); | |
| 604 | + } | |
| 590 | 605 |  				$geodir_terms = explode('/', $geodir_term);
 | 
| 591 | 606 | $geodir_last_term = end($geodir_terms); | 
| 592 | 607 | |
| @@ -622,8 +637,9 @@ discard block | ||
| 622 | 637 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && | 
| 623 | 638 | geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && | 
| 624 | 639 | geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city) | 
| 625 | - ) | |
| 626 | - $is_geodir_location_found = true; | |
| 640 | +                    ) { | |
| 641 | + $is_geodir_location_found = true; | |
| 642 | + } | |
| 627 | 643 | |
| 628 | 644 | // if location has not been found for country , region and city then search for country and region only | 
| 629 | 645 | |
| @@ -631,8 +647,9 @@ discard block | ||
| 631 | 647 | $gd_city = ''; | 
| 632 | 648 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && | 
| 633 | 649 | geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) | 
| 634 | - ) | |
| 635 | - $is_geodir_location_found = true; | |
| 650 | +                        ) { | |
| 651 | + $is_geodir_location_found = true; | |
| 652 | + } | |
| 636 | 653 | |
| 637 | 654 | } | 
| 638 | 655 | |
| @@ -640,8 +657,9 @@ discard block | ||
| 640 | 657 |                      if (!$is_geodir_location_found) {
 | 
| 641 | 658 | $gd_city = ''; | 
| 642 | 659 | $gd_region = ''; | 
| 643 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) | |
| 644 | - $is_geodir_location_found = true; | |
| 660 | +                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) { | |
| 661 | + $is_geodir_location_found = true; | |
| 662 | + } | |
| 645 | 663 | } | 
| 646 | 664 |                  } else if ($geodir_show_location_url == 'country_city') {
 | 
| 647 | 665 |                      if (count($geodir_terms) >= 2) {
 | 
| @@ -651,17 +669,19 @@ discard block | ||
| 651 | 669 | $gd_country = urldecode($geodir_terms[0]); | 
| 652 | 670 | } | 
| 653 | 671 | |
| 654 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) | |
| 655 | - $is_geodir_location_found = true; | |
| 672 | +                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) { | |
| 673 | + $is_geodir_location_found = true; | |
| 674 | + } | |
| 656 | 675 | |
| 657 | 676 | // if location has not been found for country and city then search for country only | 
| 658 | 677 |                      if (!$is_geodir_location_found) {
 | 
| 659 | 678 | $gd_city = ''; | 
| 660 | 679 | |
| 661 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) | |
| 662 | - $is_geodir_location_found = true; | |
| 680 | +						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) { | |
| 681 | + $is_geodir_location_found = true; | |
| 682 | + } | |
| 663 | 683 | } | 
| 664 | -                }  else if ($geodir_show_location_url == 'region_city') {
 | |
| 684 | +                } else if ($geodir_show_location_url == 'region_city') {
 | |
| 665 | 685 |                      if (count($geodir_terms) >= 2) {
 | 
| 666 | 686 | $gd_region = urldecode($geodir_terms[0]); | 
| 667 | 687 | $gd_city = urldecode($geodir_terms[1]); | 
| @@ -669,15 +689,17 @@ discard block | ||
| 669 | 689 | $gd_region = urldecode($geodir_terms[0]); | 
| 670 | 690 | } | 
| 671 | 691 | |
| 672 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) | |
| 673 | - $is_geodir_location_found = true; | |
| 692 | +                    if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) { | |
| 693 | + $is_geodir_location_found = true; | |
| 694 | + } | |
| 674 | 695 | |
| 675 | 696 | // if location has not been found for region and city then search for region only | 
| 676 | 697 |                      if (!$is_geodir_location_found) {
 | 
| 677 | 698 | $gd_city = ''; | 
| 678 | 699 | |
| 679 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) | |
| 680 | - $is_geodir_location_found = true; | |
| 700 | +						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) { | |
| 701 | + $is_geodir_location_found = true; | |
| 702 | + } | |
| 681 | 703 | } | 
| 682 | 704 |                  } else {
 | 
| 683 | 705 | $gd_city = $geodir_terms[0]; | 
| @@ -719,14 +741,17 @@ discard block | ||
| 719 | 741 | |
| 720 | 742 | $wp->query_vars[$geodir_taxonomy] = $geodir_term; | 
| 721 | 743 | // eliminate location related terms from taxonomy term | 
| 722 | - if ($gd_country != '') | |
| 723 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 744 | +            if ($gd_country != '') { | |
| 745 | +                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); | |
| 746 | + } | |
| 724 | 747 | |
| 725 | - if ($gd_region != '') | |
| 726 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 748 | +            if ($gd_region != '') { | |
| 749 | +                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); | |
| 750 | + } | |
| 727 | 751 | |
| 728 | - if ($gd_city != '') | |
| 729 | -                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
 | |
| 752 | +            if ($gd_city != '') { | |
| 753 | +                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); | |
| 754 | + } | |
| 730 | 755 | |
| 731 | 756 | |
| 732 | 757 |              $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
 | 
| @@ -762,27 +787,34 @@ discard block | ||
| 762 | 787 |      if (get_option('geodir_add_location_url')) {        
 | 
| 763 | 788 |  		if ($geodir_show_location_url == 'all') {
 | 
| 764 | 789 |  		} else if ($geodir_show_location_url == 'country_city') {
 | 
| 765 | - if (isset($wp->query_vars['gd_region'])) | |
| 766 | - $wp->query_vars['gd_region'] = ''; | |
| 790 | +			 if (isset($wp->query_vars['gd_region'])) { | |
| 791 | + $wp->query_vars['gd_region'] = ''; | |
| 792 | + } | |
| 767 | 793 |  		} else if ($geodir_show_location_url == 'region_city') {
 | 
| 768 | - if (isset($wp->query_vars['gd_country'])) | |
| 769 | - $wp->query_vars['gd_country'] = ''; | |
| 794 | +			if (isset($wp->query_vars['gd_country'])) { | |
| 795 | + $wp->query_vars['gd_country'] = ''; | |
| 796 | + } | |
| 770 | 797 |  		} else {
 | 
| 771 | - if (isset($wp->query_vars['gd_country'])) | |
| 772 | - $wp->query_vars['gd_country'] = ''; | |
| 798 | +			if (isset($wp->query_vars['gd_country'])) { | |
| 799 | + $wp->query_vars['gd_country'] = ''; | |
| 800 | + } | |
| 773 | 801 | |
| 774 | - if (isset($wp->query_vars['gd_region'])) | |
| 775 | - $wp->query_vars['gd_region'] = ''; | |
| 802 | +            if (isset($wp->query_vars['gd_region'])) { | |
| 803 | + $wp->query_vars['gd_region'] = ''; | |
| 804 | + } | |
| 776 | 805 | } | 
| 777 | 806 |      } else {
 | 
| 778 | - if (isset($wp->query_vars['gd_country'])) | |
| 779 | - $wp->query_vars['gd_country'] = ''; | |
| 807 | +        if (isset($wp->query_vars['gd_country'])) { | |
| 808 | + $wp->query_vars['gd_country'] = ''; | |
| 809 | + } | |
| 780 | 810 | |
| 781 | - if (isset($wp->query_vars['gd_region'])) | |
| 782 | - $wp->query_vars['gd_region'] = ''; | |
| 811 | +        if (isset($wp->query_vars['gd_region'])) { | |
| 812 | + $wp->query_vars['gd_region'] = ''; | |
| 813 | + } | |
| 783 | 814 | |
| 784 | - if (isset($wp->query_vars['gd_city'])) | |
| 785 | - $wp->query_vars['gd_city'] = ''; | |
| 815 | +        if (isset($wp->query_vars['gd_city'])) { | |
| 816 | + $wp->query_vars['gd_city'] = ''; | |
| 817 | + } | |
| 786 | 818 | } | 
| 787 | 819 | } | 
| 788 | 820 | |
| @@ -894,8 +926,9 @@ discard block | ||
| 894 | 926 | function geodir_exclude_page_where($where) | 
| 895 | 927 |  {
 | 
| 896 | 928 | global $wpdb; | 
| 897 | - if (is_admin()) | |
| 898 | - $where .= " AND $wpdb->posts.post_status != 'virtual'"; | |
| 929 | +    if (is_admin()) { | |
| 930 | + $where .= " AND $wpdb->posts.post_status != 'virtual'"; | |
| 931 | + } | |
| 899 | 932 | |
| 900 | 933 | return $where; | 
| 901 | 934 | } | 
| @@ -76,22 +76,19 @@ discard block | ||
| 76 | 76 |          if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
 | 
| 77 | 77 |          if(!$ga_end){$ga_end = date('Y-m-d');}
 | 
| 78 | 78 | $dimensions = "&dimensions=ga:date,ga:nthDay"; | 
| 79 | -    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
 | |
| 79 | +    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
 | |
| 80 | 80 |          if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
 | 
| 81 | 81 |          if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
 | 
| 82 | 82 | $dimensions = "&dimensions=ga:date,ga:nthDay"; | 
| 83 | - } | |
| 84 | -    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
 | |
| 83 | +    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
 | |
| 85 | 84 |          if(!$ga_start){$ga_start = date('Y')."-01-01";}
 | 
| 86 | 85 |          if(!$ga_end){$ga_end = date('Y-m-d');}
 | 
| 87 | 86 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; | 
| 88 | - } | |
| 89 | -    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
 | |
| 87 | +    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
 | |
| 90 | 88 |          if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
 | 
| 91 | 89 |          if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
 | 
| 92 | 90 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; | 
| 93 | - } | |
| 94 | -    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
 | |
| 91 | +    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
 | |
| 95 | 92 |          if(!$ga_start){$ga_start = "14daysAgo";}
 | 
| 96 | 93 |          if(!$ga_end){$ga_end = "yesterday";}
 | 
| 97 | 94 | $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; | 
| @@ -144,7 +141,7 @@ discard block | ||
| 144 | 141 |      if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
 | 
| 145 | 142 | |
| 146 | 143 | return $at; | 
| 147 | -    }else{//else get new access token
 | |
| 144 | +    } else{//else get new access token
 | |
| 148 | 145 | |
| 149 | 146 |          $refresh_at = get_option('gd_ga_refresh_token');
 | 
| 150 | 147 |          if(!$refresh_at){
 | 
| @@ -167,7 +164,7 @@ discard block | ||
| 167 | 164 |              update_option('gd_ga_access_token', $parts->access_token);
 | 
| 168 | 165 | return $parts->access_token; | 
| 169 | 166 | |
| 170 | -        }else{
 | |
| 167 | +        } else{
 | |
| 171 | 168 |              echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
 | 
| 172 | 169 | } | 
| 173 | 170 | |
| @@ -153,7 +153,7 @@ discard block | ||
| 153 | 153 | $slug = $post->post_name; | 
| 154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors | 
| 155 | 155 | $login_url = trailingslashit($home_url)."$slug/"; | 
| 156 | -    }else{ | |
| 156 | +    } else{ | |
| 157 | 157 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; | 
| 158 | 158 | } | 
| 159 | 159 | |
| @@ -202,7 +202,7 @@ discard block | ||
| 202 | 202 | $slug = $post->post_name; | 
| 203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors | 
| 204 | 204 | $info_url = trailingslashit($home_url)."$slug/"; | 
| 205 | -    }else{ | |
| 205 | +    } else{ | |
| 206 | 206 | $info_url = trailingslashit($home_url); | 
| 207 | 207 | } | 
| 208 | 208 | |
| @@ -107,11 +107,13 @@ discard block | ||
| 107 | 107 | } | 
| 108 | 108 | } | 
| 109 | 109 | |
| 110 | - if (!empty($field_default_cat)) | |
| 111 | - $field_default_cat = ''; | |
| 110 | +    if (!empty($field_default_cat)) { | |
| 111 | + $field_default_cat = ''; | |
| 112 | + } | |
| 112 | 113 | |
| 113 | - if (!empty($cat_find_array)) | |
| 114 | -        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
 | |
| 114 | +    if (!empty($cat_find_array)) { | |
| 115 | +            $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; | |
| 116 | + } | |
| 115 | 117 | |
| 116 | 118 | $main_query_array = $map_cat_ids_array; | 
| 117 | 119 | |
| @@ -143,8 +145,9 @@ discard block | ||
| 143 | 145 | $gd_posttype = " AND p.post_type = %s"; | 
| 144 | 146 | $main_query_array[] = $_REQUEST['gd_posttype']; | 
| 145 | 147 | |
| 146 | - } else | |
| 147 | - $table = $plugin_prefix . 'gd_place_detail'; | |
| 148 | +    } else { | |
| 149 | + $table = $plugin_prefix . 'gd_place_detail'; | |
| 150 | + } | |
| 148 | 151 | |
| 149 | 152 | $join = ", " . $table . " AS pd "; | 
| 150 | 153 | |
| @@ -309,8 +312,7 @@ discard block | ||
| 309 | 312 | |
| 310 | 313 |      if (!empty($cat_content_info)) {
 | 
| 311 | 314 |  		return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
 | 
| 312 | - } | |
| 313 | -    else {
 | |
| 315 | +    } else {
 | |
| 314 | 316 |  		return '[{"totalcount":"0"}]';
 | 
| 315 | 317 | } | 
| 316 | 318 | } | 
| 317 | 319 | \ No newline at end of file | 
| @@ -45,9 +45,10 @@ discard block | ||
| 45 | 45 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; | 
| 46 | 46 |  if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
 | 
| 47 | 47 | $mapzoom = 4; | 
| 48 | - if (isset($_REQUEST['add_hood'])) | |
| 49 | - $mapzoom = 10; | |
| 50 | -} | |
| 48 | +    if (isset($_REQUEST['add_hood'])) { | |
| 49 | + $mapzoom = 10; | |
| 50 | + } | |
| 51 | + } | |
| 51 | 52 | |
| 52 | 53 | /** | 
| 53 | 54 | * Filter the auto change address fields values | 
| @@ -641,8 +642,9 @@ discard block | ||
| 641 | 642 | </script> | 
| 642 | 643 | <?php | 
| 643 | 644 | $set_button_class = 'geodir_button'; | 
| 644 | -if (is_admin()) | |
| 645 | - $set_button_class = 'button-primary'; | |
| 645 | +if (is_admin()) { | |
| 646 | + $set_button_class = 'button-primary'; | |
| 647 | +} | |
| 646 | 648 | ?> | 
| 647 | 649 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" | 
| 648 | 650 | value="<?php _e($map_title, 'geodirectory'); ?>" style="float:none;"/> | 
| @@ -223,10 +223,11 @@ discard block | ||
| 223 | 223 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> | 
| 224 | 224 | <?php } | 
| 225 | 225 | |
| 226 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) | |
| 227 | - $show_entire_cat_panel = "none"; | |
| 228 | - else | |
| 229 | - $show_entire_cat_panel = "''"; | |
| 226 | +                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) { | |
| 227 | + $show_entire_cat_panel = "none"; | |
| 228 | +                } else { | |
| 229 | + $show_entire_cat_panel = "''"; | |
| 230 | + } | |
| 230 | 231 | ?> | 
| 231 | 232 | |
| 232 | 233 |                  <?php if ($geodir_map_options['enable_map_direction']) { ?>
 | 
| @@ -288,8 +289,9 @@ discard block | ||
| 288 | 289 | } | 
| 289 | 290 | |
| 290 | 291 |  				$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
 | 
| 291 | - if (empty($geodir_default_map_search_pt)) | |
| 292 | - $geodir_default_map_search_pt = 'gd_place'; | |
| 292 | +				if (empty($geodir_default_map_search_pt)) { | |
| 293 | + $geodir_default_map_search_pt = 'gd_place'; | |
| 294 | + } | |
| 293 | 295 | |
| 294 | 296 | /** | 
| 295 | 297 | * Filter the post type to retrive data for map |