Passed
Pull Request — master (#205)
by Kiran
06:14
created
geodirectory-functions/taxonomy_functions.php 3 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -445,16 +445,16 @@  discard block
 block discarded – undo
445 445
             case 'Array':
446 446
                 $post_types = (array)$post_types;
447 447
                 break;
448
-			case 'options':
448
+            case 'options':
449 449
                 $post_types = (array)$post_types;
450 450
 				
451
-				$options = array();
452
-				if (!empty($post_types)) {
453
-					foreach ($post_types as $key => $info) {
454
-						$options[$key] = __($info['labels']['singular_name'], 'geodirectory');
455
-					}
456
-				}
457
-				$post_types = $options;
451
+                $options = array();
452
+                if (!empty($post_types)) {
453
+                    foreach ($post_types as $key => $info) {
454
+                        $options[$key] = __($info['labels']['singular_name'], 'geodirectory');
455
+                    }
456
+                }
457
+                $post_types = $options;
458 458
                 break;
459 459
             default:
460 460
                 $post_types = array_keys($post_types);
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
         if (is_array($post_cat_array)) {
1065 1065
             $post_cat_array = array_unique( $post_cat_array );
1066 1066
 
1067
-			foreach ($post_cat_array as $post_cat_html) {
1067
+            foreach ($post_cat_array as $post_cat_html) {
1068 1068
 
1069 1069
                 $post_cat_info = explode(":", $post_cat_html);
1070 1070
                 $post_maincat_str = $post_cat_info[0];
@@ -1429,21 +1429,21 @@  discard block
 block discarded – undo
1429 1429
             }
1430 1430
         }
1431 1431
 
1432
-		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1432
+        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1433 1433
         $site_url = trailingslashit(get_bloginfo('url'));
1434 1434
 
1435
-		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1436
-		if ($fix_url) {
1437
-			$post_link = str_replace($site_url, '', $post_link);
1438
-		}
1435
+        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1436
+        if ($fix_url) {
1437
+            $post_link = str_replace($site_url, '', $post_link);
1438
+        }
1439 1439
 		
1440 1440
         $post_link = trailingslashit(
1441 1441
             preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1442 1442
         );
1443 1443
 
1444
-		if ($fix_url) {
1445
-			$post_link = $site_url . $post_link;
1446
-		}
1444
+        if ($fix_url) {
1445
+            $post_link = $site_url . $post_link;
1446
+        }
1447 1447
 
1448 1448
         if (isset($comment_post_cache[$post->ID])) {
1449 1449
             $post = $comment_post_cache[$post->ID];
@@ -1531,23 +1531,23 @@  discard block
 block discarded – undo
1531 1531
 
1532 1532
                 if (!empty($post_location)) {
1533 1533
                     $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1534
-					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1535
-					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1534
+                    $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1535
+                    $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1536 1536
 					
1537
-					$geodir_show_location_url = get_option('geodir_show_location_url');
1537
+                    $geodir_show_location_url = get_option('geodir_show_location_url');
1538 1538
 					
1539
-					$location_slug = array();
1540
-					if ($geodir_show_location_url == 'all') {
1541
-						$location_slug[] = $country_slug;
1542
-						$location_slug[] = $region_slug;
1543
-					} else if ($geodir_show_location_url == 'country_city') {
1544
-						$location_slug[] = $country_slug;
1545
-					} else if ($geodir_show_location_url == 'region_city') {
1546
-						$location_slug[] = $region_slug;
1547
-					}
1548
-					$location_slug[] = $city_slug;
1539
+                    $location_slug = array();
1540
+                    if ($geodir_show_location_url == 'all') {
1541
+                        $location_slug[] = $country_slug;
1542
+                        $location_slug[] = $region_slug;
1543
+                    } else if ($geodir_show_location_url == 'country_city') {
1544
+                        $location_slug[] = $country_slug;
1545
+                    } else if ($geodir_show_location_url == 'region_city') {
1546
+                        $location_slug[] = $region_slug;
1547
+                    }
1548
+                    $location_slug[] = $city_slug;
1549 1549
 					
1550
-					$location_request .= implode('/', $location_slug) . '/';
1550
+                    $location_request .= implode('/', $location_slug) . '/';
1551 1551
                 }
1552 1552
             }
1553 1553
 
@@ -1655,19 +1655,19 @@  discard block
 block discarded – undo
1655 1655
         if ($include_location) {
1656 1656
             global $post;
1657 1657
 			
1658
-			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1659
-			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1658
+            $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1659
+            $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1660 1660
             
1661
-			if(geodir_is_page('detail') && isset($post->country_slug)){
1661
+            if(geodir_is_page('detail') && isset($post->country_slug)){
1662 1662
                 $location_terms = array(
1663 1663
                     'gd_country' => $post->country_slug,
1664 1664
                     'gd_region' => $post->region_slug,
1665 1665
                     'gd_city' => $post->city_slug
1666 1666
                 );
1667 1667
 				
1668
-				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1669
-					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1670
-				}
1668
+                if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1669
+                    $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1670
+                }
1671 1671
             } else {
1672 1672
                 $location_terms = geodir_get_current_location_terms('query_vars');
1673 1673
             }
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
         if(function_exists('icl_object_id')){
1704 1704
             $post_types = get_option('geodir_post_types');
1705 1705
             $post_type = str_replace("category","",$taxonomy);
1706
-			$post_type = str_replace("_tags","",$post_type);
1706
+            $post_type = str_replace("_tags","",$post_type);
1707 1707
             $slug = $post_types[$post_type]['rewrite']['slug'];
1708 1708
             if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1709 1709
 
@@ -1751,13 +1751,13 @@  discard block
 block discarded – undo
1751 1751
  * @return string The modified link.
1752 1752
  */
1753 1753
 function geodir_posttype_link($link, $post_type) {
1754
-	global $geodir_add_location_url, $post, $gd_session;
1754
+    global $geodir_add_location_url, $post, $gd_session;
1755 1755
 	
1756
-	$location_terms = array();
1756
+    $location_terms = array();
1757 1757
 	
1758
-	if (in_array($post_type, geodir_get_posttypes())) {
1759
-		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1760
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1758
+    if (in_array($post_type, geodir_get_posttypes())) {
1759
+        if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1760
+            if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1761 1761
                 $location_terms = array(
1762 1762
                     'gd_country' => $post->country_slug,
1763 1763
                     'gd_region' => $post->region_slug,
@@ -1767,22 +1767,22 @@  discard block
 block discarded – undo
1767 1767
                 $location_terms = geodir_get_current_location_terms('query_vars');
1768 1768
             }
1769 1769
 			
1770
-			$location_terms = geodir_remove_location_terms($location_terms);
1770
+            $location_terms = geodir_remove_location_terms($location_terms);
1771 1771
 			
1772
-			if (!empty($location_terms)) {
1773
-				if (get_option('permalink_structure') != '') {
1774
-					$location_terms = implode("/", $location_terms);
1775
-					$location_terms = rtrim($location_terms, '/');
1772
+            if (!empty($location_terms)) {
1773
+                if (get_option('permalink_structure') != '') {
1774
+                    $location_terms = implode("/", $location_terms);
1775
+                    $location_terms = rtrim($location_terms, '/');
1776 1776
 					
1777
-					$link .= urldecode($location_terms) . '/';
1778
-				} else {
1779
-					$link = geodir_getlink($link, $location_terms);
1780
-				}
1781
-			}
1782
-		}
1783
-	}
1777
+                    $link .= urldecode($location_terms) . '/';
1778
+                } else {
1779
+                    $link = geodir_getlink($link, $location_terms);
1780
+                }
1781
+            }
1782
+        }
1783
+    }
1784 1784
 	
1785
-	return $link;
1785
+    return $link;
1786 1786
 }
1787 1787
 
1788 1788
 /**
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
189 189
                                     $items .= '<li class="' . $li_class . '">
190 190
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
191
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
191
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . '
192 192
 											</a>
193 193
 										</li>';
194 194
                                 }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
268 268
                                         $items .= '<li class="' . $li_class . '">
269 269
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
270
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
270
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . '
271 271
 														</a>
272 272
 													</li>';
273 273
                                     }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401 401
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
402
+            $geodir_post_type = get_post_type((int) $_REQUEST['pid']);
403 403
         elseif (isset($_REQUEST['listing_type']))
404 404
             $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
405 405
     }
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
         switch ($output):
440 440
             case 'object':
441 441
             case 'Object':
442
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
442
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
443 443
                 break;
444 444
             case 'array':
445 445
             case 'Array':
446
-                $post_types = (array)$post_types;
446
+                $post_types = (array) $post_types;
447 447
                 break;
448 448
 			case 'options':
449
-                $post_types = (array)$post_types;
449
+                $post_types = (array) $post_types;
450 450
 				
451 451
 				$options = array();
452 452
 				if (!empty($post_types)) {
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
     } elseif (isset($wp_query->tax_query->queries)) {
641 641
         $tax_arr = $wp_query->tax_query->queries;
642 642
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
643
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
643
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
644 644
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
645 645
     }
646 646
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
             $cat_exclude = serialize($exclude_cats);
764 764
 
765 765
         if (isset($_REQUEST['backandedit'])) {
766
-            $post = (object)$gd_session->get('listing');
766
+            $post = (object) $gd_session->get('listing');
767 767
 
768 768
             if (!is_array($post->post_category[$cat_taxonomy]))
769 769
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -841,14 +841,14 @@  discard block
 block discarded – undo
841 841
 
842 842
             function show_subcatlist(main_cat, catObj) {
843 843
                 if (main_cat != '') {
844
-					var url = '<?php echo geodir_get_ajax_url();?>';
845
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
846
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
844
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
845
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
846
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
847 847
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
848
-					<?php if ((int)$cat_limit > 0) { ?>
848
+					<?php if ((int) $cat_limit > 0) { ?>
849 849
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
850 850
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
851
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
851
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
852 852
 						return false;
853 853
 					}
854 854
 					<?php } ?>
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
             }
888 888
 
889 889
             function update_listing_cat(el) {
890
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
890
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
891 891
                 var cat_ids = '';
892 892
                 var main_cat = '';
893 893
                 var sub_cat = '';
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
         <div class="main_cat_list" style=" <?php if (isset($style)) {
969 969
             echo $style;
970 970
         }?> ">
971
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
971
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
972 972
             ?>
973 973
         </div>
974 974
     <?php
@@ -995,9 +995,9 @@  discard block
 block discarded – undo
995 995
     if ($exclude != '') {
996 996
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
997 997
         print_r($exclude_cats);
998
-        if(is_array( $exclude_cats)){
999
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
998
+        if (is_array($exclude_cats)) {
999
+            $exclude_cats = array_map('intval', $exclude_cats);
1000
+        } else {
1001 1001
             $exclude_cats = intval($exclude_cats);
1002 1002
         }
1003 1003
 
@@ -1011,25 +1011,25 @@  discard block
 block discarded – undo
1011 1011
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1012 1012
 
1013 1013
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1014
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1014
+            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png'; ?>"
1015 1015
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1016 1016
             <?php /* ?>
1017 1017
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1018 1018
 		<?php */ ?>
1019 1019
 
1020
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1020
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1021 1021
                    onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
1022 1022
                    checked="checked" disabled="disabled"/>
1023 1023
        <span> 
1024
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1024
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1025 1025
         </span>
1026 1026
             <br/>
1027 1027
 
1028 1028
             <div class="post_default_category">
1029
-                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1030
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1029
+                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>"
1030
+                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?>   />
1031 1031
         <span> 
1032
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1032
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1033 1033
         </span>
1034 1034
             </div>
1035 1035
 
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
         $post_cat_str = $post_categories[$request_taxonomy];
1063 1063
         $post_cat_array = explode("#", $post_cat_str);
1064 1064
         if (is_array($post_cat_array)) {
1065
-            $post_cat_array = array_unique( $post_cat_array );
1065
+            $post_cat_array = array_unique($post_cat_array);
1066 1066
 
1067 1067
 			foreach ($post_cat_array as $post_cat_html) {
1068 1068
 
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                 }
1078 1078
                 $post_sub_catid = '';
1079 1079
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1080
-                    $post_sub_catid = (int)$post_cat_info[1];
1080
+                    $post_sub_catid = (int) $post_cat_info[1];
1081 1081
                 }
1082 1082
 
1083 1083
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
             }
