Test Failed
Push — master ( 599770...4cd501 )
by Stiofan
01:45
created
geodirectory-functions/taxonomy_functions.php 1 patch
Braces   +167 added lines, -119 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 . '">
@@ -159,8 +162,9 @@  discard block
 block discarded – undo
159 162
     if (get_option('geodir_show_addlisting_nav')) {
160 163
 
161 164
         $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
165
+        if (geodir_is_page('add-listing')) {
166
+                    $menu_class = 'current-menu-item';
167
+        }
164 168
 
165 169
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166 170
         $post_types = geodir_get_posttypes('object');
@@ -176,8 +180,9 @@  discard block
 block discarded – undo
176 180
                                 if (geodir_get_addlisting_link($post_type)) {
177 181
 
178 182
                                     $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
183
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
184
+                                                                            $menu_class = 'current-menu-item';
185
+                                    }
181 186
                                     /**
182 187
                                      * Filter the menu li class.
183 188
                                      *
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
                                     if (geodir_get_addlisting_link($post_type)) {
262 267
 
263 268
                                         $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
269
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
270
+                                                                                    $menu_class = 'current-menu-item';
271
+                                        }
266 272
                                         /**
267 273
                                          * Filter the menu li class.
268 274
                                          *
@@ -319,8 +325,9 @@  discard block
 block discarded – undo
319 325
     }
320 326
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 327
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
328
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
329
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
330
+    }
324 331
 
325 332
     return $menu;
326 333
 
@@ -406,24 +413,28 @@  discard block
 block discarded – undo
406 413
     $geodir_post_type = get_query_var('post_type');
407 414
 
408 415
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
-        elseif (isset($_REQUEST['listing_type']))
412
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
416
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
417
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
418
+        } elseif (isset($_REQUEST['listing_type'])) {
419
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
420
+        }
413 421
     }
414 422
 
415
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
423
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
424
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
425
+    }
417 426
 
418
-    if (is_tax())
419
-        $geodir_post_type = geodir_get_taxonomy_posttype();
427
+    if (is_tax()) {
428
+            $geodir_post_type = geodir_get_taxonomy_posttype();
429
+    }
420 430
 
421 431
 
422 432
     $all_postypes = geodir_get_posttypes();
423 433
     $all_postypes = stripslashes_deep($all_postypes);
424 434
 
425
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
-        $geodir_post_type = '';
435
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
436
+            $geodir_post_type = '';
437
+    }
427 438
 
428 439
     if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429 440
         $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
@@ -507,11 +518,12 @@  discard block
 block discarded – undo
507 518
         endswitch;
508 519
     }
509 520
 
510
-    if (!empty($post_types))
511
-        return $post_types;
512
-    else
513
-        return array();
514
-}
521
+    if (!empty($post_types)) {
522
+            return $post_types;
523
+    } else {
524
+            return array();
525
+    }
526
+    }
515 527
 
516 528
 /**
517 529
  * Get Custom Post Type info.
@@ -528,9 +540,10 @@  discard block
 block discarded – undo
528 540
     $post_types = stripslashes_deep($post_types);
529 541
     if (!empty($post_types) && $post_type != '') {
530 542
         return $post_types[$post_type];
531
-    } else
532
-        return false;
533
-}
543
+    } else {
544
+            return false;
545
+    }
546
+    }
534 547
 
535 548
 if (!function_exists('geodir_get_taxonomies')) {
536 549
     /**
@@ -554,18 +567,21 @@  discard block
 block discarded – undo
554 567
             $gd_taxonomies = array_keys($taxonomies);
555 568
 
556 569
 
557
-            if ($post_type != '')
558
-                $gd_taxonomies = array();
570
+            if ($post_type != '') {
571
+                            $gd_taxonomies = array();
572
+            }
559 573
 
560 574
             $i = 0;
561 575
             foreach ($taxonomies as $taxonomy => $args) {
562 576
 
563
-                if ($post_type != '' && $args['object_type'] == $post_type)
564
-                    $gd_taxonomies[] = $taxonomy;
577
+                if ($post_type != '' && $args['object_type'] == $post_type) {
578
+                                    $gd_taxonomies[] = $taxonomy;
579
+                }
565 580
 
566 581
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
567
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
568
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
582
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
583
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
584
+                    }
569 585
                 }
570 586
 
571 587
             }
@@ -620,10 +636,11 @@  discard block
 block discarded – undo
620 636
                 . ucfirst($category_obj->name) . '</option>';
621 637
         }
622 638
 
623
-        if ($echo)
624
-            echo $html;
625
-        else
626
-            return $html;
639
+        if ($echo) {
640
+                    echo $html;
641
+        } else {
642
+                    return $html;
643
+        }
627 644
     }
628 645
 }
629 646
 
@@ -657,11 +674,12 @@  discard block
 block discarded – undo
657 674
 
658 675
     }
659 676
 
660
-    if (!empty($listing_slug))
661
-        return $listing_slug;
662
-    else
663
-        return false;
664
-}
677
+    if (!empty($listing_slug)) {
678
+            return $listing_slug;
679
+    } else {
680
+            return false;
681
+    }
682
+    }
665 683
 
666 684
 
667 685
 /**
@@ -692,16 +710,18 @@  discard block
 block discarded – undo
692 710
     if (!empty($taxonomies)) {
693 711
         foreach (geodir_get_posttypes() as $pt) {
694 712
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
695
-            if (array_intersect($taxonomies, $object_taxonomies))
696
-                $post_type[] = $pt;
713
+            if (array_intersect($taxonomies, $object_taxonomies)) {
714
+                            $post_type[] = $pt;
715
+            }
697 716
         }
698 717
     }
699 718
 
700
-    if (!empty($post_type))
701
-        return $post_type[0];
702
-    else
703
-        return false;
704
-}
719
+    if (!empty($post_type)) {
720
+            return $post_type[0];
721
+    } else {
722
+            return false;
723
+    }
724
+    }
705 725
 
706 726
 if (!function_exists('geodir_custom_taxonomy_walker')) {
707 727
     /**
@@ -757,18 +777,18 @@  discard block
 block discarded – undo
757 777
                 $checked = '';
758 778
 
759 779
                 if (in_array($cat_term->term_id, $search_terms)) {
760
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
761
-                        $checked = 'selected="selected"';
762
-                    else
763
-                        $checked = 'checked="checked"';
780
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
781
+                                            $checked = 'selected="selected"';
782
+                    } else {
783
+                                            $checked = 'checked="checked"';
784
+                    }
764 785
                 }
765 786
 
766
-                if ($cat_display == 'radio')
767
-                    $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>';
768
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
-                    $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>';
770
-
771
-                else {
787
+                if ($cat_display == 'radio') {
788
+                                    $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>';
789
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
790
+                                    $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>';
791
+                } else {
772 792
                     $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>';
773 793
                 }
774 794
 
@@ -777,8 +797,9 @@  discard block
 block discarded – undo
777 797
 
778 798
             }
779 799
 
780
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
781
-                $out .= '</div>';
800
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
801
+                            $out .= '</div>';
802
+            }
782 803
 
783 804
             return $out;
784 805
         }
@@ -804,18 +825,21 @@  discard block
 block discarded – undo
804 825
         global $exclude_cats, $gd_session;
805 826
 
806 827
         $cat_exclude = '';
807
-        if (is_array($exclude_cats) && !empty($exclude_cats))
808
-            $cat_exclude = serialize($exclude_cats);
828
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
829
+                    $cat_exclude = serialize($exclude_cats);
830
+        }
809 831
 
810 832
         if (isset($_REQUEST['backandedit'])) {
811 833
             $post = (object)$gd_session->get('listing');
812 834
 
813
-            if (!is_array($post->post_category[$cat_taxonomy]))
814
-                $post_category = $post->post_category[$cat_taxonomy];
835
+            if (!is_array($post->post_category[$cat_taxonomy])) {
836
+                            $post_category = $post->post_category[$cat_taxonomy];
837
+            }
815 838
 
816 839
             $post_categories = $post->post_category_str;
817
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
818
-                $post_category_str = $post_categories[$cat_taxonomy];
840
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
841
+                            $post_category_str = $post_categories[$cat_taxonomy];
842
+            }
819 843
 
820 844
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
821 845
             global $post;
@@ -1006,8 +1030,9 @@  discard block
 block discarded – undo
1006 1030
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1007 1031
             $post_cat_str = $post_categories[$cat_taxonomy];
1008 1032
             $post_cat_array = explode("#", $post_cat_str);
1009
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1010
-                $style = "display:none;";
1033
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
1034
+                            $style = "display:none;";
1035
+            }
1011 1036
         }
1012 1037
         ?>
1013 1038
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -1042,7 +1067,7 @@  discard block
 block discarded – undo
1042 1067
 
1043 1068
         if(is_array( $exclude_cats)){
1044 1069
             $exclude_cats = array_map( 'intval', $exclude_cats );
1045
-        }else{
1070
+        } else{
1046 1071
             $exclude_cats = intval($exclude_cats);
1047 1072
         }
1048 1073
 
@@ -1072,7 +1097,10 @@  discard block
 block discarded – undo
1072 1097
 
1073 1098
             <div class="post_default_category">
1074 1099
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1075
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1100
+                       onchange="update_listing_cat()" <?php if ($default) {
1101
+	echo ' checked="checked" ';
1102
+}
1103
+?>   />
1076 1104
         <span> 
1077 1105
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1078 1106
         </span>
@@ -1172,8 +1200,9 @@  discard block
 block discarded – undo
1172 1200
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1173 1201
 
1174 1202
         $option_selected = '';
1175
-        if (!$selected)
1176
-            $option_slected = ' selected="selected" ';
1203
+        if (!$selected) {
1204
+                    $option_slected = ' selected="selected" ';
1205
+        }
1177 1206
 
1178 1207
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1179 1208
 
@@ -1181,8 +1210,9 @@  discard block
 block discarded – undo
1181 1210
 
1182 1211
         foreach ($cat_terms as $cat_term) {
1183 1212
             $option_selected = '';
1184
-            if ($selected == $cat_term->term_id)
1185
-                $option_selected = ' selected="selected" ';
1213
+            if ($selected == $cat_term->term_id) {
1214
+                            $option_selected = ' selected="selected" ';
1215
+            }
1186 1216
 
1187 1217
             // Count child terms
1188 1218
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1247,8 +1277,9 @@  discard block
 block discarded – undo
1247 1277
 
1248 1278
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1249 1279
 
1250
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1251
-        $listing_slug = 'places';
1280
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1281
+            $listing_slug = 'places';
1282
+    }
1252 1283
 
1253 1284
     /**
1254 1285
      * Taxonomies
@@ -1398,7 +1429,7 @@  discard block
 block discarded – undo
1398 1429
     //print_r( $segments);
1399 1430
     if($gd_wpml_get_languages){
1400 1431
         $langs = $gd_wpml_get_languages;
1401
-    }else{
1432
+    } else{
1402 1433
         global $sitepress;
1403 1434
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1404 1435
     }
@@ -1551,8 +1582,9 @@  discard block
 block discarded – undo
1551 1582
                             'city_slug' => $post->city_slug
1552 1583
                         );
1553 1584
 
1554
-                    } else
1555
-                        $post_location = geodir_get_location();
1585
+                    } else {
1586
+                                            $post_location = geodir_get_location();
1587
+                    }
1556 1588
 
1557 1589
 
1558 1590
                 } else {
@@ -1581,8 +1613,9 @@  discard block
 block discarded – undo
1581 1613
                             );
1582 1614
 
1583 1615
                         }
1584
-                    } else
1585
-                        $post_location = geodir_get_location();
1616
+                    } else {
1617
+                                            $post_location = geodir_get_location();
1618
+                    }
1586 1619
                 }
1587 1620
 
1588 1621
 
@@ -1625,8 +1658,9 @@  discard block
 block discarded – undo
1625 1658
                         $post_terms = $post_terms[0];
1626 1659
                     }
1627 1660
 
1628
-                    if (!$post_terms)
1629
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1661
+                    if (!$post_terms) {
1662
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1663
+                    }
1630 1664
 
1631 1665
                     if (!$post_terms) {
1632 1666
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1640,8 +1674,9 @@  discard block
 block discarded – undo
1640 1674
 
1641 1675
                 $term = get_term_by('id', $post_terms, $taxonomies);
1642 1676
 
1643
-                if (!empty($term))
1644
-                    $term_request = $term->slug;
1677
+                if (!empty($term)) {
1678
+                                    $term_request = $term->slug;
1679
+                }
1645 1680
                 //$term_request = $term->slug.'/';
1646 1681
             }
1647 1682
 
@@ -1656,15 +1691,20 @@  discard block
 block discarded – undo
1656 1691
                 $request_term .= $term_request;
1657 1692
 
1658 1693
             } else {
1659
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1694
+                if (isset($location_request) && $location_request != '') {
1695
+                	$request_term = $location_request;
1696
+                }
1660 1697
 
1661
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1698
+                if (isset($term_request) && $term_request != '') {
1699
+                	$request_term .= $term_request;
1700
+                }
1662 1701
             }
1663 1702
             $request_term = trim($request_term, '/');
1664
-            if (!empty($request_term))
1665
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1666
-            else
1667
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1703
+            if (!empty($request_term)) {
1704
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1705
+            } else {
1706
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1707
+            }
1668 1708
             //echo $post_link ;
1669 1709
         }
1670 1710
         // temp cache the permalink
@@ -1852,10 +1892,11 @@  discard block
 block discarded – undo
1852 1892
     if (!is_object($obj_post_type)) {
1853 1893
         return;
1854 1894
     }
1855
-    if ($echo)
1856
-        echo $obj_post_type->labels->singular_name;
1857
-    else
1858
-        return $obj_post_type->labels->singular_name;
1895
+    if ($echo) {
1896
+            echo $obj_post_type->labels->singular_name;
1897
+    } else {
1898
+            return $obj_post_type->labels->singular_name;
1899
+    }
1859 1900
 
1860 1901
 }
1861 1902
 
@@ -1872,14 +1913,16 @@  discard block
 block discarded – undo
1872 1913
 {
1873 1914
     $all_postypes = geodir_get_posttypes();
1874 1915
 
1875
-    if (!in_array($post_type, $all_postypes))
1876
-        return false;
1916
+    if (!in_array($post_type, $all_postypes)) {
1917
+            return false;
1918
+    }
1877 1919
 
1878 1920
     $obj_post_type = get_post_type_object($post_type);
1879
-    if ($echo)
1880
-        echo $obj_post_type->labels->name;
1881
-    else
1882
-        return $obj_post_type->labels->name;
1921
+    if ($echo) {
1922
+            echo $obj_post_type->labels->name;
1923
+    } else {
1924
+            return $obj_post_type->labels->name;
1925
+    }
1883 1926
 
1884 1927
 }
1885 1928
 
@@ -1904,19 +1947,22 @@  discard block
 block discarded – undo
1904 1947
     $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 ";
1905 1948
 
1906 1949
     if (is_int($term)) {
1907
-        if (0 == $term)
1908
-            return 0;
1950
+        if (0 == $term) {
1951
+                    return 0;
1952
+        }
1909 1953
         $where = 't.term_id = %d';
1910
-        if (!empty($taxonomy))
1911
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912
-        else
1913
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1954
+        if (!empty($taxonomy)) {
1955
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1956
+        } else {
1957
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1958
+        }
1914 1959
     }
1915 1960
 
1916 1961
     $term = trim(wp_unslash($term));
1917 1962
 
1918
-    if ('' === $slug = sanitize_title($term))
1919
-        return 0;
1963
+    if ('' === $slug = sanitize_title($term)) {
1964
+            return 0;
1965
+    }
1920 1966
 
1921 1967
     $where = 't.slug = %s';
1922 1968
 
@@ -1933,14 +1979,16 @@  discard block
 block discarded – undo
1933 1979
         $where_fields[] = $taxonomy;
1934 1980
 
1935 1981
 
1936
-        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))
1937
-            return $result;
1982
+        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)) {
1983
+                    return $result;
1984
+        }
1938 1985
 
1939 1986
         return false;
1940 1987
     }
1941 1988
 
1942
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1943
-        return $result;
1989
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
1990
+            return $result;
1991
+    }
1944 1992
 
1945 1993
     return false;
1946 1994
 }
Please login to merge, or discard this patch.