| @@ -86,8 +86,9 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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(). | 
| @@ -1353,8 +1359,9 @@ discard block | ||
| 1353 | 1359 |      $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
 | 
| 1354 | 1360 | |
| 1355 | 1361 |      foreach ($arr_alert_msg as $key => $value) {
 | 
| 1356 | - if (!is_scalar($value)) | |
| 1357 | - continue; | |
| 1362 | +        if (!is_scalar($value)) { | |
| 1363 | + continue; | |
| 1364 | + } | |
| 1358 | 1365 | $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); | 
| 1359 | 1366 | } | 
| 1360 | 1367 | |
| @@ -1410,17 +1417,19 @@ discard block | ||
| 1410 | 1417 | global $geodir_sidebars; | 
| 1411 | 1418 | global $sidebars_widgets; | 
| 1412 | 1419 | |
| 1413 | - if (!is_array($sidebars_widgets)) | |
| 1414 | - $sidebars_widgets = wp_get_sidebars_widgets(); | |
| 1420 | +    if (!is_array($sidebars_widgets)) { | |
| 1421 | + $sidebars_widgets = wp_get_sidebars_widgets(); | |
| 1422 | + } | |
| 1415 | 1423 | $geodir_old_sidebars = array(); | 
| 1416 | 1424 | |
| 1417 | 1425 |      if (is_array($geodir_sidebars)) {
 | 
| 1418 | 1426 |          foreach ($geodir_sidebars as $val) {
 | 
| 1419 | 1427 |              if (is_array($sidebars_widgets)) {
 | 
| 1420 | - if (array_key_exists($val, $sidebars_widgets)) | |
| 1421 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; | |
| 1422 | - else | |
| 1423 | - $geodir_old_sidebars[$val] = array(); | |
| 1428 | +                if (array_key_exists($val, $sidebars_widgets)) { | |
| 1429 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; | |
| 1430 | +                } else { | |
| 1431 | + $geodir_old_sidebars[$val] = array(); | |
| 1432 | + } | |
| 1424 | 1433 | } | 
| 1425 | 1434 | } | 
| 1426 | 1435 | } | 
| @@ -1441,16 +1450,19 @@ discard block | ||
| 1441 | 1450 |  {
 | 
| 1442 | 1451 | global $sidebars_widgets; | 
| 1443 | 1452 | |
| 1444 | - if (!is_array($sidebars_widgets)) | |
| 1445 | - $sidebars_widgets = wp_get_sidebars_widgets(); | |
| 1453 | +    if (!is_array($sidebars_widgets)) { | |
| 1454 | + $sidebars_widgets = wp_get_sidebars_widgets(); | |
| 1455 | + } | |
| 1446 | 1456 | |
| 1447 | 1457 |      if (is_array($sidebars_widgets)) {
 | 
| 1448 | 1458 |          $geodir_old_sidebars = get_option('geodir_sidebars');
 | 
| 1449 | 1459 |          if (is_array($geodir_old_sidebars)) {
 | 
| 1450 | 1460 |              foreach ($geodir_old_sidebars as $key => $val) {
 | 
| 1451 | - if(0 === strpos($key, 'geodir_'))// if gd widget | |
| 1461 | +                if(0 === strpos($key, 'geodir_')) { | |
| 1462 | + // if gd widget | |
| 1452 | 1463 |                  {
 | 
| 1453 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; | |
| 1464 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; | |
| 1465 | + } | |
| 1454 | 1466 | } | 
| 1455 | 1467 | |
| 1456 | 1468 | |
| @@ -1586,20 +1598,25 @@ discard block | ||
| 1586 | 1598 | } | 
| 1587 | 1599 | } | 
| 1588 | 1600 | |
| 1589 | - if ($tab == 'post_info') | |
| 1590 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false; | |
| 1601 | +    if ($tab == 'post_info') { | |
| 1602 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false; | |
| 1603 | + } | |
| 1591 | 1604 | |
| 1592 | - if ($tab == 'post_images') | |
| 1593 | - $is_display = (!empty($post_images)) ? true : false; | |
| 1605 | +    if ($tab == 'post_images') { | |
| 1606 | + $is_display = (!empty($post_images)) ? true : false; | |
| 1607 | + } | |
| 1594 | 1608 | |
| 1595 | - if ($tab == 'post_video') | |
| 1596 | - $is_display = (!empty($video)) ? true : false; | |
| 1609 | +    if ($tab == 'post_video') { | |
| 1610 | + $is_display = (!empty($video)) ? true : false; | |
| 1611 | + } | |
| 1597 | 1612 | |
| 1598 | - if ($tab == 'special_offers') | |
| 1599 | - $is_display = (!empty($special_offers)) ? true : false; | |
| 1613 | +    if ($tab == 'special_offers') { | |
| 1614 | + $is_display = (!empty($special_offers)) ? true : false; | |
| 1615 | + } | |
| 1600 | 1616 | |
| 1601 | - if ($tab == 'reviews') | |
| 1602 | -        $is_display = (geodir_is_page('detail')) ? true : false;
 | |
| 1617 | +    if ($tab == 'reviews') { | |
| 1618 | +            $is_display = (geodir_is_page('detail')) ? true : false; | |
| 1619 | + } | |
| 1603 | 1620 | |
| 1604 | 1621 |      if ($tab == 'related_listing') {
 | 
| 1605 | 1622 |         $message = __('No listings found which match your selection.', 'geodirectory');
 | 
| @@ -1833,11 +1850,13 @@ discard block | ||
| 1833 | 1850 | $region_slug = $default_location->region_slug; | 
| 1834 | 1851 | $city_slug = $default_location->city_slug; | 
| 1835 | 1852 | |
| 1836 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) | |
| 1837 | - return $slug_exists = true; | |
| 1853 | +    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) { | |
| 1854 | + return $slug_exists = true; | |
| 1855 | + } | |
| 1838 | 1856 | |
| 1839 | -    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
 | |
| 1840 | - return $slug_exists = true; | |
| 1857 | +    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) { | |
| 1858 | + return $slug_exists = true; | |
| 1859 | + } | |
| 1841 | 1860 | |
| 1842 | 1861 | return $slug_exists; | 
| 1843 | 1862 | } | 
| @@ -1879,40 +1898,31 @@ discard block | ||
| 1879 | 1898 |      if(geodir_is_page('home')){
 | 
| 1880 | 1899 | $gd_page = 'home'; | 
| 1881 | 1900 |          $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
 | 
| 1882 | - } | |
| 1883 | -    elseif(geodir_is_page('detail')){
 | |
| 1901 | +    } elseif(geodir_is_page('detail')){
 | |
| 1884 | 1902 | $gd_page = 'detail'; | 
| 1885 | 1903 |          $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
 | 
| 1886 | - } | |
| 1887 | -    elseif(geodir_is_page('pt')){
 | |
| 1904 | +    } elseif(geodir_is_page('pt')){
 | |
| 1888 | 1905 | $gd_page = 'pt'; | 
| 1889 | 1906 |          $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
 | 
| 1890 | - } | |
| 1891 | -    elseif(geodir_is_page('listing')){
 | |
| 1907 | +    } elseif(geodir_is_page('listing')){
 | |
| 1892 | 1908 | $gd_page = 'listing'; | 
| 1893 | 1909 |          $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
 | 
| 1894 | - } | |
| 1895 | -    elseif(geodir_is_page('location')){
 | |
| 1910 | +    } elseif(geodir_is_page('location')){
 | |
| 1896 | 1911 | $gd_page = 'location'; | 
| 1897 | 1912 |          $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
 | 
| 1898 | - } | |
| 1899 | -    elseif(geodir_is_page('search')){
 | |
| 1913 | +    } elseif(geodir_is_page('search')){
 | |
| 1900 | 1914 | $gd_page = 'search'; | 
| 1901 | 1915 |          $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
 | 
| 1902 | - } | |
| 1903 | -    elseif(geodir_is_page('add-listing')){
 | |
| 1916 | +    } elseif(geodir_is_page('add-listing')){
 | |
| 1904 | 1917 | $gd_page = 'add-listing'; | 
| 1905 | 1918 |          $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
 | 
| 1906 | - } | |
| 1907 | -    elseif(geodir_is_page('author')){
 | |
| 1919 | +    } elseif(geodir_is_page('author')){
 | |
| 1908 | 1920 | $gd_page = 'author'; | 
| 1909 | 1921 |          $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
 | 
| 1910 | - } | |
| 1911 | -    elseif(geodir_is_page('login')){
 | |
| 1922 | +    } elseif(geodir_is_page('login')){
 | |
| 1912 | 1923 | $gd_page = 'login'; | 
| 1913 | 1924 |          $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
 | 
| 1914 | - } | |
| 1915 | -    elseif(geodir_is_page('listing-success')){
 | |
| 1925 | +    } elseif(geodir_is_page('listing-success')){
 | |
| 1916 | 1926 | $gd_page = 'listing-success'; | 
| 1917 | 1927 |          $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
 | 
| 1918 | 1928 | } | 
| @@ -1990,11 +2000,13 @@ discard block | ||
| 1990 | 2000 | |
| 1991 | 2001 |      if (!get_option('geodir_remove_url_seperator')) {
 | 
| 1992 | 2002 | |
| 1993 | -        if (get_option('geodir_listingurl_separator'))
 | |
| 1994 | -            delete_option('geodir_listingurl_separator');
 | |
| 2003 | +        if (get_option('geodir_listingurl_separator')) { | |
| 2004 | +                    delete_option('geodir_listingurl_separator'); | |
| 2005 | + } | |
| 1995 | 2006 | |
| 1996 | -        if (get_option('geodir_detailurl_separator'))
 | |
| 1997 | -            delete_option('geodir_detailurl_separator');
 | |
| 2007 | +        if (get_option('geodir_detailurl_separator')) { | |
| 2008 | +                    delete_option('geodir_detailurl_separator'); | |
| 2009 | + } | |
| 1998 | 2010 | |
| 1999 | 2011 | flush_rewrite_rules(false); | 
| 2000 | 2012 | |
| @@ -2018,8 +2030,9 @@ discard block | ||
| 2018 | 2030 |  {
 | 
| 2019 | 2031 |      foreach ($permalink_arr as $key => $value) {
 | 
| 2020 | 2032 | |
| 2021 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') | |
| 2022 | - unset($permalink_arr[$key]); | |
| 2033 | +        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') { | |
| 2034 | + unset($permalink_arr[$key]); | |
| 2035 | + } | |
| 2023 | 2036 | |
| 2024 | 2037 | } | 
| 2025 | 2038 | |
| @@ -2154,16 +2167,18 @@ discard block | ||
| 2154 | 2167 | |
| 2155 | 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_video', $post_type)));
 | 
| 2156 | 2169 | |
| 2157 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') | |
| 2158 | - $tabs_arr['post_video']['heading_text'] = $field_title; | |
| 2170 | +            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') { | |
| 2171 | + $tabs_arr['post_video']['heading_text'] = $field_title; | |
| 2172 | + } | |
| 2159 | 2173 | } | 
| 2160 | 2174 | |
| 2161 | 2175 |          if (array_key_exists('special_offers', $tabs_arr)) {
 | 
| 2162 | 2176 | |
| 2163 | 2177 |              $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)));
 | 
