Passed
Push — master ( 905d4c...9c92c6 )
by Stiofan
09:42
created
geodirectory_hooks_actions.php 1 patch
Braces   +96 added lines, -76 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.
@@ -468,8 +470,9 @@  discard block
 block discarded – undo
468 470
      */
469 471
     do_action('geodir_after_share_this_button');
470 472
     $content_html = ob_get_clean();
471
-    if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
+    if (trim($content_html) != '') {
474
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
475
+    }
473 476
     if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474 477
         /**
475 478
          * Filter the geodir_share_this_button() function content.
@@ -524,8 +527,9 @@  discard block
 block discarded – undo
524 527
      */
525 528
     do_action('geodir_after_edit_post_link');
526 529
     $content_html = ob_get_clean();
527
-    if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
530
+    if (trim($content_html) != '') {
531
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
532
+    }
529 533
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
530 534
         /**
531 535
          * Filter the geodir_edit_post_link() function content.
@@ -1098,8 +1102,9 @@  discard block
 block discarded – undo
1098 1102
      */
1099 1103
     do_action('geodir_after_google_analytics');
1100 1104
     $content_html = ob_get_clean();
1101
-    if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1105
+    if (trim($content_html) != '') {
1106
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1107
+    }
1103 1108
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104 1109
         /**
1105 1110
          * Filter the geodir_edit_post_link() function content.
@@ -1236,8 +1241,9 @@  discard block
 block discarded – undo
1236 1241
     do_action('geodir_after_detail_page_more_info');
1237 1242
 
1238 1243
     $content_html = ob_get_clean();
1239
-    if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1244
+    if (trim($content_html) != '') {
1245
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1246
+    }
1241 1247
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242 1248
         /**
1243 1249
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1352,8 +1358,9 @@  discard block
 block discarded – undo
1352 1358
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1353 1359
 
1354 1360
     foreach ($arr_alert_msg as $key => $value) {
1355
-        if (!is_scalar($value))
1356
-            continue;
1361
+        if (!is_scalar($value)) {
1362
+                    continue;
1363
+        }
1357 1364
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1358 1365
     }
1359 1366
 
@@ -1407,17 +1414,19 @@  discard block
 block discarded – undo
1407 1414
     global $geodir_sidebars;
1408 1415
     global $sidebars_widgets;
1409 1416
 
1410
-    if (!is_array($sidebars_widgets))
1411
-        $sidebars_widgets = wp_get_sidebars_widgets();
1417
+    if (!is_array($sidebars_widgets)) {
1418
+            $sidebars_widgets = wp_get_sidebars_widgets();
1419
+    }
1412 1420
     $geodir_old_sidebars = array();
1413 1421
 
1414 1422
     if (is_array($geodir_sidebars)) {
1415 1423
         foreach ($geodir_sidebars as $val) {
1416 1424
             if (is_array($sidebars_widgets)) {
1417
-                if (array_key_exists($val, $sidebars_widgets))
1418
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1419
-                else
1420
-                    $geodir_old_sidebars[$val] = array();
1425
+                if (array_key_exists($val, $sidebars_widgets)) {
1426
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1427
+                } else {
1428
+                                    $geodir_old_sidebars[$val] = array();
1429
+                }
1421 1430
             }
1422 1431
         }
1423 1432
     }
@@ -1438,16 +1447,19 @@  discard block
 block discarded – undo
1438 1447
 {
1439 1448
     global $sidebars_widgets;
1440 1449
 
1441
-    if (!is_array($sidebars_widgets))
1442
-        $sidebars_widgets = wp_get_sidebars_widgets();
1450
+    if (!is_array($sidebars_widgets)) {
1451
+            $sidebars_widgets = wp_get_sidebars_widgets();
1452
+    }
1443 1453
 
1444 1454
     if (is_array($sidebars_widgets)) {
1445 1455
         $geodir_old_sidebars = get_option('geodir_sidebars');
1446 1456
         if (is_array($geodir_old_sidebars)) {
1447 1457
             foreach ($geodir_old_sidebars as $key => $val) {
1448
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1458
+                if(0 === strpos($key, 'geodir_')) {
1459
+                	// if gd widget
1449 1460
                 {
1450
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1461
+                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1462
+                }
1451 1463
                 }
1452 1464
 
1453 1465
 
@@ -1583,20 +1595,25 @@  discard block
 block discarded – undo
1583 1595
         }
1584 1596
     }
1585 1597
     
1586
-    if ($tab == 'post_info')
1587
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1598
+    if ($tab == 'post_info') {
1599
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1600
+    }
1588 1601
 
1589
-    if ($tab == 'post_images')
1590
-        $is_display = (!empty($post_images)) ? true : false;
1602
+    if ($tab == 'post_images') {
1603
+            $is_display = (!empty($post_images)) ? true : false;
1604
+    }
1591 1605
 
1592
-    if ($tab == 'post_video')
1593
-        $is_display = (!empty($video)) ? true : false;
1606
+    if ($tab == 'post_video') {
1607
+            $is_display = (!empty($video)) ? true : false;
1608
+    }
1594 1609
 
1595
-    if ($tab == 'special_offers')
1596
-        $is_display = (!empty($special_offers)) ? true : false;
1610
+    if ($tab == 'special_offers') {
1611
+            $is_display = (!empty($special_offers)) ? true : false;
1612
+    }
1597 1613
 
1598
-    if ($tab == 'reviews')
1599
-        $is_display = (geodir_is_page('detail')) ? true : false;
1614
+    if ($tab == 'reviews') {
1615
+            $is_display = (geodir_is_page('detail')) ? true : false;
1616
+    }
1600 1617
 
1601 1618
     if ($tab == 'related_listing') {
1602 1619
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1830,11 +1847,13 @@  discard block
 block discarded – undo
1830 1847
     $region_slug = $default_location->region_slug;
1831 1848
     $city_slug = $default_location->city_slug;
1832 1849
 
1833
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1834
-        return $slug_exists = true;
1850
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1851
+            return $slug_exists = true;
1852
+    }
1835 1853
 
1836
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1837
-        return $slug_exists = true;
1854
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1855
+            return $slug_exists = true;
1856
+    }
1838 1857
 
1839 1858
     return $slug_exists;
1840 1859
 }
@@ -1876,40 +1895,31 @@  discard block
 block discarded – undo
1876 1895
     if(geodir_is_page('home')){
1877 1896
         $gd_page = 'home';
1878 1897
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('detail')){
1898
+    } elseif(geodir_is_page('detail')){
1881 1899
         $gd_page = 'detail';
1882 1900
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('pt')){
1901
+    } elseif(geodir_is_page('pt')){
1885 1902
         $gd_page = 'pt';
1886 1903
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('listing')){
1904
+    } elseif(geodir_is_page('listing')){
1889 1905
         $gd_page = 'listing';
1890 1906
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('location')){
1907
+    } elseif(geodir_is_page('location')){
1893 1908
         $gd_page = 'location';
1894 1909
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1895
-    }
1896
-    elseif(geodir_is_page('search')){
1910
+    } elseif(geodir_is_page('search')){
1897 1911
         $gd_page = 'search';
1898 1912
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1899
-    }
1900
-    elseif(geodir_is_page('add-listing')){
1913
+    } elseif(geodir_is_page('add-listing')){
1901 1914
         $gd_page = 'add-listing';
1902 1915
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1903
-    }
1904
-    elseif(geodir_is_page('author')){
1916
+    } elseif(geodir_is_page('author')){
1905 1917
         $gd_page = 'author';
1906 1918
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1907
-    }
1908
-    elseif(geodir_is_page('login')){
1919
+    } elseif(geodir_is_page('login')){
1909 1920
         $gd_page = 'login';
1910 1921
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1911
-    }
1912
-    elseif(geodir_is_page('listing-success')){
1922
+    } elseif(geodir_is_page('listing-success')){
1913 1923
         $gd_page = 'listing-success';
1914 1924
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1915 1925
     }
@@ -1984,11 +1994,13 @@  discard block
 block discarded – undo
1984 1994
 
1985 1995
     if (!get_option('geodir_remove_url_seperator')) {
1986 1996
 
1987
-        if (get_option('geodir_listingurl_separator'))
1988
-            delete_option('geodir_listingurl_separator');
1997
+        if (get_option('geodir_listingurl_separator')) {
1998
+                    delete_option('geodir_listingurl_separator');
1999
+        }
1989 2000
 
1990
-        if (get_option('geodir_detailurl_separator'))
1991
-            delete_option('geodir_detailurl_separator');
2001
+        if (get_option('geodir_detailurl_separator')) {
2002
+                    delete_option('geodir_detailurl_separator');
2003
+        }
1992 2004
 
1993 2005
         flush_rewrite_rules(false);
1994 2006
 
@@ -2012,8 +2024,9 @@  discard block
 block discarded – undo
2012 2024
 {
2013 2025
     foreach ($permalink_arr as $key => $value) {
2014 2026
 
2015
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2016
-            unset($permalink_arr[$key]);
2027
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2028
+                    unset($permalink_arr[$key]);
2029
+        }
2017 2030
 
2018 2031
     }
2019 2032
 
@@ -2145,16 +2158,18 @@  discard block
 block discarded – undo
2145 2158
 
2146 2159
             $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)));
2147 2160
 
2148
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2149
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2161
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2162
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2163
+            }
2150 2164
         }
2151 2165
 
2152 2166
         if (array_key_exists('special_offers', $tabs_arr)) {
2153 2167
 
2154 2168
             $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)));
2155 2169
 
2156
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2157
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2170
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2171
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2172
+            }
2158 2173
         }
2159 2174
 
2160 2175
     }
@@ -2209,8 +2224,9 @@  discard block
 block discarded – undo
2209 2224
 
2210 2225
         $all_postypes = geodir_get_posttypes();
2211 2226
 
2212
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2213
-            return false;
2227
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2228
+                    return false;
2229
+        }
2214 2230
 
2215 2231
         $uploads = wp_upload_dir();
2216 2232
 
@@ -2284,8 +2300,9 @@  discard block
 block discarded – undo
2284 2300
                         $file_info = pathinfo($attach->file);
2285 2301
 
2286 2302
                         $sub_dir = '';
2287
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2288
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2303
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2304
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2305
+                        }
2289 2306
 
2290 2307
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2291 2308
                         $uploads_path = $uploads['basedir'];
@@ -2306,8 +2323,9 @@  discard block
 block discarded – undo
2306 2323
 
2307 2324
                     if (!empty($attachment_data)) {
2308 2325
 
2309
-                        if ($attachment_data->ID)
2310
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2326
+                        if ($attachment_data->ID) {
2327
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2328
+                        }
2311 2329
 
2312 2330
                     } else {
2313 2331
 
@@ -2558,8 +2576,9 @@  discard block
 block discarded – undo
2558 2576
                             break;
2559 2577
                         case 'time': {
2560 2578
                             $value = '';
2561
-                            if ($post->{$type['htmlvar_name']} != '')
2562
-                                $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2579
+                            if ($post->{$type['htmlvar_name']} != '') {
2580
+                                                            $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2581
+                            }
2563 2582
 
2564 2583
                             if (strpos($field_icon, 'http') !== false) {
2565 2584
                                 $field_icon_af = '';
@@ -2594,8 +2613,9 @@  discard block
 block discarded – undo
2594 2613
                             $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
2595 2614
 
2596 2615
                             $value = '';
2597
-                            if ($post->{$type['htmlvar_name']} != '')
2598
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2616
+                            if ($post->{$type['htmlvar_name']} != '') {
2617
+                                                            $value = date($date_format, strtotime($post_htmlvar_value));
2618
+                            }
2599 2619
 
2600 2620
                             if (strpos($field_icon, 'http') !== false) {
2601 2621
                                 $field_icon_af = '';
Please login to merge, or discard this patch.
geodirectory_template_tags.php 1 patch
Braces   +37 added lines, -19 removed lines patch added patch discarded remove patch
@@ -245,13 +245,14 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_add_async_forscript($url)
247 247
 {
248
-    if (strpos($url, '#asyncload')===false)
249
-        return $url;
250
-    else if (is_admin())
251
-        return str_replace('#asyncload', '', $url);
252
-    else
253
-        return str_replace('#asyncload', '', $url)."' async='async";
254
-}
248
+    if (strpos($url, '#asyncload')===false) {
249
+            return $url;
250
+    } else if (is_admin()) {
251
+            return str_replace('#asyncload', '', $url);
252
+    } else {
253
+            return str_replace('#asyncload', '', $url)."' async='async";
254
+    }
255
+    }
255 256
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
256 257
 
257 258
 /**
@@ -318,8 +319,10 @@  discard block
 block discarded – undo
318 319
 
319 320
     $half_pages_to_show = round($pages_to_show / 2);
320 321
 
321
-    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
322
-        return;
322
+    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) {
323
+    	// dont apply default  pagination for geodirectory home page.
324
+        return;
325
+    }
323 326
 
324 327
     if (!is_single()) {
325 328
         if (function_exists('geodir_location_geo_home_link')) {
@@ -439,11 +442,21 @@  discard block
 block discarded – undo
439 442
     }
440 443
     $dist_dif = 1000;
441 444
 
442
-    if ($dist <= 5000) $dist_dif = 500;
443
-    if ($dist <= 1000) $dist_dif = 100;
444
-    if ($dist <= 500) $dist_dif = 50;
445
-    if ($dist <= 100) $dist_dif = 10;
446
-    if ($dist <= 50) $dist_dif = 5;
445
+    if ($dist <= 5000) {
446
+    	$dist_dif = 500;
447
+    }
448
+    if ($dist <= 1000) {
449
+    	$dist_dif = 100;
450
+    }
451
+    if ($dist <= 500) {
452
+    	$dist_dif = 50;
453
+    }
454
+    if ($dist <= 100) {
455
+    	$dist_dif = 10;
456
+    }
457
+    if ($dist <= 50) {
458
+    	$dist_dif = 5;
459
+    }
447 460
 
448 461
     ?>
449 462
     <script type="text/javascript">
@@ -505,18 +518,23 @@  discard block
 block discarded – undo
505 518
 {
506 519
 
507 520
     $default_search_for_text = SEARCH_FOR_TEXT;
508
-    if (get_option('geodir_search_field_default_text'))
509
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
521
+    if (get_option('geodir_search_field_default_text')) {
522
+            $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
523
+    }
510 524
 
511 525
     $default_near_text = NEAR_TEXT;
512
-    if (get_option('geodir_near_field_default_text'))
513
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
526
+    if (get_option('geodir_near_field_default_text')) {
527
+            $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
528
+    }
514 529
 
515 530
     ?>
516 531
 
517 532
 
518 533
     <script type="text/javascript">
519
-        var default_location = '<?php if($search_location = geodir_get_default_location())  echo $search_location->city ;?>';
534
+        var default_location = '<?php if($search_location = geodir_get_default_location()) {
535
+	echo $search_location->city ;
536
+}
537
+?>';
520 538
         var latlng;
521 539
         var address;
522 540
         var dist = 0;
Please login to merge, or discard this patch.