1099 1099
 
1100 1100
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1101
-                $post_sub_catid = (int)$post_cat_info[1];
1101
+                $post_sub_catid = (int) $post_cat_info[1];
1102 1102
             }
1103 1103
 
1104 1104
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
                 $option_selected = ' selected="selected" ';
1141 1141
 
1142 1142
             // Count child terms
1143
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1143
+            $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1144
+            $has_child = !empty($child_terms) ? 't' : 'f';
1145 1145
 
1146 1146
             echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1147 1147
         }
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
             2 => __('Custom field updated.', 'geodirectory'),
1175 1175
             3 => __('Custom field deleted.', 'geodirectory'),
1176 1176
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1177
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1177
+            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
1178 1178
             6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1179 1179
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1180 1180
             8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
             'menu_icon' => $menu_icon,
1312 1312
             'public' => true,
1313 1313
             'query_var' => true,
1314
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true),
1314
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1315 1315
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1316 1316
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1317 1317
 
@@ -1333,25 +1333,25 @@  discard block
 block discarded – undo
1333 1333
 }
1334 1334
 
1335 1335
 $gd_wpml_get_languages = "";
1336
-function gd_wpml_get_lang_from_url($url){
1336
+function gd_wpml_get_lang_from_url($url) {
1337 1337
 
1338 1338
     global $gd_wpml_get_languages;
1339
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1339
+    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
1340 1340
 
1341 1341
 
1342 1342
     //
1343
-    $url = str_replace(array("http://","https://"),"",$url);
1344
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1343
+    $url = str_replace(array("http://", "https://"), "", $url);
1344
+    $site_url = str_replace(array("http://", "https://"), "", get_bloginfo('url'));
1345 1345
 
1346
-    $url = str_replace($site_url,"",$url);
1346
+    $url = str_replace($site_url, "", $url);
1347 1347
 
1348 1348
 
1349 1349
     $segments = explode('/', trim($url, '/'));
1350 1350
 
1351 1351
     //print_r( $segments);
1352
-    if($gd_wpml_get_languages){
1352
+    if ($gd_wpml_get_languages) {
1353 1353
         $langs = $gd_wpml_get_languages;
1354
-    }else{
1354
+    } else {
1355 1355
         global $sitepress;
1356 1356
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1357 1357
     }
@@ -1414,17 +1414,17 @@  discard block
 block discarded – undo
1414 1414
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1415 1415
 
1416 1416
         // Alter the CPT slug if WPML is set to do so
1417
-        if(function_exists('icl_object_id')){
1418
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1417
+        if (function_exists('icl_object_id')) {
1418
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1419 1419
 
1420 1420
                 $org_slug = $slug;
1421
-                $slug = apply_filters( 'wpml_translate_single_string',
1421
+                $slug = apply_filters('wpml_translate_single_string',
1422 1422
                     $slug,
1423 1423
                     'WordPress',
1424 1424
                     'URL slug: ' . $slug,
1425 1425
                     $language_code);
1426 1426
 
1427
-                if(!$slug){$slug = $org_slug;}
1427
+                if (!$slug) {$slug = $org_slug; }
1428 1428
 
1429 1429
             }
1430 1430
         }
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 		}
1439 1439
 		
1440 1440
         $post_link = trailingslashit(
1441
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1441
+            preg_replace("/" . preg_quote($slug, "/") . "/", $slug . "/%gd_taxonomy%", $post_link, 1)
1442 1442
         );
1443 1443
 
1444 1444
 		if ($fix_url) {
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
                 )
1467 1467
             );
1468 1468
 
1469
-            $post = (object)array_merge((array)$post, (array)$post2);
1469
+            $post = (object) array_merge((array) $post, (array) $post2);
1470 1470
 
1471 1471
             $comment_post_cache[$post->ID] = $post;
1472 1472
         }
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1477 1477
 
1478
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1478
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1479 1479
                 $location_request = '';
1480 1480
 
1481 1481
 
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1490 1490
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1491 1491
 
1492
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1492
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1493 1493
                             'region_slug' => $post->region_slug,
1494 1494
                             'city_slug' => $post->city_slug
1495 1495
                         );
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1519 1519
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1520 1520
 
1521
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1521
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1522 1522
                                 'region_slug' => $post->region_slug,