| 2164 | 2178 | |
| 2165 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') | |
| 2166 | - $tabs_arr['special_offers']['heading_text'] = $field_title; | |
| 2179 | +            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') { | |
| 2180 | + $tabs_arr['special_offers']['heading_text'] = $field_title; | |
| 2181 | + } | |
| 2167 | 2182 | } | 
| 2168 | 2183 | |
| 2169 | 2184 | } | 
| @@ -2218,8 +2233,9 @@ discard block | ||
| 2218 | 2233 | |
| 2219 | 2234 | $all_postypes = geodir_get_posttypes(); | 
| 2220 | 2235 | |
| 2221 | - if (!in_array($post_type, $all_postypes) || !is_admin()) | |
| 2222 | - return false; | |
| 2236 | +        if (!in_array($post_type, $all_postypes) || !is_admin()) { | |
| 2237 | + return false; | |
| 2238 | + } | |
| 2223 | 2239 | |
| 2224 | 2240 | $uploads = wp_upload_dir(); | 
| 2225 | 2241 | |
| @@ -2293,8 +2309,9 @@ discard block | ||
| 2293 | 2309 | $file_info = pathinfo($attach->file); | 
| 2294 | 2310 | |
| 2295 | 2311 | $sub_dir = ''; | 
| 2296 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') | |
| 2297 | - $sub_dir = stripslashes_deep($file_info['dirname']); | |
| 2312 | +                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { | |
| 2313 | + $sub_dir = stripslashes_deep($file_info['dirname']); | |
| 2314 | + } | |
| 2298 | 2315 | |
| 2299 | 2316 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs | 
| 2300 | 2317 | $uploads_path = $uploads['basedir']; | 
| @@ -2315,8 +2332,9 @@ discard block | ||
| 2315 | 2332 | |
| 2316 | 2333 |                      if (!empty($attachment_data)) {
 | 
| 2317 | 2334 | |
| 2318 | - if ($attachment_data->ID) | |
| 2319 | -                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
 | |
| 2335 | +                        if ($attachment_data->ID) { | |
| 2336 | +                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); | |
| 2337 | + } | |
| 2320 | 2338 | |
| 2321 | 2339 |                      } else {
 | 
| 2322 | 2340 | |
| @@ -2493,7 +2511,7 @@ discard block | ||
| 2493 | 2511 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); | 
| 2494 | 2512 | $variables_array['value'] = ''; | 
| 2495 | 2513 |                          $variables_array['value'] = $post->{$type['htmlvar_name']};
 | 
| 2496 | -                    }else{
 | |
| 2514 | +                    } else{
 | |
| 2497 | 2515 | $i = 0; | 
| 2498 | 2516 | $fieldset_count++; | 
| 2499 | 2517 | $field_set_start = 1; |