Test Failed
Push — master ( a009ab...d306a2 )
by Stiofan
17:22
created
geodirectory_hooks_actions.php 1 patch
Braces   +88 added lines, -71 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 add_filter('query_vars', 'geodir_add_location_var');
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89
-if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
89
+if (get_option('permalink_structure') != '') {
90
+    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91
+}
91 92
 
92 93
 add_filter('parse_query', 'geodir_modified_query');
93 94
 
@@ -421,8 +422,9 @@  discard block
 block discarded – undo
421 422
      */
422 423
     do_action('geodir_after_social_sharing_buttons');
423 424
     $content_html = ob_get_clean();
424
-    if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
+    if (trim($content_html) != '') {
426
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
427
+    }
426 428
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427 429
         /**
428 430
          * Filter the geodir_social_sharing_buttons() function content.
@@ -478,8 +480,9 @@  discard block
 block discarded – undo
478 480
      */
479 481
     do_action('geodir_after_edit_post_link');
480 482
     $content_html = ob_get_clean();
481
-    if (trim($content_html) != '')
482
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
483
+    if (trim($content_html) != '') {
484
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
485
+    }
483 486
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
484 487
         /**
485 488
          * Filter the geodir_edit_post_link() function content.
@@ -1053,8 +1056,9 @@  discard block
 block discarded – undo
1053 1056
      */
1054 1057
     do_action('geodir_after_google_analytics');
1055 1058
     $content_html = ob_get_clean();