1523 1523
                                 'city_slug' => $post->city_slug
1524 1524
                             );
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1659 1659
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1660 1660
             
1661
-			if(geodir_is_page('detail') && isset($post->country_slug)){
1661
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1662 1662
                 $location_terms = array(
1663 1663
                     'gd_country' => $post->country_slug,
1664 1664
                     'gd_region' => $post->region_slug,
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
 
1678 1678
             if (!empty($location_terms)) {
1679 1679
 
1680
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1680
+                $url_separator = ''; //get_option('geodir_listingurl_separator');
1681 1681
 
1682 1682
                 if (get_option('permalink_structure') != '') {
1683 1683
                     $old_listing_slug = '/' . $listing_slug . '/';
@@ -1700,31 +1700,31 @@  discard block
 block discarded – undo
1700 1700
         }*/
1701 1701
 
1702 1702
         // Alter the CPT slug if WPML is set to do so
1703
-        if(function_exists('icl_object_id')){
1703
+        if (function_exists('icl_object_id')) {
1704 1704
             $post_types = get_option('geodir_post_types');
1705
-            $post_type = str_replace("category","",$taxonomy);
1706
-			$post_type = str_replace("_tags","",$post_type);
1705
+            $post_type = str_replace("category", "", $taxonomy);
1706
+			$post_type = str_replace("_tags", "", $post_type);
1707 1707
             $slug = $post_types[$post_type]['rewrite']['slug'];
1708
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1708
+            if (gd_wpml_slug_translation_turned_on($post_type)) {
1709 1709
 
1710 1710
                 global $sitepress;
1711 1711
                 $default_lang = $sitepress->get_default_language();
1712 1712
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1713
-                if(!$language_code ){$language_code  = $default_lang;}
1713
+                if (!$language_code) {$language_code = $default_lang; }
1714 1714
 
1715 1715
                 $org_slug = $slug;
1716
-                $slug = apply_filters( 'wpml_translate_single_string',
1716
+                $slug = apply_filters('wpml_translate_single_string',
1717 1717
                     $slug,
1718 1718
                     'WordPress',
1719 1719
                     'URL slug: ' . $slug,
1720 1720
                     $language_code);
1721 1721
 
1722 1722
 
1723
-                if(!$slug){$slug = $org_slug;}
1723
+                if (!$slug) {$slug = $org_slug; }
1724 1724
 
1725 1725
                 $termlink = trailingslashit(
1726 1726
 
1727
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1727
+                    preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug, $termlink, 1)
1728 1728
                 );
1729 1729
 
1730 1730
             }
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 	
1758 1758
 	if (in_array($post_type, geodir_get_posttypes())) {
1759 1759
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1760
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1760
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1761 1761
                 $location_terms = array(
1762 1762
                     'gd_country' => $post->country_slug,
1763 1763
                     'gd_region' => $post->region_slug,
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 
1871 1871
     $where_fields = array($slug);
1872 1872
     if (!empty($taxonomy)) {
1873
-        $parent = (int)$parent;
1873
+        $parent = (int) $parent;
1874 1874
         if ($parent > 0) {
1875 1875
             $where_fields[] = $parent;
1876 1876
             $else_where_fields[] = $parent;
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1940 1940
         //$terms = get_terms( $taxonomy );
1941 1941
 
1942
-        if($terms) {
1942
+        if ($terms) {
1943 1943
             foreach ($terms as $term) {
1944 1944
                 $post_type = str_replace("category", "", $term->taxonomy);
1945 1945
                 $a_terms[$post_type][] = $term;
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
             }
1948 1948
         }
1949 1949
 
1950
-        if($a_terms) {
1950
+        if ($a_terms) {
1951 1951
             foreach ($a_terms as $pt => $t2) {
1952 1952
 
1953 1953
                 foreach ($t2 as $term) {
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
     }
1973 1973
 
1974 1974
     if (is_ssl()) {
1975
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1975
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
1976 1976
     }
1977 1977
 
1978 1978
     return $terms_icons;
Please login to merge, or discard this patch.
Braces   +170 added lines, -121 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -153,8 +156,9 @@  discard block
 block discarded – undo
153 156
     if (get_option('geodir_show_addlisting_nav')) {
154 157
 
155 158
         $menu_class = '';
156
-        if (geodir_is_page('add-listing'))
157
-            $menu_class = 'current-menu-item';
159
+        if (geodir_is_page('add-listing')) {
160
+                    $menu_class = 'current-menu-item';
161
+        }
158 162
 
159 163
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160 164
         $post_types = geodir_get_posttypes('object');
@@ -170,8 +174,9 @@  discard block
 block discarded – undo
170 174
                                 if (geodir_get_addlisting_link($post_type)) {
171 175
 
172 176
                                     $menu_class = '';
173
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
-                                        $menu_class = 'current-menu-item';
177
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
178
+                                                                            $menu_class = 'current-menu-item';
179
+                                    }
175 180
                                     /**
176 181
                                      * Filter the menu li class.
177 182
                                      *
@@ -255,8 +260,9 @@  discard block
 block discarded – undo
255 260
                                     if (geodir_get_addlisting_link($post_type)) {
256 261
 
257 262
                                         $menu_class = '';
258
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
-                                            $menu_class = 'current-menu-item';
263
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
264
+                                                                                    $menu_class = 'current-menu-item';
265
+                                        }
260 266
                                         /**
261 267
                                          * Filter the menu li class.
262 268
                                          *
@@ -311,8 +317,9 @@  discard block
 block discarded – undo
311 317
     }
312 318
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
313 319
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
314
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
315
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
320
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
321
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+    }
316 323
 
317 324
     return $menu;
318 325
 
@@ -398,24 +405,28 @@  discard block
 block discarded – undo
398 405
     $geodir_post_type = get_query_var('post_type');
399 406
 
400 407
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
403
-        elseif (isset($_REQUEST['listing_type']))
404
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
408
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
409
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
410
+        } elseif (isset($_REQUEST['listing_type'])) {
411
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
412
+        }
405 413
     }
406 414
 
407
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
408
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
416
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417
+    }
409 418
 
410
-    if (is_tax())
411
-        $geodir_post_type = geodir_get_taxonomy_posttype();
419
+    if (is_tax()) {
420
+            $geodir_post_type = geodir_get_taxonomy_posttype();
421
+    }
412 422
 
413 423
 
414 424
     $all_postypes = geodir_get_posttypes();
415 425
     $all_postypes = stripslashes_deep($all_postypes);
416 426
 
417
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
418
-        $geodir_post_type = '';
427
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
428
+            $geodir_post_type = '';
429
+    }
419 430
 
420 431
 
421 432
     return $geodir_post_type;
@@ -462,11 +473,12 @@  discard block
 block discarded – undo
462 473
         endswitch;
463 474
     }
464 475
 
465
-    if (!empty($post_types))
466
-        return $post_types;
467
-    else
468
-        return array();
469
-}
476
+    if (!empty($post_types)) {
477
+            return $post_types;
478
+    } else {
479
+            return array();
480
+    }
481
+    }
470 482
 
471 483
 /**
472 484
  * Get Custom Post Type info.
@@ -483,9 +495,10 @@  discard block
 block discarded – undo
483 495
     $post_types = stripslashes_deep($post_types);
484 496
     if (!empty($post_types) && $post_type != '') {
485 497
         return $post_types[$post_type];
486
-    } else
487
-        return false;
488
-}
498
+    } else {
499
+            return false;
500
+    }
501
+    }
489 502
 
490 503
 if (!function_exists('geodir_get_taxonomies')) {
491 504
     /**
@@ -509,18 +522,21 @@  discard block
 block discarded – undo
509 522
             $gd_taxonomies = array_keys($taxonomies);
510 523
 
511 524
 
512
-            if ($post_type != '')
513
-                $gd_taxonomies = array();
525
+            if ($post_type != '') {
526
+                            $gd_taxonomies = array();
527
+            }
514 528
 
515 529
             $i = 0;
516 530
             foreach ($taxonomies as $taxonomy => $args) {
517 531
 
518
-                if ($post_type != '' && $args['object_type'] == $post_type)
519
-                    $gd_taxonomies[] = $taxonomy;
532
+                if ($post_type != '' && $args['object_type'] == $post_type) {
533
+                                    $gd_taxonomies[] = $taxonomy;
534
+                }
520 535
 
521 536
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
522
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
523
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
537
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
538
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
539
+                    }
524 540
                 }
525 541
 
526 542
             }
@@ -575,10 +591,11 @@  discard block
 block discarded – undo
575 591
                 . ucfirst($category_obj->name) . '</option>';
576 592
         }
577 593
 
578
-        if ($echo)
579
-            echo $html;
580
-        else
581
-            return $html;
594
+        if ($echo) {
595
+                    echo $html;
596
+        } else {
597
+                    return $html;
598
+        }
582 599
     }
583 600
 }
584 601
 
@@ -612,11 +629,12 @@  discard block
 block discarded – undo
612 629
 
613 630
     }
614 631
 
615
-    if (!empty($listing_slug))
616
-        return $listing_slug;
617
-    else
618
-        return false;
619
-}
632
+    if (!empty($listing_slug)) {
633
+            return $listing_slug;
634
+    } else {
635
+            return false;
636
+    }
637
+    }
620 638
 
621 639
 
622 640
 /**
@@ -647,16 +665,18 @@  discard block
 block discarded – undo
647 665
     if (!empty($taxonomies)) {
648 666
         foreach (geodir_get_posttypes() as $pt) {
649 667
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
650
-            if (array_intersect($taxonomies, $object_taxonomies))
651
-                $post_type[] = $pt;
668
+            if (array_intersect($taxonomies, $object_taxonomies)) {
669
+                            $post_type[] = $pt;
670
+            }
652 671
         }
653 672
     }
654 673
 
655
-    if (!empty($post_type))
656
-        return $post_type[0];
657
-    else
658
-        return false;
659
-}
674
+    if (!empty($post_type)) {
675
+            return $post_type[0];
676
+    } else {
677
+            return false;
678
+    }
679
+    }
660 680
 
661 681
 if (!function_exists('geodir_custom_taxonomy_walker')) {
662 682
     /**
@@ -712,18 +732,18 @@  discard block
 block discarded – undo
712 732
                 $checked = '';
713 733
 
714 734
                 if (in_array($cat_term->term_id, $search_terms)) {
715
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
716
-                        $checked = 'selected="selected"';
717
-                    else
718
-                        $checked = 'checked="checked"';
735
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
736
+                                            $checked = 'selected="selected"';
737
+                    } else {
738
+                                            $checked = 'checked="checked"';
739
+                    }
719 740
                 }
720 741
 
721
-                if ($cat_display == 'radio')
722
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
723
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
724
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
725
-
726
-                else {
742
+                if ($cat_display == 'radio') {
743
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
744
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
745
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
746
+                } else {
727 747
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
728 748
                 }
729 749
 
@@ -732,8 +752,9 @@  discard block
 block discarded – undo
732 752
 
733 753
             }
734 754
 
735
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
736
-                $out .= '</div>';
755
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
756
+                            $out .= '</div>';
757
+            }
737 758
 
738 759
             return $out;
739 760
         }
@@ -759,18 +780,21 @@  discard block
 block discarded – undo
759 780
         global $exclude_cats, $gd_session;
760 781
 
761 782
         $cat_exclude = '';
762
-        if (is_array($exclude_cats) && !empty($exclude_cats))
763
-            $cat_exclude = serialize($exclude_cats);
783
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
784
+                    $cat_exclude = serialize($exclude_cats);
785
+        }
764 786
 
765 787
         if (isset($_REQUEST['backandedit'])) {
766 788
             $post = (object)$gd_session->get('listing');
767 789
 
768
-            if (!is_array($post->post_category[$cat_taxonomy]))
769
-                $post_category = $post->post_category[$cat_taxonomy];
790
+            if (!is_array($post->post_category[$cat_taxonomy])) {
791
+                            $post_category = $post->post_category[$cat_taxonomy];
792
+            }
770 793
 
771 794
             $post_categories = $post->post_category_str;
772
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
773
-                $post_category_str = $post_categories[$cat_taxonomy];
795
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
796
+                            $post_category_str = $post_categories[$cat_taxonomy];
797
+            }
774 798
 
775 799
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
776 800
             global $post;
@@ -961,8 +985,9 @@  discard block
 block discarded – undo
961 985
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
962 986
             $post_cat_str = $post_categories[$cat_taxonomy];
963 987
             $post_cat_array = explode("#", $post_cat_str);
964
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
965
-                $style = "display:none;";
988
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
989
+                            $style = "display:none;";
990
+            }
966 991
         }
967 992
         ?>
968 993
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -997,7 +1022,7 @@  discard block
 block discarded – undo
997 1022
         print_r($exclude_cats);
998 1023
         if(is_array( $exclude_cats)){
999 1024
             $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
1025
+        } else{
1001 1026
             $exclude_cats = intval($exclude_cats);
1002 1027
         }
1003 1028
 
@@ -1027,7 +1052,10 @@  discard block
 block discarded – undo
1027 1052
 
1028 1053
             <div class="post_default_category">
1029 1054
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1030
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1055
+                       onchange="update_listing_cat()" <?php if ($default) {
1056
+    echo ' checked="checked" ';
1057
+}
1058
+?>   />
1031 1059
         <span> 
1032 1060
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1033 1061
         </span>
@@ -1127,8 +1155,9 @@  discard block
 block discarded – undo
1127 1155
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1128 1156
 
1129 1157
         $option_selected = '';
1130
-        if (!$selected)
1131
-            $option_slected = ' selected="selected" ';
1158
+        if (!$selected) {
1159
+                    $option_slected = ' selected="selected" ';
1160
+        }
1132 1161
 
1133 1162
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1134 1163
 
@@ -1136,8 +1165,9 @@  discard block
 block discarded – undo
1136 1165
 
1137 1166
         foreach ($cat_terms as $cat_term) {
1138 1167
             $option_selected = '';
1139
-            if ($selected == $cat_term->term_id)
1140
-                $option_selected = ' selected="selected" ';
1168
+            if ($selected == $cat_term->term_id) {
1169
+                            $option_selected = ' selected="selected" ';
1170
+            }
1141 1171
 
1142 1172
             // Count child terms
1143 1173
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1202,8 +1232,9 @@  discard block
 block discarded – undo
1202 1232
 
1203 1233
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1204 1234
 
1205
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1206
-        $listing_slug = 'places';
1235
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1236
+            $listing_slug = 'places';
1237
+    }
1207 1238
 
1208 1239
     /**
1209 1240
      * Taxonomies
@@ -1351,7 +1382,7 @@  discard block
 block discarded – undo
1351 1382
     //print_r( $segments);
1352 1383
     if($gd_wpml_get_languages){
1353 1384
         $langs = $gd_wpml_get_languages;
1354
-    }else{
1385
+    } else{
1355 1386
         global $sitepress;
1356 1387
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1357 1388
     }
@@ -1494,8 +1525,9 @@  discard block
 block discarded – undo
1494 1525
                             'city_slug' => $post->city_slug
1495 1526
                         );
1496 1527
 
1497
-                    } else
1498
-                        $post_location = geodir_get_location();
1528
+                    } else {
1529
+                                            $post_location = geodir_get_location();
1530
+                    }
1499 1531
 
1500 1532
 
1501 1533
                 } else {
@@ -1524,8 +1556,9 @@  discard block
 block discarded – undo
1524 1556
                             );
1525 1557
 
1526 1558
                         }
1527
-                    } else
1528
-                        $post_location = geodir_get_location();
1559
+                    } else {
1560
+                                            $post_location = geodir_get_location();
1561
+                    }
1529 1562
                 }
1530 1563
 
1531 1564
 
@@ -1568,8 +1601,9 @@  discard block
 block discarded – undo
1568 1601
                         $post_terms = $post_terms[0];
1569 1602
                     }
1570 1603
 
1571
-                    if (!$post_terms)
1572
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1604
+                    if (!$post_terms) {
1605
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1606
+                    }
1573 1607
 
1574 1608
                     if (!$post_terms) {
1575 1609
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1583,8 +1617,9 @@  discard block
 block discarded – undo
1583 1617
 
1584 1618
                 $term = get_term_by('id', $post_terms, $taxonomies);
1585 1619
 
1586
-                if (!empty($term))
1587
-                    $term_request = $term->slug;
1620
+                if (!empty($term)) {
1621
+                                    $term_request = $term->slug;
1622
+                }
1588 1623
                 //$term_request = $term->slug.'/';
1589 1624
             }
1590 1625
 
@@ -1599,15 +1634,20 @@  discard block
 block discarded – undo
1599 1634
                 $request_term .= $term_request;
1600 1635
 
1601 1636
             } else {
1602
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1637
+                if (isset($location_request) && $location_request != '') {
1638
+                    $request_term = $location_request;
1639
+                }
1603 1640
 
1604
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1641
+                if (isset($term_request) && $term_request != '') {
1642
+                    $request_term .= $term_request;
1643
+                }
1605 1644
             }
1606 1645
             $request_term = trim($request_term, '/');
1607
-            if (!empty($request_term))
1608
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1609
-            else
1610
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1646
+            if (!empty($request_term)) {
1647
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1648
+            } else {
1649
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1650
+            }
1611 1651
             //echo $post_link ;
1612 1652
         }
1613 1653
         // temp cache the permalink
@@ -1649,8 +1689,9 @@  discard block
 block discarded – undo
1649 1689
             if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1650 1690
                 $include_location = true;
1651 1691
             }
1652
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1653
-            $include_location = true;
1692
+        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1693
+                    $include_location = true;
1694
+        }
1654 1695
 
1655 1696
         if ($include_location) {
1656 1697
             global $post;
@@ -1800,10 +1841,11 @@  discard block
 block discarded – undo
1800 1841
     if (!is_object($obj_post_type)) {
1801 1842
         return;
1802 1843
     }
1803
-    if ($echo)
1804
-        echo $obj_post_type->labels->singular_name;
1805
-    else
1806
-        return $obj_post_type->labels->singular_name;
1844
+    if ($echo) {
1845
+            echo $obj_post_type->labels->singular_name;
1846
+    } else {
1847
+            return $obj_post_type->labels->singular_name;
1848
+    }
1807 1849
 
1808 1850
 }
1809 1851
 
@@ -1820,14 +1862,16 @@  discard block
 block discarded – undo
1820 1862
 {
1821 1863
     $all_postypes = geodir_get_posttypes();
1822 1864
 
1823
-    if (!in_array($post_type, $all_postypes))
1824
-        return false;
1865
+    if (!in_array($post_type, $all_postypes)) {
1866
+            return false;
1867
+    }
1825 1868
 
1826 1869
     $obj_post_type = get_post_type_object($post_type);
1827
-    if ($echo)
1828
-        echo $obj_post_type->labels->name;
1829
-    else
1830
-        return $obj_post_type->labels->name;
1870
+    if ($echo) {
1871
+            echo $obj_post_type->labels->name;
1872
+    } else {
1873
+            return $obj_post_type->labels->name;
1874
+    }
1831 1875
 
1832 1876
 }
1833 1877
 
@@ -1852,19 +1896,22 @@  discard block
 block discarded – undo
1852 1896
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1853 1897
 
1854 1898
     if (is_int($term)) {
1855
-        if (0 == $term)
1856
-            return 0;
1899
+        if (0 == $term) {
1900
+                    return 0;
1901
+        }
1857 1902
         $where = 't.term_id = %d';
1858
-        if (!empty($taxonomy))
1859
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1860
-        else
1861
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1903
+        if (!empty($taxonomy)) {
1904
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1905
+        } else {
1906
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1907
+        }
1862 1908
     }
1863 1909
 
1864 1910
     $term = trim(wp_unslash($term));
1865 1911
 
1866
-    if ('' === $slug = sanitize_title($term))
1867
-        return 0;
1912
+    if ('' === $slug = sanitize_title($term)) {
1913
+            return 0;
1914
+    }
1868 1915
 
1869 1916
     $where = 't.slug = %s';
1870 1917
 
@@ -1881,14 +1928,16 @@  discard block
 block discarded – undo
1881 1928
         $where_fields[] = $taxonomy;
1882 1929
 
1883 1930
 
1884
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1885
-            return $result;
1931
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
1932
+                    return $result;
1933
+        }
1886 1934
 
1887 1935
         return false;
1888 1936
     }
1889 1937
 
1890
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1891
-        return $result;
1938
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
1939
+            return $result;
1940
+    }
1892 1941
 
1893 1942
     return false;
1894 1943
 }
Please login to merge, or discard this patch.
geodirectory_template_actions.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template functions that affect the output of most GeoDirectory pages
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Template functions that affect the output of most GeoDirectory pages
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 ###############################################
9 9
 ########### DYNAMIC CONTENT ###################
10 10
 ###############################################
@@ -1197,9 +1197,9 @@  discard block
 block discarded – undo
1197 1197
         } else {
1198 1198
             $post_term = $post->$post_taxonomy;
1199 1199
 			
1200
-			if ($preview && !$is_backend_preview) {
1201
-				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1202
-			}
1200
+            if ($preview && !$is_backend_preview) {
1201
+                $post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1202
+            }
1203 1203
         }
1204 1204
 
1205 1205
         $post_term = array_unique($post_term);
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
         }
677 677
     }
678 678
 
679
-    $post = (object)$_REQUEST;
679
+    $post = (object) $_REQUEST;
680 680
 
681 681
 
682 682
     if (isset($post->video)) {
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020 1020
 
1021 1021
                     if ($image && $width && $height) {
1022
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1022
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1023 1023
                     }
1024 1024
 
1025 1025
                     if (isset($image->src)) {
@@ -1052,9 +1052,9 @@  discard block
 block discarded – undo
1052 1052
                 } else {
1053 1053
                     $spacer_height = ((400 - $image->height) / 2);
1054 1054
                 }
1055
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1055
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056 1056
                 $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1057
+                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />' . $caption . '</li>';
1058 1058
                 $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1059 1059
                 $slides++;
1060 1060
             }
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
  */
1091 1091
 function geodir_action_details_taxonomies()
1092 1092
 {
1093
-    global $preview, $post;?>
1093
+    global $preview, $post; ?>
1094 1094
     <p class="geodir_post_taxomomies clearfix">
1095 1095
     <?php
1096 1096
     $taxonomies = array();
@@ -1168,12 +1168,12 @@  discard block
 block discarded – undo
1168 1168
                          * @param string $tag_link The tag link html.
1169 1169
                          * @param object $term The tag term object.
1170 1170
                          */
1171
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1171
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1172 1172
                         $links[] = $tag_link;
1173 1173
                     } else {
1174 1174
                         $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175 1175
                         /** This action is documented in geodirectory-template_actions.php */
1176
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1176
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1177 1177
                         $links[] = $tag_link;
1178 1178
                     }
1179 1179
                     $terms[] = $term;
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
             if (!isset($listing_label)) {
1184 1184
                 $listing_label = '';
1185 1185
             }
1186
-            $taxonomies[$post_type . '_tags'] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Tags', 'geodirectory')), $links, (object)$terms);
1186
+            $taxonomies[$post_type . '_tags'] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Tags', 'geodirectory')), $links, (object) $terms);
1187 1187
         endif;
1188 1188
 
1189 1189
     }
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
                          * @param string $term_link The link html to the category.
1220 1220
                          * @param object $term The category term object.
1221 1221
                          */
1222
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1222
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1223 1223
                         $links[] = $term_link;
1224 1224
                         $terms[] = $term;
1225 1225
                     }
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
         if (!isset($listing_label)) {
1238 1238
             $listing_label = '';
1239 1239
         }
1240
-        $taxonomies[$post_taxonomy] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Category', 'geodirectory')), $links, (object)$terms);
1240
+        $taxonomies[$post_taxonomy] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Category', 'geodirectory')), $links, (object) $terms);
1241 1241
 
1242 1242
     }
1243 1243
 
@@ -1268,11 +1268,11 @@  discard block
 block discarded – undo
1268 1268
  * @param object $post Optional. The post object or blank.
1269 1269
  * @package GeoDirectory
1270 1270
  */
1271
-function geodir_action_details_micordata($post='')
1271
+function geodir_action_details_micordata($post = '')
1272 1272
 {
1273 1273
 
1274 1274
     global $preview;
1275
-    if(empty($post)){global $post;}
1275
+    if (empty($post)) {global $post; }
1276 1276
     if ($preview || !geodir_is_page('detail')) {
1277 1277
         return;
1278 1278
     }
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
                 "description" => $review->comment_content,
1294 1294
                 "reviewRating" => array(
1295 1295
                     "@type" => "Rating",
1296
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1296
+                    "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1297 1297
                     "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1298 1298
                     "worstRating" => "1"
1299 1299
                 )
@@ -1321,13 +1321,13 @@  discard block
 block discarded – undo
1321 1321
     }
1322 1322
     //print_r($post);
1323 1323
     // external links
1324
-    $external_links =  array();
1324
+    $external_links = array();
1325 1325
     $external_links[] = $post->geodir_website;
1326 1326
     $external_links[] = $post->geodir_twitter;
1327 1327
     $external_links[] = $post->geodir_facebook;
1328 1328
     $external_links = array_filter($external_links);
1329 1329
 
1330
-    if(!empty($external_links)){
1330
+    if (!empty($external_links)) {
1331 1331
         $external_links = array_values($external_links);
1332 1332
     }
1333 1333
 
@@ -1337,16 +1337,16 @@  discard block
 block discarded – undo
1337 1337
 
1338 1338
     // schema type
1339 1339
     $schema_type = 'LocalBusiness';
1340
-    if(isset($post->default_category) && $post->default_category){
1340
+    if (isset($post->default_category) && $post->default_category) {
1341 1341
         $schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1342
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1342
+        if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1343 1343
     }
1344 1344
 
1345 1345
     $schema = array();
1346 1346
     $schema['@context'] = "http://schema.org";
1347 1347
     $schema['@type'] = $schema_type;
1348 1348
     $schema['name'] = $post->post_name;
1349
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1349
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1350 1350
     $schema['telephone'] = $post->geodir_contact;
1351 1351
     $schema['url'] = $c_url;
1352 1352
     $schema['sameAs'] = $external_links;
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
         "postalCode" => $post->post_zip
1361 1361
     );
1362 1362
 
1363
-    if($post->post_latitude && $post->post_longitude) {
1363
+    if ($post->post_latitude && $post->post_longitude) {
1364 1364
         $schema['geo'] = array(
1365 1365
             "@type" => "GeoCoordinates",
1366 1366
             "latitude" => $post->post_latitude,
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
         );
1369 1369
     }
1370 1370
 
1371
-    if($post_avgratings) {
1371
+    if ($post_avgratings) {
1372 1372
         $schema['aggregateRating'] = array(
1373 1373
             "@type" => "AggregateRating",
1374 1374
             "ratingValue" => $post_avgratings,
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
      * @param array $schema The array of schema data to be filtered.
1388 1388
      * @param object $post The post object.
1389 1389
      */
1390
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1390
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1391 1391
 
1392 1392
 
1393 1393
     echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
@@ -1595,26 +1595,26 @@  discard block
 block discarded – undo
1595 1595
 
1596 1596
 
1597 1597
     $title = $list_title;
1598
-    if(geodir_is_page('pt')){
1598
+    if (geodir_is_page('pt')) {
1599 1599
         $gd_page = 'pt';
1600
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1600
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1601 1601
     }
1602
-    elseif(geodir_is_page('listing')){
1602
+    elseif (geodir_is_page('listing')) {
1603 1603
         $gd_page = 'listing';
1604 1604
         global $wp_query;
1605 1605
         $current_term = $wp_query->get_queried_object();
1606
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1606
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1607 1607
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1608
-        }else{
1608
+        } else {
1609 1609
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1610 1610
         }
1611 1611
 
1612 1612
     }
1613
-    elseif(geodir_is_page('author')){
1613
+    elseif (geodir_is_page('author')) {
1614 1614
         $gd_page = 'author';
1615
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1615
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1616 1616
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1617
-        }else{
1617
+        } else {
1618 1618
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1619 1619
         }
1620 1620
 
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
      * @param string $title The page title including variables.
1629 1629
      * @param string $gd_page The GeoDirectory page type if any.
1630 1630
      */
1631
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1631
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1632 1632
 
1633 1633
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1634 1634
         /**
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
         if ($cat_description) {
1674 1674
             ?>
1675 1675
 
1676
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1676
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1677 1677
         }
1678 1678
 
1679 1679
     }
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
      */
1959 1959
     do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1960 1960
     $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1961
-    echo '<div class="clearfix '.$extra_class.'">';
1961
+    echo '<div class="clearfix ' . $extra_class . '">';
1962 1962
     /**
1963 1963
      * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1964 1964
      *
@@ -2034,11 +2034,11 @@  discard block
 block discarded – undo
2034 2034
 
2035 2035
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2036 2036
 
2037
-    if(geodir_is_page('add-listing')){
2037
+    if (geodir_is_page('add-listing')) {
2038 2038
         $gd_page = 'add-listing';
2039
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2039
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2040 2040
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2041
-        }elseif(isset($listing_type)){
2041
+        }elseif (isset($listing_type)) {
2042 2042
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2043 2043
         }
2044 2044
 
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
      * @param string $title The page title including variables.
2053 2053
      * @param string $gd_page The GeoDirectory page type if any.
2054 2054
      */
2055
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2055
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2056 2056
 
2057 2057
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2058 2058
     echo $title;
@@ -2068,7 +2068,7 @@  discard block
 block discarded – undo
2068 2068
  */
2069 2069
 function geodir_action_add_listing_page_mandatory()
2070 2070
 {?>
2071
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2071
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2072 2072
 <?php
2073 2073
 }
2074 2074
 
@@ -2103,7 +2103,7 @@  discard block
 block discarded – undo
2103 2103
 
2104 2104
     if (isset($_REQUEST['backandedit'])) {
2105 2105
         global $post;
2106
-        $post = (object)$gd_session->get('listing');
2106
+        $post = (object) $gd_session->get('listing');
2107 2107
         $listing_type = $post->listing_type;
2108 2108
         $title = $post->post_title;
2109 2109
         $desc = $post->post_desc;
@@ -2145,10 +2145,10 @@  discard block
 block discarded – undo
2145 2145
 
2146 2146
 
2147 2147
     ?>
2148
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>"
2148
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>"
2149 2149
           method="post" enctype="multipart/form-data">
2150
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2151
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2150
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2151
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2152 2152
         <?php if ($page_id) { ?><input type="hidden" name="add_listing_page_id"
2153 2153
                                        value="<?php echo $page_id; ?>" /><?php }?>
2154 2154
         <?php if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
@@ -2165,9 +2165,9 @@  discard block
 block discarded – undo
2165 2165
          *
2166 2166
          * @since 1.0.0
2167 2167
          */
2168
-        do_action('geodir_before_detail_fields');?>
2168
+        do_action('geodir_before_detail_fields'); ?>
2169 2169
 
2170
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2170
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2171 2171
 
2172 2172
         <?php
2173 2173
         /**
@@ -2177,13 +2177,13 @@  discard block
 block discarded – undo
2177 2177
          *
2178 2178
          * @since 1.0.0
2179 2179
          */
2180
-        do_action('geodir_before_main_form_fields');?>
2180
+        do_action('geodir_before_main_form_fields'); ?>
2181 2181
 
2182 2182
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2183
-            <label><?php echo PLACE_TITLE_TEXT;?><span>*</span> </label>
2183
+            <label><?php echo PLACE_TITLE_TEXT; ?><span>*</span> </label>
2184 2184
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2185 2185
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2186
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2186
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2187 2187
         </div>
2188 2188
 
2189 2189
         <?php
@@ -2228,20 +2228,20 @@  discard block
 block discarded – undo
2228 2228
         <div id="geodir_post_desc_row" class="<?php if ($desc_limit != '0') {
2229 2229
             echo 'required_field';
2230 2230
         }?> geodir_form_row clearfix gd-fieldset-details">
2231
-            <label><?php echo PLACE_DESC_TEXT;?><span><?php if ($desc_limit != '0') {
2231
+            <label><?php echo PLACE_DESC_TEXT; ?><span><?php if ($desc_limit != '0') {
2232 2232
                         echo '*';
2233 2233
                     }?></span> </label>
2234 2234
             <?php
2235 2235
             if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2236 2236
 
2237
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
2237
+                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
2238 2238
 
2239 2239
                 <div class="editor" field_id="post_desc" field_type="editor">
2240 2240
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2241 2241
                 </div>
2242 2242
             <?php if ($desc_limit != '') { ?>
2243 2243
                 <script
2244
-                    type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2244
+                    type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2245 2245
             <?php } ?>
2246 2246
             <?php } else { ?>
2247 2247
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea"
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
             <?php if ($desc_limit_msg != '') { ?>
2251 2251
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2252 2252
             <?php } ?>
2253
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2253
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2254 2254
         </div>
2255 2255
         <?php
2256 2256
         /**
@@ -2300,8 +2300,8 @@  discard block
 block discarded – undo
2300 2300
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details">
2301 2301
             <label><?php echo TAGKW_TEXT; ?></label>
2302 2302
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2303
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2304
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2303
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2304
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2305 2305
         </div>
2306 2306
         <?php
2307 2307
         /**
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
 
2319 2319
         $package_info = geodir_post_package_info($package_info, $post);
2320 2320
 
2321
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);?>
2321
+        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type); ?>
2322 2322
 
2323 2323
 
2324 2324
         <?php
@@ -2334,7 +2334,7 @@  discard block
 block discarded – undo
2334 2334
         $thumb_img_arr = array();
2335 2335
         $totImg = 0;
2336 2336
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2337
-            $post = (object)$gd_session->get('listing');
2337
+            $post = (object) $gd_session->get('listing');
2338 2338
             if (isset($post->post_images))
2339 2339
                 $curImages = trim($post->post_images, ",");
2340 2340
 
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
             $listing_type = $post->listing_type;
2348 2348
 
2349 2349
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2350
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2350
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2351 2351
             $listing_type = $post->post_type;
2352 2352
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2353 2353
 
@@ -2361,7 +2361,7 @@  discard block
 block discarded – undo
2361 2361
                 //$curImages = $img->src.",";
2362 2362
             }
2363 2363
 
2364
-            $totImg = count((array)$thumb_img_arr);
2364
+            $totImg = count((array) $thumb_img_arr);
2365 2365
         }
2366 2366
 
2367 2367
         if ($curImages != '')
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
         if ($show_image_input_box) {
2383 2383
             ?>
2384 2384
 
2385
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2385
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2386 2386
                 <?php if ($image_limit == 1) {
2387 2387
                     echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2388 2388
                 } ?>
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
                 <div
2406 2406
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2407 2407
                     id="<?php echo $id; ?>plupload-upload-ui">
2408
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2408
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2409 2409
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2410 2410
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2411 2411
                     <span class="ajaxnonceplu"
@@ -2422,7 +2422,7 @@  discard block
 block discarded – undo
2422 2422
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2423 2423
                 </div>
2424 2424
                 <span
2425
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2425
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2426 2426
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2427 2427
             </div>
2428 2428
 
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
          *
2435 2435
          * @since 1.0.0
2436 2436
          */
2437
-        do_action('geodir_after_main_form_fields');?>
2437
+        do_action('geodir_after_main_form_fields'); ?>
2438 2438
 
2439 2439
 
2440 2440
         <!-- add captcha code -->
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
         </script>
2446 2446
         <noscript>
2447 2447
             <div>
2448
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2448
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2449 2449
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2450 2450
             </div>
2451 2451
         </noscript>
@@ -2455,10 +2455,10 @@  discard block
 block discarded – undo
2455 2455
         <!-- end captcha code -->
2456 2456
 
2457 2457
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2458
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2459
-                   class="geodir_button" <?php echo $submit_button;?>/>
2458
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2459
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2460 2460
             <span class="geodir_message_note"
2461
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2461
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2462 2462
         </div>
2463 2463
 
2464 2464
     </form>
@@ -2520,7 +2520,7 @@  discard block
 block discarded – undo
2520 2520
         class="<?php
2521 2521
         /** This action is documented in geodirectory_template_actions.php */
2522 2522
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2523
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2523
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2524 2524
     </div><!-- clearfix ends here-->
2525 2525
 <?php
2526 2526
 }
@@ -2542,7 +2542,7 @@  discard block
 block discarded – undo
2542 2542
 
2543 2543
     ?>
2544 2544
     <script type="text/javascript">
2545
-        <?php if ( $user_login ) { ?>
2545
+        <?php if ($user_login) { ?>
2546 2546
         setTimeout(function () {
2547 2547
             try {
2548 2548
                 d = document.getElementById('user_pass');
@@ -2559,7 +2559,7 @@  discard block
 block discarded – undo
2559 2559
         <?php } ?>
2560 2560
     </script>
2561 2561
     <script type="text/javascript">
2562
-        <?php if ( $user_login ) { ?>
2562
+        <?php if ($user_login) { ?>
2563 2563
         setTimeout(function () {
2564 2564
             try {
2565 2565
                 d = document.getElementById('user_pass');
@@ -2697,11 +2697,11 @@  discard block
 block discarded – undo
2697 2697
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2698 2698
 
2699 2699
     $title = $list_title;
2700
-    if(geodir_is_page('author')){
2700
+    if (geodir_is_page('author')) {
2701 2701
         $gd_page = 'author';
2702
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2702
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2703 2703
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2704
-        }else{
2704
+        } else {
2705 2705
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2706 2706
         }
2707 2707
 
@@ -2715,7 +2715,7 @@  discard block
 block discarded – undo
2715 2715
      * @param string $title The page title including variables.
2716 2716
      * @param string $gd_page The GeoDirectory page type if any.
2717 2717
      */
2718
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2718
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2719 2719
 
2720 2720
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2721 2721
         /**
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
     $post_type_info = get_post_type_object($gd_post_type);
2930 2930
 
2931 2931
     $pt_name = '';
2932
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2932
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
2933 2933
 
2934 2934
     if (is_search()) {
2935 2935
         $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
Please login to merge, or discard this patch.
Braces   +36 added lines, -25 removed lines patch added patch discarded remove patch
@@ -714,8 +714,9 @@  discard block
 block discarded – undo
714 714
 
715 715
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716 716
                             if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
-                                    $term_icon = $term_icon_url['src'];
717
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
718
+                                                                    $term_icon = $term_icon_url['src'];
719
+                                }
719 720
                                 break;
720 721
                             }
721 722
                         }
@@ -1246,8 +1247,9 @@  discard block
 block discarded – undo
1246 1247
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1247 1248
     }
1248 1249
 
1249
-    if (isset($taxonomies[$post_type . '_tags']))
1250
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1250
+    if (isset($taxonomies[$post_type . '_tags'])) {
1251
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1252
+    }
1251 1253
 
1252 1254
     ?>
1253 1255
     </p><?php
@@ -1598,23 +1600,21 @@  discard block
 block discarded – undo
1598 1600
     if(geodir_is_page('pt')){
1599 1601
         $gd_page = 'pt';
1600 1602
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1601
-    }
1602
-    elseif(geodir_is_page('listing')){
1603
+    } elseif(geodir_is_page('listing')){
1603 1604
         $gd_page = 'listing';
1604 1605
         global $wp_query;
1605 1606
         $current_term = $wp_query->get_queried_object();
1606 1607
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1607 1608
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1608
-        }else{
1609
+        } else{
1609 1610
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1610 1611
         }
1611 1612
 
1612
-    }
1613
-    elseif(geodir_is_page('author')){
1613
+    } elseif(geodir_is_page('author')){
1614 1614
         $gd_page = 'author';
1615 1615
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1616 1616
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1617
-        }else{
1617
+        } else{
1618 1618
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1619 1619
         }
1620 1620
 
@@ -2025,8 +2025,9 @@  discard block
 block discarded – undo
2025 2025
  */
2026 2026
 function geodir_action_add_listing_page_title()
2027 2027
 {
2028
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2029
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2028
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2029
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2030
+    }
2030 2031
     /** This action is documented in geodirectory_template_actions.php */
2031 2032
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2032 2033
     /** This action is documented in geodirectory_template_actions.php */
@@ -2038,7 +2039,7 @@  discard block
 block discarded – undo
2038 2039
         $gd_page = 'add-listing';
2039 2040
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2040 2041
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2041
-        }elseif(isset($listing_type)){
2042
+        } elseif(isset($listing_type)){
2042 2043
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2043 2044
         }
2044 2045
 
@@ -2096,7 +2097,11 @@  discard block
 block discarded – undo
2096 2097
     $required_msg = '';
2097 2098
     $submit_button = '';
2098 2099
 
2099
-    if (isset($_REQUEST['ajax_action'])) $ajax_action = $_REQUEST['ajax_action']; else $ajax_action = 'add';
2100
+    if (isset($_REQUEST['ajax_action'])) {
2101
+        $ajax_action = $_REQUEST['ajax_action'];
2102
+    } else {
2103
+        $ajax_action = 'add';
2104
+    }
2100 2105
 
2101 2106
     $thumb_img_arr = array();
2102 2107
     $curImages = '';
@@ -2335,8 +2340,9 @@  discard block
 block discarded – undo
2335 2340
         $totImg = 0;
2336 2341
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2337 2342
             $post = (object)$gd_session->get('listing');
2338
-            if (isset($post->post_images))
2339
-                $curImages = trim($post->post_images, ",");
2343
+            if (isset($post->post_images)) {
2344
+                            $curImages = trim($post->post_images, ",");
2345
+            }
2340 2346
 
2341 2347
 
2342 2348
             if ($curImages != '') {
@@ -2364,10 +2370,13 @@  discard block
 block discarded – undo
2364 2370
             $totImg = count((array)$thumb_img_arr);
2365 2371
         }
2366 2372
 
2367
-        if ($curImages != '')
2368
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2369
-        else
2370
-            $svalue = '';
2373
+        if ($curImages != '') {
2374
+                    $svalue = $curImages;
2375
+        }
2376
+        // this will be initial value of the above form field. Image urls.
2377
+        else {
2378
+                    $svalue = '';
2379
+        }
2371 2380
 
2372 2381
         $image_limit = $package_info->image_limit;
2373 2382
         $show_image_input_box = ($image_limit != '0');
@@ -2577,8 +2586,9 @@  discard block
 block discarded – undo
2577 2586
     </script><?php
2578 2587
 
2579 2588
     global $errors;
2580
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2581
-        $errors->add('claim_login', LOGIN_CLAIM);
2589
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2590
+            $errors->add('claim_login', LOGIN_CLAIM);
2591
+    }
2582 2592
 
2583 2593
     if (!empty($errors)) {
2584 2594
         foreach ($errors as $errorsObj) {
@@ -2682,8 +2692,9 @@  discard block
 block discarded – undo
2682 2692
 
2683 2693
     if (!empty($term)) {
2684 2694
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2685
-        if (!empty($current_term))
2686
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2695
+        if (!empty($current_term)) {
2696
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2697
+        }
2687 2698
     }
2688 2699
 
2689 2700
 
@@ -2701,7 +2712,7 @@  discard block
 block discarded – undo
2701 2712
         $gd_page = 'author';
2702 2713
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2703 2714
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2704
-        }else{
2715
+        } else{
2705 2716
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2706 2717
         }
2707 2718
 
Please login to merge, or discard this patch.
upgrade.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
 
50
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
50
+    add_action('init', 'gd_fix_cpt_rewrite_slug', 11); // this needs to be kept for a few versions
51 51
 
52 52
     update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
53 53
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * @since 1.0.0
85 85
  * @package GeoDirectory
86 86
  */
87
-function geodir_upgrade_146(){
87
+function geodir_upgrade_146() {
88 88
     gd_convert_virtual_pages();
89 89
 }
90 90
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
  * @since 1.5.0
95 95
  * @package GeoDirectory
96 96
  */
97
-function geodir_upgrade_150(){
97
+function geodir_upgrade_150() {
98 98
     gd_fix_cpt_rewrite_slug();
99 99
 }
100 100
 
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
  * @since 1.4.8
107 107
  * @package GeoDirectory
108 108
  */
109
-function geodir_upgrade_148(){
109
+function geodir_upgrade_148() {
110 110
     /*
111 111
      * Blank the users google password if present as we now use oAuth 2.0
112 112
      */
113
-    update_option('geodir_ga_pass','');
114
-    update_option('geodir_ga_user','');
113
+    update_option('geodir_ga_pass', '');
114
+    update_option('geodir_ga_user', '');
115 115
 
116 116
 }
117 117
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
  * @since 1.5.3
123 123
  * @package GeoDirectory
124 124
  */
125
-function geodir_upgrade_153(){
125
+function geodir_upgrade_153() {
126 126
     geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
127 127
     geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
128 128
 }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @package GeoDirectory
135 135
  */
136
-function geodir_upgrade_154(){
136
+function geodir_upgrade_154() {
137 137
     geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
138 138
 }
139 139
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
  * @since 1.5.2
144 144
  * @package GeoDirectory
145 145
  */
146
-function geodir_upgrade_152(){
146
+function geodir_upgrade_152() {
147 147
     gd_fix_address_detail_table_limit();
148 148
 }
149 149
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
     update_option('gd_theme_compats', $theme_compat);
643 643
 
644
-    gd_set_theme_compat();// set the compat pack if avail
644
+    gd_set_theme_compat(); // set the compat pack if avail
645 645
 }
646 646
 
647 647
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
  * @package GeoDirectory
653 653
  * @global object $wpdb WordPress Database object.
654 654
  */
655
-function gd_convert_virtual_pages(){
655
+function gd_convert_virtual_pages() {
656 656
     global $wpdb;
657 657
 
658 658
     // Update the add listing page settings
@@ -663,9 +663,9 @@  discard block
 block discarded – undo
663 663
         )
664 664
     );
665 665
 
666
-    if($add_listing_page){
667
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
668
-        update_option( 'geodir_add_listing_page', $add_listing_page);
666
+    if ($add_listing_page) {
667
+        wp_update_post(array('ID' => $add_listing_page, 'post_status' => 'publish'));
668
+        update_option('geodir_add_listing_page', $add_listing_page);
669 669
     }
670 670
 
671 671
     // Update the listing preview page settings
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
         )
677 677
     );
678 678
 
679
-    if($listing_preview_page){
680
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
681
-        update_option( 'geodir_preview_page', $listing_preview_page);
679
+    if ($listing_preview_page) {
680
+        wp_update_post(array('ID' => $listing_preview_page, 'post_status' => 'publish'));
681
+        update_option('geodir_preview_page', $listing_preview_page);
682 682
     }
683 683
 
684 684
     // Update the listing success page settings
@@ -689,9 +689,9 @@  discard block
 block discarded – undo
689 689
         )
690 690
     );
691 691
 
692
-    if($listing_success_page){
693
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
694
-        update_option( 'geodir_success_page', $listing_success_page);
692
+    if ($listing_success_page) {
693
+        wp_update_post(array('ID' => $listing_success_page, 'post_status' => 'publish'));
694
+        update_option('geodir_success_page', $listing_success_page);
695 695
     }
696 696
 
697 697
     // Update the listing success page settings
@@ -702,11 +702,11 @@  discard block
 block discarded – undo
702 702
         )
703 703
     );
704 704
 
705
-    if($location_page){
705
+    if ($location_page) {
706 706
         $location_slug = get_option('geodir_location_prefix');
707
-        if(!$location_slug ){$location_slug  = 'location';}
708
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
709
-        update_option( 'geodir_location_page', $location_page);
707
+        if (!$location_slug) {$location_slug = 'location'; }
708
+        wp_update_post(array('ID' => $location_page, 'post_status' => 'publish', 'post_name' => $location_slug));
709
+        update_option('geodir_location_page', $location_page);
710 710
     }
711 711
 
712 712
 }
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
     $post_types = get_option('geodir_post_types');
726 726
 
727 727
 
728
-    if (is_array($post_types)){
728
+    if (is_array($post_types)) {
729 729
 
730 730
         foreach ($post_types as $post_type => $args) {
731 731
 
732 732
 
733
-            if(isset($args['rewrite']['slug'])){
734
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
733
+            if (isset($args['rewrite']['slug'])) {
734
+                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%", "", $args['rewrite']['slug']);
735 735
             }
736 736
 
737 737
                 $alt_post_types[$post_type] = $args;
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
         }
740 740
     }
741 741
 
742
-    if(!empty($alt_post_types)) {
743
-        update_option('geodir_post_types',$alt_post_types);
742
+    if (!empty($alt_post_types)) {
743
+        update_option('geodir_post_types', $alt_post_types);
744 744
         }
745 745
 
746 746
 
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
             // update each GD CTP
768 768
             try {
769 769
                 $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
770
-            } catch(Exception $e) {
771
-                error_log( 'Error: ' . $e->getMessage() );
770
+            } catch (Exception $e) {
771
+                error_log('Error: ' . $e->getMessage());
772 772
             }
773 773
         }
774 774
     }
Please login to merge, or discard this patch.