Passed
Pull Request — master (#223)
by Kiran
15:09
created
geodirectory_hooks_actions.php 1 patch
Braces   +92 added lines, -74 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
 
@@ -420,8 +421,9 @@  discard block
 block discarded – undo
420 421
      */
421 422
     do_action('geodir_after_social_sharing_buttons');
422 423
     $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
424
+    if (trim($content_html) != '') {
425
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+    }
425 427
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426 428
         /**
427 429
          * Filter the geodir_social_sharing_buttons() function content.
@@ -467,8 +469,9 @@  discard block
 block discarded – undo
467 469
      */
468 470
     do_action('geodir_after_share_this_button');
469 471
     $content_html = ob_get_clean();
470
-    if (trim($content_html) != '')
471
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
+    if (trim($content_html) != '') {
473
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
474
+    }
472 475
     if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473 476
         /**
474 477
          * Filter the geodir_share_this_button() function content.
@@ -523,8 +526,9 @@  discard block
 block discarded – undo
523 526
      */
524 527
     do_action('geodir_after_edit_post_link');
525 528
     $content_html = ob_get_clean();
526
-    if (trim($content_html) != '')
527
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
+    if (trim($content_html) != '') {
530
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
531
+    }
528 532
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
529 533
         /**
530 534
          * Filter the geodir_edit_post_link() function content.
@@ -1090,8 +1094,9 @@  discard block
 block discarded – undo
1090 1094
      */
1091 1095
     do_action('geodir_after_google_analytics');
1092 1096
     $content_html = ob_get_clean();
1093
-    if (trim($content_html) != '')
1094
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1097
+    if (trim($content_html) != '') {
1098
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1099
+    }
1095 1100
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1096 1101
         /**
1097 1102
          * Filter the geodir_edit_post_link() function content.
@@ -1226,8 +1231,9 @@  discard block
 block discarded – undo
1226 1231
     do_action('geodir_after_detail_page_more_info');
1227 1232
 
1228 1233
     $content_html = ob_get_clean();
1229
-    if (trim($content_html) != '')
1230
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1234
+    if (trim($content_html) != '') {
1235
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1236
+    }
1231 1237
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1232 1238
         /**
1233 1239
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1334,8 +1340,9 @@  discard block
 block discarded – undo
1334 1340
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1335 1341
 
1336 1342
     foreach ($arr_alert_msg as $key => $value) {
1337
-        if (!is_scalar($value))
1338
-            continue;
1343
+        if (!is_scalar($value)) {
1344
+                    continue;
1345
+        }
1339 1346
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1340 1347
     }
1341 1348
 
@@ -1389,17 +1396,19 @@  discard block
 block discarded – undo
1389 1396
     global $geodir_sidebars;
1390 1397
     global $sidebars_widgets;
1391 1398
 
1392
-    if (!is_array($sidebars_widgets))
1393
-        $sidebars_widgets = wp_get_sidebars_widgets();
1399
+    if (!is_array($sidebars_widgets)) {
1400
+            $sidebars_widgets = wp_get_sidebars_widgets();
1401
+    }
1394 1402
     $geodir_old_sidebars = array();
1395 1403
 
1396 1404
     if (is_array($geodir_sidebars)) {
1397 1405
         foreach ($geodir_sidebars as $val) {
1398 1406
             if (is_array($sidebars_widgets)) {
1399
-                if (array_key_exists($val, $sidebars_widgets))
1400
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1401
-                else
1402
-                    $geodir_old_sidebars[$val] = array();
1407
+                if (array_key_exists($val, $sidebars_widgets)) {
1408
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1409
+                } else {
1410
+                                    $geodir_old_sidebars[$val] = array();
1411
+                }
1403 1412
             }
1404 1413
         }
1405 1414
     }
@@ -1420,8 +1429,9 @@  discard block
 block discarded – undo
1420 1429
 {
1421 1430
     global $sidebars_widgets;
1422 1431
 
1423
-    if (!is_array($sidebars_widgets))
1424
-        $sidebars_widgets = wp_get_sidebars_widgets();
1432
+    if (!is_array($sidebars_widgets)) {
1433
+            $sidebars_widgets = wp_get_sidebars_widgets();
1434
+    }
1425 1435
 
1426 1436
     if (is_array($sidebars_widgets)) {
1427 1437
         $geodir_old_sidebars = get_option('geodir_sidebars');
@@ -1571,20 +1581,25 @@  discard block
 block discarded – undo
1571 1581
         }
1572 1582
     }
1573 1583
     
1574
-    if ($tab == 'post_info')
1575
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1584
+    if ($tab == 'post_info') {
1585
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1586
+    }
1576 1587
 
1577
-    if ($tab == 'post_images')
1578
-        $is_display = (!empty($post_images)) ? true : false;
1588
+    if ($tab == 'post_images') {
1589
+            $is_display = (!empty($post_images)) ? true : false;
1590
+    }
1579 1591
 
1580
-    if ($tab == 'post_video')
1581
-        $is_display = (!empty($video)) ? true : false;
1592
+    if ($tab == 'post_video') {
1593
+            $is_display = (!empty($video)) ? true : false;
1594
+    }
1582 1595
 
1583
-    if ($tab == 'special_offers')
1584
-        $is_display = (!empty($special_offers)) ? true : false;
1596
+    if ($tab == 'special_offers') {
1597
+            $is_display = (!empty($special_offers)) ? true : false;
1598
+    }
1585 1599
 
1586
-    if ($tab == 'reviews')
1587
-        $is_display = (geodir_is_page('detail')) ? true : false;
1600
+    if ($tab == 'reviews') {
1601
+            $is_display = (geodir_is_page('detail')) ? true : false;
1602
+    }
1588 1603
 
1589 1604
     if ($tab == 'related_listing') {
1590 1605
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1818,11 +1833,13 @@  discard block
 block discarded – undo
1818 1833
     $region_slug = $default_location->region_slug;
1819 1834
     $city_slug = $default_location->city_slug;
1820 1835
 
1821
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1822
-        return $slug_exists = true;
1836
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1837
+            return $slug_exists = true;
1838
+    }
1823 1839
 
1824
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1825
-        return $slug_exists = true;
1840
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1841
+            return $slug_exists = true;
1842
+    }
1826 1843
 
1827 1844
     return $slug_exists;
1828 1845
 }
@@ -1864,40 +1881,31 @@  discard block
 block discarded – undo
1864 1881
     if(geodir_is_page('home')){
1865 1882
         $gd_page = 'home';
1866 1883
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('detail')){
1884
+    } elseif(geodir_is_page('detail')){
1869 1885
         $gd_page = 'detail';
1870 1886
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('pt')){
1887
+    } elseif(geodir_is_page('pt')){
1873 1888
         $gd_page = 'pt';
1874 1889
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('listing')){
1890
+    } elseif(geodir_is_page('listing')){
1877 1891
         $gd_page = 'listing';
1878 1892
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('location')){
1893
+    } elseif(geodir_is_page('location')){
1881 1894
         $gd_page = 'location';
1882 1895
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('search')){
1896
+    } elseif(geodir_is_page('search')){
1885 1897
         $gd_page = 'search';
1886 1898
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('add-listing')){
1899
+    } elseif(geodir_is_page('add-listing')){
1889 1900
         $gd_page = 'add-listing';
1890 1901
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('author')){
1902
+    } elseif(geodir_is_page('author')){
1893 1903
         $gd_page = 'author';
1894 1904
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1895
-    }
1896
-    elseif(geodir_is_page('login')){
1905
+    } elseif(geodir_is_page('login')){
1897 1906
         $gd_page = 'login';
1898 1907
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1899
-    }
1900
-    elseif(geodir_is_page('listing-success')){
1908
+    } elseif(geodir_is_page('listing-success')){
1901 1909
         $gd_page = 'listing-success';
1902 1910
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1903 1911
     }
@@ -1972,11 +1980,13 @@  discard block
 block discarded – undo
1972 1980
 
1973 1981
     if (!get_option('geodir_remove_url_seperator')) {
1974 1982
 
1975
-        if (get_option('geodir_listingurl_separator'))
1976
-            delete_option('geodir_listingurl_separator');
1983
+        if (get_option('geodir_listingurl_separator')) {
1984
+                    delete_option('geodir_listingurl_separator');
1985
+        }
1977 1986
 
1978
-        if (get_option('geodir_detailurl_separator'))
1979
-            delete_option('geodir_detailurl_separator');
1987
+        if (get_option('geodir_detailurl_separator')) {
1988
+                    delete_option('geodir_detailurl_separator');
1989
+        }
1980 1990
 
1981 1991
         flush_rewrite_rules(false);
1982 1992
 
@@ -2000,8 +2010,9 @@  discard block
 block discarded – undo
2000 2010
 {
2001 2011
     foreach ($permalink_arr as $key => $value) {
2002 2012
 
2003
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2004
-            unset($permalink_arr[$key]);
2013
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2014
+                    unset($permalink_arr[$key]);
2015
+        }
2005 2016
 
2006 2017
     }
2007 2018
 
@@ -2133,16 +2144,18 @@  discard block
 block discarded – undo
2133 2144
 
2134 2145
             $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)));
2135 2146
 
2136
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2137
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2147
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2148
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2149
+            }
2138 2150
         }
2139 2151
 
2140 2152
         if (array_key_exists('special_offers', $tabs_arr)) {
2141 2153
 
2142 2154
             $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)));
2143 2155
 
2144
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2145
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2156
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2157
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2158
+            }
2146 2159
         }
2147 2160
 
2148 2161
     }
@@ -2197,8 +2210,9 @@  discard block
 block discarded – undo
2197 2210
 
2198 2211
         $all_postypes = geodir_get_posttypes();
2199 2212
 
2200
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2201
-            return false;
2213
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2214
+                    return false;
2215
+        }
2202 2216
 
2203 2217
         $uploads = wp_upload_dir();
2204 2218
 
@@ -2272,8 +2286,9 @@  discard block
 block discarded – undo
2272 2286
                         $file_info = pathinfo($attach->file);
2273 2287
 
2274 2288
                         $sub_dir = '';
2275
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2276
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2289
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2290
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2291
+                        }
2277 2292
 
2278 2293
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2279 2294
                         $uploads_path = $uploads['basedir'];
@@ -2294,8 +2309,9 @@  discard block
 block discarded – undo
2294 2309
 
2295 2310
                     if (!empty($attachment_data)) {
2296 2311
 
2297
-                        if ($attachment_data->ID)
2298
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2312
+                        if ($attachment_data->ID) {
2313
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2314
+                        }
2299 2315
 
2300 2316
                     } else {
2301 2317
 
@@ -2542,8 +2558,9 @@  discard block
 block discarded – undo
2542 2558
                             break;
2543 2559
                         case 'time': {
2544 2560
                             $value = '';
2545
-                            if ($post->$type['htmlvar_name'] != '')
2546
-                                $value = date_i18n(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2561
+                            if ($post->$type['htmlvar_name'] != '') {
2562
+                                                            $value = date_i18n(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2563
+                            }
2547 2564
 
2548 2565
                             if (strpos($field_icon, 'http') !== false) {
2549 2566
                                 $field_icon_af = '';
@@ -2578,8 +2595,9 @@  discard block
 block discarded – undo
2578 2595
                             $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2579 2596
 
2580 2597
                             $value = '';
2581
-                            if ($post->$type['htmlvar_name'] != '')
2582
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2598
+                            if ($post->$type['htmlvar_name'] != '') {
2599
+                                                            $value = date($date_format, strtotime($post_htmlvar_value));
2600
+                            }
2583 2601
 
2584 2602
                             if (strpos($field_icon, 'http') !== false) {
2585 2603
                                 $field_icon_af = '';
Please login to merge, or discard this patch.