1056
-    if (trim($content_html) != '')
1057
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1059
+    if (trim($content_html) != '') {
1060
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1061
+    }
1058 1062
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1059 1063
         /**
1060 1064
          * Filter the geodir_edit_post_link() function content.
@@ -1196,8 +1200,9 @@  discard block
 block discarded – undo
1196 1200
     do_action('geodir_after_detail_page_more_info');
1197 1201
 
1198 1202
     $content_html = ob_get_clean();
1199
-    if (trim($content_html) != '')
1200
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1203
+    if (trim($content_html) != '') {
1204
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1205
+    }
1201 1206
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1202 1207
         /**
1203 1208
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1324,8 +1329,9 @@  discard block
 block discarded – undo
1324 1329
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1325 1330
 
1326 1331
     foreach ($arr_alert_msg as $key => $value) {
1327
-        if (!is_scalar($value))
1328
-            continue;
1332
+        if (!is_scalar($value)) {
1333
+                    continue;
1334
+        }
1329 1335
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1330 1336
     }
1331 1337
 
@@ -1381,17 +1387,19 @@  discard block
 block discarded – undo
1381 1387
     global $geodir_sidebars;
1382 1388
     global $sidebars_widgets;
1383 1389
 
1384
-    if (!is_array($sidebars_widgets))
1385
-        $sidebars_widgets = wp_get_sidebars_widgets();
1390
+    if (!is_array($sidebars_widgets)) {
1391
+            $sidebars_widgets = wp_get_sidebars_widgets();
1392
+    }
1386 1393
     $geodir_old_sidebars = array();
1387 1394
 
1388 1395
     if (is_array($geodir_sidebars)) {
1389 1396
         foreach ($geodir_sidebars as $val) {
1390 1397
             if (is_array($sidebars_widgets)) {
1391
-                if (array_key_exists($val, $sidebars_widgets))
1392
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1393
-                else
1394
-                    $geodir_old_sidebars[$val] = array();
1398
+                if (array_key_exists($val, $sidebars_widgets)) {
1399
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1400
+                } else {
1401
+                                    $geodir_old_sidebars[$val] = array();
1402
+                }
1395 1403
             }
1396 1404
         }
1397 1405
     }
@@ -1412,16 +1420,19 @@  discard block
 block discarded – undo
1412 1420
 {
1413 1421
     global $sidebars_widgets;
1414 1422
 
1415
-    if (!is_array($sidebars_widgets))
1416
-        $sidebars_widgets = wp_get_sidebars_widgets();
1423
+    if (!is_array($sidebars_widgets)) {
1424
+            $sidebars_widgets = wp_get_sidebars_widgets();
1425
+    }
1417 1426
 
1418 1427
     if (is_array($sidebars_widgets)) {
1419 1428
         $geodir_old_sidebars = get_option('geodir_sidebars');
1420 1429
         if (is_array($geodir_old_sidebars)) {
1421 1430
             foreach ($geodir_old_sidebars as $key => $val) {
1422
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1431
+                if(0 === strpos($key, 'geodir_')) {
1432
+                	// if gd widget
1423 1433
                 {
1424
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1434
+                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1435
+                }
1425 1436
                 }
1426 1437
 
1427 1438
 
@@ -1557,20 +1568,25 @@  discard block
 block discarded – undo
1557 1568
         }
1558 1569
     }
1559 1570
     
1560
-    if ($tab == 'post_info')
1561
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1571
+    if ($tab == 'post_info') {
1572
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1573
+    }
1562 1574
     
1563
-    if ($tab == 'post_images')
1564
-        $is_display = (!empty($post_images)) ? true : false;
1575
+    if ($tab == 'post_images') {
1576
+            $is_display = (!empty($post_images)) ? true : false;
1577
+    }
1565 1578
 
1566
-    if ($tab == 'post_video')
1567
-        $is_display = (!empty($video)) ? true : false;
1579
+    if ($tab == 'post_video') {
1580
+            $is_display = (!empty($video)) ? true : false;
1581
+    }
1568 1582
 
1569
-    if ($tab == 'special_offers')
1570
-        $is_display = (!empty($special_offers)) ? true : false;
1583
+    if ($tab == 'special_offers') {
1584
+            $is_display = (!empty($special_offers)) ? true : false;
1585
+    }
1571 1586
 
1572
-    if ($tab == 'reviews')
1573
-        $is_display = (geodir_is_page('detail')) ? true : false;
1587
+    if ($tab == 'reviews') {
1588
+            $is_display = (geodir_is_page('detail')) ? true : false;
1589
+    }
1574 1590
 
1575 1591
     if ($tab == 'related_listing') {
1576 1592
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1804,11 +1820,13 @@  discard block
 block discarded – undo
1804 1820
     $region_slug = $default_location->region_slug;
1805 1821
     $city_slug = $default_location->city_slug;
1806 1822
 
1807
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1808
-        return $slug_exists = true;
1823
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1824
+            return $slug_exists = true;
1825
+    }
1809 1826
 
1810
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1811
-        return $slug_exists = true;
1827
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1828
+            return $slug_exists = true;
1829
+    }
1812 1830
 
1813 1831
     return $slug_exists;
1814 1832
 }
@@ -1851,40 +1869,31 @@  discard block
 block discarded – undo
1851 1869
     if(geodir_is_page('home')){
1852 1870
         $gd_page = 'home';
1853 1871
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1854
-    }
1855
-    elseif(geodir_is_page('detail')){
1872
+    } elseif(geodir_is_page('detail')){
1856 1873
         $gd_page = 'detail';
1857 1874
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1858
-    }
1859
-    elseif(geodir_is_page('pt')){
1875
+    } elseif(geodir_is_page('pt')){
1860 1876
         $gd_page = 'pt';
1861 1877
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1862
-    }
1863
-    elseif(geodir_is_page('listing')){
1878
+    } elseif(geodir_is_page('listing')){
1864 1879
         $gd_page = 'listing';
1865 1880
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1866
-    }
1867
-    elseif(geodir_is_page('location')){
1881
+    } elseif(geodir_is_page('location')){
1868 1882
         $gd_page = 'location';
1869 1883
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1870
-    }
1871
-    elseif(geodir_is_page('search')){
1884
+    } elseif(geodir_is_page('search')){
1872 1885
         $gd_page = 'search';
1873 1886
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1874
-    }
1875
-    elseif(geodir_is_page('add-listing')){
1887
+    } elseif(geodir_is_page('add-listing')){
1876 1888
         $gd_page = 'add-listing';
1877 1889
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1878
-    }
1879
-    elseif(geodir_is_page('author')){
1890
+    } elseif(geodir_is_page('author')){
1880 1891
         $gd_page = 'author';
1881 1892
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1882
-    }
1883
-    elseif(geodir_is_page('login')){
1893
+    } elseif(geodir_is_page('login')){
1884 1894
         $gd_page = 'login';
1885 1895
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1886
-    }
1887
-    elseif(geodir_is_page('listing-success')){
1896
+    } elseif(geodir_is_page('listing-success')){
1888 1897
         $gd_page = 'listing-success';
1889 1898
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1890 1899
     }
@@ -1962,11 +1971,13 @@  discard block
 block discarded – undo
1962 1971
 
1963 1972
     if (!get_option('geodir_remove_url_seperator')) {
1964 1973
 
1965
-        if (get_option('geodir_listingurl_separator'))
1966
-            delete_option('geodir_listingurl_separator');
1974
+        if (get_option('geodir_listingurl_separator')) {
1975
+                    delete_option('geodir_listingurl_separator');
1976
+        }
1967 1977
 
1968
-        if (get_option('geodir_detailurl_separator'))
1969
-            delete_option('geodir_detailurl_separator');
1978
+        if (get_option('geodir_detailurl_separator')) {
1979
+                    delete_option('geodir_detailurl_separator');
1980
+        }
1970 1981
 
1971 1982
         flush_rewrite_rules(false);
1972 1983
 
@@ -1990,8 +2001,9 @@  discard block
 block discarded – undo
1990 2001
 {
1991 2002
     foreach ($permalink_arr as $key => $value) {
1992 2003
 
1993
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1994
-            unset($permalink_arr[$key]);
2004
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2005
+                    unset($permalink_arr[$key]);
2006
+        }
1995 2007
 
1996 2008
     }
1997 2009
 
@@ -2126,16 +2138,18 @@  discard block
 block discarded – undo
2126 2138
 
2127 2139
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2128 2140
 
2129
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2130
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2141
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2142
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2143
+            }
2131 2144
         }
2132 2145
 
2133 2146
         if (array_key_exists('special_offers', $tabs_arr)) {
2134 2147
 
2135 2148
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2136 2149
 
2137
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2138
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2150
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2151
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2152
+            }
2139 2153
         }
2140 2154
 
2141 2155
     }
@@ -2190,8 +2204,9 @@  discard block
 block discarded – undo
2190 2204
 
2191 2205
         $all_postypes = geodir_get_posttypes();
2192 2206
 
2193
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2194
-            return false;
2207
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2208
+                    return false;
2209
+        }
2195 2210
 
2196 2211
         $uploads = wp_upload_dir();
2197 2212
 
@@ -2265,8 +2280,9 @@  discard block
 block discarded – undo
2265 2280
                         $file_info = pathinfo($attach->file);
2266 2281
 
2267 2282
                         $sub_dir = '';
2268
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2269
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2283
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2284
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2285
+                        }
2270 2286
 
2271 2287
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2272 2288
                         $uploads_path = $uploads['basedir'];
@@ -2287,8 +2303,9 @@  discard block
 block discarded – undo
2287 2303
 
2288 2304
                     if (!empty($attachment_data)) {
2289 2305
 
2290
-                        if ($attachment_data->ID)
2291
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2306
+                        if ($attachment_data->ID) {
2307
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2308
+                        }
2292 2309
 
2293 2310
                     } else {
2294 2311
 
@@ -2481,7 +2498,7 @@  discard block
 block discarded – undo
2481 2498
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2482 2499
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2483 2500
 
2484
-                    }else{
2501
+                    } else{
2485 2502
                         $i = 0;
2486 2503
                         $fieldset_count++;
2487 2504
                         $field_set_start = 1;
Please login to merge, or discard this patch.