Test Failed
Push — master ( 059a70...a017c6 )
by Stiofan
04:47 queued 11s
created
geodirectory-admin/admin_hooks_actions.php 1 patch
Braces   +61 added lines, -54 removed lines patch added patch discarded remove patch
@@ -24,8 +24,11 @@  discard block
 block discarded – undo
24 24
             global $current_tab;
25 25
             geodir_redirect_to_admin_panel_on_installed();
26 26
             $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
-            if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
27
+            if (!(isset($_REQUEST['action']))) {
28
+            	// this will avoid Ajax requests
29
+                geodir_handle_option_form_submit($current_tab);
30
+            }
31
+            // located in admin function.php
29 32
             /**
30 33
              * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31 34
              *
@@ -324,8 +327,9 @@  discard block
 block discarded – undo
324 327
     if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
325 328
 
326 329
         foreach ($notification as $key => $value) {
327
-            if ($value['type'] == 'textarea')
328
-                $notification[$key]['type'] = 'editor';
330
+            if ($value['type'] == 'textarea') {
331
+                            $notification[$key]['type'] = 'editor';
332
+            }
329 333
         }
330 334
 
331 335
     }
@@ -350,8 +354,9 @@  discard block
 block discarded – undo
350 354
     if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
351 355
 
352 356
         foreach ($design_setting as $key => $value) {
353
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
354
-                $design_setting[$key]['type'] = 'editor';
357
+            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') {
358
+                            $design_setting[$key]['type'] = 'editor';
359
+            }
355 360
         }
356 361
 
357 362
     }
@@ -470,9 +475,9 @@  discard block
 block discarded – undo
470 475
                    class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
471 476
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
472 477
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
473
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
478
+                    } elseif(isset($val['field_icon']) && $val['field_icon'] ){
474 479
                         echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
475
-                    }else{
480
+                    } else{
476 481
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
477 482
                     }?>
478 483
                     <?php echo $val['site_title'];?>
@@ -702,9 +707,9 @@  discard block
 block discarded – undo
702 707
         <?php
703 708
         if($type=='predefined'){
704 709
             $cfs = geodir_custom_fields_predefined($listing_type);
705
-        }elseif($type=='custom'){
710
+        } elseif($type=='custom'){
706 711
             $cfs = geodir_custom_fields_custom($listing_type);
707
-        }else{
712
+        } else{
708 713
             $cfs = geodir_custom_fields($listing_type);
709 714
             ?>
710 715
             <ul class="full gd-cf-tooltip-wrap">
@@ -759,7 +764,7 @@  discard block
 block discarded – undo
759 764
             </li>
760 765
             <?php
761 766
         }
762
-    }else{
767
+    } else{
763 768
         _e('There are no custom fields here yet.', 'geodirectory');
764 769
     }
765 770
         ?>
@@ -956,8 +961,9 @@  discard block
 block discarded – undo
956 961
 
957 962
     if (!get_option('geodir_remove_unnecessary_fields')) {
958 963
 
959
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
960
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
964
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
965
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
966
+        }
961 967
 
962 968
         update_option('geodir_remove_unnecessary_fields', '1');
963 969
 
@@ -993,8 +999,9 @@  discard block
 block discarded – undo
993 999
                 break;
994 1000
 
995 1001
             case 'diagnosis-fix' :
996
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
997
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
1002
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
1003
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
1004
+                }
998 1005
                 call_user_func('geodir_diagnose_' . $diagnose_this);
999 1006
                 exit();
1000 1007
                 break;
@@ -1609,11 +1616,11 @@  discard block
 block discarded – undo
1609 1616
     //////////////////////////////////
1610 1617
     $option_value = get_option('geodir_home_page');
1611 1618
     $page = get_post($option_value);
1612
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1619
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1613 1620
 
1614
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1615
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1616
-    else {
1621
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1622
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1623
+    } else {
1617 1624
         $is_error_during_diagnose = true;
1618 1625
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1619 1626
         if ($fix) {
@@ -1634,11 +1641,11 @@  discard block
 block discarded – undo
1634 1641
     //////////////////////////////////
1635 1642
     $option_value = get_option('geodir_add_listing_page');
1636 1643
     $page = get_post($option_value);
1637
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1644
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1638 1645
 
1639
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1640
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1641
-    else {
1646
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1647
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1648
+    } else {
1642 1649
         $is_error_during_diagnose = true;
1643 1650
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1644 1651
         if ($fix) {
@@ -1660,11 +1667,11 @@  discard block
 block discarded – undo
1660 1667
     //////////////////////////////////
1661 1668
     $option_value = get_option('geodir_preview_page');
1662 1669
     $page = get_post($option_value);
1663
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1670
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1664 1671
 
1665
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1666
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1667
-    else {
1672
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1673
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1674
+    } else {
1668 1675
         $is_error_during_diagnose = true;
1669 1676
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1670 1677
         if ($fix) {
@@ -1685,11 +1692,11 @@  discard block
 block discarded – undo
1685 1692
     //////////////////////////////////
1686 1693
     $option_value = get_option('geodir_success_page');
1687 1694
     $page = get_post($option_value);
1688
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1695
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1689 1696
 
1690
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1691
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1692
-    else {
1697
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1698
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1699
+    } else {
1693 1700
         $is_error_during_diagnose = true;
1694 1701
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1695 1702
         if ($fix) {
@@ -1710,11 +1717,11 @@  discard block
 block discarded – undo
1710 1717
     //////////////////////////////////
1711 1718
     $option_value = get_option('geodir_info_page');
1712 1719
     $page = get_post($option_value);
1713
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1720
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1714 1721
 
1715
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1716
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1717
-    else {
1722
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1723
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1724
+    } else {
1718 1725
         $is_error_during_diagnose = true;
1719 1726
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1720 1727
         if ($fix) {
@@ -1735,11 +1742,11 @@  discard block
 block discarded – undo
1735 1742
     //////////////////////////////////
1736 1743
     $option_value = get_option('geodir_login_page');
1737 1744
     $page = get_post($option_value);
1738
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1745
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1739 1746
 
1740
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1741
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1742
-    else {
1747
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1748
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1749
+    } else {
1743 1750
         $is_error_during_diagnose = true;
1744 1751
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1745 1752
         if ($fix) {
@@ -1760,11 +1767,11 @@  discard block
 block discarded – undo
1760 1767
     //////////////////////////////////
1761 1768
     $option_value = get_option('geodir_location_page');
1762 1769
     $page = get_post($option_value);
1763
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1770
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1764 1771
 
1765
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1766
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1767
-    else {
1772
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1773
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1774
+    } else {
1768 1775
         $is_error_during_diagnose = true;
1769 1776
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1770 1777
         if ($fix) {
@@ -2209,8 +2216,9 @@  discard block
 block discarded – undo
2209 2216
                             );
2210 2217
 
2211 2218
                             $post_location_info = $request_info['post_location'];
2212
-                            if ($location_id = geodir_add_new_location($post_location_info))
2213
-                                $post_location_id = $location_id;
2219
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
2220
+                                                            $post_location_id = $location_id;
2221
+                            }
2214 2222
                         } else {
2215 2223
                             $post_location_id = 0;
2216 2224
                         }
@@ -2273,8 +2281,9 @@  discard block
 block discarded – undo
2273 2281
                             $attachment_set = '';
2274 2282
 
2275 2283
                             foreach ($attachment as $key => $val) {
2276
-                                if ($val != '')
2277
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2284
+                                if ($val != '') {
2285
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
2286
+                                }
2278 2287
                             }
2279 2288
                             $attachment_set = trim($attachment_set, ", ");
2280 2289
 
@@ -2370,8 +2379,7 @@  discard block
 block discarded – undo
2370 2379
 
2371 2380
         $parts = json_decode($response['body']);
2372 2381
         //print_r($parts);
2373
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2374
-        else{
2382
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2375 2383
 
2376 2384
             update_option('gd_ga_access_token', $parts->access_token);
2377 2385
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2379,17 +2387,16 @@  discard block
 block discarded – undo
2379 2387
         }
2380 2388
 
2381 2389
 
2382
-    }
2383
-    elseif(!empty($response['response']['code'])) {
2390
+    } elseif(!empty($response['response']['code'])) {
2384 2391
         $parts = json_decode($response['body']);
2385 2392
 
2386 2393
         if(isset($parts->error)){
2387 2394
             echo $parts->error.": ".$parts->error_description;exit;
2388
-        }else{
2395
+        } else{
2389 2396
             echo $error_msg." - #2";exit;
2390 2397
         }
2391 2398
 
2392
-    }else{
2399
+    } else{
2393 2400
 
2394 2401
         echo $error_msg." - #3";exit;
2395 2402
 
@@ -2527,7 +2534,7 @@  discard block
 block discarded – undo
2527 2534
         ob_start();
2528 2535
         geodir_diagnose_version_clear();
2529 2536
         ob_end_clean();
2530
-    }else{
2537
+    } else{
2531 2538
         $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
2532 2539
     }
2533 2540
 
Please login to merge, or discard this patch.