Test Failed
Pull Request — master (#421)
by Kiran
17:15
created
geodirectory-admin/google-api-php-client/src/Google/Auth/Abstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 4 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
  * @global object $wpdb WordPress Database object.
2172 2172
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2173 2173
  * @param int $attachment_id Attachment ID.
2174
- * @return bool|void Returns false on failure.
2174
+ * @return false|null Returns false on failure.
2175 2175
  */
2176 2176
 function geodirectory_before_featured_image_delete($attachment_id)
2177 2177
 {
@@ -2344,6 +2344,7 @@  discard block
 block discarded – undo
2344 2344
  * @global object $wpdb WordPress Database object.
2345 2345
  * @global object $current_user Current user object.
2346 2346
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2347
+ * @param string $user_id
2347 2348
  * @return array User listing count for each post type.
2348 2349
  */
2349 2350
 function geodir_user_post_listing_count($user_id=null)
@@ -2680,7 +2681,7 @@  discard block
 block discarded – undo
2680 2681
  * @since 1.6.16
2681 2682
  * @package GeoDirectory
2682 2683
  * @param array $classes The class array of the HTML element.
2683
- * @return array Modified class array.
2684
+ * @return string[] Modified class array.
2684 2685
  */
2685 2686
 function geodir_body_class_active_map($classes = array()) {
2686 2687
     $classes[] = 'gd-map-' . geodir_map_name();
Please login to merge, or discard this 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.
Indentation   +1206 added lines, -1206 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
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 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
-    if ($geodir_theme_location) {
228
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
229
-    } else {
230
-        update_option('geodir_theme_location_nav', '');
231
-    }
226
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
+	if ($geodir_theme_location) {
228
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
229
+	} else {
230
+		update_option('geodir_theme_location_nav', '');
231
+	}
232 232
 }
233 233
 
234 234
 /// add action for theme switch to blank previous theme navigation location setting
@@ -249,37 +249,37 @@  discard block
 block discarded – undo
249 249
  */
250 250
 function geodir_add_post_filters()
251 251
 {
252
-    /**
253
-     * Contains all function for filtering listing.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     */
258
-    include_once('geodirectory-functions/listing_filters.php');
252
+	/**
253
+	 * Contains all function for filtering listing.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 */
258
+	include_once('geodirectory-functions/listing_filters.php');
259 259
     
260
-    // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
-    }
260
+	// Theme My Login compatibility fix
261
+	if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
+		remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
+	}
264 264
 }
265 265
 
266 266
 
267 267
 if (!function_exists('geodir_init_defaults')) {
268
-    /**
269
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
270
-     *
271
-     * @since 1.0.0
272
-     * @package GeoDirectory
273
-     */
274
-    function geodir_init_defaults()
275
-    {
276
-        if (function_exists('geodir_register_defaults')) {
268
+	/**
269
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
270
+	 *
271
+	 * @since 1.0.0
272
+	 * @package GeoDirectory
273
+	 */
274
+	function geodir_init_defaults()
275
+	{
276
+		if (function_exists('geodir_register_defaults')) {
277 277
 
278
-            geodir_register_defaults();
278
+			geodir_register_defaults();
279 279
 
280
-        }
280
+		}
281 281
 
282
-    }
282
+	}
283 283
 }
284 284
 
285 285
 
@@ -301,26 +301,26 @@  discard block
 block discarded – undo
301 301
 // CALLED ON 'sidebars_widgets' FILTER
302 302
 
303 303
 if (!function_exists('geodir_restrict_widget')) {
304
-    /**
305
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
306
-     *
307
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
308
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
309
-     * @since 1.0.0
310
-     * @package GeoDirectory
311
-     */
312
-    function geodir_restrict_widget()
313
-    {
314
-        global $is_listing, $is_single_place;
304
+	/**
305
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
306
+	 *
307
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
308
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
309
+	 * @since 1.0.0
310
+	 * @package GeoDirectory
311
+	 */
312
+	function geodir_restrict_widget()
313
+	{
314
+		global $is_listing, $is_single_place;
315 315
 
316
-        // set is listing	
317
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
316
+		// set is listing	
317
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
318 318
 
319
-        // set is single place
320
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
319
+		// set is single place
320
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
321 321
 
322 322
 
323
-    }
323
+	}
324 324
 }
325 325
 
326 326
 
@@ -341,31 +341,31 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function geodir_detail_page_sidebar_content_sorting()
343 343
 {
344
-    $arr_detail_page_sidebar_content =
345
-        /**
346
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
347
-         *
348
-         * This filter can be used to remove sections of the details page sidebar,
349
-         * add new sections or rearrange the order of the sections.
350
-         *
351
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
352
-         * @since 1.0.0
353
-         */
354
-        apply_filters('geodir_detail_page_sidebar_content',
355
-            array('geodir_social_sharing_buttons',
356
-                'geodir_detail_page_google_analytics',
357
-                'geodir_edit_post_link',
358
-                'geodir_detail_page_review_rating',
359
-                'geodir_detail_page_more_info'
360
-            ) // end of array 
361
-        ); // end of apply filter
362
-    if (!empty($arr_detail_page_sidebar_content)) {
363
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
364
-            if (function_exists($content_function)) {
365
-                add_action('geodir_detail_page_sidebar', $content_function);
366
-            }
367
-        }
368
-    }
344
+	$arr_detail_page_sidebar_content =
345
+		/**
346
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
347
+		 *
348
+		 * This filter can be used to remove sections of the details page sidebar,
349
+		 * add new sections or rearrange the order of the sections.
350
+		 *
351
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
352
+		 * @since 1.0.0
353
+		 */
354
+		apply_filters('geodir_detail_page_sidebar_content',
355
+			array('geodir_social_sharing_buttons',
356
+				'geodir_detail_page_google_analytics',
357
+				'geodir_edit_post_link',
358
+				'geodir_detail_page_review_rating',
359
+				'geodir_detail_page_more_info'
360
+			) // end of array 
361
+		); // end of apply filter
362
+	if (!empty($arr_detail_page_sidebar_content)) {
363
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
364
+			if (function_exists($content_function)) {
365
+				add_action('geodir_detail_page_sidebar', $content_function);
366
+			}
367
+		}
368
+	}
369 369
 }
370 370
 
371 371
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
  */
381 381
 function geodir_add_to_favourite_link()
382 382
 {
383
-    global $post, $preview;
384
-    if (!$preview && geodir_is_page('detail')) {
385
-        ?>
383
+	global $post, $preview;
384
+	if (!$preview && geodir_is_page('detail')) {
385
+		?>
386 386
         <p class="edit_link">
387 387
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
388 388
         </p>
389 389
     <?php
390
-    }
390
+	}
391 391
 }
392 392
 
393 393
 /**
@@ -401,41 +401,41 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_social_sharing_buttons()
403 403
 {
404
-    global $preview;
405
-    ob_start(); // Start  buffering;
406
-    /**
407
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
408
-     *
409
-     * @since 1.0.0
410
-     */
411
-    do_action('geodir_before_social_sharing_buttons');
412
-    if (!$preview) {
413
-        ?>
404
+	global $preview;
405
+	ob_start(); // Start  buffering;
406
+	/**
407
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
408
+	 *
409
+	 * @since 1.0.0
410
+	 */
411
+	do_action('geodir_before_social_sharing_buttons');
412
+	if (!$preview) {
413
+		?>
414 414
         <div class="likethis">
415 415
             <?php geodir_twitter_tweet_button(); ?>
416 416
             <?php geodir_fb_like_button(); ?>
417 417
             <?php geodir_google_plus_button(); ?>
418 418
         </div>
419 419
     <?php
420
-    }// end of if, if its a preview or not
421
-
422
-    /**
423
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
424
-     *
425
-     * @since 1.0.0
426
-     */
427
-    do_action('geodir_after_social_sharing_buttons');
428
-    $content_html = ob_get_clean();
429
-    if (trim($content_html) != '')
430
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
431
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
432
-        /**
433
-         * Filter the geodir_social_sharing_buttons() function content.
434
-         *
435
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
436
-         */
437
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
438
-    }
420
+	}// end of if, if its a preview or not
421
+
422
+	/**
423
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
424
+	 *
425
+	 * @since 1.0.0
426
+	 */
427
+	do_action('geodir_after_social_sharing_buttons');
428
+	$content_html = ob_get_clean();
429
+	if (trim($content_html) != '')
430
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
431
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
432
+		/**
433
+		 * Filter the geodir_social_sharing_buttons() function content.
434
+		 *
435
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
436
+		 */
437
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
438
+	}
439 439
 
440 440
 
441 441
 }
@@ -453,46 +453,46 @@  discard block
 block discarded – undo
453 453
  */
454 454
 function geodir_edit_post_link()
455 455
 {
456
-    global $post, $preview;
457
-    ob_start(); // Start buffering;
458
-    /**
459
-     * This is called before the edit post link html in the function geodir_edit_post_link()
460
-     *
461
-     * @since 1.0.0
462
-     */
463
-    do_action('geodir_before_edit_post_link');
464
-    if (!$preview) {
465
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
456
+	global $post, $preview;
457
+	ob_start(); // Start buffering;
458
+	/**
459
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
460
+	 *
461
+	 * @since 1.0.0
462
+	 */
463
+	do_action('geodir_before_edit_post_link');
464
+	if (!$preview) {
465
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
466 466
         
467
-        if ($is_current_user_owner) {
468
-            $post_id = $post->ID;
467
+		if ($is_current_user_owner) {
468
+			$post_id = $post->ID;
469 469
             
470
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
471
-                $post_id = (int)$_REQUEST['pid'];
472
-            }
470
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
471
+				$post_id = (int)$_REQUEST['pid'];
472
+			}
473 473
 
474
-            $postlink = get_permalink(geodir_add_listing_page_id());
475
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
476
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
477
-        }
478
-    }// end of if, if its a preview or not
479
-    /**
480
-     * This is called after the edit post link html in the function geodir_edit_post_link()
481
-     *
482
-     * @since 1.0.0
483
-     */
484
-    do_action('geodir_after_edit_post_link');
485
-    $content_html = ob_get_clean();
486
-    if (trim($content_html) != '')
487
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
488
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
489
-        /**
490
-         * Filter the geodir_edit_post_link() function content.
491
-         *
492
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
493
-         */
494
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
495
-    }
474
+			$postlink = get_permalink(geodir_add_listing_page_id());
475
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
476
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
477
+		}
478
+	}// end of if, if its a preview or not
479
+	/**
480
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
481
+	 *
482
+	 * @since 1.0.0
483
+	 */
484
+	do_action('geodir_after_edit_post_link');
485
+	$content_html = ob_get_clean();
486
+	if (trim($content_html) != '')
487
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
488
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
489
+		/**
490
+		 * Filter the geodir_edit_post_link() function content.
491
+		 *
492
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
493
+		 */
494
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
495
+	}
496 496
 }
497 497
 
498 498
 /**
@@ -506,42 +506,42 @@  discard block
 block discarded – undo
506 506
  */
507 507
 function geodir_detail_page_google_analytics()
508 508
 {
509
-    global $post,$preview;
510
-    if($preview){return '';}
511
-    $package_info = array();
512
-    $package_info = geodir_post_package_info($package_info, $post);
509
+	global $post,$preview;
510
+	if($preview){return '';}
511
+	$package_info = array();
512
+	$package_info = geodir_post_package_info($package_info, $post);
513 513
 
514
-    $id = trim(get_option('geodir_ga_account_id'));
514
+	$id = trim(get_option('geodir_ga_account_id'));
515 515
 
516
-    if (!$id) {
517
-        return; //if no Google Analytics ID then bail.
518
-    }
516
+	if (!$id) {
517
+		return; //if no Google Analytics ID then bail.
518
+	}
519 519
 
520
-    ob_start(); // Start buffering;
521
-    /**
522
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
523
-     *
524
-     * @since 1.0.0
525
-     */
526
-    do_action('geodir_before_google_analytics');
520
+	ob_start(); // Start buffering;
521
+	/**
522
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
523
+	 *
524
+	 * @since 1.0.0
525
+	 */
526
+	do_action('geodir_before_google_analytics');
527 527
     
528
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
529
-    /**
530
-     * Filter the time interval to check & refresh new users results.
531
-     *
532
-     * @since 1.5.9
533
-     *
534
-     * @param int $refresh_time Time interval to check & refresh new users results.
535
-     */
536
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
537
-    $refresh_time = absint($refresh_time * 1000);
528
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
529
+	/**
530
+	 * Filter the time interval to check & refresh new users results.
531
+	 *
532
+	 * @since 1.5.9
533
+	 *
534
+	 * @param int $refresh_time Time interval to check & refresh new users results.
535
+	 */
536
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
537
+	$refresh_time = absint($refresh_time * 1000);
538 538
     
539
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
539
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
540 540
     
541
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
542
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
543
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
544
-        ?>
541
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
542
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
543
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
544
+		?>
545 545
         <script type="text/javascript">
546 546
             var gd_gaTimeOut;
547 547
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -793,15 +793,15 @@  discard block
 block discarded – undo
793 793
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
794 794
 
795 795
                     <?php
796
-                    // Here we list the shorthand days of the week so it can be used in translation.
797
-                    __("Mon",'geodirectory');
798
-                    __("Tue",'geodirectory');
799
-                    __("Wed",'geodirectory');
800
-                    __("Thu",'geodirectory');
801
-                    __("Fri",'geodirectory');
802
-                    __("Sat",'geodirectory');
803
-                    __("Sun",'geodirectory');
804
-                    ?>
796
+					// Here we list the shorthand days of the week so it can be used in translation.
797
+					__("Mon",'geodirectory');
798
+					__("Tue",'geodirectory');
799
+					__("Wed",'geodirectory');
800
+					__("Thu",'geodirectory');
801
+					__("Fri",'geodirectory');
802
+					__("Sat",'geodirectory');
803
+					__("Sun",'geodirectory');
804
+					?>
805 805
 
806 806
                     labels = [
807 807
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1050,24 +1050,24 @@  discard block
 block discarded – undo
1050 1050
         </span>
1051 1051
 
1052 1052
     <?php
1053
-    }
1054
-    /**
1055
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1056
-     *
1057
-     * @since 1.0.0
1058
-     */
1059
-    do_action('geodir_after_google_analytics');
1060
-    $content_html = ob_get_clean();
1061
-    if (trim($content_html) != '')
1062
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1063
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1064
-        /**
1065
-         * Filter the geodir_edit_post_link() function content.
1066
-         *
1067
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1068
-         */
1069
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1070
-    }
1053
+	}
1054
+	/**
1055
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1056
+	 *
1057
+	 * @since 1.0.0
1058
+	 */
1059
+	do_action('geodir_after_google_analytics');
1060
+	$content_html = ob_get_clean();
1061
+	if (trim($content_html) != '')
1062
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1063
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1064
+		/**
1065
+		 * Filter the geodir_edit_post_link() function content.
1066
+		 *
1067
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1068
+		 */
1069
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1070
+	}
1071 1071
 }
1072 1072
 
1073 1073
 /**
@@ -1084,94 +1084,94 @@  discard block
 block discarded – undo
1084 1084
  */
1085 1085
 function geodir_detail_page_review_rating()
1086 1086
 {
1087
-    global $post, $preview, $post_images;
1087
+	global $post, $preview, $post_images;
1088 1088
     
1089
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1090
-        return;
1091
-    }
1092
-    ob_start(); // Start  buffering;
1093
-    /**
1094
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1095
-     *
1096
-     * This is called outside the check for an actual rating and the check for preview page.
1097
-     *
1098
-     * @since 1.0.0
1099
-     */
1100
-    do_action('geodir_before_detail_page_review_rating');
1101
-
1102
-    $comment_count = geodir_get_review_count_total($post->ID);
1103
-    $post_avgratings = geodir_get_post_rating($post->ID);
1104
-
1105
-    if ($post_avgratings != 0 && !$preview) {
1106
-        /**
1107
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1108
-         *
1109
-         * This is called inside the check for an actual rating and the check for preview page.
1110
-         *
1111
-         * @since 1.0.0
1112
-         * @param float $post_avgratings Average rating for the current post.
1113
-         * @param int $post->ID Current post ID.
1114
-         */
1115
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1116
-
1117
-        $html = '<p style=" float:left;">';
1118
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1119
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1120
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1089
+	if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1090
+		return;
1091
+	}
1092
+	ob_start(); // Start  buffering;
1093
+	/**
1094
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1095
+	 *
1096
+	 * This is called outside the check for an actual rating and the check for preview page.
1097
+	 *
1098
+	 * @since 1.0.0
1099
+	 */
1100
+	do_action('geodir_before_detail_page_review_rating');
1101
+
1102
+	$comment_count = geodir_get_review_count_total($post->ID);
1103
+	$post_avgratings = geodir_get_post_rating($post->ID);
1104
+
1105
+	if ($post_avgratings != 0 && !$preview) {
1106
+		/**
1107
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1108
+		 *
1109
+		 * This is called inside the check for an actual rating and the check for preview page.
1110
+		 *
1111
+		 * @since 1.0.0
1112
+		 * @param float $post_avgratings Average rating for the current post.
1113
+		 * @param int $post->ID Current post ID.
1114
+		 */
1115
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1116
+
1117
+		$html = '<p style=" float:left;">';
1118
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1119
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1120
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1121 1121
        
1122 1122
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1123 1123
 	   
1124 1124
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1125 1125
 
1126
-        $html .= '<span class="item">';
1127
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1126
+		$html .= '<span class="item">';
1127
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1128 1128
 
1129
-        if ($post_images) {
1130
-            foreach ($post_images as $img) {
1131
-                $post_img = $img->src;
1132
-                break;
1133
-            }
1134
-        }
1135
-
1136
-        if (isset($post_img) && $post_img) {
1137
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1138
-        }
1139
-
1140
-        $html .= '</span>';
1141
-
1142
-        echo $html .= '</div>';
1143
-        /**
1144
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1145
-         *
1146
-         * This is called inside the check for an actual rating and the check for preview page.
1147
-         *
1148
-         * @since 1.0.0
1149
-         * @param float $post_avgratings Average rating for the current post.
1150
-         * @param int $post->ID Current post ID.
1151
-         */
1152
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1153
-    }
1154
-    /**
1155
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1156
-     *
1157
-     * This is called outside the check for an actual rating and the check for preview page.
1158
-     *
1159
-     * @since 1.0.0
1160
-     */
1161
-    do_action('geodir_after_detail_page_review_rating');
1162
-    $content_html = ob_get_clean();
1163
-    if (trim($content_html) != '') {
1164
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1165
-    }
1166
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1167
-        /**
1168
-         * Filter the geodir_detail_page_review_rating() function content.
1169
-         *
1170
-         * @since 1.0.0
1171
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1172
-         */
1173
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1174
-    }
1129
+		if ($post_images) {
1130
+			foreach ($post_images as $img) {
1131
+				$post_img = $img->src;
1132
+				break;
1133
+			}
1134
+		}
1135
+
1136
+		if (isset($post_img) && $post_img) {
1137
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1138
+		}
1139
+
1140
+		$html .= '</span>';
1141
+
1142
+		echo $html .= '</div>';
1143
+		/**
1144
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1145
+		 *
1146
+		 * This is called inside the check for an actual rating and the check for preview page.
1147
+		 *
1148
+		 * @since 1.0.0
1149
+		 * @param float $post_avgratings Average rating for the current post.
1150
+		 * @param int $post->ID Current post ID.
1151
+		 */
1152
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1153
+	}
1154
+	/**
1155
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1156
+	 *
1157
+	 * This is called outside the check for an actual rating and the check for preview page.
1158
+	 *
1159
+	 * @since 1.0.0
1160
+	 */
1161
+	do_action('geodir_after_detail_page_review_rating');
1162
+	$content_html = ob_get_clean();
1163
+	if (trim($content_html) != '') {
1164
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1165
+	}
1166
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1167
+		/**
1168
+		 * Filter the geodir_detail_page_review_rating() function content.
1169
+		 *
1170
+		 * @since 1.0.0
1171
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1172
+		 */
1173
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1174
+	}
1175 1175
 }
1176 1176
 
1177 1177
 /**
@@ -1183,35 +1183,35 @@  discard block
 block discarded – undo
1183 1183
  */
1184 1184
 function geodir_detail_page_more_info()
1185 1185
 {
1186
-    ob_start(); // Start  buffering;
1187
-    /**
1188
-     * This is called before the info section html.
1189
-     *
1190
-     * @since 1.0.0
1191
-     */
1192
-    do_action('geodir_before_detail_page_more_info');
1193
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1194
-        echo $geodir_post_detail_fields;
1195
-    }
1196
-    /**
1197
-     * This is called after the info section html.
1198
-     *
1199
-     * @since 1.0.0
1200
-     */
1201
-    do_action('geodir_after_detail_page_more_info');
1202
-
1203
-    $content_html = ob_get_clean();
1204
-    if (trim($content_html) != '')
1205
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1206
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1207
-        /**
1208
-         * Filter the output html for function geodir_detail_page_more_info().
1209
-         *
1210
-         * @since 1.0.0
1211
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1212
-         */
1213
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1214
-    }
1186
+	ob_start(); // Start  buffering;
1187
+	/**
1188
+	 * This is called before the info section html.
1189
+	 *
1190
+	 * @since 1.0.0
1191
+	 */
1192
+	do_action('geodir_before_detail_page_more_info');
1193
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1194
+		echo $geodir_post_detail_fields;
1195
+	}
1196
+	/**
1197
+	 * This is called after the info section html.
1198
+	 *
1199
+	 * @since 1.0.0
1200
+	 */
1201
+	do_action('geodir_after_detail_page_more_info');
1202
+
1203
+	$content_html = ob_get_clean();
1204
+	if (trim($content_html) != '')
1205
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1206
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1207
+		/**
1208
+		 * Filter the output html for function geodir_detail_page_more_info().
1209
+		 *
1210
+		 * @since 1.0.0
1211
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1212
+		 */
1213
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1214
+	}
1215 1215
 }
1216 1216
 
1217 1217
 
@@ -1225,15 +1225,15 @@  discard block
 block discarded – undo
1225 1225
  */
1226 1226
 function geodir_localize_all_js_msg()
1227 1227
 {// check_ajax_referer function is used to make sure no files are uploaded remotely but it will fail if used between https and non https so we do the check below of the urls
1228
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1229
-        $ajax_url = admin_url('admin-ajax.php');
1230
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1231
-        $ajax_url = admin_url('admin-ajax.php');
1232
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1233
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1234
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1235
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1236
-    }
1228
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1229
+		$ajax_url = admin_url('admin-ajax.php');
1230
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1231
+		$ajax_url = admin_url('admin-ajax.php');
1232
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1233
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1234
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1235
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1236
+	}
1237 1237
 	
1238 1238
 	/**
1239 1239
 	 * Filter the allowed image type extensions for post images.
@@ -1243,60 +1243,60 @@  discard block
 block discarded – undo
1243 1243
 	 */
1244 1244
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1245 1245
 	
1246
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1247
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1248
-    $default_marker_width = $default_marker_size['w'];
1249
-    $default_marker_height = $default_marker_size['h'];
1246
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1247
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1248
+	$default_marker_width = $default_marker_size['w'];
1249
+	$default_marker_height = $default_marker_size['h'];
1250 1250
     
1251
-    $arr_alert_msg = array(
1252
-        'geodir_plugin_url' => geodir_plugin_url(),
1253
-        'geodir_admin_ajax_url' => $ajax_url,
1254
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1255
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1256
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1257
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1258
-        //start not show alert msg
1259
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1260
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1261
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1262
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1263
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1264
-        // end not show alert msg
1265
-        'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1266
-        'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1267
-        //start not show alert msg
1268
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1269
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1270
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1271
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1272
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1273
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1274
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1275
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1276
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1277
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1278
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1279
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1280
-        'geodir_default_marker_icon' => $default_marker_icon,
1281
-        'geodir_default_marker_w' => $default_marker_width,
1282
-        'geodir_default_marker_h' => $default_marker_height,
1283
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1284
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1285
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1286
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1287
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1288
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1289
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1290
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1291
-        /* on/off dragging for phone devices */
1292
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1293
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1294
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1295
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1296
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1297
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1298
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1299
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1251
+	$arr_alert_msg = array(
1252
+		'geodir_plugin_url' => geodir_plugin_url(),
1253
+		'geodir_admin_ajax_url' => $ajax_url,
1254
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1255
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1256
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1257
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1258
+		//start not show alert msg
1259
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1260
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1261
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1262
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1263
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1264
+		// end not show alert msg
1265
+		'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1266
+		'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1267
+		//start not show alert msg
1268
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1269
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1270
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1271
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1272
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1273
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1274
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1275
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1276
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1277
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1278
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1279
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1280
+		'geodir_default_marker_icon' => $default_marker_icon,
1281
+		'geodir_default_marker_w' => $default_marker_width,
1282
+		'geodir_default_marker_h' => $default_marker_height,
1283
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1284
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1285
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1286
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1287
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1288
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1289
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1290
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1291
+		/* on/off dragging for phone devices */
1292
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1293
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1294
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1295
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1296
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1297
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1298
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1299
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1300 1300
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1301 1301
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1302 1302
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1304,40 +1304,40 @@  discard block
 block discarded – undo
1304 1304
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1305 1305
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1306 1306
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1307
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1308
-        'geodir_map_name' => geodir_map_name(),
1309
-        'osmStart' => __('Start', 'geodirectory'),
1310
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1311
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1312
-        'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1313
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1314
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1315
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1316
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1317
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1318
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1319
-    );
1320
-
1321
-    /**
1322
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1323
-     *
1324
-     * With this filter you can add, remove or change translated JS strings.
1325
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1326
-     *
1327
-     * @since 1.0.0
1328
-     */
1329
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1330
-
1331
-    foreach ($arr_alert_msg as $key => $value) {
1332
-        if (!is_scalar($value))
1333
-            continue;
1334
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1335
-    }
1307
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1308
+		'geodir_map_name' => geodir_map_name(),
1309
+		'osmStart' => __('Start', 'geodirectory'),
1310
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1311
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1312
+		'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1313
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1314
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1315
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1316
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1317
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1318
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1319
+	);
1320
+
1321
+	/**
1322
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1323
+	 *
1324
+	 * With this filter you can add, remove or change translated JS strings.
1325
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1326
+	 *
1327
+	 * @since 1.0.0
1328
+	 */
1329
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1330
+
1331
+	foreach ($arr_alert_msg as $key => $value) {
1332
+		if (!is_scalar($value))
1333
+			continue;
1334
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1335
+	}
1336 1336
 
1337
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1338
-    echo '<script>';
1339
-    echo $script;
1340
-    echo '</script>';
1337
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1338
+	echo '<script>';
1339
+	echo $script;
1340
+	echo '</script>';
1341 1341
 }
1342 1342
 
1343 1343
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1353,11 +1353,11 @@  discard block
 block discarded – undo
1353 1353
  */
1354 1354
 function geodir_admin_bar_site_menu($wp_admin_bar)
1355 1355
 {
1356
-    if (get_option("geodir_installed")) {
1357
-        if (current_user_can('manage_options')) {
1358
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1359
-        }
1360
-    }
1356
+	if (get_option("geodir_installed")) {
1357
+		if (current_user_can('manage_options')) {
1358
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1359
+		}
1360
+	}
1361 1361
 }
1362 1362
 
1363 1363
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1383,25 +1383,25 @@  discard block
 block discarded – undo
1383 1383
  */
1384 1384
 function geodir_store_sidebars()
1385 1385
 {
1386
-    global $geodir_sidebars;
1387
-    global $sidebars_widgets;
1388
-
1389
-    if (!is_array($sidebars_widgets))
1390
-        $sidebars_widgets = wp_get_sidebars_widgets();
1391
-    $geodir_old_sidebars = array();
1392
-
1393
-    if (is_array($geodir_sidebars)) {
1394
-        foreach ($geodir_sidebars as $val) {
1395
-            if (is_array($sidebars_widgets)) {
1396
-                if (array_key_exists($val, $sidebars_widgets))
1397
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1398
-                else
1399
-                    $geodir_old_sidebars[$val] = array();
1400
-            }
1401
-        }
1402
-    }
1403
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1404
-    geodir_option_version_backup('geodir_sidebars');
1386
+	global $geodir_sidebars;
1387
+	global $sidebars_widgets;
1388
+
1389
+	if (!is_array($sidebars_widgets))
1390
+		$sidebars_widgets = wp_get_sidebars_widgets();
1391
+	$geodir_old_sidebars = array();
1392
+
1393
+	if (is_array($geodir_sidebars)) {
1394
+		foreach ($geodir_sidebars as $val) {
1395
+			if (is_array($sidebars_widgets)) {
1396
+				if (array_key_exists($val, $sidebars_widgets))
1397
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1398
+				else
1399
+					$geodir_old_sidebars[$val] = array();
1400
+			}
1401
+		}
1402
+	}
1403
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1404
+	geodir_option_version_backup('geodir_sidebars');
1405 1405
 
1406 1406
 }
1407 1407
 
@@ -1415,28 +1415,28 @@  discard block
 block discarded – undo
1415 1415
  */
1416 1416
 function geodir_restore_sidebars()
1417 1417
 {
1418
-    global $sidebars_widgets;
1419
-
1420
-    if (!is_array($sidebars_widgets))
1421
-        $sidebars_widgets = wp_get_sidebars_widgets();
1422
-
1423
-    if (is_array($sidebars_widgets)) {
1424
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1425
-        if (is_array($geodir_old_sidebars)) {
1426
-            foreach ($geodir_old_sidebars as $key => $val) {
1427
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1428
-                {
1429
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1430
-                }
1418
+	global $sidebars_widgets;
1431 1419
 
1420
+	if (!is_array($sidebars_widgets))
1421
+		$sidebars_widgets = wp_get_sidebars_widgets();
1432 1422
 
1433
-            }
1434
-        }
1423
+	if (is_array($sidebars_widgets)) {
1424
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1425
+		if (is_array($geodir_old_sidebars)) {
1426
+			foreach ($geodir_old_sidebars as $key => $val) {
1427
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1428
+				{
1429
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1430
+				}
1435 1431
 
1436
-    }
1437 1432
 
1438
-    update_option('sidebars_widgets', $sidebars_widgets);
1439
-    update_option('geodir_sidebars', '');
1433
+			}
1434
+		}
1435
+
1436
+	}
1437
+
1438
+	update_option('sidebars_widgets', $sidebars_widgets);
1439
+	update_option('geodir_sidebars', '');
1440 1440
 }
1441 1441
 
1442 1442
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1449,9 +1449,9 @@  discard block
 block discarded – undo
1449 1449
  */
1450 1450
 function geodir_after_listing_post_gridview()
1451 1451
 {
1452
-    global $gridview_columns;
1452
+	global $gridview_columns;
1453 1453
 
1454
-    $gridview_columns = '';
1454
+	$gridview_columns = '';
1455 1455
 
1456 1456
 }
1457 1457
 
@@ -1479,11 +1479,11 @@  discard block
 block discarded – undo
1479 1479
  */
1480 1480
 function so_handle_038($url, $original_url, $_context)
1481 1481
 {
1482
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1483
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1484
-    }
1482
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1483
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1484
+	}
1485 1485
 
1486
-    return $url;
1486
+	return $url;
1487 1487
 }
1488 1488
 
1489 1489
 
@@ -1499,34 +1499,34 @@  discard block
 block discarded – undo
1499 1499
 function geodir_after_main_form_fields() {
1500 1500
 	global $gd_session;
1501 1501
 	
1502
-    if (get_option('geodir_accept_term_condition')) {
1503
-        global $post;
1504
-        $term_condition = '';
1505
-        if (isset($_REQUEST['backandedit'])) {
1506
-            $post = (object)$gd_session->get('listing');
1507
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1508
-        }
1509
-
1510
-        ?>
1502
+	if (get_option('geodir_accept_term_condition')) {
1503
+		global $post;
1504
+		$term_condition = '';
1505
+		if (isset($_REQUEST['backandedit'])) {
1506
+			$post = (object)$gd_session->get('listing');
1507
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1508
+		}
1509
+
1510
+		?>
1511 1511
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1512 1512
             <label>&nbsp;</label>
1513 1513
 
1514 1514
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1515 1515
 				<span style="display:block"> 
1516 1516
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1517
-                    echo 'checked="checked"';
1518
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1517
+					echo 'checked="checked"';
1518
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1519 1519
                        class="geodir_textfield" value="1"
1520 1520
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1521 1521
 				</span>
1522 1522
             </div>
1523 1523
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1524
-                    _e($required_msg, 'geodirectory');
1525
-                } ?></span>
1524
+					_e($required_msg, 'geodirectory');
1525
+				} ?></span>
1526 1526
         </div>
1527 1527
     <?php
1528 1528
 
1529
-    }
1529
+	}
1530 1530
 }
1531 1531
 
1532 1532
 
@@ -1551,42 +1551,42 @@  discard block
 block discarded – undo
1551 1551
  */
1552 1552
 function geodir_detail_page_tab_is_display($is_display, $tab)
1553 1553
 {
1554
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1554
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1555 1555
 
1556
-    if ($tab == 'post_profile') {
1557
-        /** This action is documented in geodirectory_template_actions.php */
1558
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1556
+	if ($tab == 'post_profile') {
1557
+		/** This action is documented in geodirectory_template_actions.php */
1558
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1559 1559
         
1560
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1561
-            $is_display = false;
1562
-        }
1563
-    }
1560
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1561
+			$is_display = false;
1562
+		}
1563
+	}
1564 1564
     
1565
-    if ($tab == 'post_info')
1566
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1565
+	if ($tab == 'post_info')
1566
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1567 1567
     
1568
-    if ($tab == 'post_images')
1569
-        $is_display = (!empty($post_images)) ? true : false;
1568
+	if ($tab == 'post_images')
1569
+		$is_display = (!empty($post_images)) ? true : false;
1570 1570
 
1571
-    if ($tab == 'post_video')
1572
-        $is_display = (!empty($video)) ? true : false;
1571
+	if ($tab == 'post_video')
1572
+		$is_display = (!empty($video)) ? true : false;
1573 1573
 
1574
-    if ($tab == 'special_offers')
1575
-        $is_display = (!empty($special_offers)) ? true : false;
1574
+	if ($tab == 'special_offers')
1575
+		$is_display = (!empty($special_offers)) ? true : false;
1576 1576
 
1577
-    if ($tab == 'reviews')
1578
-        $is_display = (geodir_is_page('detail')) ? true : false;
1577
+	if ($tab == 'reviews')
1578
+		$is_display = (geodir_is_page('detail')) ? true : false;
1579 1579
 
1580
-    if ($tab == 'related_listing') {
1581
-       $message = __('No listings found which match your selection.', 'geodirectory');
1580
+	if ($tab == 'related_listing') {
1581
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1582 1582
        
1583
-       /** This action is documented in geodirectory-functions/template_functions.php */
1584
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1583
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1584
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1585 1585
        
1586
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1587
-    }
1586
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1587
+	}
1588 1588
 
1589
-    return $is_display;
1589
+	return $is_display;
1590 1590
 }
1591 1591
 
1592 1592
 
@@ -1602,69 +1602,69 @@  discard block
 block discarded – undo
1602 1602
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1603 1603
  */
1604 1604
 function geodir_changes_in_custom_fields_table() {
1605
-    global $wpdb, $plugin_prefix;
1605
+	global $wpdb, $plugin_prefix;
1606 1606
 	
1607 1607
 	// Remove unused virtual page
1608 1608
 	$listings_page_id = (int)get_option('geodir_listing_page');
1609 1609
 	if ($listings_page_id) {
1610 1610
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1611
-        delete_option('geodir_listing_page');
1611
+		delete_option('geodir_listing_page');
1612 1612
 	}
1613 1613
 
1614
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1615
-        $wpdb->query(
1616
-            $wpdb->prepare(
1617
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1618
-                array('1', '1', 'admin')
1619
-            )
1620
-        );
1614
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1615
+		$wpdb->query(
1616
+			$wpdb->prepare(
1617
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1618
+				array('1', '1', 'admin')
1619
+			)
1620
+		);
1621 1621
 
1622 1622
 
1623
-        /* --- terms meta value set --- */
1623
+		/* --- terms meta value set --- */
1624 1624
 
1625
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1625
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1626 1626
 
1627
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1627
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1628 1628
 
1629
-        if (!empty($options_data)) {
1629
+		if (!empty($options_data)) {
1630 1630
 
1631
-            foreach ($options_data as $optobj) {
1631
+			foreach ($options_data as $optobj) {
1632 1632
 
1633
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1633
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1634 1634
 
1635
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1635
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1636 1636
 
1637
-                if (!empty($taxonomies_data)) {
1637
+				if (!empty($taxonomies_data)) {
1638 1638
 
1639
-                    foreach ($taxonomies_data as $taxobj) {
1639
+					foreach ($taxonomies_data as $taxobj) {
1640 1640
 
1641
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1642
-                        $post_type = $taxObject->object_type[0];
1641
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1642
+						$post_type = $taxObject->object_type[0];
1643 1643
 
1644
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1644
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1645 1645
 
1646
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1646
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1647 1647
 
1648
-                        if ($duplicate_data) {
1648
+						if ($duplicate_data) {
1649 1649
 
1650
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1650
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1651 1651
 
1652
-                        } else {
1652
+						} else {
1653 1653
 
1654
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1654
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1655 1655
 
1656
-                        }
1656
+						}
1657 1657
 
1658
-                    }
1658
+					}
1659 1659
 
1660
-                }
1660
+				}
1661 1661
 
1662
-            }
1663
-        }
1662
+			}
1663
+		}
1664 1664
 
1665
-        update_option('geodir_changes_in_custom_fields_table', '1');
1665
+		update_option('geodir_changes_in_custom_fields_table', '1');
1666 1666
 
1667
-    }
1667
+	}
1668 1668
 
1669 1669
 }
1670 1670
 
@@ -1683,24 +1683,24 @@  discard block
 block discarded – undo
1683 1683
 function geodir_location_slug_check($slug)
1684 1684
 {
1685 1685
 
1686
-    global $wpdb, $table_prefix;
1686
+	global $wpdb, $table_prefix;
1687 1687
 
1688
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1688
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1689 1689
 
1690
-    if ($slug_exists) {
1690
+	if ($slug_exists) {
1691 1691
 
1692
-        $suffix = 1;
1693
-        do {
1694
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1695
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1696
-            $suffix++;
1697
-        } while ($location_slug_check && $suffix < 100);
1692
+		$suffix = 1;
1693
+		do {
1694
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1695
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1696
+			$suffix++;
1697
+		} while ($location_slug_check && $suffix < 100);
1698 1698
 
1699
-        $slug = $alt_location_name;
1699
+		$slug = $alt_location_name;
1700 1700
 
1701
-    }
1701
+	}
1702 1702
 
1703
-    return $slug;
1703
+	return $slug;
1704 1704
 
1705 1705
 }
1706 1706
 
@@ -1725,42 +1725,42 @@  discard block
 block discarded – undo
1725 1725
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1726 1726
 {
1727 1727
 
1728
-    global $wpdb, $plugin_prefix, $table_prefix;
1728
+	global $wpdb, $plugin_prefix, $table_prefix;
1729 1729
 
1730
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1730
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1731 1731
 
1732
-    $slug = $tern_data->slug;
1732
+	$slug = $tern_data->slug;
1733 1733
 
1734
-    /**
1735
-     * Filter if a term slug exists.
1736
-     *
1737
-     * @since 1.0.0
1738
-     * @package GeoDirectory
1739
-     * @param bool $bool Default: false.
1740
-     * @param string $slug The term slug.
1741
-     * @param int $term_id The term ID.
1742
-     */
1743
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1734
+	/**
1735
+	 * Filter if a term slug exists.
1736
+	 *
1737
+	 * @since 1.0.0
1738
+	 * @package GeoDirectory
1739
+	 * @param bool $bool Default: false.
1740
+	 * @param string $slug The term slug.
1741
+	 * @param int $term_id The term ID.
1742
+	 */
1743
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1744 1744
 
1745
-    if ($slug_exists) {
1745
+	if ($slug_exists) {
1746 1746
 
1747
-        $suffix = 1;
1748
-        do {
1749
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1747
+		$suffix = 1;
1748
+		do {
1749
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1750 1750
 
1751
-            /** This action is documented in geodirectory_hooks_actions.php */
1752
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1751
+			/** This action is documented in geodirectory_hooks_actions.php */
1752
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1753 1753
 
1754
-            $suffix++;
1755
-        } while ($term_slug_check && $suffix < 100);
1754
+			$suffix++;
1755
+		} while ($term_slug_check && $suffix < 100);
1756 1756
 
1757
-        $slug = $new_slug;
1757
+		$slug = $new_slug;
1758 1758
 
1759
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1759
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1760 1760
 
1761
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1761
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1762 1762
 
1763
-    }
1763
+	}
1764 1764
 	
1765 1765
 	// Update tag in detail table.
1766 1766
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1801,21 +1801,21 @@  discard block
 block discarded – undo
1801 1801
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1802 1802
 {
1803 1803
 
1804
-    global $wpdb, $table_prefix;
1804
+	global $wpdb, $table_prefix;
1805 1805
 
1806
-    $default_location = geodir_get_default_location();
1806
+	$default_location = geodir_get_default_location();
1807 1807
 
1808
-    $country_slug = $default_location->country_slug;
1809
-    $region_slug = $default_location->region_slug;
1810
-    $city_slug = $default_location->city_slug;
1808
+	$country_slug = $default_location->country_slug;
1809
+	$region_slug = $default_location->region_slug;
1810
+	$city_slug = $default_location->city_slug;
1811 1811
 
1812
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1813
-        return $slug_exists = true;
1812
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1813
+		return $slug_exists = true;
1814 1814
 
1815
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1816
-        return $slug_exists = true;
1815
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1816
+		return $slug_exists = true;
1817 1817
 
1818
-    return $slug_exists;
1818
+	return $slug_exists;
1819 1819
 }
1820 1820
 
1821 1821
 
@@ -1835,75 +1835,75 @@  discard block
 block discarded – undo
1835 1835
  */
1836 1836
 function geodir_custom_page_title($title = '', $sep = '')
1837 1837
 {
1838
-    global $wp;
1839
-    if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1840
-        return $title;
1841
-    }
1838
+	global $wp;
1839
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1840
+		return $title;
1841
+	}
1842 1842
 
1843
-    if ($sep == '') {
1844
-        /**
1845
-         * Filter the page title separator.
1846
-         *
1847
-         * @since 1.0.0
1848
-         * @package GeoDirectory
1849
-         * @param string $sep The separator, default: `|`.
1850
-         */
1851
-        $sep = apply_filters('geodir_page_title_separator', '|');
1852
-    }
1843
+	if ($sep == '') {
1844
+		/**
1845
+		 * Filter the page title separator.
1846
+		 *
1847
+		 * @since 1.0.0
1848
+		 * @package GeoDirectory
1849
+		 * @param string $sep The separator, default: `|`.
1850
+		 */
1851
+		$sep = apply_filters('geodir_page_title_separator', '|');
1852
+	}
1853 1853
 
1854 1854
 
1855
-    $gd_page = '';
1856
-    if(geodir_is_page('home')){
1857
-        $gd_page = 'home';
1858
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1859
-    }
1860
-    elseif(geodir_is_page('detail')){
1861
-        $gd_page = 'detail';
1862
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1863
-    }
1864
-    elseif(geodir_is_page('pt')){
1865
-        $gd_page = 'pt';
1866
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('listing')){
1869
-        $gd_page = 'listing';
1870
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('location')){
1873
-        $gd_page = 'location';
1874
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('search')){
1877
-        $gd_page = 'search';
1878
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('add-listing')){
1881
-        $gd_page = 'add-listing';
1882
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('author')){
1885
-        $gd_page = 'author';
1886
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('login')){
1889
-        $gd_page = 'login';
1890
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('listing-success')){
1893
-        $gd_page = 'listing-success';
1894
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1895
-    }
1855
+	$gd_page = '';
1856
+	if(geodir_is_page('home')){
1857
+		$gd_page = 'home';
1858
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1859
+	}
1860
+	elseif(geodir_is_page('detail')){
1861
+		$gd_page = 'detail';
1862
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1863
+	}
1864
+	elseif(geodir_is_page('pt')){
1865
+		$gd_page = 'pt';
1866
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1867
+	}
1868
+	elseif(geodir_is_page('listing')){
1869
+		$gd_page = 'listing';
1870
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1871
+	}
1872
+	elseif(geodir_is_page('location')){
1873
+		$gd_page = 'location';
1874
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1875
+	}
1876
+	elseif(geodir_is_page('search')){
1877
+		$gd_page = 'search';
1878
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('add-listing')){
1881
+		$gd_page = 'add-listing';
1882
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1883
+	}
1884
+	elseif(geodir_is_page('author')){
1885
+		$gd_page = 'author';
1886
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1887
+	}
1888
+	elseif(geodir_is_page('login')){
1889
+		$gd_page = 'login';
1890
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1891
+	}
1892
+	elseif(geodir_is_page('listing-success')){
1893
+		$gd_page = 'listing-success';
1894
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1895
+	}
1896 1896
 
1897 1897
 
1898
-    /**
1899
-     * Filter page meta title to replace variables.
1900
-     *
1901
-     * @since 1.5.4
1902
-     * @param string $title The page title including variables.
1903
-     * @param string $gd_page The GeoDirectory page type if any.
1904
-     * @param string $sep The title separator symbol.
1905
-     */
1906
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1898
+	/**
1899
+	 * Filter page meta title to replace variables.
1900
+	 *
1901
+	 * @since 1.5.4
1902
+	 * @param string $title The page title including variables.
1903
+	 * @param string $gd_page The GeoDirectory page type if any.
1904
+	 * @param string $sep The title separator symbol.
1905
+	 */
1906
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1907 1907
 
1908 1908
 }
1909 1909
 
@@ -1919,36 +1919,36 @@  discard block
 block discarded – undo
1919 1919
 function geodir_set_post_attachment()
1920 1920
 {
1921 1921
 
1922
-    if (!get_option('geodir_set_post_attachments')) {
1922
+	if (!get_option('geodir_set_post_attachments')) {
1923 1923
 
1924
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1925
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1924
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1925
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1926 1926
 
1927
-        $all_postypes = geodir_get_posttypes();
1927
+		$all_postypes = geodir_get_posttypes();
1928 1928
 
1929
-        foreach($all_postypes as $post_type){
1930
-            $args = array(
1931
-                'posts_per_page' => -1,
1932
-                'post_type' => $post_type,
1933
-                'post_status' => 'publish');
1929
+		foreach($all_postypes as $post_type){
1930
+			$args = array(
1931
+				'posts_per_page' => -1,
1932
+				'post_type' => $post_type,
1933
+				'post_status' => 'publish');
1934 1934
 
1935
-            $posts_array = get_posts($args);
1935
+			$posts_array = get_posts($args);
1936 1936
 
1937
-            if (!empty($posts_array)) {
1937
+			if (!empty($posts_array)) {
1938 1938
 
1939
-                foreach ($posts_array as $post) {
1939
+				foreach ($posts_array as $post) {
1940 1940
 
1941
-                    geodir_set_wp_featured_image($post->ID);
1941
+					geodir_set_wp_featured_image($post->ID);
1942 1942
 
1943
-                }
1943
+				}
1944 1944
 
1945
-            }
1946
-        }
1945
+			}
1946
+		}
1947 1947
 
1948 1948
 
1949
-        update_option('geodir_set_post_attachments', '1');
1949
+		update_option('geodir_set_post_attachments', '1');
1950 1950
 
1951
-    }
1951
+	}
1952 1952
 
1953 1953
 }
1954 1954
 
@@ -1965,19 +1965,19 @@  discard block
 block discarded – undo
1965 1965
 function geodir_remove_url_seperator()
1966 1966
 {
1967 1967
 
1968
-    if (!get_option('geodir_remove_url_seperator')) {
1968
+	if (!get_option('geodir_remove_url_seperator')) {
1969 1969
 
1970
-        if (get_option('geodir_listingurl_separator'))
1971
-            delete_option('geodir_listingurl_separator');
1970
+		if (get_option('geodir_listingurl_separator'))
1971
+			delete_option('geodir_listingurl_separator');
1972 1972
 
1973
-        if (get_option('geodir_detailurl_separator'))
1974
-            delete_option('geodir_detailurl_separator');
1973
+		if (get_option('geodir_detailurl_separator'))
1974
+			delete_option('geodir_detailurl_separator');
1975 1975
 
1976
-        flush_rewrite_rules(false);
1976
+		flush_rewrite_rules(false);
1977 1977
 
1978
-        update_option('geodir_remove_url_seperator', '1');
1978
+		update_option('geodir_remove_url_seperator', '1');
1979 1979
 
1980
-    }
1980
+	}
1981 1981
 
1982 1982
 }
1983 1983
 
@@ -1993,19 +1993,19 @@  discard block
 block discarded – undo
1993 1993
  */
1994 1994
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
1995 1995
 {
1996
-    foreach ($permalink_arr as $key => $value) {
1996
+	foreach ($permalink_arr as $key => $value) {
1997 1997
 
1998
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1999
-            unset($permalink_arr[$key]);
1998
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1999
+			unset($permalink_arr[$key]);
2000 2000
 
2001
-    }
2001
+	}
2002 2002
 
2003
-    return $permalink_arr;
2003
+	return $permalink_arr;
2004 2004
 
2005 2005
 }
2006 2006
 
2007 2007
 if (!is_admin()) {
2008
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2008
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2009 2009
 }
2010 2010
 /**
2011 2011
  * Set status from draft to publish.
@@ -2018,16 +2018,16 @@  discard block
 block discarded – undo
2018 2018
  */
2019 2019
 function geodir_set_status_draft_to_publish_for_own_post($post)
2020 2020
 {
2021
-    $user_id = get_current_user_id();
2021
+	$user_id = get_current_user_id();
2022 2022
 
2023
-    if(!$user_id){return $post;}
2023
+	if(!$user_id){return $post;}
2024 2024
 
2025
-    $gd_post_types = geodir_get_posttypes();
2025
+	$gd_post_types = geodir_get_posttypes();
2026 2026
 
2027
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2028
-        $post[0]->post_status = 'publish';
2029
-    }
2030
-    return $post;
2027
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2028
+		$post[0]->post_status = 'publish';
2029
+	}
2030
+	return $post;
2031 2031
 }
2032 2032
 
2033 2033
 
@@ -2119,33 +2119,33 @@  discard block
 block discarded – undo
2119 2119
  */
2120 2120
 function geodir_detail_page_tab_headings_change($tabs_arr)
2121 2121
 {
2122
-    global $wpdb;
2122
+	global $wpdb;
2123 2123
 
2124
-    $post_type = geodir_get_current_posttype();
2124
+	$post_type = geodir_get_current_posttype();
2125 2125
 
2126
-    $all_postypes = geodir_get_posttypes();
2126
+	$all_postypes = geodir_get_posttypes();
2127 2127
 
2128
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2128
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2129 2129
 
2130
-        if (array_key_exists('post_video', $tabs_arr)) {
2130
+		if (array_key_exists('post_video', $tabs_arr)) {
2131 2131
 
2132
-            $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)));
2132
+			$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)));
2133 2133
 
2134
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2135
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2136
-        }
2134
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2135
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2136
+		}
2137 2137
 
2138
-        if (array_key_exists('special_offers', $tabs_arr)) {
2138
+		if (array_key_exists('special_offers', $tabs_arr)) {
2139 2139
 
2140
-            $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)));
2140
+			$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)));
2141 2141
 
2142
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2143
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2144
-        }
2142
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2143
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2144
+		}
2145 2145
 
2146
-    }
2146
+	}
2147 2147
 
2148
-    return $tabs_arr;
2148
+	return $tabs_arr;
2149 2149
 
2150 2150
 }
2151 2151
 
@@ -2158,10 +2158,10 @@  discard block
 block discarded – undo
2158 2158
  */
2159 2159
 function geodir_remove_template_redirect_actions()
2160 2160
 {
2161
-    if (geodir_is_page('login')){
2162
-        remove_all_actions('template_redirect');
2163
-        remove_action('init', 'avia_modify_front', 10);
2164
-    }
2161
+	if (geodir_is_page('login')){
2162
+		remove_all_actions('template_redirect');
2163
+		remove_action('init', 'avia_modify_front', 10);
2164
+	}
2165 2165
 }
2166 2166
 
2167 2167
 
@@ -2183,51 +2183,51 @@  discard block
 block discarded – undo
2183 2183
 function geodirectory_before_featured_image_delete($attachment_id)
2184 2184
 {
2185 2185
 
2186
-    global $wpdb, $plugin_prefix;
2186
+	global $wpdb, $plugin_prefix;
2187 2187
 
2188
-    $post_id = get_post_field('post_parent', $attachment_id);
2188
+	$post_id = get_post_field('post_parent', $attachment_id);
2189 2189
 
2190
-    $attachment_url = wp_get_attachment_url($attachment_id);
2190
+	$attachment_url = wp_get_attachment_url($attachment_id);
2191 2191
 
2192
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2192
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2193 2193
 
2194
-        $post_type = get_post_type($post_id);
2194
+		$post_type = get_post_type($post_id);
2195 2195
 
2196
-        $all_postypes = geodir_get_posttypes();
2196
+		$all_postypes = geodir_get_posttypes();
2197 2197
 
2198
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2199
-            return false;
2198
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2199
+			return false;
2200 2200
 
2201
-        $uploads = wp_upload_dir();
2201
+		$uploads = wp_upload_dir();
2202 2202
 
2203
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2203
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2204 2204
 
2205
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2205
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2206 2206
 
2207
-        $wpdb->query(
2208
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2209
-                array($post_id, $split_img_file_path)
2210
-            )
2211
-        );
2207
+		$wpdb->query(
2208
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2209
+				array($post_id, $split_img_file_path)
2210
+			)
2211
+		);
2212 2212
 
2213
-        $attachment_data = $wpdb->get_row(
2214
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2215
-                array($post_id)
2216
-            )
2217
-        );
2213
+		$attachment_data = $wpdb->get_row(
2214
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2215
+				array($post_id)
2216
+			)
2217
+		);
2218 2218
 
2219
-        if (!empty($attachment_data)) {
2220
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2221
-        }
2219
+		if (!empty($attachment_data)) {
2220
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2221
+		}
2222 2222
 
2223 2223
 
2224
-        $table_name = $plugin_prefix . $post_type . '_detail';
2224
+		$table_name = $plugin_prefix . $post_type . '_detail';
2225 2225
 
2226
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2226
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2227 2227
 
2228
-        geodir_set_wp_featured_image($post_id);
2228
+		geodir_set_wp_featured_image($post_id);
2229 2229
 
2230
-    }
2230
+	}
2231 2231
 
2232 2232
 }
2233 2233
 
@@ -2245,79 +2245,79 @@  discard block
 block discarded – undo
2245 2245
 function geodir_temp_set_post_attachment()
2246 2246
 {
2247 2247
 
2248
-    global $wpdb, $plugin_prefix;
2248
+	global $wpdb, $plugin_prefix;
2249 2249
 
2250
-    $all_postypes = geodir_get_posttypes();
2250
+	$all_postypes = geodir_get_posttypes();
2251 2251
 
2252
-    foreach ($all_postypes as $posttype) {
2252
+	foreach ($all_postypes as $posttype) {
2253 2253
 
2254
-        $tablename = $plugin_prefix . $posttype . '_detail';
2254
+		$tablename = $plugin_prefix . $posttype . '_detail';
2255 2255
 
2256
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2256
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2257 2257
 
2258
-        if (!empty($get_post_data)) {
2258
+		if (!empty($get_post_data)) {
2259 2259
 
2260
-            foreach ($get_post_data as $data) {
2260
+			foreach ($get_post_data as $data) {
2261 2261
 
2262
-                $post_id = $data->post_id;
2262
+				$post_id = $data->post_id;
2263 2263
 
2264
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2264
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2265 2265
 
2266
-                if (!empty($attachment_data)) {
2266
+				if (!empty($attachment_data)) {
2267 2267
 
2268
-                    foreach ($attachment_data as $attach) {
2268
+					foreach ($attachment_data as $attach) {
2269 2269
 
2270
-                        $file_info = pathinfo($attach->file);
2270
+						$file_info = pathinfo($attach->file);
2271 2271
 
2272
-                        $sub_dir = '';
2273
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2274
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2272
+						$sub_dir = '';
2273
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2274
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2275 2275
 
2276
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2277
-                        $uploads_path = $uploads['basedir'];
2276
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2277
+						$uploads_path = $uploads['basedir'];
2278 2278
 
2279
-                        $file_name = $file_info['basename'];
2279
+						$file_name = $file_info['basename'];
2280 2280
 
2281
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2281
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2282 2282
 
2283
-                        if (!file_exists($img_arr['path'])) {
2283
+						if (!file_exists($img_arr['path'])) {
2284 2284
 
2285
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2285
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2286 2286
 
2287
-                        }
2287
+						}
2288 2288
 
2289
-                    }
2289
+					}
2290 2290
 
2291
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2291
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2292 2292
 
2293
-                    if (!empty($attachment_data)) {
2293
+					if (!empty($attachment_data)) {
2294 2294
 
2295
-                        if ($attachment_data->ID)
2296
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2295
+						if ($attachment_data->ID)
2296
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2297 2297
 
2298
-                    } else {
2298
+					} else {
2299 2299
 
2300
-                        if (has_post_thumbnail($post_id)) {
2300
+						if (has_post_thumbnail($post_id)) {
2301 2301
 
2302
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2302
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2303 2303
 
2304
-                            wp_delete_attachment($post_thumbnail_id);
2304
+							wp_delete_attachment($post_thumbnail_id);
2305 2305
 
2306
-                        }
2306
+						}
2307 2307
 
2308
-                    }
2308
+					}
2309 2309
 
2310
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2310
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2311 2311
 
2312
-                    geodir_set_wp_featured_image($post_id);
2312
+					geodir_set_wp_featured_image($post_id);
2313 2313
 
2314
-                }
2314
+				}
2315 2315
 
2316
-            }
2316
+			}
2317 2317
 
2318
-        }
2318
+		}
2319 2319
 
2320
-    }
2320
+	}
2321 2321
 
2322 2322
 }
2323 2323
 
@@ -2335,9 +2335,9 @@  discard block
 block discarded – undo
2335 2335
 function geodir_default_rating_star_icon()
2336 2336
 {
2337 2337
 
2338
-    if (!get_option('geodir_default_rating_star_icon')) {
2339
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2340
-    }
2338
+	if (!get_option('geodir_default_rating_star_icon')) {
2339
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2340
+	}
2341 2341
 
2342 2342
 }
2343 2343
 
@@ -2355,27 +2355,27 @@  discard block
 block discarded – undo
2355 2355
  */
2356 2356
 function geodir_user_post_listing_count($user_id=null)
2357 2357
 {
2358
-    global $wpdb, $plugin_prefix, $current_user;
2359
-    if(!$user_id){
2360
-        $user_id = $current_user->ID;
2361
-    }
2358
+	global $wpdb, $plugin_prefix, $current_user;
2359
+	if(!$user_id){
2360
+		$user_id = $current_user->ID;
2361
+	}
2362 2362
 
2363
-    $user_id = $current_user->ID;
2364
-    $all_postypes = geodir_get_posttypes();
2365
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2363
+	$user_id = $current_user->ID;
2364
+	$all_postypes = geodir_get_posttypes();
2365
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2366 2366
 
2367
-    $user_listing = array();
2368
-    if (is_array($all_posts) && !empty($all_posts)) {
2369
-        foreach ($all_posts as $ptype) {
2370
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2367
+	$user_listing = array();
2368
+	if (is_array($all_posts) && !empty($all_posts)) {
2369
+		foreach ($all_posts as $ptype) {
2370
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2371 2371
 
2372
-            if ($total_posts > 0) {
2373
-                $user_listing[$ptype] = $total_posts;
2374
-            }
2375
-        }
2376
-    }
2372
+			if ($total_posts > 0) {
2373
+				$user_listing[$ptype] = $total_posts;
2374
+			}
2375
+		}
2376
+	}
2377 2377
 
2378
-    return $user_listing;
2378
+	return $user_listing;
2379 2379
 }
2380 2380
 
2381 2381
 
@@ -2395,189 +2395,189 @@  discard block
 block discarded – undo
2395 2395
  */
2396 2396
 function geodir_detail_page_custom_field_tab($tabs_arr)
2397 2397
 {
2398
-    global $post;
2399
-
2400
-    $post_type = geodir_get_current_posttype();
2401
-    $all_postypes = geodir_get_posttypes();
2402
-
2403
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2404
-        $package_info = array();
2405
-        $package_info = geodir_post_package_info($package_info, $post);
2406
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2407
-        $fields_location = 'owntab';
2408
-
2409
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2410
-        //remove video and special offers if it is already set to show
2411
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2412
-            $unset_video = true;
2413
-        }
2414
-
2415
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2416
-            $unset_special_offers = true;
2417
-        }
2418
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2419
-            foreach($custom_fields as $key => $custom_field){
2420
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2421
-                    unset($custom_fields[$key]);
2422
-                }
2423
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2424
-                    unset($custom_fields[$key]);
2425
-                }
2426
-            }
2427
-        }
2428
-
2429
-
2430
-        if (!empty($custom_fields)) {
2431
-            $parse_custom_fields = array();
2432
-            foreach ($custom_fields as $field) {
2433
-                $field = stripslashes_deep($field); // strip slashes
2434
-                $type = $field;
2435
-                $field_name = $field['htmlvar_name'];
2436
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2437
-                    $post->{$field_name} = $_REQUEST[$field_name];
2438
-                }
2398
+	global $post;
2439 2399
 
2440
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2441
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2442
-                        continue;
2443
-                    }
2400
+	$post_type = geodir_get_current_posttype();
2401
+	$all_postypes = geodir_get_posttypes();
2444 2402
 
2445
-                    $parse_custom_fields[] = $field;
2446
-                }
2447
-            }
2448
-            $custom_fields = $parse_custom_fields;
2449
-        }
2450
-        //print_r($custom_fields);
2451
-        if (!empty($custom_fields)) {
2403
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2404
+		$package_info = array();
2405
+		$package_info = geodir_post_package_info($package_info, $post);
2406
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2407
+		$fields_location = 'owntab';
2452 2408
 
2453
-            global $field_set_start;
2409
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2410
+		//remove video and special offers if it is already set to show
2411
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2412
+			$unset_video = true;
2413
+		}
2454 2414
 
2455
-            $post = stripslashes_deep($post); // strip slashes
2456
-            
2457
-            $field_set_start = 0;
2458
-            $fieldset_count = 0;
2459
-            $fieldset = '';
2460
-            $total_fields = count($custom_fields);
2461
-            $count_field = 0;
2462
-            $fieldset_arr = array();
2463
-            $i = 0;
2464
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2465
-
2466
-            foreach ($custom_fields as $field) {
2467
-                $count_field++;
2468
-                $field_name = $field['htmlvar_name'];
2469
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2470
-                    $post->{$field_name} = $_REQUEST[$field_name];
2471
-                }
2415
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2416
+			$unset_special_offers = true;
2417
+		}
2418
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2419
+			foreach($custom_fields as $key => $custom_field){
2420
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2421
+					unset($custom_fields[$key]);
2422
+				}
2423
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2424
+					unset($custom_fields[$key]);
2425
+				}
2426
+			}
2427
+		}
2472 2428
 
2473
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2474
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2475
-                    $site_title = trim($field['site_title']);
2476
-                    $type = $field;
2477
-                    $variables_array = array();
2478 2429
 
2479
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2480
-                        continue;
2481
-                    }
2430
+		if (!empty($custom_fields)) {
2431
+			$parse_custom_fields = array();
2432
+			foreach ($custom_fields as $field) {
2433
+				$field = stripslashes_deep($field); // strip slashes
2434
+				$type = $field;
2435
+				$field_name = $field['htmlvar_name'];
2436
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2437
+					$post->{$field_name} = $_REQUEST[$field_name];
2438
+				}
2482 2439
 
2483
-                    if ($type['type'] != 'fieldset') {
2484
-                        $i++;
2485
-                        $variables_array['post_id'] = $post->ID;
2486
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2487
-                        $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2488
-
2489
-                    }else{
2490
-                        $i = 0;
2491
-                        $fieldset_count++;
2492
-                        $field_set_start = 1;
2493
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2494
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2495
-                    }
2440
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2441
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2442
+						continue;
2443
+					}
2496 2444
 
2445
+					$parse_custom_fields[] = $field;
2446
+				}
2447
+			}
2448
+			$custom_fields = $parse_custom_fields;
2449
+		}
2450
+		//print_r($custom_fields);
2451
+		if (!empty($custom_fields)) {
2497 2452
 
2498
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2499
-                    $type = stripslashes_deep($type); // strip slashes
2500
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2501
-                    $html = '';
2502
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2503
-                    if($html_var=='post'){$html_var='post_address';}
2504
-                    $field_icon = geodir_field_icon_proccess($type);
2505
-                    $filed_type = $type['type'];
2506
-
2507
-                    /**
2508
-                     * Filter the output for custom fields.
2509
-                     *
2510
-                     * Here we can remove or add new functions depending on the field type.
2511
-                     *
2512
-                     * @param string $html The html to be filtered (blank).
2513
-                     * @param string $fields_location The location the field is to be show.
2514
-                     * @param array $type The array of field values.
2515
-                     */
2516
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2517
-
2518
-
2519
-                    /**
2520
-                     * Filter custom field output in tab.
2521
-                     *
2522
-                     * @since 1.5.6
2523
-                     *
2524
-                     * @param string $html_var The HTML variable name for the field.
2525
-                     * @param string $html Custom field unfiltered HTML.
2526
-                     * @param array $variables_array Custom field variables array.
2527
-                     */
2528
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2529
-
2530
-                    $fieldset_html = '';
2531
-                    if ($field_set_start == 1) {
2532
-                        $add_html = false;
2533
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2534
-                            if ($fieldset != '') {
2535
-                                $add_html = true;
2536
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2537
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2538
-                            }
2539
-                            $fieldset_html = $fieldset;
2540
-                            $fieldset = '';
2541
-                        } else {
2542
-                            $fieldset .= $html;
2543
-                            if ($total_fields == $count_field && $fieldset != '') {
2544
-                                $add_html = true;
2545
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2546
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2547
-                                $fieldset_html = $fieldset;
2548
-                            }
2549
-                        }
2453
+			global $field_set_start;
2550 2454
 
2551
-                        if ($add_html) {
2552
-                            $tabs_arr[$htmlvar_name] = array(
2553
-                                'heading_text' => __($label, 'geodirectory'),
2554
-                                'is_active_tab' => false,
2555
-                                /**
2556
-                                 * Filter if a custom field should be displayed on the details page tab.
2557
-                                 *
2558
-                                 * @since 1.0.0
2559
-                                 * @param string $htmlvar_name The field HTML var name.
2560
-                                 */
2561
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2562
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2563
-                            );
2564
-                        }
2565
-                    } else {
2566
-                        if ($html != '') {
2567
-                            $tabs_arr[$html_var] = array(
2568
-                                'heading_text' => __($label, 'geodirectory'),
2569
-                                'is_active_tab' => false,
2570
-                                /** This action is documented in geodirectory_hooks_actions.php */
2571
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2572
-                                'tab_content' => $html
2573
-                            );
2574
-                        }
2575
-                    }
2576
-                }
2577
-            }
2578
-        }
2579
-    }
2580
-    return $tabs_arr;
2455
+			$post = stripslashes_deep($post); // strip slashes
2456
+            
2457
+			$field_set_start = 0;
2458
+			$fieldset_count = 0;
2459
+			$fieldset = '';
2460
+			$total_fields = count($custom_fields);
2461
+			$count_field = 0;
2462
+			$fieldset_arr = array();
2463
+			$i = 0;
2464
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2465
+
2466
+			foreach ($custom_fields as $field) {
2467
+				$count_field++;
2468
+				$field_name = $field['htmlvar_name'];
2469
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2470
+					$post->{$field_name} = $_REQUEST[$field_name];
2471
+				}
2472
+
2473
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2474
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2475
+					$site_title = trim($field['site_title']);
2476
+					$type = $field;
2477
+					$variables_array = array();
2478
+
2479
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2480
+						continue;
2481
+					}
2482
+
2483
+					if ($type['type'] != 'fieldset') {
2484
+						$i++;
2485
+						$variables_array['post_id'] = $post->ID;
2486
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2487
+						$variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2488
+
2489
+					}else{
2490
+						$i = 0;
2491
+						$fieldset_count++;
2492
+						$field_set_start = 1;
2493
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2494
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2495
+					}
2496
+
2497
+
2498
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2499
+					$type = stripslashes_deep($type); // strip slashes
2500
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2501
+					$html = '';
2502
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2503
+					if($html_var=='post'){$html_var='post_address';}
2504
+					$field_icon = geodir_field_icon_proccess($type);
2505
+					$filed_type = $type['type'];
2506
+
2507
+					/**
2508
+					 * Filter the output for custom fields.
2509
+					 *
2510
+					 * Here we can remove or add new functions depending on the field type.
2511
+					 *
2512
+					 * @param string $html The html to be filtered (blank).
2513
+					 * @param string $fields_location The location the field is to be show.
2514
+					 * @param array $type The array of field values.
2515
+					 */
2516
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2517
+
2518
+
2519
+					/**
2520
+					 * Filter custom field output in tab.
2521
+					 *
2522
+					 * @since 1.5.6
2523
+					 *
2524
+					 * @param string $html_var The HTML variable name for the field.
2525
+					 * @param string $html Custom field unfiltered HTML.
2526
+					 * @param array $variables_array Custom field variables array.
2527
+					 */
2528
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2529
+
2530
+					$fieldset_html = '';
2531
+					if ($field_set_start == 1) {
2532
+						$add_html = false;
2533
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2534
+							if ($fieldset != '') {
2535
+								$add_html = true;
2536
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2537
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2538
+							}
2539
+							$fieldset_html = $fieldset;
2540
+							$fieldset = '';
2541
+						} else {
2542
+							$fieldset .= $html;
2543
+							if ($total_fields == $count_field && $fieldset != '') {
2544
+								$add_html = true;
2545
+								$label = $fieldset_arr[$fieldset_count]['label'];
2546
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2547
+								$fieldset_html = $fieldset;
2548
+							}
2549
+						}
2550
+
2551
+						if ($add_html) {
2552
+							$tabs_arr[$htmlvar_name] = array(
2553
+								'heading_text' => __($label, 'geodirectory'),
2554
+								'is_active_tab' => false,
2555
+								/**
2556
+								 * Filter if a custom field should be displayed on the details page tab.
2557
+								 *
2558
+								 * @since 1.0.0
2559
+								 * @param string $htmlvar_name The field HTML var name.
2560
+								 */
2561
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2562
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2563
+							);
2564
+						}
2565
+					} else {
2566
+						if ($html != '') {
2567
+							$tabs_arr[$html_var] = array(
2568
+								'heading_text' => __($label, 'geodirectory'),
2569
+								'is_active_tab' => false,
2570
+								/** This action is documented in geodirectory_hooks_actions.php */
2571
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2572
+								'tab_content' => $html
2573
+							);
2574
+						}
2575
+					}
2576
+				}
2577
+			}
2578
+		}
2579
+	}
2580
+	return $tabs_arr;
2581 2581
 }
2582 2582
 
2583 2583
 /* display add listing page for wpml */
@@ -2601,39 +2601,39 @@  discard block
 block discarded – undo
2601 2601
  */
2602 2602
 function geodir_add_post_status_author_page()
2603 2603
 {
2604
-    global $wpdb, $post;
2605
-
2606
-    $html = '';
2607
-    if (get_current_user_id()) {
2608
-
2609
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2610
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2611
-
2612
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2613
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2614
-            $status = "<strong>(";
2615
-            $status_icon = '<i class="fa fa-play"></i>';
2616
-            if ($real_status == 'publish') {
2617
-                $status .= __('Published', 'geodirectory');
2618
-            } else {
2619
-                $status .= __('Not published', 'geodirectory');
2620
-                $status_icon = '<i class="fa fa-pause"></i>';
2621
-            }
2622
-            $status .= ")</strong>";
2604
+	global $wpdb, $post;
2605
+
2606
+	$html = '';
2607
+	if (get_current_user_id()) {
2608
+
2609
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2610
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2611
+
2612
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2613
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2614
+			$status = "<strong>(";
2615
+			$status_icon = '<i class="fa fa-play"></i>';
2616
+			if ($real_status == 'publish') {
2617
+				$status .= __('Published', 'geodirectory');
2618
+			} else {
2619
+				$status .= __('Not published', 'geodirectory');
2620
+				$status_icon = '<i class="fa fa-pause"></i>';
2621
+			}
2622
+			$status .= ")</strong>";
2623 2623
 
2624
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2625
-        }
2626
-    }
2624
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2625
+		}
2626
+	}
2627 2627
 
2628
-    if ($html != '') {
2629
-        /**
2630
-         * Filter the post status text on the author page.
2631
-         *
2632
-         * @since 1.0.0
2633
-         * @param string $html The HTML of the status.
2634
-         */
2635
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2636
-    }
2628
+	if ($html != '') {
2629
+		/**
2630
+		 * Filter the post status text on the author page.
2631
+		 *
2632
+		 * @since 1.0.0
2633
+		 * @param string $html The HTML of the status.
2634
+		 */
2635
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2636
+	}
2637 2637
 
2638 2638
 
2639 2639
 }
@@ -2647,9 +2647,9 @@  discard block
 block discarded – undo
2647 2647
  * @package GeoDirectory
2648 2648
  */
2649 2649
 function geodir_init_no_rating() {
2650
-    if (geodir_rating_disabled_post_types()) {
2651
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2652
-    }
2650
+	if (geodir_rating_disabled_post_types()) {
2651
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2652
+	}
2653 2653
 }
2654 2654
 
2655 2655
 /**
@@ -2663,22 +2663,22 @@  discard block
 block discarded – undo
2663 2663
  * @return array Modified sort options array.
2664 2664
  */
2665 2665
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2666
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2667
-        $new_options = array();
2666
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2667
+		$new_options = array();
2668 2668
         
2669
-        if (!empty($options)) {
2670
-            foreach ($options as $option) {
2671
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2672
-                    continue;
2673
-                }
2674
-                $new_options[] = $option;
2675
-            }
2669
+		if (!empty($options)) {
2670
+			foreach ($options as $option) {
2671
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2672
+					continue;
2673
+				}
2674
+				$new_options[] = $option;
2675
+			}
2676 2676
 
2677
-            $options = $new_options;
2678
-        }
2679
-    }
2677
+			$options = $new_options;
2678
+		}
2679
+	}
2680 2680
 
2681
-    return $options;
2681
+	return $options;
2682 2682
 }
2683 2683
 
2684 2684
 /**
@@ -2690,9 +2690,9 @@  discard block
 block discarded – undo
2690 2690
  * @return array Modified class array.
2691 2691
  */
2692 2692
 function geodir_body_class_active_map($classes = array()) {
2693
-    $classes[] = 'gd-map-' . geodir_map_name();
2693
+	$classes[] = 'gd-map-' . geodir_map_name();
2694 2694
 
2695
-    return $classes;
2695
+	return $classes;
2696 2696
 }
2697 2697
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2698 2698
 
@@ -2705,9 +2705,9 @@  discard block
 block discarded – undo
2705 2705
  * @return string Modified class string.
2706 2706
  */
2707 2707
 function geodir_admin_body_class_active_map($class = '') {    
2708
-    $class .= ' gd-map-' . geodir_map_name();
2708
+	$class .= ' gd-map-' . geodir_map_name();
2709 2709
 
2710
-    return $class;
2710
+	return $class;
2711 2711
 }
2712 2712
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2713 2713
 
@@ -2725,36 +2725,36 @@  discard block
 block discarded – undo
2725 2725
  * @return array Translation texts.
2726 2726
  */
2727 2727
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2728
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2729
-
2730
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2731
-
2732
-    /**
2733
-     * Filters the geodirectory option names that requires to add for translation.
2734
-     *
2735
-     * @since 1.5.7
2736
-     * @package GeoDirectory
2737
-     *
2738
-     * @param  array $gd_options Array of option names.
2739
-     */
2740
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2741
-    $gd_options = array_unique($gd_options);
2742
-
2743
-    if (!empty($gd_options)) {
2744
-        foreach ($gd_options as $gd_option) {
2745
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2746
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2728
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2729
+
2730
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2731
+
2732
+	/**
2733
+	 * Filters the geodirectory option names that requires to add for translation.
2734
+	 *
2735
+	 * @since 1.5.7
2736
+	 * @package GeoDirectory
2737
+	 *
2738
+	 * @param  array $gd_options Array of option names.
2739
+	 */
2740
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2741
+	$gd_options = array_unique($gd_options);
2742
+
2743
+	if (!empty($gd_options)) {
2744
+		foreach ($gd_options as $gd_option) {
2745
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2746
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2747 2747
                 
2748
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2749
-                    $translation_texts[] = stripslashes_deep($option_value);
2750
-                }
2751
-            }
2752
-        }
2753
-    }
2748
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2749
+					$translation_texts[] = stripslashes_deep($option_value);
2750
+				}
2751
+			}
2752
+		}
2753
+	}
2754 2754
 
2755
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2755
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2756 2756
 
2757
-    return $translation_texts;
2757
+	return $translation_texts;
2758 2758
 }
2759 2759
 
2760 2760
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2768,15 +2768,15 @@  discard block
 block discarded – undo
2768 2768
 
2769 2769
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2770 2770
 function gd_get_comments_link($comments_link, $post_id) {
2771
-    $post_type = get_post_type($post_id);
2771
+	$post_type = get_post_type($post_id);
2772 2772
 
2773
-    $all_postypes = geodir_get_posttypes();
2774
-    if (in_array($post_type, $all_postypes)) {
2775
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2776
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2777
-    }
2773
+	$all_postypes = geodir_get_posttypes();
2774
+	if (in_array($post_type, $all_postypes)) {
2775
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2776
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2777
+	}
2778 2778
 
2779
-    return $comments_link;
2779
+	return $comments_link;
2780 2780
 }
2781 2781
 
2782 2782
 
@@ -2794,11 +2794,11 @@  discard block
 block discarded – undo
2794 2794
 function geodir_add_nav_menu_class( $args )
2795 2795
 {
2796 2796
 
2797
-        if(isset($args['menu_class'])){
2798
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2799
-        }
2797
+		if(isset($args['menu_class'])){
2798
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2799
+		}
2800 2800
     
2801
-    return $args;
2801
+	return $args;
2802 2802
 }
2803 2803
 
2804 2804
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2815,15 +2815,15 @@  discard block
 block discarded – undo
2815 2815
  * @return string Filtered locale ID.
2816 2816
  */
2817 2817
 function geodir_wpml_filter_locale($locale) {
2818
-    global $sitepress;
2818
+	global $sitepress;
2819 2819
     
2820
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2820
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2821 2821
     
2822
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2823
-        $locale = $sitepress->get_locale($current_lang);
2824
-    }
2822
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2823
+		$locale = $sitepress->get_locale($current_lang);
2824
+	}
2825 2825
     
2826
-    return $locale;
2826
+	return $locale;
2827 2827
 }
2828 2828
 
2829 2829
 /**
@@ -2833,19 +2833,19 @@  discard block
 block discarded – undo
2833 2833
  * @package GeoDirectory
2834 2834
  */
2835 2835
 function geodir_wpml_set_filter() {
2836
-    if (geodir_is_wpml()) {
2837
-        global $sitepress;
2836
+	if (geodir_is_wpml()) {
2837
+		global $sitepress;
2838 2838
         
2839
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2840
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2841
-        }
2839
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2840
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2841
+		}
2842 2842
         
2843
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2844
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2845
-        if (is_admin()) {
2846
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2847
-        }
2848
-    }
2843
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2844
+		add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2845
+		if (is_admin()) {
2846
+			add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2847
+		}
2848
+	}
2849 2849
 }
2850 2850
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2851 2851
 
@@ -2858,38 +2858,38 @@  discard block
 block discarded – undo
2858 2858
  * @return array Filtered languages.
2859 2859
  */
2860 2860
 function geodir_wpml_filter_ls_languages($languages) {    
2861
-    if (geodir_is_geodir_page()) {        
2862
-        $keep_vars = array();
2861
+	if (geodir_is_geodir_page()) {        
2862
+		$keep_vars = array();
2863 2863
         
2864
-        if (geodir_is_page('add-listing')) {
2865
-            $keep_vars = array('listing_type', 'package_id');
2866
-        } else if (geodir_is_page('search')) {
2867
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2868
-        } else if (geodir_is_page('author')) {
2869
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2870
-        } else if (geodir_is_page('login')) {
2871
-            $keep_vars = array('forgot', 'signup');
2872
-        }        
2864
+		if (geodir_is_page('add-listing')) {
2865
+			$keep_vars = array('listing_type', 'package_id');
2866
+		} else if (geodir_is_page('search')) {
2867
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2868
+		} else if (geodir_is_page('author')) {
2869
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2870
+		} else if (geodir_is_page('login')) {
2871
+			$keep_vars = array('forgot', 'signup');
2872
+		}        
2873 2873
         
2874
-        if (!empty($keep_vars)) {
2875
-            foreach ( $languages as $code => $url) {
2876
-                $filter_url = $url['url'];
2874
+		if (!empty($keep_vars)) {
2875
+			foreach ( $languages as $code => $url) {
2876
+				$filter_url = $url['url'];
2877 2877
                 
2878
-                foreach ($keep_vars as $var) {
2879
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2880
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2881
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2882
-                    }
2883
-                }
2878
+				foreach ($keep_vars as $var) {
2879
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2880
+						$filter_url = remove_query_arg(array($var), $filter_url);
2881
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2882
+					}
2883
+				}
2884 2884
                 
2885
-                if ($filter_url != $url['url']) {
2886
-                    $languages[$code]['url'] = $filter_url;
2887
-                }
2888
-            }
2889
-        }
2890
-    }
2885
+				if ($filter_url != $url['url']) {
2886
+					$languages[$code]['url'] = $filter_url;
2887
+				}
2888
+			}
2889
+		}
2890
+	}
2891 2891
 
2892
-    return $languages;
2892
+	return $languages;
2893 2893
 }
2894 2894
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2895 2895
 
@@ -2900,18 +2900,18 @@  discard block
 block discarded – undo
2900 2900
  *
2901 2901
  */
2902 2902
 function geodir_remove_yoast_seo_metas(){
2903
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2904
-        $wpseo = WPSEO_Frontend::get_instance();
2903
+	if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2904
+		$wpseo = WPSEO_Frontend::get_instance();
2905 2905
         
2906
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2907
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2908
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2909
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2910
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2911
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2906
+		remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2907
+		remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2908
+		remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2909
+		remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2910
+		remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2911
+		remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2912 2912
         
2913
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2914
-    }
2913
+		remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2914
+	}
2915 2915
 }
2916 2916
 
2917 2917
 /**
@@ -2925,20 +2925,20 @@  discard block
 block discarded – undo
2925 2925
  *
2926 2926
  */
2927 2927
  function geodir_wpml_ajax_set_guest_lang() {    
2928
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2929
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2930
-            global $sitepress;
2928
+	if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2929
+		if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2930
+			global $sitepress;
2931 2931
             
2932
-            $referer = wp_get_referer();
2932
+			$referer = wp_get_referer();
2933 2933
             
2934
-            $current_lang = $sitepress->get_current_language();
2935
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2934
+			$current_lang = $sitepress->get_current_language();
2935
+			$referrer_lang = $sitepress->get_language_from_url( $referer );
2936 2936
             
2937
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2938
-                $_GET['lang'] = $referrer_lang;
2939
-            }
2940
-        }
2941
-    }
2937
+			if ( $referrer_lang && $current_lang != $referrer_lang ) {
2938
+				$_GET['lang'] = $referrer_lang;
2939
+			}
2940
+		}
2941
+	}
2942 2942
 }
2943 2943
 add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2944 2944
 
@@ -2950,36 +2950,36 @@  discard block
 block discarded – undo
2950 2950
  * @param object $wp The WordPress object.
2951 2951
  */
2952 2952
 function geodir_check_redirect($wp) {
2953
-    if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2954
-        $current_url = geodir_curPageURL();
2955
-        $search = 'czech-republic';
2956
-        $replace = 'czechia';        
2953
+	if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2954
+		$current_url = geodir_curPageURL();
2955
+		$search = 'czech-republic';
2956
+		$replace = 'czechia';        
2957 2957
         
2958
-        $has_slash = substr($current_url, -1);
2959
-        if ($has_slash != "/") {
2960
-            $current_url .= '/';
2961
-        }
2958
+		$has_slash = substr($current_url, -1);
2959
+		if ($has_slash != "/") {
2960
+			$current_url .= '/';
2961
+		}
2962 2962
         
2963
-        $redirect = false;
2964
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2965
-            $redirect = true;
2966
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2967
-        }
2963
+		$redirect = false;
2964
+		if (strpos($current_url, '/' . $search . '/') !== false) {
2965
+			$redirect = true;
2966
+			$current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2967
+		}
2968 2968
         
2969
-        if ($has_slash != "/") {
2970
-            $current_url = trim($current_url, '/');
2971
-        }
2969
+		if ($has_slash != "/") {
2970
+			$current_url = trim($current_url, '/');
2971
+		}
2972 2972
         
2973
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2974
-            $redirect = true;
2975
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2976
-        }
2977
-
2978
-        if ($redirect) {
2979
-            wp_redirect($current_url);
2980
-            exit;
2981
-        }
2982
-    }
2973
+		if (strpos($current_url, 'gd_country=' . $search) !== false) {
2974
+			$redirect = true;
2975
+			$current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2976
+		}
2977
+
2978
+		if ($redirect) {
2979
+			wp_redirect($current_url);
2980
+			exit;
2981
+		}
2982
+	}
2983 2983
 }
2984 2984
 add_action('parse_request', 'geodir_check_redirect', 101, 1);
2985 2985
 
@@ -2999,50 +2999,50 @@  discard block
 block discarded – undo
2999 2999
  * @param string $original_slug The original post slug.
3000 3000
  */
3001 3001
 function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3002
-    global $wpdb, $sitepress;
3002
+	global $wpdb, $sitepress;
3003 3003
     
3004
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3005
-        $wpml_post_join = "";
3006
-        $wpml_post_where = "";
3007
-        $wpml_term_join = "";
3008
-        $wpml_term_where = "";
3004
+	if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3005
+		$wpml_post_join = "";
3006
+		$wpml_post_where = "";
3007
+		$wpml_term_join = "";
3008
+		$wpml_term_where = "";
3009 3009
         
3010
-        if (geodir_wpml_is_post_type_translated($post_type)) {
3011
-            $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3012
-            $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3013
-            if (!$post_language) {
3014
-                $post_language = $sitepress->get_current_language();
3015
-            }
3010
+		if (geodir_wpml_is_post_type_translated($post_type)) {
3011
+			$post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3012
+			$post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3013
+			if (!$post_language) {
3014
+				$post_language = $sitepress->get_current_language();
3015
+			}
3016 3016
             
3017
-            $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3018
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3017
+			$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3018
+			$wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3019 3019
             
3020
-            $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3021
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3022
-        }
3020
+			$wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3021
+			$wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3022
+		}
3023 3023
 
3024
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3024
+		$term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3025 3025
 
3026
-        if ( $term_slug_check ) {
3027
-            $suffix = 1;
3026
+		if ( $term_slug_check ) {
3027
+			$suffix = 1;
3028 3028
             
3029
-            do {
3030
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3029
+			do {
3030
+				$alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3031 3031
                 
3032
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3032
+				$term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3033 3033
                 
3034
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3034
+				$post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3035 3035
                 
3036
-                $term_slug_check = $term_check || $post_check;
3036
+				$term_slug_check = $term_check || $post_check;
3037 3037
                 
3038
-                $suffix++;
3039
-            } while ( $term_slug_check );
3038
+				$suffix++;
3039
+			} while ( $term_slug_check );
3040 3040
             
3041
-            $slug = $alt_slug;
3042
-        }
3043
-    }
3041
+			$slug = $alt_slug;
3042
+		}
3043
+	}
3044 3044
     
3045
-    return $slug;
3045
+	return $slug;
3046 3046
 }
3047 3047
 add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3048 3048
 
@@ -3062,47 +3062,47 @@  discard block
 block discarded – undo
3062 3062
  * @return bool true when exists. false when not exists.
3063 3063
  */
3064 3064
 function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3065
-    global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3065
+	global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3066 3066
     
3067
-    if ( $slug_exists ) {
3068
-        return $slug_exists;
3069
-    }
3067
+	if ( $slug_exists ) {
3068
+		return $slug_exists;
3069
+	}
3070 3070
     
3071
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3072
-        $taxonomy = $gd_term_taxonomy[$term_id];
3073
-    } else {
3074
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3075
-        $gd_term_taxonomy[$term_id] = $taxonomy;
3076
-    }
3071
+	if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3072
+		$taxonomy = $gd_term_taxonomy[$term_id];
3073
+	} else {
3074
+		$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3075
+		$gd_term_taxonomy[$term_id] = $taxonomy;
3076
+	}
3077 3077
     
3078
-    if ( empty($taxonomy) ) {
3079
-        return $slug_exists;
3080
-    }
3078
+	if ( empty($taxonomy) ) {
3079
+		return $slug_exists;
3080
+	}
3081 3081
     
3082
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3083
-        $post_type = $gd_term_post_type[$term_id];
3084
-    } else {
3085
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3086
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3087
-    }
3082
+	if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3083
+		$post_type = $gd_term_post_type[$term_id];
3084
+	} else {
3085
+		$taxonomy_obj = get_taxonomy( $taxonomy );
3086
+		$post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3087
+	}
3088 3088
     
3089
-    $wpml_post_join = "";
3090
-    $wpml_post_where = "";
3089
+	$wpml_post_join = "";
3090
+	$wpml_post_where = "";
3091 3091
     
3092
-    if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3093
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3094
-        if (!$term_language) {
3095
-            $term_language = $sitepress->get_current_language();
3096
-        }
3092
+	if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3093
+		$term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3094
+		if (!$term_language) {
3095
+			$term_language = $sitepress->get_current_language();
3096
+		}
3097 3097
         
3098
-        $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3099
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3100
-    }
3098
+		$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3099
+		$wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3100
+	}
3101 3101
     
3102
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3103
-        $slug_exists = true;
3104
-    }
3102
+	if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3103
+		$slug_exists = true;
3104
+	}
3105 3105
 
3106
-    return $slug_exists;
3106
+	return $slug_exists;
3107 3107
 }
3108 3108
 add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3109 3109
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 /* WP REVIEW COUNT ACTIONS */
177 177
 ////////////////////////
178 178
 
179
-add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
179
+add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
180 180
 //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
181
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
181
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
182 182
 //add_action('created_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
184 184
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
227 227
     if ($geodir_theme_location) {
228 228
         update_option('geodir_theme_location_nav', $geodir_theme_location);
229 229
     } else {
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
     include_once('geodirectory-functions/listing_filters.php');
259 259
     
260 260
     // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
261
+    if (isset($_REQUEST['geodir_search']) && class_exists('Theme_My_Login')) {
262
+        remove_action('pre_get_posts', array(Theme_My_Login::get_object(), 'pre_get_posts'));
263 263
     }
264 264
 }
265 265
 
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 
327 327
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
328 328
 
329
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
330
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
329
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
330
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
331 331
 
332 332
 // Detail page sidebar content 
333 333
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
     do_action('geodir_after_social_sharing_buttons');
428 428
     $content_html = ob_get_clean();
429 429
     if (trim($content_html) != '')
430
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
431
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
430
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
431
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
432 432
         /**
433 433
          * Filter the geodir_social_sharing_buttons() function content.
434 434
          *
@@ -468,12 +468,12 @@  discard block
 block discarded – undo
468 468
             $post_id = $post->ID;
469 469
             
470 470
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
471
-                $post_id = (int)$_REQUEST['pid'];
471
+                $post_id = (int) $_REQUEST['pid'];
472 472
             }
473 473
 
474 474
             $postlink = get_permalink(geodir_add_listing_page_id());
475 475
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
476
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
476
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
477 477
         }
478 478
     }// end of if, if its a preview or not
479 479
     /**
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
     do_action('geodir_after_edit_post_link');
485 485
     $content_html = ob_get_clean();
486 486
     if (trim($content_html) != '')
487
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
488
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
487
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
488
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
489 489
         /**
490 490
          * Filter the geodir_edit_post_link() function content.
491 491
          *
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
  */
507 507
 function geodir_detail_page_google_analytics()
508 508
 {
509
-    global $post,$preview;
510
-    if($preview){return '';}
509
+    global $post, $preview;
510
+    if ($preview) {return ''; }
511 511
     $package_info = array();
512 512
     $package_info = geodir_post_package_info($package_info, $post);
513 513
 
@@ -539,14 +539,14 @@  discard block
 block discarded – undo
539 539
     $hide_refresh = get_option('geodir_ga_auto_refresh');
540 540
     
541 541
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
542
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
542
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
543 543
         $page_url = urlencode($_SERVER['REQUEST_URI']);
544 544
         ?>
545 545
         <script type="text/javascript">
546 546
             var gd_gaTimeOut;
547
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
548
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
549
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
547
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
548
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
549
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
550 550
             ga_data1 = false;
551 551
             ga_data2 = false;
552 552
             ga_data3 = false;
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
             }
688 688
 
689 689
             function gdga_noResults() {
690
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
690
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
691 691
                 jQuery('#gdga-legend-container').html('');
692 692
             }
693 693
 
@@ -719,18 +719,18 @@  discard block
 block discarded – undo
719 719
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
720 720
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
721 721
 
722
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
723
-                        '<?php _e('Feb', 'geodirectory');?>',
724
-                        '<?php _e('Mar', 'geodirectory');?>',
725
-                        '<?php _e('Apr', 'geodirectory');?>',
726
-                        '<?php _e('May', 'geodirectory');?>',
727
-                        '<?php _e('Jun', 'geodirectory');?>',
728
-                        '<?php _e('Jul', 'geodirectory');?>',
729
-                        '<?php _e('Aug', 'geodirectory');?>',
730
-                        '<?php _e('Sep', 'geodirectory');?>',
731
-                        '<?php _e('Oct', 'geodirectory');?>',
732
-                        '<?php _e('Nov', 'geodirectory');?>',
733
-                        '<?php _e('Dec', 'geodirectory');?>'];
722
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
723
+                        '<?php _e('Feb', 'geodirectory'); ?>',
724
+                        '<?php _e('Mar', 'geodirectory'); ?>',
725
+                        '<?php _e('Apr', 'geodirectory'); ?>',
726
+                        '<?php _e('May', 'geodirectory'); ?>',
727
+                        '<?php _e('Jun', 'geodirectory'); ?>',
728
+                        '<?php _e('Jul', 'geodirectory'); ?>',
729
+                        '<?php _e('Aug', 'geodirectory'); ?>',
730
+                        '<?php _e('Sep', 'geodirectory'); ?>',
731
+                        '<?php _e('Oct', 'geodirectory'); ?>',
732
+                        '<?php _e('Nov', 'geodirectory'); ?>',
733
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
734 734
 
735 735
                     // Ensure the data arrays are at least as long as the labels array.
736 736
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
                         labels : labels,
744 744
                         datasets : [
745 745
                             {
746
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
746
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
747 747
                                 fillColor : "rgba(220,220,220,0.5)",
748 748
                                 strokeColor : "rgba(220,220,220,1)",
749 749
                                 data : data2
750 750
                             },
751 751
                             {
752
-                                label: '<?php _e('This Year', 'geodirectory');?>',
752
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
753 753
                                 fillColor : "rgba(151,187,205,0.5)",
754 754
                                 strokeColor : "rgba(151,187,205,1)",
755 755
                                 data : data1
@@ -794,30 +794,30 @@  discard block
 block discarded – undo
794 794
 
795 795
                     <?php
796 796
                     // Here we list the shorthand days of the week so it can be used in translation.
797
-                    __("Mon",'geodirectory');
798
-                    __("Tue",'geodirectory');
799
-                    __("Wed",'geodirectory');
800
-                    __("Thu",'geodirectory');
801
-                    __("Fri",'geodirectory');
802
-                    __("Sat",'geodirectory');
803
-                    __("Sun",'geodirectory');
797
+                    __("Mon", 'geodirectory');
798
+                    __("Tue", 'geodirectory');
799
+                    __("Wed", 'geodirectory');
800
+                    __("Thu", 'geodirectory');
801
+                    __("Fri", 'geodirectory');
802
+                    __("Sat", 'geodirectory');
803
+                    __("Sun", 'geodirectory');
804 804
                     ?>
805 805
 
806 806
                     labels = [
807
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
808
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
809
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
810
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
811
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
812
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
813
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
807
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
808
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
809
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
810
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
811
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
812
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
813
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
814 814
                     ];
815 815
 
816 816
                     var data = {
817 817
                         labels : labels,
818 818
                         datasets : [
819 819
                             {
820
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
820
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
821 821
                                 fillColor : "rgba(220,220,220,0.5)",
822 822
                                 strokeColor : "rgba(220,220,220,1)",
823 823
                                 pointColor : "rgba(220,220,220,1)",
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
                                 data : data2
826 826
                             },
827 827
                             {
828
-                                label: '<?php _e('This Week', 'geodirectory');?>',
828
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
829 829
                                 fillColor : "rgba(151,187,205,0.5)",
830 830
                                 strokeColor : "rgba(151,187,205,1)",
831 831
                                 pointColor : "rgba(151,187,205,1)",
@@ -1032,18 +1032,18 @@  discard block
 block discarded – undo
1032 1032
         </style>
1033 1033
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1034 1034
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1035
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1035
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1036 1036
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1037
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1037
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1038 1038
             <div id="gd-active-users-container">
1039
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1039
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1040 1040
                     <b class="gd-ActiveUsers-value">0</b>
1041 1041
                 </div>
1042 1042
             </div>
1043 1043
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1044
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1045
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1046
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1044
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1045
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1046
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1047 1047
             </select>
1048 1048
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1049 1049
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
     do_action('geodir_after_google_analytics');
1060 1060
     $content_html = ob_get_clean();
1061 1061
     if (trim($content_html) != '')
1062
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1063
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1062
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1063
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1064 1064
         /**
1065 1065
          * Filter the geodir_edit_post_link() function content.
1066 1066
          *
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 {
1087 1087
     global $post, $preview, $post_images;
1088 1088
     
1089
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1089
+    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) {
1090 1090
         return;
1091 1091
     }
1092 1092
     ob_start(); // Start  buffering;
@@ -1121,10 +1121,10 @@  discard block
 block discarded – undo
1121 1121
        
1122 1122
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1123 1123
 	   
1124
-	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1124
+	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />';
1125 1125
 
1126 1126
         $html .= '<span class="item">';
1127
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1127
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1128 1128
 
1129 1129
         if ($post_images) {
1130 1130
             foreach ($post_images as $img) {
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
         }
1135 1135
 
1136 1136
         if (isset($post_img) && $post_img) {
1137
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1137
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1138 1138
         }
1139 1139
 
1140 1140
         $html .= '</span>';
@@ -1161,9 +1161,9 @@  discard block
 block discarded – undo
1161 1161
     do_action('geodir_after_detail_page_review_rating');
1162 1162
     $content_html = ob_get_clean();
1163 1163
     if (trim($content_html) != '') {
1164
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1164
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1165 1165
     }
1166
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1166
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1167 1167
         /**
1168 1168
          * Filter the geodir_detail_page_review_rating() function content.
1169 1169
          *
@@ -1202,8 +1202,8 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
     $content_html = ob_get_clean();
1204 1204
     if (trim($content_html) != '')
1205
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1206
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1205
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1206
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1207 1207
         /**
1208 1208
          * Filter the output html for function geodir_detail_page_more_info().
1209 1209
          *
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1303 1303
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1304 1304
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1305
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1305
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1306 1306
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1307 1307
         'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1308 1308
         'geodir_map_name' => geodir_map_name(),
@@ -1331,10 +1331,10 @@  discard block
 block discarded – undo
1331 1331
     foreach ($arr_alert_msg as $key => $value) {
1332 1332
         if (!is_scalar($value))
1333 1333
             continue;
1334
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1334
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1335 1335
     }
1336 1336
 
1337
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1337
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1338 1338
     echo '<script>';
1339 1339
     echo $script;
1340 1340
     echo '</script>';
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
         $geodir_old_sidebars = get_option('geodir_sidebars');
1425 1425
         if (is_array($geodir_old_sidebars)) {
1426 1426
             foreach ($geodir_old_sidebars as $key => $val) {
1427
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1427
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1428 1428
                 {
1429 1429
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1430 1430
                 }
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
         global $post;
1504 1504
         $term_condition = '';
1505 1505
         if (isset($_REQUEST['backandedit'])) {
1506
-            $post = (object)$gd_session->get('listing');
1506
+            $post = (object) $gd_session->get('listing');
1507 1507
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1508 1508
         }
1509 1509
 
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
                     echo 'checked="checked"';
1518 1518
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1519 1519
                        class="geodir_textfield" value="1"
1520
-                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1520
+                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1521 1521
 				</span>
1522 1522
             </div>
1523 1523
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
         /** This action is documented in geodirectory_template_actions.php */
1558 1558
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1559 1559
         
1560
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1560
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1561 1561
             $is_display = false;
1562 1562
         }
1563 1563
     }
@@ -1605,16 +1605,16 @@  discard block
 block discarded – undo
1605 1605
     global $wpdb, $plugin_prefix;
1606 1606
 	
1607 1607
 	// Remove unused virtual page
1608
-	$listings_page_id = (int)get_option('geodir_listing_page');
1608
+	$listings_page_id = (int) get_option('geodir_listing_page');
1609 1609
 	if ($listings_page_id) {
1610
-		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1610
+		$wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1611 1611
         delete_option('geodir_listing_page');
1612 1612
 	}
1613 1613
 
1614 1614
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1615 1615
         $wpdb->query(
1616 1616
             $wpdb->prepare(
1617
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1617
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1618 1618
                 array('1', '1', 'admin')
1619 1619
             )
1620 1620
         );
@@ -1622,9 +1622,9 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
         /* --- terms meta value set --- */
1624 1624
 
1625
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1625
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1626 1626
 
1627
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1627
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1628 1628
 
1629 1629
         if (!empty($options_data)) {
1630 1630
 
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 
1633 1633
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1634 1634
 
1635
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1635
+                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1636 1636
 
1637 1637
                 if (!empty($taxonomies_data)) {
1638 1638
 
@@ -1641,17 +1641,17 @@  discard block
 block discarded – undo
1641 1641
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1642 1642
                         $post_type = $taxObject->object_type[0];
1643 1643
 
1644
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1644
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1645 1645
 
1646
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1646
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1647 1647
 
1648 1648
                         if ($duplicate_data) {
1649 1649
 
1650
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1650
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1651 1651
 
1652 1652
                         } else {
1653 1653
 
1654
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1654
+                            $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1655 1655
 
1656 1656
                         }
1657 1657
 
@@ -1685,14 +1685,14 @@  discard block
 block discarded – undo
1685 1685
 
1686 1686
     global $wpdb, $table_prefix;
1687 1687
 
1688
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1688
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1689 1689
 
1690 1690
     if ($slug_exists) {
1691 1691
 
1692 1692
         $suffix = 1;
1693 1693
         do {
1694
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1695
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1694
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1695
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1696 1696
             $suffix++;
1697 1697
         } while ($location_slug_check && $suffix < 100);
1698 1698
 
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
 
1747 1747
         $suffix = 1;
1748 1748
         do {
1749
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1749
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1750 1750
 
1751 1751
             /** This action is documented in geodirectory_hooks_actions.php */
1752 1752
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1760 1760
 
1761
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1761
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1762 1762
 
1763 1763
     }
1764 1764
 	
@@ -1767,18 +1767,18 @@  discard block
 block discarded – undo
1767 1767
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1768 1768
 	
1769 1769
 	$post_types = geodir_get_posttypes();
1770
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1771
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1770
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1771
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1772 1772
 		
1773 1773
 		if (!empty($posts_obj)) {
1774 1774
 			foreach ($posts_obj as $post_obj) {
1775 1775
 				$post_id = $post_obj->object_id;
1776 1776
 				
1777
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1777
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1778 1778
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1779 1779
 				
1780
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1781
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1780
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1781
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1782 1782
 			}
1783 1783
 		}
1784 1784
 	}
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1813 1813
         return $slug_exists = true;
1814 1814
 
1815
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1815
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1816 1816
         return $slug_exists = true;
1817 1817
 
1818 1818
     return $slug_exists;
@@ -1853,43 +1853,43 @@  discard block
 block discarded – undo
1853 1853
 
1854 1854
 
1855 1855
     $gd_page = '';
1856
-    if(geodir_is_page('home')){
1856
+    if (geodir_is_page('home')) {
1857 1857
         $gd_page = 'home';
1858 1858
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1859 1859
     }
1860
-    elseif(geodir_is_page('detail')){
1860
+    elseif (geodir_is_page('detail')) {
1861 1861
         $gd_page = 'detail';
1862 1862
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1863 1863
     }
1864
-    elseif(geodir_is_page('pt')){
1864
+    elseif (geodir_is_page('pt')) {
1865 1865
         $gd_page = 'pt';
1866 1866
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1867 1867
     }
1868
-    elseif(geodir_is_page('listing')){
1868
+    elseif (geodir_is_page('listing')) {
1869 1869
         $gd_page = 'listing';
1870 1870
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1871 1871
     }
1872
-    elseif(geodir_is_page('location')){
1872
+    elseif (geodir_is_page('location')) {
1873 1873
         $gd_page = 'location';
1874 1874
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1875 1875
     }
1876
-    elseif(geodir_is_page('search')){
1876
+    elseif (geodir_is_page('search')) {
1877 1877
         $gd_page = 'search';
1878 1878
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1879 1879
     }
1880
-    elseif(geodir_is_page('add-listing')){
1880
+    elseif (geodir_is_page('add-listing')) {
1881 1881
         $gd_page = 'add-listing';
1882 1882
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1883 1883
     }
1884
-    elseif(geodir_is_page('author')){
1884
+    elseif (geodir_is_page('author')) {
1885 1885
         $gd_page = 'author';
1886 1886
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1887 1887
     }
1888
-    elseif(geodir_is_page('login')){
1888
+    elseif (geodir_is_page('login')) {
1889 1889
         $gd_page = 'login';
1890 1890
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1891 1891
     }
1892
-    elseif(geodir_is_page('listing-success')){
1892
+    elseif (geodir_is_page('listing-success')) {
1893 1893
         $gd_page = 'listing-success';
1894 1894
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1895 1895
     }
@@ -1921,12 +1921,12 @@  discard block
 block discarded – undo
1921 1921
 
1922 1922
     if (!get_option('geodir_set_post_attachments')) {
1923 1923
 
1924
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1925
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1924
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1925
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1926 1926
 
1927 1927
         $all_postypes = geodir_get_posttypes();
1928 1928
 
1929
-        foreach($all_postypes as $post_type){
1929
+        foreach ($all_postypes as $post_type) {
1930 1930
             $args = array(
1931 1931
                 'posts_per_page' => -1,
1932 1932
                 'post_type' => $post_type,
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 {
2021 2021
     $user_id = get_current_user_id();
2022 2022
 
2023
-    if(!$user_id){return $post;}
2023
+    if (!$user_id) {return $post; }
2024 2024
 
2025 2025
     $gd_post_types = geodir_get_posttypes();
2026 2026
 
@@ -2129,7 +2129,7 @@  discard block
 block discarded – undo
2129 2129
 
2130 2130
         if (array_key_exists('post_video', $tabs_arr)) {
2131 2131
 
2132
-            $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)));
2132
+            $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)));
2133 2133
 
2134 2134
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2135 2135
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
 
2138 2138
         if (array_key_exists('special_offers', $tabs_arr)) {
2139 2139
 
2140
-            $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)));
2140
+            $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)));
2141 2141
 
2142 2142
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2143 2143
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2158,7 +2158,7 @@  discard block
 block discarded – undo
2158 2158
  */
2159 2159
 function geodir_remove_template_redirect_actions()
2160 2160
 {
2161
-    if (geodir_is_page('login')){
2161
+    if (geodir_is_page('login')) {
2162 2162
         remove_all_actions('template_redirect');
2163 2163
         remove_action('init', 'avia_modify_front', 10);
2164 2164
     }
@@ -2205,25 +2205,25 @@  discard block
 block discarded – undo
2205 2205
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2206 2206
 
2207 2207
         $wpdb->query(
2208
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2208
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2209 2209
                 array($post_id, $split_img_file_path)
2210 2210
             )
2211 2211
         );
2212 2212
 
2213 2213
         $attachment_data = $wpdb->get_row(
2214
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2214
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2215 2215
                 array($post_id)
2216 2216
             )
2217 2217
         );
2218 2218
 
2219 2219
         if (!empty($attachment_data)) {
2220
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2220
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2221 2221
         }
2222 2222
 
2223 2223
 
2224
-        $table_name = $plugin_prefix . $post_type . '_detail';
2224
+        $table_name = $plugin_prefix.$post_type.'_detail';
2225 2225
 
2226
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2226
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2227 2227
 
2228 2228
         geodir_set_wp_featured_image($post_id);
2229 2229
 
@@ -2251,9 +2251,9 @@  discard block
 block discarded – undo
2251 2251
 
2252 2252
     foreach ($all_postypes as $posttype) {
2253 2253
 
2254
-        $tablename = $plugin_prefix . $posttype . '_detail';
2254
+        $tablename = $plugin_prefix.$posttype.'_detail';
2255 2255
 
2256
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2256
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2257 2257
 
2258 2258
         if (!empty($get_post_data)) {
2259 2259
 
@@ -2261,7 +2261,7 @@  discard block
 block discarded – undo
2261 2261
 
2262 2262
                 $post_id = $data->post_id;
2263 2263
 
2264
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2264
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2265 2265
 
2266 2266
                 if (!empty($attachment_data)) {
2267 2267
 
@@ -2278,22 +2278,22 @@  discard block
 block discarded – undo
2278 2278
 
2279 2279
                         $file_name = $file_info['basename'];
2280 2280
 
2281
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2281
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2282 2282
 
2283 2283
                         if (!file_exists($img_arr['path'])) {
2284 2284
 
2285
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2285
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2286 2286
 
2287 2287
                         }
2288 2288
 
2289 2289
                     }
2290 2290
 
2291
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2291
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2292 2292
 
2293 2293
                     if (!empty($attachment_data)) {
2294 2294
 
2295 2295
                         if ($attachment_data->ID)
2296
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2296
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2297 2297
 
2298 2298
                     } else {
2299 2299
 
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
 
2308 2308
                     }
2309 2309
 
2310
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2310
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2311 2311
 
2312 2312
                     geodir_set_wp_featured_image($post_id);
2313 2313
 
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
 {
2337 2337
 
2338 2338
     if (!get_option('geodir_default_rating_star_icon')) {
2339
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2339
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2340 2340
     }
2341 2341
 
2342 2342
 }
@@ -2353,10 +2353,10 @@  discard block
 block discarded – undo
2353 2353
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2354 2354
  * @return array User listing count for each post type.
2355 2355
  */
2356
-function geodir_user_post_listing_count($user_id=null)
2356
+function geodir_user_post_listing_count($user_id = null)
2357 2357
 {
2358 2358
     global $wpdb, $plugin_prefix, $current_user;
2359
-    if(!$user_id){
2359
+    if (!$user_id) {
2360 2360
         $user_id = $current_user->ID;
2361 2361
     }
2362 2362
 
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
     $user_listing = array();
2368 2368
     if (is_array($all_posts) && !empty($all_posts)) {
2369 2369
         foreach ($all_posts as $ptype) {
2370
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2370
+            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2371 2371
 
2372 2372
             if ($total_posts > 0) {
2373 2373
                 $user_listing[$ptype] = $total_posts;
@@ -2408,19 +2408,19 @@  discard block
 block discarded – undo
2408 2408
 
2409 2409
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2410 2410
         //remove video and special offers if it is already set to show
2411
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2411
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2412 2412
             $unset_video = true;
2413 2413
         }
2414 2414
 
2415
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2415
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2416 2416
             $unset_special_offers = true;
2417 2417
         }
2418
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2419
-            foreach($custom_fields as $key => $custom_field){
2420
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2418
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2419
+            foreach ($custom_fields as $key => $custom_field) {
2420
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2421 2421
                     unset($custom_fields[$key]);
2422 2422
                 }
2423
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2423
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2424 2424
                     unset($custom_fields[$key]);
2425 2425
                 }
2426 2426
             }
@@ -2437,7 +2437,7 @@  discard block
 block discarded – undo
2437 2437
                     $post->{$field_name} = $_REQUEST[$field_name];
2438 2438
                 }
2439 2439
 
2440
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2440
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
2441 2441
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2442 2442
                         continue;
2443 2443
                     }
@@ -2470,7 +2470,7 @@  discard block
 block discarded – undo
2470 2470
                     $post->{$field_name} = $_REQUEST[$field_name];
2471 2471
                 }
2472 2472
 
2473
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2473
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
2474 2474
                     $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2475 2475
                     $site_title = trim($field['site_title']);
2476 2476
                     $type = $field;
@@ -2486,21 +2486,21 @@  discard block
 block discarded – undo
2486 2486
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2487 2487
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2488 2488
 
2489
-                    }else{
2489
+                    } else {
2490 2490
                         $i = 0;
2491 2491
                         $fieldset_count++;
2492 2492
                         $field_set_start = 1;
2493
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2493
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2494 2494
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2495 2495
                     }
2496 2496
 
2497 2497
 
2498
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2498
+                    if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
2499 2499
                     $type = stripslashes_deep($type); // strip slashes
2500
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2500
+                    if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
2501 2501
                     $html = '';
2502 2502
                     $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2503
-                    if($html_var=='post'){$html_var='post_address';}
2503
+                    if ($html_var == 'post') {$html_var = 'post_address'; }
2504 2504
                     $field_icon = geodir_field_icon_proccess($type);
2505 2505
                     $filed_type = $type['type'];
2506 2506
 
@@ -2513,7 +2513,7 @@  discard block
 block discarded – undo
2513 2513
                      * @param string $fields_location The location the field is to be show.
2514 2514
                      * @param array $type The array of field values.
2515 2515
                      */
2516
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2516
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2517 2517
 
2518 2518
 
2519 2519
                     /**
@@ -2559,7 +2559,7 @@  discard block
 block discarded – undo
2559 2559
                                  * @param string $htmlvar_name The field HTML var name.
2560 2560
                                  */
2561 2561
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2562
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2562
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2563 2563
                             );
2564 2564
                         }
2565 2565
                     } else {
@@ -2621,7 +2621,7 @@  discard block
 block discarded – undo
2621 2621
             }
2622 2622
             $status .= ")</strong>";
2623 2623
 
2624
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2624
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2625 2625
         }
2626 2626
     }
2627 2627
 
@@ -2690,7 +2690,7 @@  discard block
 block discarded – undo
2690 2690
  * @return array Modified class array.
2691 2691
  */
2692 2692
 function geodir_body_class_active_map($classes = array()) {
2693
-    $classes[] = 'gd-map-' . geodir_map_name();
2693
+    $classes[] = 'gd-map-'.geodir_map_name();
2694 2694
 
2695 2695
     return $classes;
2696 2696
 }
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
  * @return string Modified class string.
2706 2706
  */
2707 2707
 function geodir_admin_body_class_active_map($class = '') {    
2708
-    $class .= ' gd-map-' . geodir_map_name();
2708
+    $class .= ' gd-map-'.geodir_map_name();
2709 2709
 
2710 2710
     return $class;
2711 2711
 }
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
  * @return array Translation texts.
2726 2726
  */
2727 2727
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2728
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2728
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2729 2729
 
2730 2730
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2731 2731
 
@@ -2791,17 +2791,17 @@  discard block
 block discarded – undo
2791 2791
  * @param array $args The array of menu arguments.
2792 2792
  * @return array The modified arguments.
2793 2793
  */
2794
-function geodir_add_nav_menu_class( $args )
2794
+function geodir_add_nav_menu_class($args)
2795 2795
 {
2796 2796
 
2797
-        if(isset($args['menu_class'])){
2797
+        if (isset($args['menu_class'])) {
2798 2798
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2799 2799
         }
2800 2800
     
2801 2801
     return $args;
2802 2802
 }
2803 2803
 
2804
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2804
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2805 2805
 
2806 2806
 /**
2807 2807
  * Filters WordPress locale ID.
@@ -2841,9 +2841,9 @@  discard block
 block discarded – undo
2841 2841
         }
2842 2842
         
2843 2843
         add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2844
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2844
+        add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1);
2845 2845
         if (is_admin()) {
2846
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2846
+            add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1);
2847 2847
         }
2848 2848
     }
2849 2849
 }
@@ -2872,7 +2872,7 @@  discard block
 block discarded – undo
2872 2872
         }        
2873 2873
         
2874 2874
         if (!empty($keep_vars)) {
2875
-            foreach ( $languages as $code => $url) {
2875
+            foreach ($languages as $code => $url) {
2876 2876
                 $filter_url = $url['url'];
2877 2877
                 
2878 2878
                 foreach ($keep_vars as $var) {
@@ -2891,7 +2891,7 @@  discard block
 block discarded – undo
2891 2891
 
2892 2892
     return $languages;
2893 2893
 }
2894
-add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2894
+add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1);
2895 2895
 
2896 2896
 /**
2897 2897
  * Remove Yoast SEO hook if disabled on GD pages.
@@ -2899,18 +2899,18 @@  discard block
 block discarded – undo
2899 2899
  * @since 1.6.18
2900 2900
  *
2901 2901
  */
2902
-function geodir_remove_yoast_seo_metas(){
2903
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2902
+function geodir_remove_yoast_seo_metas() {
2903
+    if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) {
2904 2904
         $wpseo = WPSEO_Frontend::get_instance();
2905 2905
         
2906
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2907
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2908
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2909
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2910
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2911
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2906
+        remove_action('wp_head', array($wpseo, 'metadesc'), 6);
2907
+        remove_action('wp_head', array($wpseo, 'metakeywords'), 11);
2908
+        remove_filter('pre_get_document_title', array($wpseo, 'title'), 15);
2909
+        remove_filter('wp_title', array($wpseo, 'title'), 15, 3);
2910
+        remove_filter('thematic_doctitle', array($wpseo, 'title'), 15);
2911
+        remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99);
2912 2912
         
2913
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2913
+        remove_action('template_redirect', 'wpseo_frontend_head_init', 999);
2914 2914
     }
2915 2915
 }
2916 2916
 
@@ -2925,22 +2925,22 @@  discard block
 block discarded – undo
2925 2925
  *
2926 2926
  */
2927 2927
  function geodir_wpml_ajax_set_guest_lang() {    
2928
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2929
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2928
+    if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) {
2929
+        if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) {
2930 2930
             global $sitepress;
2931 2931
             
2932 2932
             $referer = wp_get_referer();
2933 2933
             
2934 2934
             $current_lang = $sitepress->get_current_language();
2935
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2935
+            $referrer_lang = $sitepress->get_language_from_url($referer);
2936 2936
             
2937
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2937
+            if ($referrer_lang && $current_lang != $referrer_lang) {
2938 2938
                 $_GET['lang'] = $referrer_lang;
2939 2939
             }
2940 2940
         }
2941 2941
     }
2942 2942
 }
2943
-add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2943
+add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1);
2944 2944
 
2945 2945
 /**
2946 2946
  * Change country slug czech-republic to czechia and redirect.
@@ -2961,18 +2961,18 @@  discard block
 block discarded – undo
2961 2961
         }
2962 2962
         
2963 2963
         $redirect = false;
2964
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2964
+        if (strpos($current_url, '/'.$search.'/') !== false) {
2965 2965
             $redirect = true;
2966
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2966
+            $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1);
2967 2967
         }
2968 2968
         
2969 2969
         if ($has_slash != "/") {
2970 2970
             $current_url = trim($current_url, '/');
2971 2971
         }
2972 2972
         
2973
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2973
+        if (strpos($current_url, 'gd_country='.$search) !== false) {
2974 2974
             $redirect = true;
2975
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2975
+            $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url);
2976 2976
         }
2977 2977
 
2978 2978
         if ($redirect) {
@@ -2998,10 +2998,10 @@  discard block
 block discarded – undo
2998 2998
  * @param int    $post_parent   Post parent ID
2999 2999
  * @param string $original_slug The original post slug.
3000 3000
  */
3001
-function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3001
+function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
3002 3002
     global $wpdb, $sitepress;
3003 3003
     
3004
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3004
+    if ($post_type && strpos($post_type, 'gd_') === 0) {
3005 3005
         $wpml_post_join = "";
3006 3006
         $wpml_post_where = "";
3007 3007
         $wpml_term_join = "";
@@ -3015,28 +3015,28 @@  discard block
 block discarded – undo
3015 3015
             }
3016 3016
             
3017 3017
             $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3018
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3018
+            $wpml_post_where = " AND icl_t.language_code = '".$post_language."'";
3019 3019
             
3020 3020
             $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3021
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3021
+            $wpml_term_where = " AND icl_t.language_code = '".$post_language."'";
3022 3022
         }
3023 3023
 
3024
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3024
+        $term_slug_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $slug));
3025 3025
 
3026
-        if ( $term_slug_check ) {
3026
+        if ($term_slug_check) {
3027 3027
             $suffix = 1;
3028 3028
             
3029 3029
             do {
3030
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3030
+                $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix";
3031 3031
                 
3032
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3032
+                $term_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug));
3033 3033
                 
3034
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3034
+                $post_check = !$term_check && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID));
3035 3035
                 
3036 3036
                 $term_slug_check = $term_check || $post_check;
3037 3037
                 
3038 3038
                 $suffix++;
3039
-            } while ( $term_slug_check );
3039
+            } while ($term_slug_check);
3040 3040
             
3041 3041
             $slug = $alt_slug;
3042 3042
         }
@@ -3044,7 +3044,7 @@  discard block
 block discarded – undo
3044 3044
     
3045 3045
     return $slug;
3046 3046
 }
3047
-add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3047
+add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6);
3048 3048
 
3049 3049
 /**
3050 3050
  * Check whether a post name with slug exists or not.
@@ -3061,48 +3061,48 @@  discard block
 block discarded – undo
3061 3061
  * @param int $term_id The term ID.
3062 3062
  * @return bool true when exists. false when not exists.
3063 3063
  */
3064
-function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3064
+function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) {
3065 3065
     global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3066 3066
     
3067
-    if ( $slug_exists ) {
3067
+    if ($slug_exists) {
3068 3068
         return $slug_exists;
3069 3069
     }
3070 3070
     
3071
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3071
+    if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) {
3072 3072
         $taxonomy = $gd_term_taxonomy[$term_id];
3073 3073
     } else {
3074
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3074
+        $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id));
3075 3075
         $gd_term_taxonomy[$term_id] = $taxonomy;
3076 3076
     }
3077 3077
     
3078
-    if ( empty($taxonomy) ) {
3078
+    if (empty($taxonomy)) {
3079 3079
         return $slug_exists;
3080 3080
     }
3081 3081
     
3082
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3082
+    if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) {
3083 3083
         $post_type = $gd_term_post_type[$term_id];
3084 3084
     } else {
3085
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3086
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3085
+        $taxonomy_obj = get_taxonomy($taxonomy);
3086
+        $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL;
3087 3087
     }
3088 3088
     
3089 3089
     $wpml_post_join = "";
3090 3090
     $wpml_post_where = "";
3091 3091
     
3092 3092
     if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3093
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3093
+        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language();
3094 3094
         if (!$term_language) {
3095 3095
             $term_language = $sitepress->get_current_language();
3096 3096
         }
3097 3097
         
3098 3098
         $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3099
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3099
+        $wpml_post_where = " AND icl_t.language_code = '".$term_language."'";
3100 3100
     }
3101 3101
     
3102
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3102
+    if ($post_type && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type))) {
3103 3103
         $slug_exists = true;
3104 3104
     }
3105 3105
 
3106 3106
     return $slug_exists;
3107 3107
 }
3108
-add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3109 3108
\ No newline at end of file
3109
+add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3);
3110 3110
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/comments_functions.php 3 patches
Braces   +60 added lines, -48 removed lines patch added patch discarded remove patch
@@ -278,8 +278,9 @@  discard block
 block discarded – undo
278 278
 
279 279
     $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
280 280
 
281
-    if (!empty($comment_info))
282
-        $status = $comment_info->comment_approved;
281
+    if (!empty($comment_info)) {
282
+            $status = $comment_info->comment_approved;
283
+    }
283 284
 
284 285
     if ($status == 'approve' || $status == 1) {
285 286
         $status = 1;
@@ -418,12 +419,14 @@  discard block
 block discarded – undo
418 419
         }
419 420
     } else {
420 421
         $rating = 0;
421
-        if (!empty($comment))
422
-            $rating = geodir_get_commentoverall($comment->comment_ID);
422
+        if (!empty($comment)) {
423
+                    $rating = geodir_get_commentoverall($comment->comment_ID);
424
+        }
423 425
         if ($rating != 0 && !is_admin()) {
424 426
             return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
425
-        } else
426
-            return $content;
427
+        } else {
428
+                    return $content;
429
+        }
427 430
     }
428 431
 }
429 432
 
@@ -512,11 +515,12 @@  discard block
 block discarded – undo
512 515
         $post_ratings = get_post_meta($post_id, 'overall_rating');
513 516
     }
514 517
 
515
-    if ($post_ratings)
516
-        return $post_ratings;
517
-    else
518
-        return false;
519
-}
518
+    if ($post_ratings) {
519
+            return $post_ratings;
520
+    } else {
521
+            return false;
522
+    }
523
+    }
520 524
 
521 525
 
522 526
 /**
@@ -541,11 +545,12 @@  discard block
 block discarded – undo
541 545
         )
542 546
     );
543 547
 
544
-    if (!empty($reatings))
545
-        return $reatings;
546
-    else
547
-        return false;
548
-}
548
+    if (!empty($reatings)) {
549
+            return $reatings;
550
+    } else {
551
+            return false;
552
+    }
553
+    }
549 554
 
550 555
 /**
551 556
  * Get review total of a Post.
@@ -569,11 +574,12 @@  discard block
 block discarded – undo
569 574
         )
570 575
     );
571 576
 
572
-    if (!empty($results))
573
-        return $results;
574
-    else
575
-        return false;
576
-}
577
+    if (!empty($results)) {
578
+            return $results;
579
+    } else {
580
+            return false;
581
+    }
582
+    }
577 583
 
578 584
 /**
579 585
  * Get review count by user ID.
@@ -596,11 +602,12 @@  discard block
 block discarded – undo
596 602
         )
597 603
     );
598 604
 
599
-    if (!empty($results))
600
-        return $results;
601
-    else
602
-        return false;
603
-}
605
+    if (!empty($results)) {
606
+            return $results;
607
+    } else {
608
+            return false;
609
+    }
610
+    }
604 611
 
605 612
 /**
606 613
  * Get average overall rating of a Post.
@@ -634,11 +641,12 @@  discard block
 block discarded – undo
634 641
         )
635 642
     );
636 643
 
637
-    if (!empty($results))
638
-        return $results;
639
-    else
640
-        return false;
641
-}
644
+    if (!empty($results)) {
645
+            return $results;
646
+    } else {
647
+            return false;
648
+    }
649
+    }
642 650
 
643 651
 /**
644 652
  * Get review count of a Post.
@@ -662,11 +670,12 @@  discard block
 block discarded – undo
662 670
         )
663 671
     );
664 672
 
665
-    if (!empty($results))
666
-        return $results;
667
-    else
668
-        return false;
669
-}
673
+    if (!empty($results)) {
674
+            return $results;
675
+    } else {
676
+            return false;
677
+    }
678
+    }
670 679
 
671 680
 /**
672 681
  * Get comments count of a Post.
@@ -692,11 +701,12 @@  discard block
 block discarded – undo
692 701
     );
693 702
 
694 703
 
695
-    if (!empty($results))
696
-        return $results;
697
-    else
698
-        return false;
699
-}
704
+    if (!empty($results)) {
705
+            return $results;
706
+    } else {
707
+            return false;
708
+    }
709
+    }
700 710
 
701 711
 /**
702 712
  * Get overall rating of a comment.
@@ -720,11 +730,12 @@  discard block
 block discarded – undo
720 730
         )
721 731
     );
722 732
 
723
-    if ($reatings)
724
-        return $reatings;
725
-    else
726
-        return false;
727
-}
733
+    if ($reatings) {
734
+            return $reatings;
735
+    } else {
736
+            return false;
737
+    }
738
+    }
728 739
 
729 740
 /**
730 741
  * Returns average overall rating of a Post. Depreciated since ver 1.3.6.
@@ -970,8 +981,9 @@  discard block
 block discarded – undo
970 981
     $active_tabs = get_option('geodir_detail_page_tabs_excluded');
971 982
 
972 983
     $is_display = true;
973
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
974
-        $is_display = false;
984
+    if (!empty($active_tabs) && in_array('reviews', $active_tabs)) {
985
+            $is_display = false;
986
+    }
975 987
 
976 988
     /**
977 989
      * Filter to change display value.
Please login to merge, or discard this patch.
Indentation   +466 added lines, -466 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function geodir_comment_meta_row_action($a)
33 33
 {
34
-    global $comment;
34
+	global $comment;
35 35
 
36
-    $rating = geodir_get_commentoverall($comment->comment_ID);
37
-    if ($rating != 0) {
38
-        echo geodir_get_rating_stars($rating, $comment->comment_ID);
39
-    }
40
-    return $a;
36
+	$rating = geodir_get_commentoverall($comment->comment_ID);
37
+	if ($rating != 0) {
38
+		echo geodir_get_rating_stars($rating, $comment->comment_ID);
39
+	}
40
+	return $a;
41 41
 }
42 42
 
43 43
 add_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function geodir_comment_add_meta_box($comment)
54 54
 {
55
-    add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
55
+	add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
56 56
 }
57 57
 
58 58
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  * @param object $comment The comment object.
67 67
  */
68 68
 function geodir_comment_rating_meta($comment) {
69
-    $post_type = get_post_type($comment->comment_post_ID);
69
+	$post_type = get_post_type($comment->comment_post_ID);
70 70
 	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
71 71
 		$rating = geodir_get_commentoverall($comment->comment_ID);
72 72
 		
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
  * @global object $post The post object.
107 107
  */
108 108
 function geodir_comment_rating_fields() {
109
-    global $post;
109
+	global $post;
110 110
 
111
-    $post_types = geodir_get_posttypes();
111
+	$post_types = geodir_get_posttypes();
112 112
 
113
-    if (!empty($post->post_type) && in_array($post->post_type, $post_types) && !(!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type))) {
114
-        $star_texts = array();
115
-        $star_texts[] = __('Terrible', 'geodirectory');
116
-        $star_texts[] = __('Poor', 'geodirectory');
117
-        $star_texts[] = __('Average', 'geodirectory');
118
-        $star_texts[] = __('Very Good', 'geodirectory');
119
-        $star_texts[] = __('Excellent', 'geodirectory');
113
+	if (!empty($post->post_type) && in_array($post->post_type, $post_types) && !(!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type))) {
114
+		$star_texts = array();
115
+		$star_texts[] = __('Terrible', 'geodirectory');
116
+		$star_texts[] = __('Poor', 'geodirectory');
117
+		$star_texts[] = __('Average', 'geodirectory');
118
+		$star_texts[] = __('Very Good', 'geodirectory');
119
+		$star_texts[] = __('Excellent', 'geodirectory');
120 120
         
121
-        $gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
122
-        echo $gd_rating_html;
123
-        ?>
121
+		$gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
122
+		echo $gd_rating_html;
123
+		?>
124 124
         <input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="0"/>
125 125
         <?php
126
-    }
126
+	}
127 127
 }
128 128
 
129 129
 add_filter('comment_reply_link', 'geodir_comment_replaylink');
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 function geodir_comment_replaylink($link)
140 140
 {
141 141
 
142
-    if (strpos($link, 'wp-login.php?') !== false) {
143
-        $link = str_replace(wp_login_url(),geodir_login_url(),$link);
144
-    }
145
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
142
+	if (strpos($link, 'wp-login.php?') !== false) {
143
+		$link = str_replace(wp_login_url(),geodir_login_url(),$link);
144
+	}
145
+	$link = '<div class="gd_comment_replaylink">' . $link . '</div>';
146 146
 
147
-    return $link;
147
+	return $link;
148 148
 }
149 149
 
150 150
 add_filter('cancel_comment_reply_link', 'geodir_cancle_replaylink');
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 function geodir_cancle_replaylink($link)
160 160
 {
161 161
 
162
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
162
+	$link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
163 163
 
164
-    return $link;
164
+	return $link;
165 165
 }
166 166
 
167 167
 add_action('comment_post', 'geodir_save_rating');
@@ -177,32 +177,32 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function geodir_save_rating($comment = 0)
179 179
 {
180
-    global $wpdb, $user_ID, $plugin_prefix;
180
+	global $wpdb, $user_ID, $plugin_prefix;
181 181
 
182
-    $comment_info = get_comment($comment);
182
+	$comment_info = get_comment($comment);
183 183
 
184
-    $post_id = $comment_info->comment_post_ID;
185
-    $status = $comment_info->comment_approved;
186
-    $rating_ip = getenv("REMOTE_ADDR");
184
+	$post_id = $comment_info->comment_post_ID;
185
+	$status = $comment_info->comment_approved;
186
+	$rating_ip = getenv("REMOTE_ADDR");
187 187
 	
188
-    $post = geodir_get_post_info($post_id);
189
-    if (empty($post)) {
190
-        return;
191
-    }
192
-
193
-    if ($post->post_status == 'publish') {
194
-        $post_status = '1';
195
-    } else {
196
-        $post_status = '0';
197
-    }
188
+	$post = geodir_get_post_info($post_id);
189
+	if (empty($post)) {
190
+		return;
191
+	}
192
+
193
+	if ($post->post_status == 'publish') {
194
+		$post_status = '1';
195
+	} else {
196
+		$post_status = '0';
197
+	}
198 198
 	
199
-    if (isset($_REQUEST['geodir_overallrating'])) {
200
-        $overall_rating = $_REQUEST['geodir_overallrating'];
199
+	if (isset($_REQUEST['geodir_overallrating'])) {
200
+		$overall_rating = $_REQUEST['geodir_overallrating'];
201 201
         
202 202
 		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
203
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
203
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
204 204
 
205
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
205
+			$sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
206 206
 					post_id		= %d,
207 207
 					post_type = %s,
208 208
 					post_title	= %s,
@@ -220,35 +220,35 @@  discard block
 block discarded – undo
220 220
 					post_latitude	= %s,
221 221
 					comment_content	= %s 
222 222
 					",
223
-                array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
224
-            );
225
-
226
-            $wpdb->query($sqlqry);
227
-
228
-            /**
229
-             * Called after saving the comment.
230
-             *
231
-             * @since 1.0.0
232
-             * @package GeoDirectory
233
-             * @param array $_REQUEST {
234
-             *    Attributes of the $_REQUEST variable.
235
-             *
236
-             *    @type string $geodir_overallrating Overall rating.
237
-             *    @type string $comment Comment text.
238
-             *    @type string $submit Submit button text.
239
-             *    @type string $comment_post_ID Comment post ID.
240
-             *    @type string $comment_parent Comment Parent ID.
241
-             *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
242
-             *
243
-             * }
244
-             */
245
-            do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
246
-
247
-            if ($status) {
248
-                geodir_update_postrating($post_id);
249
-            }
250
-        }
251
-    }
223
+				array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
224
+			);
225
+
226
+			$wpdb->query($sqlqry);
227
+
228
+			/**
229
+			 * Called after saving the comment.
230
+			 *
231
+			 * @since 1.0.0
232
+			 * @package GeoDirectory
233
+			 * @param array $_REQUEST {
234
+			 *    Attributes of the $_REQUEST variable.
235
+			 *
236
+			 *    @type string $geodir_overallrating Overall rating.
237
+			 *    @type string $comment Comment text.
238
+			 *    @type string $submit Submit button text.
239
+			 *    @type string $comment_post_ID Comment post ID.
240
+			 *    @type string $comment_parent Comment Parent ID.
241
+			 *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
242
+			 *
243
+			 * }
244
+			 */
245
+			do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
246
+
247
+			if ($status) {
248
+				geodir_update_postrating($post_id);
249
+			}
250
+		}
251
+	}
252 252
 }
253 253
 
254 254
 
@@ -266,51 +266,51 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function geodir_update_rating_status_change($comment_id, $status)
268 268
 {
269
-    if ($status == 'delete') {
270
-        return;
271
-    }
272
-    global $wpdb, $plugin_prefix, $user_ID;
269
+	if ($status == 'delete') {
270
+		return;
271
+	}
272
+	global $wpdb, $plugin_prefix, $user_ID;
273 273
 
274
-    $comment_info = get_comment($comment_id);
274
+	$comment_info = get_comment($comment_id);
275 275
 
276
-    $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
276
+	$post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
277 277
 
278
-    if (!empty($comment_info))
279
-        $status = $comment_info->comment_approved;
278
+	if (!empty($comment_info))
279
+		$status = $comment_info->comment_approved;
280 280
 
281
-    if ($status == 'approve' || $status == 1) {
282
-        $status = 1;
283
-    } else {
284
-        $status = 0;
285
-    }
281
+	if ($status == 'approve' || $status == 1) {
282
+		$status = 1;
283
+	} else {
284
+		$status = 0;
285
+	}
286 286
 
287
-    $comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
288
-    $old_rating = geodir_get_commentoverall($comment_info_ID);
287
+	$comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
288
+	$old_rating = geodir_get_commentoverall($comment_info_ID);
289 289
 
290
-    $post_type = get_post_type($post_id);
290
+	$post_type = get_post_type($post_id);
291 291
 
292
-    $detail_table = $plugin_prefix . $post_type . '_detail';
292
+	$detail_table = $plugin_prefix . $post_type . '_detail';
293 293
 
294
-    if ($comment_id) {
294
+	if ($comment_id) {
295 295
 
296
-        $overall_rating = $old_rating;
296
+		$overall_rating = $old_rating;
297 297
 
298
-        if (isset($old_rating)) {
298
+		if (isset($old_rating)) {
299 299
 
300
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
300
+			$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
301 301
 						overall_rating = %f,
302 302
 						status		= %s,
303 303
 						comment_content = %s 
304 304
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
305 305
 
306
-            $wpdb->query($sqlqry);
306
+			$wpdb->query($sqlqry);
307 307
 
308
-            //update rating
309
-            geodir_update_postrating($post_id, $post_type);
308
+			//update rating
309
+			geodir_update_postrating($post_id, $post_type);
310 310
 
311
-        }
311
+		}
312 312
 
313
-    }
313
+	}
314 314
 
315 315
 }
316 316
 
@@ -329,41 +329,41 @@  discard block
 block discarded – undo
329 329
 function geodir_update_rating($comment_id = 0)
330 330
 {
331 331
 
332
-    global $wpdb, $plugin_prefix, $user_ID;
332
+	global $wpdb, $plugin_prefix, $user_ID;
333 333
 
334
-    $comment_info = get_comment($comment_id);
334
+	$comment_info = get_comment($comment_id);
335 335
 
336
-    $post_id = $comment_info->comment_post_ID;
337
-    $status = $comment_info->comment_approved;
338
-    $old_rating = geodir_get_commentoverall($comment_info->comment_ID);
336
+	$post_id = $comment_info->comment_post_ID;
337
+	$status = $comment_info->comment_approved;
338
+	$old_rating = geodir_get_commentoverall($comment_info->comment_ID);
339 339
 
340
-    $post_type = get_post_type($post_id);
340
+	$post_type = get_post_type($post_id);
341 341
 
342
-    $detail_table = $plugin_prefix . $post_type . '_detail';
342
+	$detail_table = $plugin_prefix . $post_type . '_detail';
343 343
 
344
-    if (isset($_REQUEST['geodir_overallrating'])) {
344
+	if (isset($_REQUEST['geodir_overallrating'])) {
345 345
 
346
-        $overall_rating = $_REQUEST['geodir_overallrating'];
346
+		$overall_rating = $_REQUEST['geodir_overallrating'];
347 347
 
348
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
349
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
348
+		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
349
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
350 350
 
351
-            if (isset($old_rating)) {
351
+			if (isset($old_rating)) {
352 352
 
353
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
353
+				$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
354 354
 						overall_rating = %f,
355 355
 						status		= %s,
356 356
 						comment_content	= %s 
357 357
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
358 358
 
359
-                $wpdb->query($sqlqry);
359
+				$wpdb->query($sqlqry);
360 360
 
361
-                //update rating
362
-                geodir_update_postrating($post_id, $post_type);
361
+				//update rating
362
+				geodir_update_postrating($post_id, $post_type);
363 363
 
364
-            }
365
-        }
366
-    }
364
+			}
365
+		}
366
+	}
367 367
 
368 368
 
369 369
 }
@@ -379,19 +379,19 @@  discard block
 block discarded – undo
379 379
  */
380 380
 function geodir_comment_delete_comment($comment_id)
381 381
 {
382
-    global $wpdb;
382
+	global $wpdb;
383 383
 
384
-    $review_info = geodir_get_review($comment_id);
385
-    if ($review_info) {
386
-        geodir_update_postrating($review_info->post_id);
387
-    }
384
+	$review_info = geodir_get_review($comment_id);
385
+	if ($review_info) {
386
+		geodir_update_postrating($review_info->post_id);
387
+	}
388 388
 
389
-    $wpdb->query(
390
-        $wpdb->prepare(
391
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
392
-            array($comment_id)
393
-        )
394
-    );
389
+	$wpdb->query(
390
+		$wpdb->prepare(
391
+			"DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
392
+			array($comment_id)
393
+		)
394
+	);
395 395
 
396 396
 }
397 397
 
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
  * @return string The comment content.
408 408
  */
409 409
 function geodir_wrap_comment_text($content, $comment = '') {
410
-    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
411
-        if (!is_admin()) {
412
-            return '<div class="description">' . $content . '</div>';
413
-        } else {
414
-            return $content;
415
-        }
416
-    } else {
417
-        $rating = 0;
418
-        if (!empty($comment))
419
-            $rating = geodir_get_commentoverall($comment->comment_ID);
420
-        if ($rating != 0 && !is_admin()) {
421
-            return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
422
-        } else
423
-            return $content;
424
-    }
410
+	if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
411
+		if (!is_admin()) {
412
+			return '<div class="description">' . $content . '</div>';
413
+		} else {
414
+			return $content;
415
+		}
416
+	} else {
417
+		$rating = 0;
418
+		if (!empty($comment))
419
+			$rating = geodir_get_commentoverall($comment->comment_ID);
420
+		if ($rating != 0 && !is_admin()) {
421
+			return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
422
+		} else
423
+			return $content;
424
+	}
425 425
 }
426 426
 
427 427
 
@@ -438,41 +438,41 @@  discard block
 block discarded – undo
438 438
  */
439 439
 function geodir_update_postrating($post_id = 0, $post_type = '', $delete = false)
440 440
 {
441
-    global $wpdb, $plugin_prefix, $comment;
442
-    if (!$post_type) {
443
-        $post_type = get_post_type($post_id);
444
-    }
445
-    $detail_table = $plugin_prefix . $post_type . '_detail';
446
-    $post_newrating = geodir_get_post_rating($post_id, 1);
447
-    $post_newrating_count = geodir_get_review_count_total($post_id);
441
+	global $wpdb, $plugin_prefix, $comment;
442
+	if (!$post_type) {
443
+		$post_type = get_post_type($post_id);
444
+	}
445
+	$detail_table = $plugin_prefix . $post_type . '_detail';
446
+	$post_newrating = geodir_get_post_rating($post_id, 1);
447
+	$post_newrating_count = geodir_get_review_count_total($post_id);
448 448
 
449 449
 
450
-    //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
450
+	//$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
451 451
 
452
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
452
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
453 453
 
454
-        $wpdb->query(
455
-            $wpdb->prepare(
456
-                "UPDATE " . $detail_table . " SET
454
+		$wpdb->query(
455
+			$wpdb->prepare(
456
+				"UPDATE " . $detail_table . " SET
457 457
 						overall_rating = %f,
458 458
 						rating_count = %f
459 459
 						where post_id = %d",
460
-                array($post_newrating, $post_newrating_count, $post_id)
461
-            )
462
-        );
463
-
464
-        update_post_meta($post_id, 'overall_rating', $post_newrating);
465
-        update_post_meta($post_id, 'rating_count', $post_newrating_count);
466
-    }
467
-    /**
468
-     * Called after Updating post overall rating and rating count.
469
-     *
470
-     * @since 1.0.0
471
-     * @since 1.4.3 Added `$post_id` param.
472
-     * @package GeoDirectory
473
-     * @param int $post_id The post ID.
474
-     */
475
-    do_action('geodir_update_postrating',$post_id);
460
+				array($post_newrating, $post_newrating_count, $post_id)
461
+			)
462
+		);
463
+
464
+		update_post_meta($post_id, 'overall_rating', $post_newrating);
465
+		update_post_meta($post_id, 'rating_count', $post_newrating_count);
466
+	}
467
+	/**
468
+	 * Called after Updating post overall rating and rating count.
469
+	 *
470
+	 * @since 1.0.0
471
+	 * @since 1.4.3 Added `$post_id` param.
472
+	 * @package GeoDirectory
473
+	 * @param int $post_id The post ID.
474
+	 */
475
+	do_action('geodir_update_postrating',$post_id);
476 476
 
477 477
 }
478 478
 
@@ -490,29 +490,29 @@  discard block
 block discarded – undo
490 490
  */
491 491
 function geodir_get_postoverall($post_id = 0)
492 492
 {
493
-    global $wpdb, $plugin_prefix;
493
+	global $wpdb, $plugin_prefix;
494 494
 
495
-    $post_type = get_post_type($post_id);
496
-    $detail_table = $plugin_prefix . $post_type . '_detail';
495
+	$post_type = get_post_type($post_id);
496
+	$detail_table = $plugin_prefix . $post_type . '_detail';
497 497
 
498
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
498
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
499 499
 
500
-        $post_ratings = $wpdb->get_var(
501
-            $wpdb->prepare(
502
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
503
-                array($post_id)
504
-            )
505
-        );
500
+		$post_ratings = $wpdb->get_var(
501
+			$wpdb->prepare(
502
+				"SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
503
+				array($post_id)
504
+			)
505
+		);
506 506
 
507 507
 
508
-    } else {
509
-        $post_ratings = get_post_meta($post_id, 'overall_rating');
510
-    }
508
+	} else {
509
+		$post_ratings = get_post_meta($post_id, 'overall_rating');
510
+	}
511 511
 
512
-    if ($post_ratings)
513
-        return $post_ratings;
514
-    else
515
-        return false;
512
+	if ($post_ratings)
513
+		return $post_ratings;
514
+	else
515
+		return false;
516 516
 }
517 517
 
518 518
 
@@ -529,19 +529,19 @@  discard block
 block discarded – undo
529 529
  */
530 530
 function geodir_get_review($comment_id = 0)
531 531
 {
532
-    global $wpdb;
533
-
534
-    $reatings = $wpdb->get_row(
535
-        $wpdb->prepare(
536
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
537
-            array($comment_id)
538
-        )
539
-    );
540
-
541
-    if (!empty($reatings))
542
-        return $reatings;
543
-    else
544
-        return false;
532
+	global $wpdb;
533
+
534
+	$reatings = $wpdb->get_row(
535
+		$wpdb->prepare(
536
+			"SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
537
+			array($comment_id)
538
+		)
539
+	);
540
+
541
+	if (!empty($reatings))
542
+		return $reatings;
543
+	else
544
+		return false;
545 545
 }
546 546
 
547 547
 /**
@@ -557,19 +557,19 @@  discard block
 block discarded – undo
557 557
  */
558 558
 function geodir_get_review_total($post_id = 0)
559 559
 {
560
-    global $wpdb;
561
-
562
-    $results = $wpdb->get_var(
563
-        $wpdb->prepare(
564
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
565
-            array($post_id)
566
-        )
567
-    );
568
-
569
-    if (!empty($results))
570
-        return $results;
571
-    else
572
-        return false;
560
+	global $wpdb;
561
+
562
+	$results = $wpdb->get_var(
563
+		$wpdb->prepare(
564
+			"SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
565
+			array($post_id)
566
+		)
567
+	);
568
+
569
+	if (!empty($results))
570
+		return $results;
571
+	else
572
+		return false;
573 573
 }
574 574
 
575 575
 /**
@@ -585,18 +585,18 @@  discard block
 block discarded – undo
585 585
  */
586 586
 function geodir_get_review_count_by_user_id($user_id = 0)
587 587
 {
588
-    global $wpdb;
589
-    $results = $wpdb->get_var(
590
-        $wpdb->prepare(
591
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
592
-            array($user_id)
593
-        )
594
-    );
595
-
596
-    if (!empty($results))
597
-        return $results;
598
-    else
599
-        return false;
588
+	global $wpdb;
589
+	$results = $wpdb->get_var(
590
+		$wpdb->prepare(
591
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
592
+			array($user_id)
593
+		)
594
+	);
595
+
596
+	if (!empty($results))
597
+		return $results;
598
+	else
599
+		return false;
600 600
 }
601 601
 
602 602
 /**
@@ -614,27 +614,27 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_get_post_rating($post_id = 0, $force_query = 0)
616 616
 {
617
-    global $wpdb, $post;
618
-
619
-    if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
620
-        if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
621
-            return $post->overall_rating;
622
-        } else {
623
-            return 0;
624
-        }
625
-    }
626
-
627
-    $results = $wpdb->get_var(
628
-        $wpdb->prepare(
629
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
630
-            array($post_id)
631
-        )
632
-    );
633
-
634
-    if (!empty($results))
635
-        return $results;
636
-    else
637
-        return false;
617
+	global $wpdb, $post;
618
+
619
+	if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
620
+		if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
621
+			return $post->overall_rating;
622
+		} else {
623
+			return 0;
624
+		}
625
+	}
626
+
627
+	$results = $wpdb->get_var(
628
+		$wpdb->prepare(
629
+			"SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
630
+			array($post_id)
631
+		)
632
+	);
633
+
634
+	if (!empty($results))
635
+		return $results;
636
+	else
637
+		return false;
638 638
 }
639 639
 
640 640
 /**
@@ -650,19 +650,19 @@  discard block
 block discarded – undo
650 650
  */
651 651
 function geodir_get_review_count_total($post_id = 0)
652 652
 {
653
-    global $wpdb;
654
-
655
-    $results = $wpdb->get_var(
656
-        $wpdb->prepare(
657
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
658
-            array($post_id)
659
-        )
660
-    );
661
-
662
-    if (!empty($results))
663
-        return $results;
664
-    else
665
-        return false;
653
+	global $wpdb;
654
+
655
+	$results = $wpdb->get_var(
656
+		$wpdb->prepare(
657
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
658
+			array($post_id)
659
+		)
660
+	);
661
+
662
+	if (!empty($results))
663
+		return $results;
664
+	else
665
+		return false;
666 666
 }
667 667
 
668 668
 /**
@@ -679,20 +679,20 @@  discard block
 block discarded – undo
679 679
  */
680 680
 function geodir_get_comments_number($post_id = 0)
681 681
 {
682
-    global $wpdb;
682
+	global $wpdb;
683 683
 
684
-    $results = $wpdb->get_var(
685
-        $wpdb->prepare(
686
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
687
-            array($post_id)
688
-        )
689
-    );
684
+	$results = $wpdb->get_var(
685
+		$wpdb->prepare(
686
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
687
+			array($post_id)
688
+		)
689
+	);
690 690
 
691 691
 
692
-    if (!empty($results))
693
-        return $results;
694
-    else
695
-        return false;
692
+	if (!empty($results))
693
+		return $results;
694
+	else
695
+		return false;
696 696
 }
697 697
 
698 698
 /**
@@ -708,19 +708,19 @@  discard block
 block discarded – undo
708 708
  */
709 709
 function geodir_get_commentoverall($comment_id = 0)
710 710
 {
711
-    global $wpdb;
712
-
713
-    $reatings = $wpdb->get_var(
714
-        $wpdb->prepare(
715
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
716
-            array($comment_id)
717
-        )
718
-    );
719
-
720
-    if ($reatings)
721
-        return $reatings;
722
-    else
723
-        return false;
711
+	global $wpdb;
712
+
713
+	$reatings = $wpdb->get_var(
714
+		$wpdb->prepare(
715
+			"SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
716
+			array($comment_id)
717
+		)
718
+	);
719
+
720
+	if ($reatings)
721
+		return $reatings;
722
+	else
723
+		return false;
724 724
 }
725 725
 
726 726
 /**
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
  */
735 735
 function geodir_get_commentoverall_number($post_id = 0)
736 736
 {
737
-    return geodir_get_post_rating($post_id);
737
+	return geodir_get_post_rating($post_id);
738 738
 }
739 739
 
740 740
 
@@ -752,102 +752,102 @@  discard block
 block discarded – undo
752 752
  */
753 753
 function geodir_comment_template($comment_template)
754 754
 {
755
-    global $post;
755
+	global $post;
756 756
 
757
-    $post_types = geodir_get_posttypes();
757
+	$post_types = geodir_get_posttypes();
758 758
 
759
-    if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
760
-        return;
761
-    }
762
-    if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
763
-        if (geodir_cpt_has_rating_disabled($post->post_type)) {
764
-            return $comment_template;
765
-        }
759
+	if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
760
+		return;
761
+	}
762
+	if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
763
+		if (geodir_cpt_has_rating_disabled($post->post_type)) {
764
+			return $comment_template;
765
+		}
766 766
         
767
-        $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768
-        if (!$template) {
769
-            $template = dirname(__FILE__) . '/reviews.php';
770
-        }
771
-        return $template;
772
-    }
767
+		$template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768
+		if (!$template) {
769
+			$template = dirname(__FILE__) . '/reviews.php';
770
+		}
771
+		return $template;
772
+	}
773 773
 }
774 774
 
775 775
 add_filter("comments_template", "geodir_comment_template");
776 776
 
777 777
 
778 778
 if (!function_exists('geodir_comment')) {
779
-    /**
780
-     * Comment HTML markup.
781
-     *
782
-     * @since 1.0.0
783
-     * @package GeoDirectory
784
-     * @global object $post The current post object.
785
-     * @param object $comment The comment object.
786
-     * @param string|array $args {
787
-     *     Optional. Formatting options.
788
-     *
789
-     *     @type object $walker            Instance of a Walker class to list comments. Default null.
790
-     *     @type int    $max_depth         The maximum comments depth. Default empty.
791
-     *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
792
-     *     @type string $callback          Callback function to use. Default null.
793
-     *     @type string $end-callback      Callback function to use at the end. Default null.
794
-     *     @type string $type              Type of comments to list.
795
-     *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
796
-     *     @type int    $page              Page ID to list comments for. Default empty.
797
-     *     @type int    $per_page          Number of comments to list per page. Default empty.
798
-     *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
799
-     *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
800
-     *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
801
-     *     @type string $format            How to format the comments list.
802
-     *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
803
-     *     @type bool   $short_ping        Whether to output short pings. Default false.
804
-     *     @type bool   $echo              Whether to echo the output or return it. Default true.
805
-     * }
806
-     * @param int $depth Depth of comment.
807
-     */
808
-    function geodir_comment($comment, $args, $depth)
809
-    {
810
-        $GLOBALS['comment'] = $comment;
811
-        switch ($comment->comment_type) :
812
-            case 'pingback' :
813
-            case 'trackback' :
814
-                // Display trackbacks differently than normal comments.
815
-                ?>
779
+	/**
780
+	 * Comment HTML markup.
781
+	 *
782
+	 * @since 1.0.0
783
+	 * @package GeoDirectory
784
+	 * @global object $post The current post object.
785
+	 * @param object $comment The comment object.
786
+	 * @param string|array $args {
787
+	 *     Optional. Formatting options.
788
+	 *
789
+	 *     @type object $walker            Instance of a Walker class to list comments. Default null.
790
+	 *     @type int    $max_depth         The maximum comments depth. Default empty.
791
+	 *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
792
+	 *     @type string $callback          Callback function to use. Default null.
793
+	 *     @type string $end-callback      Callback function to use at the end. Default null.
794
+	 *     @type string $type              Type of comments to list.
795
+	 *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
796
+	 *     @type int    $page              Page ID to list comments for. Default empty.
797
+	 *     @type int    $per_page          Number of comments to list per page. Default empty.
798
+	 *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
799
+	 *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
800
+	 *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
801
+	 *     @type string $format            How to format the comments list.
802
+	 *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
803
+	 *     @type bool   $short_ping        Whether to output short pings. Default false.
804
+	 *     @type bool   $echo              Whether to echo the output or return it. Default true.
805
+	 * }
806
+	 * @param int $depth Depth of comment.
807
+	 */
808
+	function geodir_comment($comment, $args, $depth)
809
+	{
810
+		$GLOBALS['comment'] = $comment;
811
+		switch ($comment->comment_type) :
812
+			case 'pingback' :
813
+			case 'trackback' :
814
+				// Display trackbacks differently than normal comments.
815
+				?>
816 816
                 <li <?php comment_class('geodir-comment'); ?> id="comment-<?php comment_ID(); ?>">
817 817
                 <p><?php _e('Pingback:', 'geodirectory'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'geodirectory'), '<span class="edit-link">', '</span>'); ?></p>
818 818
                 <?php
819
-                break;
820
-            default :
821
-                // Proceed with normal comments.
822
-                global $post;
823
-                ?>
819
+				break;
820
+			default :
821
+				// Proceed with normal comments.
822
+				global $post;
823
+				?>
824 824
             <li <?php comment_class('geodir-comment'); ?> id="li-comment-<?php comment_ID(); ?>">
825 825
                 <article id="comment-<?php comment_ID(); ?>" class="comment">
826 826
                     <header class="comment-meta comment-author vcard">
827 827
                         <?php
828
-                        /**
829
-                         * Filter to modify comment avatar size
830
-                         *
831
-                         * You can use this filter to change comment avatar size.
832
-                         *
833
-                         * @since 1.0.0
834
-                         * @package GeoDirectory
835
-                         */
836
-                        $avatar_size = apply_filters('geodir_comment_avatar_size', 44);
837
-                        echo get_avatar($comment, $avatar_size);
838
-                        printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839
-                            get_comment_author_link(),
840
-                            // If current post author is also comment author, make it known visually.
841
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
842
-                        );
843
-                        echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844
-                        printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
845
-                            esc_url(get_comment_link($comment->comment_ID)),
846
-                            get_comment_time('c'),
847
-                            /* translators: 1: date, 2: time */
848
-                            sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
849
-                        );
850
-                        ?>
828
+						/**
829
+						 * Filter to modify comment avatar size
830
+						 *
831
+						 * You can use this filter to change comment avatar size.
832
+						 *
833
+						 * @since 1.0.0
834
+						 * @package GeoDirectory
835
+						 */
836
+						$avatar_size = apply_filters('geodir_comment_avatar_size', 44);
837
+						echo get_avatar($comment, $avatar_size);
838
+						printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839
+							get_comment_author_link(),
840
+							// If current post author is also comment author, make it known visually.
841
+							($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
842
+						);
843
+						echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844
+						printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
845
+							esc_url(get_comment_link($comment->comment_ID)),
846
+							get_comment_time('c'),
847
+							/* translators: 1: date, 2: time */
848
+							sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
849
+						);
850
+						?>
851 851
                     </header>
852 852
                     <!-- .comment-meta -->
853 853
 
@@ -871,47 +871,47 @@  discard block
 block discarded – undo
871 871
                 </article>
872 872
                 <!-- #comment-## -->
873 873
                 <?php
874
-                break;
875
-        endswitch; // end comment_type check
876
-    }
874
+				break;
875
+		endswitch; // end comment_type check
876
+	}
877 877
 }
878 878
 
879 879
 
880 880
 add_filter('get_comments_number', 'geodir_fix_comment_count', 10, 2);
881 881
 if (!function_exists('geodir_fix_comment_count')) {
882
-    /**
883
-     * Fix comment count by not listing replies as reviews
884
-     *
885
-     * @since 1.0.0
886
-     * @package GeoDirectory
887
-     * @global object $post The current post object.
888
-     * @param int $count The comment count.
889
-     * @param int $post_id The post ID.
890
-     * @todo $post is unreachable since the function return the count before that variable.
891
-     * @return bool|null|string The comment count.
892
-     */
893
-    function geodir_fix_comment_count($count, $post_id)
894
-    {
895
-        if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
896
-            global $post;
897
-            $post_types = geodir_get_posttypes();
898
-
899
-            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
900
-                $review_count = geodir_get_review_count_total($post_id);
901
-                return $review_count;
902
-
903
-                if ($post && isset($post->rating_count)) {
904
-                    return $post->rating_count;
905
-                } else {
906
-                    return geodir_get_comments_number($post_id);
907
-                }
908
-            } else {
909
-                return $count;
910
-            }
911
-        } else {
912
-            return $count;
913
-        }
914
-    }
882
+	/**
883
+	 * Fix comment count by not listing replies as reviews
884
+	 *
885
+	 * @since 1.0.0
886
+	 * @package GeoDirectory
887
+	 * @global object $post The current post object.
888
+	 * @param int $count The comment count.
889
+	 * @param int $post_id The post ID.
890
+	 * @todo $post is unreachable since the function return the count before that variable.
891
+	 * @return bool|null|string The comment count.
892
+	 */
893
+	function geodir_fix_comment_count($count, $post_id)
894
+	{
895
+		if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
896
+			global $post;
897
+			$post_types = geodir_get_posttypes();
898
+
899
+			if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
900
+				$review_count = geodir_get_review_count_total($post_id);
901
+				return $review_count;
902
+
903
+				if ($post && isset($post->rating_count)) {
904
+					return $post->rating_count;
905
+				} else {
906
+					return geodir_get_comments_number($post_id);
907
+				}
908
+			} else {
909
+				return $count;
910
+			}
911
+		} else {
912
+			return $count;
913
+		}
914
+	}
915 915
 }
916 916
 
917 917
 /**
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_rating_stars($rating, $post_id, $small = false)
931 931
 {
932
-    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
933
-        return NULL;
934
-    }
935
-    $a_rating = $rating / 5 * 100;
936
-
937
-    if ($small) {
938
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
939
-    } else {
932
+	if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
933
+		return NULL;
934
+	}
935
+	$a_rating = $rating / 5 * 100;
936
+
937
+	if ($small) {
938
+		$r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
939
+	} else {
940 940
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
941 941
 			// Show rating stars from review rating manager
942 942
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
@@ -953,8 +953,8 @@  discard block
 block discarded – undo
953 953
 			}
954 954
 			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
955 955
 		}
956
-    }
957
-    return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
956
+	}
957
+	return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
958 958
 }
959 959
 
960 960
 /**
@@ -968,23 +968,23 @@  discard block
 block discarded – undo
968 968
 function geodir_is_reviews_show($pageview = '')
969 969
 {
970 970
 
971
-    $active_tabs = get_option('geodir_detail_page_tabs_excluded');
972
-
973
-    $is_display = true;
974
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
975
-        $is_display = false;
976
-
977
-    /**
978
-     * Filter to change display value.
979
-     *
980
-     * You can use this filter to change the is_display value.
981
-     *
982
-     * @since 1.0.0
983
-     * @package GeoDirectory
984
-     * @param bool $is_display Display ratings when set to true.
985
-     * @param string $pageview The view template. Ex: listview, gridview etc.
986
-     */
987
-    return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
971
+	$active_tabs = get_option('geodir_detail_page_tabs_excluded');
972
+
973
+	$is_display = true;
974
+	if (!empty($active_tabs) && in_array('reviews', $active_tabs))
975
+		$is_display = false;
976
+
977
+	/**
978
+	 * Filter to change display value.
979
+	 *
980
+	 * You can use this filter to change the is_display value.
981
+	 *
982
+	 * @since 1.0.0
983
+	 * @package GeoDirectory
984
+	 * @param bool $is_display Display ratings when set to true.
985
+	 * @param string $pageview The view template. Ex: listview, gridview etc.
986
+	 */
987
+	return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
988 988
 }
989 989
 
990 990
 
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
993 993
  */
994 994
 if(function_exists('dsq_can_replace')) {
995
-    remove_filter('comments_template', 'dsq_comments_template');
996
-    add_filter('comments_template', 'dsq_comments_template', 100);
997
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
995
+	remove_filter('comments_template', 'dsq_comments_template');
996
+	add_filter('comments_template', 'dsq_comments_template', 100);
997
+	add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
998 998
 }
999 999
 
1000 1000
 
@@ -1008,14 +1008,14 @@  discard block
 block discarded – undo
1008 1008
  * @return string `1` if active `0` if disabled.
1009 1009
  */
1010 1010
 function geodir_option_disqus_active($disqus_active){
1011
-    global $post;
1012
-    $all_postypes = geodir_get_posttypes();
1011
+	global $post;
1012
+	$all_postypes = geodir_get_posttypes();
1013 1013
 
1014
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1015
-        $disqus_active = '0';
1016
-    }
1014
+	if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1015
+		$disqus_active = '0';
1016
+	}
1017 1017
 
1018
-    return $disqus_active;
1018
+	return $disqus_active;
1019 1019
 }
1020 1020
 
1021 1021
 /**
@@ -1029,23 +1029,23 @@  discard block
 block discarded – undo
1029 1029
  * @return array Modified tabs array.
1030 1030
  */
1031 1031
 function geodir_detail_reviews_tab_title($tabs_arr) {
1032
-    $post_type = geodir_get_current_posttype();
1032
+	$post_type = geodir_get_current_posttype();
1033 1033
 
1034
-    if (!empty($tabs_arr) && !empty($tabs_arr['reviews']) && isset($tabs_arr['reviews']['heading_text']) && $post_type != '' && geodir_cpt_has_rating_disabled($post_type)) {
1035
-        $label_reviews = __('Comments', 'geodirectory');
1034
+	if (!empty($tabs_arr) && !empty($tabs_arr['reviews']) && isset($tabs_arr['reviews']['heading_text']) && $post_type != '' && geodir_cpt_has_rating_disabled($post_type)) {
1035
+		$label_reviews = __('Comments', 'geodirectory');
1036 1036
         
1037
-        if (defined('GEODIR_CP_VERSION')) {
1038
-            $post_types = geodir_get_posttypes('array');
1037
+		if (defined('GEODIR_CP_VERSION')) {
1038
+			$post_types = geodir_get_posttypes('array');
1039 1039
             
1040
-            if (!empty($post_types[$post_type]['labels']['label_reviews'])) {
1041
-                $label_reviews = stripslashes(__($post_types[$post_type]['labels']['label_reviews'], 'geodirectory'));
1042
-            }
1043
-        }
1040
+			if (!empty($post_types[$post_type]['labels']['label_reviews'])) {
1041
+				$label_reviews = stripslashes(__($post_types[$post_type]['labels']['label_reviews'], 'geodirectory'));
1042
+			}
1043
+		}
1044 1044
         
1045
-        $tabs_arr['reviews']['heading_text'] = $label_reviews;
1046
-    }
1045
+		$tabs_arr['reviews']['heading_text'] = $label_reviews;
1046
+	}
1047 1047
     
1048
-    return $tabs_arr;
1048
+	return $tabs_arr;
1049 1049
 }
1050 1050
 add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_reviews_tab_title', 1000, 1);
1051 1051
 
@@ -1056,13 +1056,13 @@  discard block
 block discarded – undo
1056 1056
  * @since 1.6.21
1057 1057
  */
1058 1058
 function geodir_jetpack_disable_comments(){
1059
-    //only run if jetpack installed
1060
-    if(defined('JETPACK__VERSION')){
1061
-        $post_types = geodir_get_posttypes();
1062
-        foreach($post_types as $post_type){
1063
-            add_filter('jetpack_comment_form_enabled_for_' . $post_type, '__return_false');
1064
-        }
1065
-    }
1059
+	//only run if jetpack installed
1060
+	if(defined('JETPACK__VERSION')){
1061
+		$post_types = geodir_get_posttypes();
1062
+		foreach($post_types as $post_type){
1063
+			add_filter('jetpack_comment_form_enabled_for_' . $post_type, '__return_false');
1064
+		}
1065
+	}
1066 1066
 }
1067 1067
 
1068 1068
 add_action('plugins_loaded','geodir_jetpack_disable_comments');
@@ -1077,12 +1077,12 @@  discard block
 block discarded – undo
1077 1077
  * @return bool True if allowed otherwise False.
1078 1078
  */
1079 1079
 function geodir_check_reviews_open( $open, $post_id ) {
1080
-    if ( $open && $post_id && geodir_is_page( 'detail' ) ) {
1081
-        if ( in_array( get_post_status( $post_id ), array( 'draft', 'pending', 'auto-draft', 'trash' ) ) ) {
1082
-            $open = false;
1083
-        }
1084
-    }
1080
+	if ( $open && $post_id && geodir_is_page( 'detail' ) ) {
1081
+		if ( in_array( get_post_status( $post_id ), array( 'draft', 'pending', 'auto-draft', 'trash' ) ) ) {
1082
+			$open = false;
1083
+		}
1084
+	}
1085 1085
     
1086
-    return $open;
1086
+	return $open;
1087 1087
 }
1088 1088
 add_filter( 'comments_open', 'geodir_check_reviews_open', 10, 2 );
1089 1089
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_comment_rating_meta($comment) {
69 69
     $post_type = get_post_type($comment->comment_post_ID);
70
-	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
70
+	if (in_array($post_type, (array) geodir_get_posttypes()) && (int) $comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
71 71
 		$rating = geodir_get_commentoverall($comment->comment_ID);
72 72
 		
73
-		if ((int)get_option('geodir_reviewrating_enable_font_awesome') == 1) {
73
+		if ((int) get_option('geodir_reviewrating_enable_font_awesome') == 1) {
74 74
 			$star_texts = array();
75 75
 			$star_texts[] = __('Terrible', 'geodirectory');
76 76
 			$star_texts[] = __('Poor', 'geodirectory');
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 			echo geodir_font_awesome_rating_form_html('', $star_texts, $rating);
82 82
 		} else {			
83 83
 			if ($rating) {
84
-				echo '<div class="gd_rating" data-average="' . $rating . '" data-id="5">';
84
+				echo '<div class="gd_rating" data-average="'.$rating.'" data-id="5">';
85 85
 
86 86
 			} else {
87 87
 				echo '<div class="gd_rating" data-average="0" data-id="5"></div>';
88 88
 			}
89 89
 		}
90
-		echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="' . $rating . '"  />';
90
+		echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="'.$rating.'"  />';
91 91
 	}
92 92
 }
93 93
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 {
141 141
 
142 142
     if (strpos($link, 'wp-login.php?') !== false) {
143
-        $link = str_replace(wp_login_url(),geodir_login_url(),$link);
143
+        $link = str_replace(wp_login_url(), geodir_login_url(), $link);
144 144
     }
145
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
145
+    $link = '<div class="gd_comment_replaylink">'.$link.'</div>';
146 146
 
147 147
     return $link;
148 148
 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 function geodir_cancle_replaylink($link)
160 160
 {
161 161
 
162
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
162
+    $link = '<span class="gd-cancel-replaylink">'.$link.'</span>';
163 163
 
164 164
     return $link;
165 165
 }
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
     if (isset($_REQUEST['geodir_overallrating'])) {
200 200
         $overall_rating = $_REQUEST['geodir_overallrating'];
201 201
         
202
-		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
202
+		if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
203 203
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
204 204
 
205
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
205
+            $sqlqry = $wpdb->prepare("INSERT INTO ".GEODIR_REVIEW_TABLE." SET
206 206
 					post_id		= %d,
207 207
 					post_type = %s,
208 208
 					post_title	= %s,
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
     $post_type = get_post_type($post_id);
291 291
 
292
-    $detail_table = $plugin_prefix . $post_type . '_detail';
292
+    $detail_table = $plugin_prefix.$post_type.'_detail';
293 293
 
294 294
     if ($comment_id) {
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
         if (isset($old_rating)) {
299 299
 
300
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
300
+            $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET
301 301
 						overall_rating = %f,
302 302
 						status		= %s,
303 303
 						comment_content = %s 
@@ -339,18 +339,18 @@  discard block
 block discarded – undo
339 339
 
340 340
     $post_type = get_post_type($post_id);
341 341
 
342
-    $detail_table = $plugin_prefix . $post_type . '_detail';
342
+    $detail_table = $plugin_prefix.$post_type.'_detail';
343 343
 
344 344
     if (isset($_REQUEST['geodir_overallrating'])) {
345 345
 
346 346
         $overall_rating = $_REQUEST['geodir_overallrating'];
347 347
 
348
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
348
+        if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
349 349
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
350 350
 
351 351
             if (isset($old_rating)) {
352 352
 
353
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
353
+                $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET
354 354
 						overall_rating = %f,
355 355
 						status		= %s,
356 356
 						comment_content	= %s 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
     $wpdb->query(
390 390
         $wpdb->prepare(
391
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
391
+            "DELETE FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d",
392 392
             array($comment_id)
393 393
         )
394 394
     );
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
  * @return string The comment content.
408 408
  */
409 409
 function geodir_wrap_comment_text($content, $comment = '') {
410
-    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
410
+    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int) $comment->comment_post_ID)) {
411 411
         if (!is_admin()) {
412
-            return '<div class="description">' . $content . '</div>';
412
+            return '<div class="description">'.$content.'</div>';
413 413
         } else {
414 414
             return $content;
415 415
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         if (!empty($comment))
419 419
             $rating = geodir_get_commentoverall($comment->comment_ID);
420 420
         if ($rating != 0 && !is_admin()) {
421
-            return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
421
+            return '<div><div class="gd-rating-text">'.__('Overall Rating', 'geodirectory').': <div class="rating">'.$rating.'</div></div>'.geodir_get_rating_stars($rating, $comment->comment_ID).'</div><div class="description">'.$content.'</div>';
422 422
         } else
423 423
             return $content;
424 424
     }
@@ -442,18 +442,18 @@  discard block
 block discarded – undo
442 442
     if (!$post_type) {
443 443
         $post_type = get_post_type($post_id);
444 444
     }
445
-    $detail_table = $plugin_prefix . $post_type . '_detail';
445
+    $detail_table = $plugin_prefix.$post_type.'_detail';
446 446
     $post_newrating = geodir_get_post_rating($post_id, 1);
447 447
     $post_newrating_count = geodir_get_review_count_total($post_id);
448 448
 
449 449
 
450 450
     //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
451 451
 
452
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
452
+    if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) {
453 453
 
454 454
         $wpdb->query(
455 455
             $wpdb->prepare(
456
-                "UPDATE " . $detail_table . " SET
456
+                "UPDATE ".$detail_table." SET
457 457
 						overall_rating = %f,
458 458
 						rating_count = %f
459 459
 						where post_id = %d",
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      * @package GeoDirectory
473 473
      * @param int $post_id The post ID.
474 474
      */
475
-    do_action('geodir_update_postrating',$post_id);
475
+    do_action('geodir_update_postrating', $post_id);
476 476
 
477 477
 }
478 478
 
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
     global $wpdb, $plugin_prefix;
494 494
 
495 495
     $post_type = get_post_type($post_id);
496
-    $detail_table = $plugin_prefix . $post_type . '_detail';
496
+    $detail_table = $plugin_prefix.$post_type.'_detail';
497 497
 
498
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
498
+    if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) {
499 499
 
500 500
         $post_ratings = $wpdb->get_var(
501 501
             $wpdb->prepare(
502
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
502
+                "SELECT overall_rating FROM ".$detail_table." WHERE post_id = %d",
503 503
                 array($post_id)
504 504
             )
505 505
         );
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 
534 534
     $reatings = $wpdb->get_row(
535 535
         $wpdb->prepare(
536
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
536
+            "SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d",
537 537
             array($comment_id)
538 538
         )
539 539
     );
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 
562 562
     $results = $wpdb->get_var(
563 563
         $wpdb->prepare(
564
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
564
+            "SELECT SUM(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
565 565
             array($post_id)
566 566
         )
567 567
     );
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
     global $wpdb;
589 589
     $results = $wpdb->get_var(
590 590
         $wpdb->prepare(
591
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
591
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d AND status=1 AND overall_rating>0",
592 592
             array($user_id)
593 593
         )
594 594
     );
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 
627 627
     $results = $wpdb->get_var(
628 628
         $wpdb->prepare(
629
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
629
+            "SELECT COALESCE(avg(overall_rating),0) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
630 630
             array($post_id)
631 631
         )
632 632
     );
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 
655 655
     $results = $wpdb->get_var(
656 656
         $wpdb->prepare(
657
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
657
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
658 658
             array($post_id)
659 659
         )
660 660
     );
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
     $results = $wpdb->get_var(
685 685
         $wpdb->prepare(
686
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
686
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
687 687
             array($post_id)
688 688
         )
689 689
     );
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
     $reatings = $wpdb->get_var(
714 714
         $wpdb->prepare(
715
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
715
+            "SELECT overall_rating FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d",
716 716
             array($comment_id)
717 717
         )
718 718
     );
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         
767 767
         $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768 768
         if (!$template) {
769
-            $template = dirname(__FILE__) . '/reviews.php';
769
+            $template = dirname(__FILE__).'/reviews.php';
770 770
         }
771 771
         return $template;
772 772
     }
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
                         printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839 839
                             get_comment_author_link(),
840 840
                             // If current post author is also comment author, make it known visually.
841
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
841
+                            ($comment->user_id === $post->post_author) ? '<span>'.__('Post author', 'geodirectory').'</span>' : ''
842 842
                         );
843 843
                         echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844 844
                         printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
             global $post;
897 897
             $post_types = geodir_get_posttypes();
898 898
 
899
-            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
899
+            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int) $post_id)) {
900 900
                 $review_count = geodir_get_review_count_total($post_id);
901 901
                 return $review_count;
902 902
 
@@ -929,29 +929,29 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_rating_stars($rating, $post_id, $small = false)
931 931
 {
932
-    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
932
+    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int) $post_id)) {
933 933
         return NULL;
934 934
     }
935 935
     $a_rating = $rating / 5 * 100;
936 936
 
937 937
     if ($small) {
938
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
938
+        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: '.$a_rating.'%;"></div><div class="geodir_Star_small"></div></div></div>';
939 939
     } else {
940 940
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
941 941
 			// Show rating stars from review rating manager
942 942
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
943 943
 		} else {
944
-			$rating_img = '<img alt="rating icon" src="' . get_option('geodir_default_rating_star_icon') . '" />';
944
+			$rating_img = '<img alt="rating icon" src="'.get_option('geodir_default_rating_star_icon').'" />';
945 945
 			
946 946
 			/* fix rating star for safari */
947 947
 			$star_width = 23 * 5;
948 948
 			
949 949
 			if ($star_width > 0) {
950
-				$attach_style = 'max-width:' . $star_width . 'px';
950
+				$attach_style = 'max-width:'.$star_width.'px';
951 951
 			} else {
952 952
 				$attach_style = '';
953 953
 			}
954
-			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
954
+			$r_html = '<div class="geodir-rating" style="'.$attach_style.'"><div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingAverage" style="width: '.$a_rating.'%;"></div><div class="geodir_Star">'.$rating_img.$rating_img.$rating_img.$rating_img.$rating_img.'</div></div></div>';
955 955
 		}
956 956
     }
957 957
     return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
@@ -991,10 +991,10 @@  discard block
 block discarded – undo
991 991
 /*
992 992
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
993 993
  */
994
-if(function_exists('dsq_can_replace')) {
994
+if (function_exists('dsq_can_replace')) {
995 995
     remove_filter('comments_template', 'dsq_comments_template');
996 996
     add_filter('comments_template', 'dsq_comments_template', 100);
997
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
997
+    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active', 10, 1);
998 998
 }
999 999
 
1000 1000
 
@@ -1007,11 +1007,11 @@  discard block
 block discarded – undo
1007 1007
  * @param string $disqus_active Hook called before DB call for option so this is empty.
1008 1008
  * @return string `1` if active `0` if disabled.
1009 1009
  */
1010
-function geodir_option_disqus_active($disqus_active){
1010
+function geodir_option_disqus_active($disqus_active) {
1011 1011
     global $post;
1012 1012
     $all_postypes = geodir_get_posttypes();
1013 1013
 
1014
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1014
+    if (isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
1015 1015
         $disqus_active = '0';
1016 1016
     }
1017 1017
 
@@ -1055,17 +1055,17 @@  discard block
 block discarded – undo
1055 1055
  *
1056 1056
  * @since 1.6.21
1057 1057
  */
1058
-function geodir_jetpack_disable_comments(){
1058
+function geodir_jetpack_disable_comments() {
1059 1059
     //only run if jetpack installed
1060
-    if(defined('JETPACK__VERSION')){
1060
+    if (defined('JETPACK__VERSION')) {
1061 1061
         $post_types = geodir_get_posttypes();
1062
-        foreach($post_types as $post_type){
1063
-            add_filter('jetpack_comment_form_enabled_for_' . $post_type, '__return_false');
1062
+        foreach ($post_types as $post_type) {
1063
+            add_filter('jetpack_comment_form_enabled_for_'.$post_type, '__return_false');
1064 1064
         }
1065 1065
     }
1066 1066
 }
1067 1067
 
1068
-add_action('plugins_loaded','geodir_jetpack_disable_comments');
1068
+add_action('plugins_loaded', 'geodir_jetpack_disable_comments');
1069 1069
 
1070 1070
 /**
1071 1071
  * Check whether the current post is open for reviews.
@@ -1076,13 +1076,13 @@  discard block
 block discarded – undo
1076 1076
  * @param int  $post_id The post ID.
1077 1077
  * @return bool True if allowed otherwise False.
1078 1078
  */
1079
-function geodir_check_reviews_open( $open, $post_id ) {
1080
-    if ( $open && $post_id && geodir_is_page( 'detail' ) ) {
1081
-        if ( in_array( get_post_status( $post_id ), array( 'draft', 'pending', 'auto-draft', 'trash' ) ) ) {
1079
+function geodir_check_reviews_open($open, $post_id) {
1080
+    if ($open && $post_id && geodir_is_page('detail')) {
1081
+        if (in_array(get_post_status($post_id), array('draft', 'pending', 'auto-draft', 'trash'))) {
1082 1082
             $open = false;
1083 1083
         }
1084 1084
     }
1085 1085
     
1086 1086
     return $open;
1087 1087
 }
1088
-add_filter( 'comments_open', 'geodir_check_reviews_open', 10, 2 );
1089 1088
\ No newline at end of file
1089
+add_filter('comments_open', 'geodir_check_reviews_open', 10, 2);
1090 1090
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_template_tags.php 3 patches
Braces   +34 added lines, -19 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         </script>
253 253
 
254 254
         <?php
255
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
255
+    } elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
256 256
         echo stripslashes(get_option('geodir_ga_tracking_code'));
257 257
     }
258 258
 }
@@ -291,13 +291,14 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function geodir_add_async_forscript($url)
293 293
 {
294
-    if (strpos($url, '#asyncload')===false)
295
-        return $url;
296
-    else if (is_admin())
297
-        return str_replace('#asyncload', '', $url);
298
-    else
299
-        return str_replace('#asyncload', '', $url)."' async='async";
300
-}
294
+    if (strpos($url, '#asyncload')===false) {
295
+            return $url;
296
+    } else if (is_admin()) {
297
+            return str_replace('#asyncload', '', $url);
298
+    } else {
299
+            return str_replace('#asyncload', '', $url)."' async='async";
300
+    }
301
+    }
301 302
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
302 303
 
303 304
 /**
@@ -364,8 +365,10 @@  discard block
 block discarded – undo
364 365
 
365 366
     $half_pages_to_show = round($pages_to_show / 2);
366 367
 
367
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
368
-        return;
368
+    if (geodir_is_page('home')) {
369
+    	// dont apply default  pagination for geodirectory home page.
370
+        return;
371
+    }
369 372
 
370 373
     if (!is_single()) {
371 374
         if (function_exists('geodir_location_geo_home_link')) {
@@ -485,11 +488,21 @@  discard block
 block discarded – undo
485 488
     }
486 489
     $dist_dif = 1000;
487 490
 
488
-    if ($dist <= 5000) $dist_dif = 500;
489
-    if ($dist <= 1000) $dist_dif = 100;
490
-    if ($dist <= 500) $dist_dif = 50;
491
-    if ($dist <= 100) $dist_dif = 10;
492
-    if ($dist <= 50) $dist_dif = 5;
491
+    if ($dist <= 5000) {
492
+    	$dist_dif = 500;
493
+    }
494
+    if ($dist <= 1000) {
495
+    	$dist_dif = 100;
496
+    }
497
+    if ($dist <= 500) {
498
+    	$dist_dif = 50;
499
+    }
500
+    if ($dist <= 100) {
501
+    	$dist_dif = 10;
502
+    }
503
+    if ($dist <= 50) {
504
+    	$dist_dif = 5;
505
+    }
493 506
 
494 507
     ?>
495 508
     <script type="text/javascript">
@@ -550,12 +563,14 @@  discard block
 block discarded – undo
550 563
  */
551 564
 function geodir_add_sharelocation_scripts() {
552 565
     $default_search_for_text = SEARCH_FOR_TEXT;
553
-    if (get_option('geodir_search_field_default_text'))
554
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
566
+    if (get_option('geodir_search_field_default_text')) {
567
+            $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
568
+    }
555 569
 
556 570
     $default_near_text = NEAR_TEXT;
557
-    if (get_option('geodir_near_field_default_text'))
558
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
571
+    if (get_option('geodir_near_field_default_text')) {
572
+            $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
573
+    }
559 574
     
560 575
     $search_location = geodir_get_default_location();
561 576
     
Please login to merge, or discard this patch.
Indentation   +344 added lines, -344 removed lines patch added patch discarded remove patch
@@ -36,175 +36,175 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function geodir_templates_scripts()
38 38
 {
39
-    $is_detail_page = false;
40
-    $geodir_map_name = geodir_map_name();
39
+	$is_detail_page = false;
40
+	$geodir_map_name = geodir_map_name();
41 41
 
42
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
43
-        $is_detail_page = true;
44
-    }
45
-
46
-    wp_enqueue_script('jquery');
47
-
48
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49
-    wp_enqueue_script('geodirectory-script');
50
-
51
-    $geodir_vars_data = array(
52
-        'siteurl' => get_option('siteurl'),
53
-        'geodir_plugin_url' => geodir_plugin_url(),
54
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
55
-        'geodir_ajax_url' => geodir_get_ajax_url(),
56
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
57
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
58
-    );
59
-
60
-    /**
61
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
62
-     *
63
-     * This is used by addons to add JS translatable variables.
64
-     *
65
-     * @since 1.4.4
66
-     * @param array $geodir_vars_data {
67
-     *    geodir var data used by addons to add JS translatable variables.
68
-     *
69
-     *    @type string $siteurl Site url.
70
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
71
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
72
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
73
-     *    @type int $is_rtl Checks if current locale is RTL.
74
-     *
75
-     * }
76
-     */
77
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
78
-
79
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
80
-
81
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
82
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
83
-
84
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
85
-    wp_enqueue_script('geodirectory-lightbox-jquery');
42
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
43
+		$is_detail_page = true;
44
+	}
86 45
 
87
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
88
-    if ($is_detail_page) {
89
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
90
-    }
46
+	wp_enqueue_script('jquery');
47
+
48
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49
+	wp_enqueue_script('geodirectory-script');
50
+
51
+	$geodir_vars_data = array(
52
+		'siteurl' => get_option('siteurl'),
53
+		'geodir_plugin_url' => geodir_plugin_url(),
54
+		'geodir_lazy_load' => get_option('geodir_lazy_load',1),
55
+		'geodir_ajax_url' => geodir_get_ajax_url(),
56
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
57
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
58
+	);
59
+
60
+	/**
61
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
62
+	 *
63
+	 * This is used by addons to add JS translatable variables.
64
+	 *
65
+	 * @since 1.4.4
66
+	 * @param array $geodir_vars_data {
67
+	 *    geodir var data used by addons to add JS translatable variables.
68
+	 *
69
+	 *    @type string $siteurl Site url.
70
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
71
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
72
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
73
+	 *    @type int $is_rtl Checks if current locale is RTL.
74
+	 *
75
+	 * }
76
+	 */
77
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
78
+
79
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
80
+
81
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
82
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
83
+
84
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
85
+	wp_enqueue_script('geodirectory-lightbox-jquery');
86
+
87
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
88
+	if ($is_detail_page) {
89
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
90
+	}
91 91
 
92
-    if (in_array($geodir_map_name, array('auto', 'google'))) {
93
-        $map_lang = "&language=" . geodir_get_map_default_language();
94
-        $map_key = "&key=" . geodir_get_map_api_key();
95
-        /**
96
-         * Filter the variables that are added to the end of the google maps script call.
97
-         *
98
-         * This i used to change things like google maps language etc.
99
-         *
100
-         * @since 1.0.0
101
-         * @param string $var The string to filter, default is empty string.
102
-         */
103
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
104
-        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
92
+	if (in_array($geodir_map_name, array('auto', 'google'))) {
93
+		$map_lang = "&language=" . geodir_get_map_default_language();
94
+		$map_key = "&key=" . geodir_get_map_api_key();
95
+		/**
96
+		 * Filter the variables that are added to the end of the google maps script call.
97
+		 *
98
+		 * This i used to change things like google maps language etc.
99
+		 *
100
+		 * @since 1.0.0
101
+		 * @param string $var The string to filter, default is empty string.
102
+		 */
103
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
104
+		wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
105 105
         
106
-        // Overlapping Marker Spiderfier
107
-        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
108
-        wp_enqueue_script('geodirectory-g-overlappingmarker-script');
109
-    }
106
+		// Overlapping Marker Spiderfier
107
+		wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
108
+		wp_enqueue_script('geodirectory-g-overlappingmarker-script');
109
+	}
110 110
     
111
-    if ($geodir_map_name == 'osm') {
112
-        // Leaflet OpenStreetMap
113
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
114
-        wp_enqueue_style('geodirectory-leaflet-style');
111
+	if ($geodir_map_name == 'osm') {
112
+		// Leaflet OpenStreetMap
113
+		wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
114
+		wp_enqueue_style('geodirectory-leaflet-style');
115 115
             
116
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
117
-        wp_enqueue_script('geodirectory-leaflet-script');
116
+		wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
117
+		wp_enqueue_script('geodirectory-leaflet-script');
118 118
         
119
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
120
-        wp_enqueue_script('geodirectory-leaflet-geo-script');
119
+		wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
120
+		wp_enqueue_script('geodirectory-leaflet-geo-script');
121 121
         
122
-        if ($is_detail_page) {
123
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
124
-            wp_enqueue_style('geodirectory-leaflet-routing-style');
122
+		if ($is_detail_page) {
123
+			wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
124
+			wp_enqueue_style('geodirectory-leaflet-routing-style');
125 125
                 
126
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
127
-            wp_enqueue_script('geodirectory-leaflet-routing-script');
128
-        }
126
+			wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
127
+			wp_enqueue_script('geodirectory-leaflet-routing-script');
128
+		}
129 129
         
130
-        // Overlapping Marker Spiderfier Leaflet
131
-        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
132
-        wp_enqueue_script('geodirectory-o-overlappingmarker-script');
133
-    }
134
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
130
+		// Overlapping Marker Spiderfier Leaflet
131
+		wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
132
+		wp_enqueue_script('geodirectory-o-overlappingmarker-script');
133
+	}
134
+	wp_enqueue_script( 'jquery-ui-autocomplete' );
135 135
     
136
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
137
-    wp_enqueue_script('geodirectory-goMap-script');
138
-
139
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
140
-    wp_enqueue_script('chosen');
141
-
142
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
143
-    wp_enqueue_script('geodirectory-choose-ajax');
144
-
145
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
146
-
147
-    if (is_page() && geodir_is_page('add-listing')) {
148
-        // SCRIPT FOR UPLOAD
149
-        wp_enqueue_script('plupload-all');
150
-        wp_enqueue_script('jquery-ui-sortable');
151
-
152
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
153
-        wp_enqueue_script('geodirectory-plupload-script');
154
-        // SCRIPT FOR UPLOAD END
155
-
156
-        // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
157
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
158
-            $ajax_url = admin_url('admin-ajax.php');
159
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
160
-            $ajax_url = admin_url('admin-ajax.php');
161
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
162
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
163
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
164
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
165
-        } else {
166
-            $ajax_url = admin_url('admin-ajax.php');
167
-        }
136
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
137
+	wp_enqueue_script('geodirectory-goMap-script');
138
+
139
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
140
+	wp_enqueue_script('chosen');
141
+
142
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
143
+	wp_enqueue_script('geodirectory-choose-ajax');
144
+
145
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
146
+
147
+	if (is_page() && geodir_is_page('add-listing')) {
148
+		// SCRIPT FOR UPLOAD
149
+		wp_enqueue_script('plupload-all');
150
+		wp_enqueue_script('jquery-ui-sortable');
151
+
152
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
153
+		wp_enqueue_script('geodirectory-plupload-script');
154
+		// SCRIPT FOR UPLOAD END
155
+
156
+		// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
157
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
158
+			$ajax_url = admin_url('admin-ajax.php');
159
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
160
+			$ajax_url = admin_url('admin-ajax.php');
161
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
162
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
163
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
164
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
165
+		} else {
166
+			$ajax_url = admin_url('admin-ajax.php');
167
+		}
168 168
 
169
-        // place js config array for plupload
170
-        $plupload_init = array(
171
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
172
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
173
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
174
-            'drop_element' => 'dropbox', // will be adjusted per uploader
175
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
176
-            'multiple_queues' => true,
177
-            'max_file_size' => geodir_max_upload_size(),
178
-            'url' => $ajax_url,
179
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
180
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
181
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
182
-            'multipart' => true,
183
-            'urlstream_upload' => true,
184
-            'multi_selection' => false, // will be added per uploader
185
-            // additional post data to send to our ajax hook
186
-            'multipart_params' => array(
187
-                '_ajax_nonce' => "", // will be added per uploader
188
-                'action' => 'plupload_action', // the ajax action name
189
-                'imgid' => 0 // will be added per uploader
190
-            )
191
-        );
192
-        $base_plupload_config = json_encode($plupload_init);
193
-
194
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
195
-            'upload_img_size' => geodir_max_upload_size());
196
-
197
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
198
-
199
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
200
-    } // End if for add place page
201
-
202
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
-    if ($is_detail_page) {
169
+		// place js config array for plupload
170
+		$plupload_init = array(
171
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
172
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
173
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
174
+			'drop_element' => 'dropbox', // will be adjusted per uploader
175
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
176
+			'multiple_queues' => true,
177
+			'max_file_size' => geodir_max_upload_size(),
178
+			'url' => $ajax_url,
179
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
180
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
181
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
182
+			'multipart' => true,
183
+			'urlstream_upload' => true,
184
+			'multi_selection' => false, // will be added per uploader
185
+			// additional post data to send to our ajax hook
186
+			'multipart_params' => array(
187
+				'_ajax_nonce' => "", // will be added per uploader
188
+				'action' => 'plupload_action', // the ajax action name
189
+				'imgid' => 0 // will be added per uploader
190
+			)
191
+		);
192
+		$base_plupload_config = json_encode($plupload_init);
193
+
194
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
195
+			'upload_img_size' => geodir_max_upload_size());
196
+
197
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
198
+
199
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
200
+	} // End if for add place page
201
+
202
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
+	if ($is_detail_page) {
204 204
 		wp_enqueue_script('geodirectory-post-custom-js');
205 205
 	}
206 206
 
207
-    // font awesome rating script
207
+	// font awesome rating script
208 208
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
209 209
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
210 210
 		wp_enqueue_script('geodir-barrating-js');
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 		wp_enqueue_script('geodir-jRating-js');
214 214
 	}
215 215
 
216
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
217
-    wp_enqueue_script('geodir-on-document-load');
216
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
217
+	wp_enqueue_script('geodir-on-document-load');
218 218
 
219
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
220
-    wp_enqueue_script('google-geometa');
219
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
220
+	wp_enqueue_script('google-geometa');
221 221
 }
222 222
 
223 223
 /**
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function geodir_header_scripts()
233 233
 {
234
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
235
-    echo stripslashes(get_option('geodir_header_scripts'));
234
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
235
+	echo stripslashes(get_option('geodir_header_scripts'));
236 236
 }
237 237
 
238 238
 /**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_google_analytics_tracking_code()
247 247
 {
248
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
248
+	if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
249 249
 
250 250
         <script>
251 251
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
         </script>
261 261
 
262 262
         <?php
263
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
264
-        echo stripslashes(get_option('geodir_ga_tracking_code'));
265
-    }
263
+	}elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
264
+		echo stripslashes(get_option('geodir_ga_tracking_code'));
265
+	}
266 266
 }
267 267
 
268 268
 /**
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
 function geodir_footer_scripts()
277 277
 {
278 278
 
279
-    echo stripslashes(get_option('geodir_footer_scripts'));
279
+	echo stripslashes(get_option('geodir_footer_scripts'));
280 280
 
281
-    /*
281
+	/*
282 282
      * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041
283 283
      *
284 284
      * Flexbox wont wrap on ios for search form items
285 285
      */
286
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
287
-        echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
288
-    }
286
+	if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
287
+		echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
288
+	}
289 289
 }
290 290
 
291 291
 
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
  */
300 300
 function geodir_add_async_forscript($url)
301 301
 {
302
-    if (strpos($url, '#asyncload')===false)
303
-        return $url;
304
-    else if (is_admin())
305
-        return str_replace('#asyncload', '', $url);
306
-    else
307
-        return str_replace('#asyncload', '', $url)."' async='async";
302
+	if (strpos($url, '#asyncload')===false)
303
+		return $url;
304
+	else if (is_admin())
305
+		return str_replace('#asyncload', '', $url);
306
+	else
307
+		return str_replace('#asyncload', '', $url)."' async='async";
308 308
 }
309 309
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
310 310
 
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
 function geodir_templates_styles()
318 318
 {
319 319
 
320
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
321
-    wp_enqueue_style('geodir-core-scss');
322
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
320
+	wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
321
+	wp_enqueue_style('geodir-core-scss');
322
+	wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
323 323
 
324
-    if(is_rtl()){
325
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
326
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
327
-    }
324
+	if(is_rtl()){
325
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
326
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
327
+	}
328 328
 
329
-    wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
330
-    wp_enqueue_style('font-awesome');
329
+	wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
330
+	wp_enqueue_style('font-awesome');
331 331
 
332 332
 
333 333
 }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function geodir_get_sidebar()
343 343
 {
344
-    get_sidebar('geodirectory');
344
+	get_sidebar('geodirectory');
345 345
 }
346 346
 
347 347
 /**
@@ -360,122 +360,122 @@  discard block
 block discarded – undo
360 360
  * @param bool $always_show Do you want to show the pagination always? Default: false.
361 361
  */
362 362
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
363
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
363
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
364 364
 
365
-    if (empty($prelabel)) {
366
-        $prelabel = '<strong>&lt;</strong>';
367
-    }
365
+	if (empty($prelabel)) {
366
+		$prelabel = '<strong>&lt;</strong>';
367
+	}
368 368
 
369
-    if (empty($nxtlabel)) {
370
-        $nxtlabel = '<strong>&gt;</strong>';
371
-    }
369
+	if (empty($nxtlabel)) {
370
+		$nxtlabel = '<strong>&gt;</strong>';
371
+	}
372 372
 
373
-    $half_pages_to_show = round($pages_to_show / 2);
373
+	$half_pages_to_show = round($pages_to_show / 2);
374 374
 
375
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
376
-        return;
375
+	if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
376
+		return;
377 377
 
378
-    if (!is_single()) {
379
-        if (function_exists('geodir_location_geo_home_link')) {
380
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
381
-        }
382
-        $numposts = $wp_query->found_posts;
378
+	if (!is_single()) {
379
+		if (function_exists('geodir_location_geo_home_link')) {
380
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
381
+		}
382
+		$numposts = $wp_query->found_posts;
383 383
 
384
-        $max_page = ceil($numposts / $posts_per_page);
384
+		$max_page = ceil($numposts / $posts_per_page);
385 385
 
386
-        if (empty($paged)) {
387
-            $paged = 1;
388
-        }
386
+		if (empty($paged)) {
387
+			$paged = 1;
388
+		}
389 389
         
390
-        $post_type = geodir_get_current_posttype();
391
-        $listing_type_name = get_post_type_plural_label($post_type);
392
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
393
-            $term = array();
390
+		$post_type = geodir_get_current_posttype();
391
+		$listing_type_name = get_post_type_plural_label($post_type);
392
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
393
+			$term = array();
394 394
             
395
-            if (is_tax()) {
396
-                $term_id = get_queried_object_id();
397
-                $taxonomy = get_query_var('taxonomy');
395
+			if (is_tax()) {
396
+				$term_id = get_queried_object_id();
397
+				$taxonomy = get_query_var('taxonomy');
398 398
 
399
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
400
-                    $term = get_term($term_id, $post_type . 'category');
401
-                }
402
-            }
399
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
400
+					$term = get_term($term_id, $post_type . 'category');
401
+				}
402
+			}
403 403
             
404
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
405
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
404
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
405
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
406 406
                 
407
-                if (!is_array($taxonomy_search)) {
408
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
409
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
410
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
411
-                }
412
-            }
407
+				if (!is_array($taxonomy_search)) {
408
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
409
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
410
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
411
+				}
412
+			}
413 413
             
414
-            if (!empty($term) && !is_wp_error($term)) {
415
-                $listing_type_name = $term->name;
416
-            }
417
-        }
414
+			if (!empty($term) && !is_wp_error($term)) {
415
+				$listing_type_name = $term->name;
416
+			}
417
+		}
418 418
 
419
-        if ($max_page > 1 || $always_show) {            
420
-            // Extra pagination info
421
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
422
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
423
-            $end_no = min($paged * $posts_per_page, $numposts);
419
+		if ($max_page > 1 || $always_show) {            
420
+			// Extra pagination info
421
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
422
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
423
+			$end_no = min($paged * $posts_per_page, $numposts);
424 424
 
425
-            if ($geodir_pagination_more_info != '') {
426
-                if ($listing_type_name) {
427
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
428
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
429
-                } else {
430
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
431
-                }
432
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
433
-                /**
434
-                 * Adds an extra pagination info above/under pagination.
435
-                 *
436
-                 * @since 1.5.9
437
-                 *
438
-                 * @param string $pagination_info Extra pagination info content.
439
-                 * @param string $listing_type_name Listing results type.
440
-                 * @param string $start_no First result number.
441
-                 * @param string $end_no Last result number.
442
-                 * @param string $numposts Total number of listings.
443
-                 * @param string $post_type The post type.
444
-                 */
445
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
425
+			if ($geodir_pagination_more_info != '') {
426
+				if ($listing_type_name) {
427
+					$listing_type_name = __($listing_type_name, 'geodirectory');
428
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
429
+				} else {
430
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
431
+				}
432
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
433
+				/**
434
+				 * Adds an extra pagination info above/under pagination.
435
+				 *
436
+				 * @since 1.5.9
437
+				 *
438
+				 * @param string $pagination_info Extra pagination info content.
439
+				 * @param string $listing_type_name Listing results type.
440
+				 * @param string $start_no First result number.
441
+				 * @param string $end_no Last result number.
442
+				 * @param string $numposts Total number of listings.
443
+				 * @param string $post_type The post type.
444
+				 */
445
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
446 446
                 
447
-                if ($geodir_pagination_more_info == 'before') {
448
-                    $before = $before . $pagination_info;
449
-                } else if ($geodir_pagination_more_info == 'after') {
450
-                    $after = $pagination_info . $after;
451
-                }
452
-            }
447
+				if ($geodir_pagination_more_info == 'before') {
448
+					$before = $before . $pagination_info;
449
+				} else if ($geodir_pagination_more_info == 'after') {
450
+					$after = $pagination_info . $after;
451
+				}
452
+			}
453 453
             
454
-            echo "$before <div class='Navi gd-navi'>";
455
-            if ($paged >= ($pages_to_show - 1)) {
456
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
457
-            }
458
-            previous_posts_link($prelabel);
459
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
460
-                if ($i >= 1 && $i <= $max_page) {
461
-                    if ($i == $paged) {
462
-                        echo "<strong class='on'>$i</strong>";
463
-                    } else {
464
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
465
-                    }
466
-                }
467
-            }
468
-            next_posts_link($nxtlabel, $max_page);
469
-            if (($paged + $half_pages_to_show) < ($max_page)) {
470
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
471
-            }
472
-            echo "</div> $after";
473
-        }
454
+			echo "$before <div class='Navi gd-navi'>";
455
+			if ($paged >= ($pages_to_show - 1)) {
456
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
457
+			}
458
+			previous_posts_link($prelabel);
459
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
460
+				if ($i >= 1 && $i <= $max_page) {
461
+					if ($i == $paged) {
462
+						echo "<strong class='on'>$i</strong>";
463
+					} else {
464
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
465
+					}
466
+				}
467
+			}
468
+			next_posts_link($nxtlabel, $max_page);
469
+			if (($paged + $half_pages_to_show) < ($max_page)) {
470
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
471
+			}
472
+			echo "</div> $after";
473
+		}
474 474
         
475
-        if (function_exists('geodir_location_geo_home_link')) {
476
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
477
-        }
478
-    }
475
+		if (function_exists('geodir_location_geo_home_link')) {
476
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
477
+		}
478
+	}
479 479
 }
480 480
 
481 481
 /**
@@ -486,20 +486,20 @@  discard block
 block discarded – undo
486 486
  */
487 487
 function geodir_listingsearch_scripts()
488 488
 {
489
-    if (get_option('gd_search_dist') != '') {
490
-        $dist = get_option('gd_search_dist');
491
-    } else {
492
-        $dist = 500;
493
-    }
494
-    $dist_dif = 1000;
495
-
496
-    if ($dist <= 5000) $dist_dif = 500;
497
-    if ($dist <= 1000) $dist_dif = 100;
498
-    if ($dist <= 500) $dist_dif = 50;
499
-    if ($dist <= 100) $dist_dif = 10;
500
-    if ($dist <= 50) $dist_dif = 5;
501
-
502
-    ?>
489
+	if (get_option('gd_search_dist') != '') {
490
+		$dist = get_option('gd_search_dist');
491
+	} else {
492
+		$dist = 500;
493
+	}
494
+	$dist_dif = 1000;
495
+
496
+	if ($dist <= 5000) $dist_dif = 500;
497
+	if ($dist <= 1000) $dist_dif = 100;
498
+	if ($dist <= 500) $dist_dif = 50;
499
+	if ($dist <= 100) $dist_dif = 10;
500
+	if ($dist <= 50) $dist_dif = 5;
501
+
502
+	?>
503 503
     <script type="text/javascript">
504 504
 
505 505
         jQuery(function ($) {
@@ -557,20 +557,20 @@  discard block
 block discarded – undo
557 557
  * @package GeoDirectory
558 558
  */
559 559
 function geodir_add_sharelocation_scripts() {
560
-    $default_search_for_text = SEARCH_FOR_TEXT;
561
-    if (get_option('geodir_search_field_default_text'))
562
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
560
+	$default_search_for_text = SEARCH_FOR_TEXT;
561
+	if (get_option('geodir_search_field_default_text'))
562
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
563 563
 
564
-    $default_near_text = NEAR_TEXT;
565
-    if (get_option('geodir_near_field_default_text'))
566
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
564
+	$default_near_text = NEAR_TEXT;
565
+	if (get_option('geodir_near_field_default_text'))
566
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
567 567
     
568
-    $search_location = geodir_get_default_location();
568
+	$search_location = geodir_get_default_location();
569 569
     
570
-    $default_search_for_text = addslashes(stripslashes($default_search_for_text));
571
-    $default_near_text = addslashes(stripslashes($default_near_text));
572
-    $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
573
-    ?>
570
+	$default_search_for_text = addslashes(stripslashes($default_search_for_text));
571
+	$default_near_text = addslashes(stripslashes($default_near_text));
572
+	$city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
573
+	?>
574 574
     <script type="text/javascript">
575 575
         var default_location = '<?php echo $city ;?>';
576 576
         var latlng;
@@ -651,14 +651,14 @@  discard block
 block discarded – undo
651 651
                     initialise2();
652 652
                 } else {
653 653
                     <?php
654
-                    $near_add = get_option('geodir_search_near_addition');
655
-                    /**
656
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
657
-                     *
658
-                     * @since 1.0.0
659
-                     */
660
-                    $near_add2 = apply_filters('geodir_search_near_addition', '');
661
-                    ?>
654
+					$near_add = get_option('geodir_search_near_addition');
655
+					/**
656
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
657
+					 *
658
+					 * @since 1.0.0
659
+					 */
660
+					$near_add2 = apply_filters('geodir_search_near_addition', '');
661
+					?>
662 662
                     if (window.gdMaps === 'google') {
663 663
                         Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
664 664
                             function (results, status) {
@@ -772,32 +772,32 @@  discard block
 block discarded – undo
772 772
  */
773 773
 function geodir_show_badges_on_image($which, $post, $link)
774 774
 {
775
-    $return = '';
776
-    switch ($which) {
777
-        case 'featured':
778
-            /**
779
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
780
-             *
781
-             * @since 1.0.0
782
-             * @param object $post The post object.
783
-             * @param string $link The link to the post.
784
-             */
785
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
786
-            break;
787
-        case 'new' :
788
-            /**
789
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
790
-             *
791
-             * @since 1.0.0
792
-             * @param object $post The post object.
793
-             * @param string $link The link to the post.
794
-             */
795
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
796
-            break;
797
-
798
-    }
775
+	$return = '';
776
+	switch ($which) {
777
+		case 'featured':
778
+			/**
779
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
780
+			 *
781
+			 * @since 1.0.0
782
+			 * @param object $post The post object.
783
+			 * @param string $link The link to the post.
784
+			 */
785
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
786
+			break;
787
+		case 'new' :
788
+			/**
789
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
790
+			 *
791
+			 * @since 1.0.0
792
+			 * @param object $post The post object.
793
+			 * @param string $link The link to the post.
794
+			 */
795
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
796
+			break;
797
+
798
+	}
799 799
     
800
-    return $return;
800
+	return $return;
801 801
 }
802 802
 
803 803
 /**
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
  * @since 1.6.22
807 807
  */
808 808
 function geodir_fix_script_conflict() {
809
-    if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
810
-        wp_dequeue_script( 'flexslider' );
811
-    }
809
+	if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
810
+		wp_dequeue_script( 'flexslider' );
811
+	}
812 812
 }
813 813
 add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 );
814 814
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
     $is_detail_page = false;
40 40
     $geodir_map_name = geodir_map_name();
41 41
 
42
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
43 43
         $is_detail_page = true;
44 44
     }
45 45
 
46 46
     wp_enqueue_script('jquery');
47 47
 
48
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
+    wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49 49
     wp_enqueue_script('geodirectory-script');
50 50
 
51 51
     $geodir_vars_data = array(
52 52
         'siteurl' => get_option('siteurl'),
53 53
         'geodir_plugin_url' => geodir_plugin_url(),
54
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
+        'geodir_lazy_load' => get_option('geodir_lazy_load', 1),
55 55
         'geodir_ajax_url' => geodir_get_ajax_url(),
56
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
57 57
         'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
58 58
     );
59 59
 
@@ -74,24 +74,24 @@  discard block
 block discarded – undo
74 74
      *
75 75
      * }
76 76
      */
77
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
78 78
 
79 79
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
80 80
 
81
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
82
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
81
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
82
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
83 83
 
84
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
85 85
     wp_enqueue_script('geodirectory-lightbox-jquery');
86 86
 
87
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
88 88
     if ($is_detail_page) {
89 89
         wp_enqueue_script('geodirectory-jquery-simplemodal');
90 90
     }
91 91
 
92 92
     if (in_array($geodir_map_name, array('auto', 'google'))) {
93
-        $map_lang = "&language=" . geodir_get_map_default_language();
94
-        $map_key = "&key=" . geodir_get_map_api_key();
93
+        $map_lang = "&language=".geodir_get_map_default_language();
94
+        $map_key = "&key=".geodir_get_map_api_key();
95 95
         /**
96 96
          * Filter the variables that are added to the end of the google maps script call.
97 97
          *
@@ -101,55 +101,55 @@  discard block
 block discarded – undo
101 101
          * @param string $var The string to filter, default is empty string.
102 102
          */
103 103
         $map_extra = apply_filters('geodir_googlemap_script_extra', '');
104
-        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
104
+        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
105 105
         
106 106
         // Overlapping Marker Spiderfier
107
-        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
107
+        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
108 108
         wp_enqueue_script('geodirectory-g-overlappingmarker-script');
109 109
     }
110 110
     
111 111
     if ($geodir_map_name == 'osm') {
112 112
         // Leaflet OpenStreetMap
113
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
113
+        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
114 114
         wp_enqueue_style('geodirectory-leaflet-style');
115 115
             
116
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
116
+        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
117 117
         wp_enqueue_script('geodirectory-leaflet-script');
118 118
         
119
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
119
+        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
120 120
         wp_enqueue_script('geodirectory-leaflet-geo-script');
121 121
         
122 122
         if ($is_detail_page) {
123
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
123
+            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
124 124
             wp_enqueue_style('geodirectory-leaflet-routing-style');
125 125
                 
126
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
126
+            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
127 127
             wp_enqueue_script('geodirectory-leaflet-routing-script');
128 128
         }
129 129
         
130 130
         // Overlapping Marker Spiderfier Leaflet
131
-        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
131
+        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
132 132
         wp_enqueue_script('geodirectory-o-overlappingmarker-script');
133 133
     }
134
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
134
+    wp_enqueue_script('jquery-ui-autocomplete');
135 135
     
136
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
136
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
137 137
     wp_enqueue_script('geodirectory-goMap-script');
138 138
 
139
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
139
+    wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
140 140
     wp_enqueue_script('chosen');
141 141
 
142
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
142
+    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
143 143
     wp_enqueue_script('geodirectory-choose-ajax');
144 144
 
145
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
145
+    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
146 146
 
147 147
     if (is_page() && geodir_is_page('add-listing')) {
148 148
         // SCRIPT FOR UPLOAD
149 149
         wp_enqueue_script('plupload-all');
150 150
         wp_enqueue_script('jquery-ui-sortable');
151 151
 
152
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
152
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
153 153
         wp_enqueue_script('geodirectory-plupload-script');
154 154
         // SCRIPT FOR UPLOAD END
155 155
 
@@ -196,27 +196,27 @@  discard block
 block discarded – undo
196 196
 
197 197
         wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
198 198
 
199
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
199
+        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload');
200 200
     } // End if for add place page
201 201
 
202
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
202
+    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203 203
     if ($is_detail_page) {
204 204
 		wp_enqueue_script('geodirectory-post-custom-js');
205 205
 	}
206 206
 
207 207
     // font awesome rating script
208 208
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
209
-		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
209
+		wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
210 210
 		wp_enqueue_script('geodir-barrating-js');
211 211
 	} else { // default rating script
212
-		wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
212
+		wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
213 213
 		wp_enqueue_script('geodir-jRating-js');
214 214
 	}
215 215
 
216
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
216
+    wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
217 217
     wp_enqueue_script('geodir-on-document-load');
218 218
 
219
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
219
+    wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
220 220
     wp_enqueue_script('google-geometa');
221 221
 }
222 222
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function geodir_header_scripts()
233 233
 {
234
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
234
+    echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>';
235 235
     echo stripslashes(get_option('geodir_header_scripts'));
236 236
 }
237 237
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_google_analytics_tracking_code()
247 247
 {
248
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
248
+    if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?>
249 249
 
250 250
         <script>
251 251
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
                 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
254 254
             })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
255 255
 
256
-            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto');
257
-            <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?>
256
+            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto');
257
+            <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?>
258 258
             ga('send', 'pageview');
259 259
 
260 260
         </script>
261 261
 
262 262
         <?php
263
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
263
+    }elseif (get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) {
264 264
         echo stripslashes(get_option('geodir_ga_tracking_code'));
265 265
     }
266 266
 }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      *
284 284
      * Flexbox wont wrap on ios for search form items
285 285
      */
286
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
286
+    if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) {
287 287
         echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
288 288
     }
289 289
 }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
  */
300 300
 function geodir_add_async_forscript($url)
301 301
 {
302
-    if (strpos($url, '#asyncload')===false)
302
+    if (strpos($url, '#asyncload') === false)
303 303
         return $url;
304 304
     else if (is_admin())
305 305
         return str_replace('#asyncload', '', $url);
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 function geodir_templates_styles()
318 318
 {
319 319
 
320
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
320
+    wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
321 321
     wp_enqueue_style('geodir-core-scss');
322
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
322
+    wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
323 323
 
324
-    if(is_rtl()){
325
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
324
+    if (is_rtl()) {
325
+    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
326 326
     wp_enqueue_style('geodirectory-frontend-rtl-style');
327 327
     }
328 328
 
@@ -396,18 +396,18 @@  discard block
 block discarded – undo
396 396
                 $term_id = get_queried_object_id();
397 397
                 $taxonomy = get_query_var('taxonomy');
398 398
 
399
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
400
-                    $term = get_term($term_id, $post_type . 'category');
399
+                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') {
400
+                    $term = get_term($term_id, $post_type.'category');
401 401
                 }
402 402
             }
403 403
             
404
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
405
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
404
+            if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) {
405
+                $taxonomy_search = $_REQUEST['s'.$post_type.'category'];
406 406
                 
407 407
                 if (!is_array($taxonomy_search)) {
408
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
409
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
410
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
408
+                    $term = get_term((int) $taxonomy_search, $post_type.'category');
409
+                } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
410
+                    $term = get_term((int) $taxonomy_search[0], $post_type.'category');
411 411
                 }
412 412
             }
413 413
             
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         if ($max_page > 1 || $always_show) {            
420 420
             // Extra pagination info
421 421
             $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
422
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
422
+            $start_no = ($paged - 1) * $posts_per_page + 1;
423 423
             $end_no = min($paged * $posts_per_page, $numposts);
424 424
 
425 425
             if ($geodir_pagination_more_info != '') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
                 } else {
430 430
                     $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
431 431
                 }
432
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
432
+                $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>';
433 433
                 /**
434 434
                  * Adds an extra pagination info above/under pagination.
435 435
                  *
@@ -445,15 +445,15 @@  discard block
 block discarded – undo
445 445
                 $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
446 446
                 
447 447
                 if ($geodir_pagination_more_info == 'before') {
448
-                    $before = $before . $pagination_info;
448
+                    $before = $before.$pagination_info;
449 449
                 } else if ($geodir_pagination_more_info == 'after') {
450
-                    $after = $pagination_info . $after;
450
+                    $after = $pagination_info.$after;
451 451
                 }
452 452
             }
453 453
             
454 454
             echo "$before <div class='Navi gd-navi'>";
455 455
             if ($paged >= ($pages_to_show - 1)) {
456
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
456
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link()).'">&laquo;</a>';
457 457
             }
458 458
             previous_posts_link($prelabel);
459 459
             for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
@@ -461,13 +461,13 @@  discard block
 block discarded – undo
461 461
                     if ($i == $paged) {
462 462
                         echo "<strong class='on'>$i</strong>";
463 463
                     } else {
464
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
464
+                        echo ' <a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($i)).'">'.$i.'</a> ';
465 465
                     }
466 466
                 }
467 467
             }
468 468
             next_posts_link($nxtlabel, $max_page);
469 469
             if (($paged + $half_pages_to_show) < ($max_page)) {
470
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
470
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)).'">&raquo;</a>';
471 471
             }
472 472
             echo "</div> $after";
473 473
         }
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
         jQuery(function ($) {
506 506
             $("#distance_slider").slider({
507 507
                 range: true,
508
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
508
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
509 509
                 min: 0,
510 510
                 max: <?php echo $dist; ?>,
511 511
                 step: <?php echo $dist_dif; ?>,
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
     $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
573 573
     ?>
574 574
     <script type="text/javascript">
575
-        var default_location = '<?php echo $city ;?>';
575
+        var default_location = '<?php echo $city; ?>';
576 576
         var latlng;
577 577
         var address;
578 578
         var dist = 0;
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 				var $form = jQuery(this).closest('form');
589 589
 
590 590
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
591
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
591
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
592 592
 				
593 593
 				// Disable location based search for disabled location post type.
594 594
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 					}
603 603
 				}
604 604
 				
605
-				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
605
+				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
606 606
 					geodir_setsearch($form);
607 607
 				} else {
608 608
 					jQuery(".snear", $form).val('');
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
         });
621 621
         
622 622
 		function geodir_setsearch($form) {
623
-			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
623
+			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
624 624
 			geocodeAddress($form);
625 625
 		}
626 626
 
@@ -639,15 +639,15 @@  discard block
 block discarded – undo
639 639
             // Call the geocode function
640 640
             Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
641 641
 
642
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
643
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
642
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
643
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
644 644
                     jQuery(".snear", $form).val('');
645 645
                 }
646 646
                 jQuery($form).submit();
647 647
             } else {
648 648
                 var address = jQuery(".snear", $form).val();
649 649
 
650
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
650
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
651 651
                     initialise2();
652 652
                 } else {
653 653
                     <?php
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
                     $near_add2 = apply_filters('geodir_search_near_addition', '');
661 661
                     ?>
662 662
                     if (window.gdMaps === 'google') {
663
-                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
663
+                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>},
664 664
                             function (results, status) {
665 665
                                 if (status == google.maps.GeocoderStatus.OK) {
666 666
                                     updateSearchPosition(results[0].geometry.location, $form);
667 667
                                 } else {
668
-                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status);
668
+                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status);
669 669
                                 }
670 670
                             });
671 671
                     } else if (window.gdMaps === 'osm') {
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                                 if (typeof geo !== 'undefined' && geo.lat && geo.lon) {
675 675
                                     updateSearchPosition(geo, $form);
676 676
                                 } else {
677
-                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>");
677
+                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>");
678 678
                                 }
679 679
                             });
680 680
                     } else {
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
             var msg;
721 721
             switch (err.code) {
722 722
                 case err.UNKNOWN_ERROR:
723
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
723
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
724 724
                     break;
725 725
                 case err.PERMISSION_DENINED:
726
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
726
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
727 727
                     break;
728 728
                 case err.POSITION_UNAVAILABLE:
729
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
729
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
730 730
                     break;
731 731
                 case err.BREAK:
732
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
732
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
733 733
                     break;
734 734
                 default:
735
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
735
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
736 736
             }
737 737
             jQuery('#info').html(msg);
738 738
         }
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
              * @param object $post The post object.
783 783
              * @param string $link The link to the post.
784 784
              */
785
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
785
+            $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
786 786
             break;
787 787
         case 'new' :
788 788
             /**
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
              * @param object $post The post object.
793 793
              * @param string $link The link to the post.
794 794
              */
795
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
795
+            $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
796 796
             break;
797 797
 
798 798
     }
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
  * @since 1.6.22
807 807
  */
808 808
 function geodir_fix_script_conflict() {
809
-    if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
810
-        wp_dequeue_script( 'flexslider' );
809
+    if (wp_script_is('flexslider', 'enqueued') && wp_script_is('geodirectory-jquery-flexslider-js', 'enqueued')) {
810
+        wp_dequeue_script('flexslider');
811 811
     }
812 812
 }
813
-add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 );
814 813
\ No newline at end of file
814
+add_action('wp_enqueue_scripts', 'geodir_fix_script_conflict', 100);
815 815
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/location_functions.php 4 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @since 1.0.0
38 38
  * @package GeoDirectory
39
- * @return object
39
+ * @return string
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
  * @package GeoDirectory
277 277
  * @param int $min The minimum number. Default: 0.
278 278
  * @param int $max The maximum number. Default: 1.
279
- * @return float
279
+ * @return integer
280 280
  */
281 281
 function geodir_random_float($min = 0, $max = 1)
282 282
 {
@@ -594,6 +594,9 @@  discard block
 block discarded – undo
594 594
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
595 595
 
596 596
 
597
+/**
598
+ * @param string $sep
599
+ */
597 600
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
598 601
 
599 602
     global $wp;
Please login to merge, or discard this patch.
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -61,11 +61,12 @@  discard block
 block discarded – undo
61 61
 function geodir_is_default_location_set()
62 62
 {
63 63
     $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
68
-}
64
+    if (!empty($default_location)) {
65
+            return true;
66
+    } else {
67
+            return false;
68
+    }
69
+    }
69 70
 
70 71
 /**
71 72
  * Returns location slug using location string.
@@ -259,8 +260,9 @@  discard block
 block discarded – undo
259 260
         }
260 261
         */
261 262
 
262
-        if ($geodir_location->is_default)
263
-            update_option('geodir_default_location', $geodir_location);
263
+        if ($geodir_location->is_default) {
264
+                    update_option('geodir_default_location', $geodir_location);
265
+        }
264 266
 
265 267
         return $geodir_location->location_id;
266 268
 
@@ -308,9 +310,10 @@  discard block
 block discarded – undo
308 310
     $status = $data->status;
309 311
     if ($status == "OK") {
310 312
         return $data->results[0]->address_components;
311
-    } else
312
-        return false;
313
-}
313
+    } else {
314
+            return false;
315
+    }
316
+    }
314 317
 
315 318
 /**
316 319
  * Returns current location terms.
@@ -334,16 +337,19 @@  discard block
 block discarded – undo
334 337
         }
335 338
 
336 339
         $country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
340
+        if ($country != '' && $country) {
341
+                    $location_array['gd_country'] = urldecode($country);
342
+        }
339 343
 
340 344
         $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
345
+        if ($region != '' && $region) {
346
+                    $location_array['gd_region'] = urldecode($region);
347
+        }
343 348
 
344 349
         $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
345
-        if ($city != '' && $city)
346
-            $location_array['gd_city'] = urldecode($city);
350
+        if ($city != '' && $city) {
351
+                    $location_array['gd_city'] = urldecode($city);
352
+        }
347 353
     } else {
348 354
         if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349 355
             return $location_array;
@@ -355,14 +361,17 @@  discard block
 block discarded – undo
355 361
 
356 362
         $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357 363
 
358
-        if ($country != '')
359
-            $location_array['gd_country'] = urldecode($country);
364
+        if ($country != '') {
365
+                    $location_array['gd_country'] = urldecode($country);
366
+        }
360 367
 
361
-        if ($region != '')
362
-            $location_array['gd_region'] = urldecode($region);
368
+        if ($region != '') {
369
+                    $location_array['gd_region'] = urldecode($region);
370
+        }
363 371
 
364
-        if ($city != '')
365
-            $location_array['gd_city'] = urldecode($city);
372
+        if ($city != '') {
373
+                    $location_array['gd_city'] = urldecode($city);
374
+        }
366 375
 			
367 376
 		// Fix category link in ajax popular category widget on change post type
368 377
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
Please login to merge, or discard this patch.
Indentation   +408 added lines, -408 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function geodir_get_current_city_lat()
11 11
 {
12
-    $location = geodir_get_default_location();
13
-    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
12
+	$location = geodir_get_default_location();
13
+	$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
14 14
 
15
-    return $lat;
15
+	return $lat;
16 16
 }
17 17
 
18 18
 /**
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function geodir_get_current_city_lng()
27 27
 {
28
-    $location = geodir_get_default_location();
29
-    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
-    return $lng;
28
+	$location = geodir_get_default_location();
29
+	$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
+	return $lng;
31 31
 }
32 32
 
33 33
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
43
-    /**
44
-     * Filter the default location.
45
-     *
46
-     * @since 1.0.0
47
-     * @package GeoDirectory
48
-     *
49
-     * @param string $location_result The default location object.
50
-     */
51
-    return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
43
+	/**
44
+	 * Filter the default location.
45
+	 *
46
+	 * @since 1.0.0
47
+	 * @package GeoDirectory
48
+	 *
49
+	 * @param string $location_result The default location object.
50
+	 */
51
+	return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
52 52
 }
53 53
 
54 54
 /**
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function geodir_is_default_location_set()
62 62
 {
63
-    $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
63
+	$default_location = geodir_get_default_location();
64
+	if (!empty($default_location))
65
+		return true;
66
+	else
67
+		return false;
68 68
 }
69 69
 
70 70
 /**
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 function create_location_slug($location_string)
79 79
 {
80 80
 
81
-    /**
82
-     * Filter the location slug.
83
-     *
84
-     * @since 1.0.0
85
-     * @package GeoDirectory
86
-     *
87
-     * @param string $location_string Sanitized location string.
88
-     */
89
-    return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
81
+	/**
82
+	 * Filter the location slug.
83
+	 *
84
+	 * @since 1.0.0
85
+	 * @package GeoDirectory
86
+	 *
87
+	 * @param string $location_string Sanitized location string.
88
+	 */
89
+	return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
90 90
 
91 91
 }
92 92
 
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_location($id = '')
102 102
 {
103
-    /**
104
-     * Filter the location information.
105
-     *
106
-     * @since 1.0.0
107
-     * @package GeoDirectory
108
-     *
109
-     * @param string $id The location ID.
110
-     */
111
-    return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
103
+	/**
104
+	 * Filter the location information.
105
+	 *
106
+	 * @since 1.0.0
107
+	 * @package GeoDirectory
108
+	 *
109
+	 * @param string $id The location ID.
110
+	 */
111
+	return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
112 112
 }
113 113
 
114 114
 /**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function geodir_get_country_dl($post_country = '', $prefix = '')
124 124
 {
125
-    global $wpdb;
125
+	global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+	$rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
128 128
     
129
-    $ISO2 = array();
130
-    $countries = array();
129
+	$ISO2 = array();
130
+	$countries = array();
131 131
     
132
-    foreach ($rows as $row) {
133
-        $ISO2[$row->Country] = $row->ISO2;
134
-        $countries[$row->Country] = __($row->Country, 'geodirectory');
135
-    }
132
+	foreach ($rows as $row) {
133
+		$ISO2[$row->Country] = $row->ISO2;
134
+		$countries[$row->Country] = __($row->Country, 'geodirectory');
135
+	}
136 136
     
137
-    asort($countries);
137
+	asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
-    foreach ($countries as $country => $name) {
141
-        $ccode = $ISO2[$country];
139
+	$out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
+	foreach ($countries as $country => $name) {
141
+		$ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
-    }
143
+		$out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
+	}
145 145
 
146
-    echo $out_put;
146
+	echo $out_put;
147 147
 }
148 148
 
149 149
 
@@ -158,40 +158,40 @@  discard block
 block discarded – undo
158 158
 function geodir_location_form_submit()
159 159
 {
160 160
 
161
-    global $wpdb, $plugin_prefix;
162
-    if (isset($_REQUEST['add_location'])) {
161
+	global $wpdb, $plugin_prefix;
162
+	if (isset($_REQUEST['add_location'])) {
163 163
 
164
-        $location_info = array(
165
-            'city' => $_REQUEST['city'],
166
-            'region' => $_REQUEST['region'],
167
-            'country' => $_REQUEST['country'],
168
-            'geo_lat' => $_REQUEST['latitude'],
169
-            'geo_lng' => $_REQUEST['longitude'],
170
-            'is_default' => $_REQUEST['is_default'],
171
-            'update_city' => $_REQUEST['update_city']
172
-        );
164
+		$location_info = array(
165
+			'city' => $_REQUEST['city'],
166
+			'region' => $_REQUEST['region'],
167
+			'country' => $_REQUEST['country'],
168
+			'geo_lat' => $_REQUEST['latitude'],
169
+			'geo_lng' => $_REQUEST['longitude'],
170
+			'is_default' => $_REQUEST['is_default'],
171
+			'update_city' => $_REQUEST['update_city']
172
+		);
173 173
 
174
-        $old_location = geodir_get_default_location();
174
+		$old_location = geodir_get_default_location();
175 175
 
176
-        $locationid = geodir_add_new_location($location_info);
176
+		$locationid = geodir_add_new_location($location_info);
177 177
 
178
-        $default_location = geodir_get_location($locationid);
178
+		$default_location = geodir_get_location($locationid);
179 179
 
180
-        //UPDATE AND DELETE LISTING
181
-        $posttype = geodir_get_posttypes();
182
-        if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
180
+		//UPDATE AND DELETE LISTING
181
+		$posttype = geodir_get_posttypes();
182
+		if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184
-            foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
184
+			foreach ($posttype as $posttypeobj) {
185
+				$post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
186 186
 
187
-                $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
-                    array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
-                );
191
-                $wpdb->query($sql);
192
-            }
193
-        }
194
-    }
187
+				$sql = $wpdb->prepare(
188
+					"UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
+					array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
+				);
191
+				$wpdb->query($sql);
192
+			}
193
+		}
194
+	}
195 195
 }
196 196
 
197 197
 /**
@@ -215,37 +215,37 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_add_new_location($location_info = array())
217 217
 {
218
-    global $wpdb;
219
-
220
-    if (!empty($location_info)) {
221
-        $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
-        $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
-        $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
-        $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
-        $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
-        $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
-        $country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
-        $region_slug = create_location_slug($location_region);
229
-        $city_slug = create_location_slug($location_city);
218
+	global $wpdb;
219
+
220
+	if (!empty($location_info)) {
221
+		$location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
+		$location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
+		$location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
+		$location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
+		$location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
+		$is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
+		$country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
+		$region_slug = create_location_slug($location_region);
229
+		$city_slug = create_location_slug($location_city);
230 230
         
231
-        /**
232
-         * Filter add new location data.
233
-         *
234
-         * @since 1.0.0
235
-         */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
-            'country' => $location_country,
238
-            'region' => $location_region,
239
-            'city' => $location_city,
240
-            'country_slug' => $country_slug,
241
-            'region_slug' => $region_slug,
242
-            'city_slug' => $city_slug,
243
-            'city_latitude' => $location_lat,
244
-            'city_longitude' => $location_lng,
245
-            'is_default' => $is_default
246
-        ));
247
-
248
-        /* // Not allowed to create country in DB : 2016-12-09
231
+		/**
232
+		 * Filter add new location data.
233
+		 *
234
+		 * @since 1.0.0
235
+		 */
236
+		$geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
+			'country' => $location_country,
238
+			'region' => $location_region,
239
+			'city' => $location_city,
240
+			'country_slug' => $country_slug,
241
+			'region_slug' => $region_slug,
242
+			'city_slug' => $city_slug,
243
+			'city_latitude' => $location_lat,
244
+			'city_longitude' => $location_lng,
245
+			'is_default' => $is_default
246
+		));
247
+
248
+		/* // Not allowed to create country in DB : 2016-12-09
249 249
         if ($geodir_location->country) {
250 250
 
251 251
             $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
         }
260 260
         */
261 261
 
262
-        if ($geodir_location->is_default)
263
-            update_option('geodir_default_location', $geodir_location);
262
+		if ($geodir_location->is_default)
263
+			update_option('geodir_default_location', $geodir_location);
264 264
 
265
-        return $geodir_location->location_id;
265
+		return $geodir_location->location_id;
266 266
 
267
-    } else {
268
-        return false;
269
-    }
267
+	} else {
268
+		return false;
269
+	}
270 270
 }
271 271
 
272 272
 /**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
  */
281 281
 function geodir_random_float($min = 0, $max = 1)
282 282
 {
283
-    return $min + mt_rand() / mt_getrandmax() * ($max - $min);
283
+	return $min + mt_rand() / mt_getrandmax() * ($max - $min);
284 284
 }
285 285
 
286 286
 /**
@@ -294,22 +294,22 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
-
299
-    $ch = curl_init();
300
-    curl_setopt($ch, CURLOPT_URL, $url);
301
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
-    $response = curl_exec($ch);
306
-    curl_close($ch);
307
-    $data = json_decode($response);
308
-    $status = $data->status;
309
-    if ($status == "OK") {
310
-        return $data->results[0]->address_components;
311
-    } else
312
-        return false;
297
+	$url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
+
299
+	$ch = curl_init();
300
+	curl_setopt($ch, CURLOPT_URL, $url);
301
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
+	$response = curl_exec($ch);
306
+	curl_close($ch);
307
+	$data = json_decode($response);
308
+	$status = $data->status;
309
+	if ($status == "OK") {
310
+		return $data->results[0]->address_components;
311
+	} else
312
+		return false;
313 313
 }
314 314
 
315 315
 /**
@@ -326,71 +326,71 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '')
328 328
 {
329
-    global $wp, $gd_session;
330
-    $location_array = array();
331
-    if ($location_array_from == 'session') {
332
-        if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
-            return $location_array;
334
-        }
329
+	global $wp, $gd_session;
330
+	$location_array = array();
331
+	if ($location_array_from == 'session') {
332
+		if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
+			return $location_array;
334
+		}
335 335
 
336
-        $country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
336
+		$country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
+		if ($country != '' && $country)
338
+			$location_array['gd_country'] = urldecode($country);
339 339
 
340
-        $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
340
+		$region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
+		if ($region != '' && $region)
342
+			$location_array['gd_region'] = urldecode($region);
343 343
 
344
-        $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
345
-        if ($city != '' && $city)
346
-            $location_array['gd_city'] = urldecode($city);
347
-    } else {
348
-        if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
-            return $location_array;
350
-        }
344
+		$city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
345
+		if ($city != '' && $city)
346
+			$location_array['gd_city'] = urldecode($city);
347
+	} else {
348
+		if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
+			return $location_array;
350
+		}
351 351
 
352
-        $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
352
+		$country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
353 353
 
354
-        $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
354
+		$region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
355 355
 
356
-        $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
356
+		$city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357 357
 
358
-        if ($country != '')
359
-            $location_array['gd_country'] = urldecode($country);
358
+		if ($country != '')
359
+			$location_array['gd_country'] = urldecode($country);
360 360
 
361
-        if ($region != '')
362
-            $location_array['gd_region'] = urldecode($region);
361
+		if ($region != '')
362
+			$location_array['gd_region'] = urldecode($region);
363 363
 
364
-        if ($city != '')
365
-            $location_array['gd_city'] = urldecode($city);
364
+		if ($city != '')
365
+			$location_array['gd_city'] = urldecode($city);
366 366
 			
367 367
 		// Fix category link in ajax popular category widget on change post type
368 368
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
369 369
 			$location_array = geodir_get_current_location_terms('session');
370 370
 		}
371
-    }
371
+	}
372 372
 
373 373
 
374 374
 	/**
375 375
 	 * Filter the location terms.
376 376
 	 *
377 377
 	 * @since 1.4.6
378
-     * @package GeoDirectory
378
+	 * @package GeoDirectory
379
+	 *
380
+	 * @param array $location_array {
381
+	 *    Attributes of the location_array.
382
+	 *
383
+	 *    @type string $gd_country The country slug.
384
+	 *    @type string $gd_region The region slug.
385
+	 *    @type string $gd_city The city slug.
379 386
 	 *
380
-     * @param array $location_array {
381
-     *    Attributes of the location_array.
382
-     *
383
-     *    @type string $gd_country The country slug.
384
-     *    @type string $gd_region The region slug.
385
-     *    @type string $gd_city The city slug.
386
-     *
387
-     * }
387
+	 * }
388 388
 	 * @param string $location_array_from Source type of location terms. Default session.
389 389
 	 * @param string $gd_post_type WP post type.
390 390
 	 */
391 391
 	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
392 392
 
393
-    return $location_array;
393
+	return $location_array;
394 394
 
395 395
 }
396 396
 
@@ -403,24 +403,24 @@  discard block
 block discarded – undo
403 403
  * @return bool|string
404 404
  */
405 405
 function geodir_get_location_link($which_location = 'current') {
406
-    $location_link = get_permalink(geodir_location_page_id());
407
-
408
-    if ($which_location == 'base') {
409
-        return $location_link;
410
-    } else {
411
-        $location_terms = geodir_get_current_location_terms();
412
-
413
-        if (!empty($location_terms)) {
414
-            if (get_option('permalink_structure') != '') {
415
-                $location_terms = implode("/", $location_terms);
416
-                $location_terms = rtrim($location_terms, '/');
417
-                $location_link .= $location_terms;
418
-            } else {
419
-                $location_link = geodir_getlink($location_link, $location_terms);
420
-            }
421
-        }
422
-    }
423
-    return $location_link;
406
+	$location_link = get_permalink(geodir_location_page_id());
407
+
408
+	if ($which_location == 'base') {
409
+		return $location_link;
410
+	} else {
411
+		$location_terms = geodir_get_current_location_terms();
412
+
413
+		if (!empty($location_terms)) {
414
+			if (get_option('permalink_structure') != '') {
415
+				$location_terms = implode("/", $location_terms);
416
+				$location_terms = rtrim($location_terms, '/');
417
+				$location_link .= $location_terms;
418
+			} else {
419
+				$location_link = geodir_getlink($location_link, $location_terms);
420
+			}
421
+		}
422
+	}
423
+	return $location_link;
424 424
 }
425 425
 
426 426
 /**
@@ -433,34 +433,34 @@  discard block
 block discarded – undo
433 433
  * @return array|bool Returns address on success.
434 434
  */
435 435
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
436
-    $url = is_ssl() ? 'https:' : 'http:';
437
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
-
439
-    $ch = curl_init();
440
-    curl_setopt($ch, CURLOPT_URL, $url);
441
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
442
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
443
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
444
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
445
-    $response = curl_exec($ch);
446
-    curl_close($ch);
447
-    $data = json_decode($response);
436
+	$url = is_ssl() ? 'https:' : 'http:';
437
+	$url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
+
439
+	$ch = curl_init();
440
+	curl_setopt($ch, CURLOPT_URL, $url);
441
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
442
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
443
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
444
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
445
+	$response = curl_exec($ch);
446
+	curl_close($ch);
447
+	$data = json_decode($response);
448 448
     
449
-    if (!empty($data) && !empty($data->address)) {
450
-        $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
-        $formatted_address = (array)$data->address;
449
+	if (!empty($data) && !empty($data->address)) {
450
+		$address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
+		$formatted_address = (array)$data->address;
452 452
         
453
-        foreach ( $data->address as $key => $value ) {
454
-            if (!in_array($key, $address_fields)) {
455
-                unset($formatted_address[$key]);
456
-            }
457
-        }
458
-        $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
453
+		foreach ( $data->address as $key => $value ) {
454
+			if (!in_array($key, $address_fields)) {
455
+				unset($formatted_address[$key]);
456
+			}
457
+		}
458
+		$data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
459 459
         
460
-        return $data;
461
-    } else {
462
-        return false;
463
-    }
460
+		return $data;
461
+	} else {
462
+		return false;
463
+	}
464 464
 }
465 465
 
466 466
 /**
@@ -474,51 +474,51 @@  discard block
 block discarded – undo
474 474
  * @return string Returns the country.
475 475
  */
476 476
 function geodir_get_normal_country($country, $default = '1') {
477
-    global $wpdb;
478
-    if ($result = geodir_get_country_by_name($country)) {
479
-        return $result;
480
-    }
477
+	global $wpdb;
478
+	if ($result = geodir_get_country_by_name($country)) {
479
+		return $result;
480
+	}
481 481
     
482
-    if (defined('POST_LOCATION_TABLE')) {
483
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
484
-        if (!empty($rows)) {
485
-            foreach ($rows as $row) {
486
-                $translated = __($row->country, 'geodirectory');
487
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
488
-                    return $result;
489
-                }
490
-            }
491
-        }
482
+	if (defined('POST_LOCATION_TABLE')) {
483
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
484
+		if (!empty($rows)) {
485
+			foreach ($rows as $row) {
486
+				$translated = __($row->country, 'geodirectory');
487
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
488
+					return $result;
489
+				}
490
+			}
491
+		}
492 492
         
493
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
494
-        if (!empty($rows)) {
495
-            foreach ($rows as $row) {
496
-                $translated = __($row->country, 'geodirectory');
497
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
498
-                    return $result;
499
-                }
500
-            }
501
-        }
502
-    }
493
+		$rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
494
+		if (!empty($rows)) {
495
+			foreach ($rows as $row) {
496
+				$translated = __($row->country, 'geodirectory');
497
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
498
+					return $result;
499
+				}
500
+			}
501
+		}
502
+	}
503 503
     
504
-    if ( $default === '0' ) {
505
-        return NULL;
506
-    }
504
+	if ( $default === '0' ) {
505
+		return NULL;
506
+	}
507 507
     
508
-    $default_location = geodir_get_default_location();
509
-    if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
510
-        return $result;
511
-    }
508
+	$default_location = geodir_get_default_location();
509
+	if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
510
+		return $result;
511
+	}
512 512
     
513
-    if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
514
-        return $result;
515
-    }
513
+	if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
514
+		return $result;
515
+	}
516 516
     
517
-    if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
518
-        return $result;
519
-    }
517
+	if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
518
+		return $result;
519
+	}
520 520
     
521
-    return $country;
521
+	return $country;
522 522
 }
523 523
 
524 524
 /**
@@ -530,16 +530,16 @@  discard block
 block discarded – undo
530 530
  * @return string Country ISO2 code.
531 531
  */
532 532
 function geodir_get_country_iso2($country) {
533
-    global $wpdb;
533
+	global $wpdb;
534 534
     
535
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
536
-        return $result;
537
-    }
538
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
539
-        return $result;
540
-    }
535
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
536
+		return $result;
537
+	}
538
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
539
+		return $result;
540
+	}
541 541
     
542
-    return $country;
542
+	return $country;
543 543
 }
544 544
 
545 545
 /**
@@ -552,16 +552,16 @@  discard block
 block discarded – undo
552 552
  * @return string|null Country ISO2 code.
553 553
  */
554 554
 function geodir_get_country_by_name($country, $iso2 = false) {
555
-    global $wpdb;
555
+	global $wpdb;
556 556
     
557
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
558
-        return $result;
559
-    }
560
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
561
-        return $result;
562
-    }
557
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
558
+		return $result;
559
+	}
560
+	if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
561
+		return $result;
562
+	}
563 563
     
564
-    return NULL;
564
+	return NULL;
565 565
 }
566 566
 
567 567
 
@@ -581,158 +581,158 @@  discard block
 block discarded – undo
581 581
  */
582 582
 function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
583 583
 
584
-    if (empty($content)) {
585
-        return $content;
586
-    }
584
+	if (empty($content)) {
585
+		return $content;
586
+	}
587 587
 
588 588
 
589
-    $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
589
+	$location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
590 590
 
591
-    if (!empty($location_replace_vars)) {
592
-        foreach ($location_replace_vars as $search => $replace) {
593
-            if (!empty($search) && strpos($content, $search) !== false) {
594
-                $content = str_replace($search, $replace, $content);
595
-            }
596
-        }
597
-    }
591
+	if (!empty($location_replace_vars)) {
592
+		foreach ($location_replace_vars as $search => $replace) {
593
+			if (!empty($search) && strpos($content, $search) !== false) {
594
+				$content = str_replace($search, $replace, $content);
595
+			}
596
+		}
597
+	}
598 598
 
599
-    return $content;
599
+	return $content;
600 600
 }
601 601
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
602 602
 
603 603
 
604 604
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
605 605
 
606
-    global $wp;
606
+	global $wp;
607 607
     
608
-    $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
609
-
610
-    if (empty($location_array)) {
611
-        $location_array = geodir_get_current_location_terms('query_vars');
612
-    }
613
-
614
-    $location_terms = array();
615
-    $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
616
-    $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
617
-    $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
618
-    $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
619
-
620
-    $location_names = array();
621
-    foreach ($location_terms as $type => $location) {
622
-        $location_name = $location;
623
-
624
-        if (!empty($location_name)) {
625
-            if ($location_manager) {
626
-                $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
627
-                $location_name = get_actual_location_name($location_type, $location, true);
628
-            } else {
629
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
630
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
631
-                $location_name = __(geodir_ucwords($location_name), 'geodirectory');
632
-            }
633
-        }
634
-
635
-        $location_names[$type] = $location_name;
636
-    }
637
-
638
-    $location_single = '';
639
-    foreach ($location_terms as $type => $location) {
640
-        if (!empty($location)) {
641
-            if (!empty($location_names[$type])) {
642
-                $location_single = $location_names[$type];
643
-            } else {
644
-                if ($location_manager) {
645
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
646
-                    $location_single = get_actual_location_name($location_type, $location, true);
647
-                } else {
648
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
649
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
650
-                    $location_single = __(geodir_ucwords($location_name), 'geodirectory');
651
-                }
652
-            }
653
-            break;
654
-        }
655
-    }
656
-
657
-    $full_location = array();
658
-    if (!empty($location_array)) {
659
-        $location_array = array_reverse($location_array);
660
-
661
-        foreach ($location_array as $type => $location) {
662
-            if (!empty($location_names[$type])) {
663
-                $location_name = $location_names[$type];
664
-            } else {
665
-                if ($location_manager) {
666
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
667
-                    $location_name = get_actual_location_name($location_type, $location, true);
668
-                } else {
669
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
670
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
671
-                    $location_name = __(geodir_ucwords($location_name), 'geodirectory');
672
-                }
673
-            }
608
+	$location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
609
+
610
+	if (empty($location_array)) {
611
+		$location_array = geodir_get_current_location_terms('query_vars');
612
+	}
613
+
614
+	$location_terms = array();
615
+	$location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
616
+	$location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
617
+	$location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
618
+	$location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
619
+
620
+	$location_names = array();
621
+	foreach ($location_terms as $type => $location) {
622
+		$location_name = $location;
623
+
624
+		if (!empty($location_name)) {
625
+			if ($location_manager) {
626
+				$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
627
+				$location_name = get_actual_location_name($location_type, $location, true);
628
+			} else {
629
+				$location_name = preg_replace( '/-(\d+)$/', '', $location_name);
630
+				$location_name = preg_replace( '/[_-]/', ' ', $location_name );
631
+				$location_name = __(geodir_ucwords($location_name), 'geodirectory');
632
+			}
633
+		}
674 634
 
675
-            $full_location[] = $location_name;
676
-        }
635
+		$location_names[$type] = $location_name;
636
+	}
637
+
638
+	$location_single = '';
639
+	foreach ($location_terms as $type => $location) {
640
+		if (!empty($location)) {
641
+			if (!empty($location_names[$type])) {
642
+				$location_single = $location_names[$type];
643
+			} else {
644
+				if ($location_manager) {
645
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
646
+					$location_single = get_actual_location_name($location_type, $location, true);
647
+				} else {
648
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
649
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
650
+					$location_single = __(geodir_ucwords($location_name), 'geodirectory');
651
+				}
652
+			}
653
+			break;
654
+		}
655
+	}
656
+
657
+	$full_location = array();
658
+	if (!empty($location_array)) {
659
+		$location_array = array_reverse($location_array);
660
+
661
+		foreach ($location_array as $type => $location) {
662
+			if (!empty($location_names[$type])) {
663
+				$location_name = $location_names[$type];
664
+			} else {
665
+				if ($location_manager) {
666
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
667
+					$location_name = get_actual_location_name($location_type, $location, true);
668
+				} else {
669
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
670
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
671
+					$location_name = __(geodir_ucwords($location_name), 'geodirectory');
672
+				}
673
+			}
674
+
675
+			$full_location[] = $location_name;
676
+		}
677 677
 
678
-        if (!empty($full_location)) {
679
-            $full_location = array_unique($full_location);
680
-        }
681
-    }
682
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
678
+		if (!empty($full_location)) {
679
+			$full_location = array_unique($full_location);
680
+		}
681
+	}
682
+	$full_location = !empty($full_location) ? implode(', ', $full_location): '';
683 683
     
684
-    if ( empty( $full_location ) ) {
685
-        /**
686
-         * Filter the text in meta description in full location is empty.
687
-         *
688
-         * @since 1.6.22
689
-         * 
690
-         * @param string $full_location Default: Empty.
691
-         * @param array  $location_array The array of location variables.
692
-         * @param string $gd_page       The page being filtered.
693
-         * @param string $sep           The separator.
694
-         */
695
-         $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
696
-    }
684
+	if ( empty( $full_location ) ) {
685
+		/**
686
+		 * Filter the text in meta description in full location is empty.
687
+		 *
688
+		 * @since 1.6.22
689
+		 * 
690
+		 * @param string $full_location Default: Empty.
691
+		 * @param array  $location_array The array of location variables.
692
+		 * @param string $gd_page       The page being filtered.
693
+		 * @param string $sep           The separator.
694
+		 */
695
+		 $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
696
+	}
697 697
     
698
-    if ( empty( $location_single ) ) {
699
-        /**
700
-         * Filter the text in meta description in single location is empty.
701
-         *
702
-         * @since 1.6.22
703
-         * 
704
-         * @param string $location_single Default: Empty.
705
-         * @param array $location_array The array of location variables.
706
-         * @param string $gd_page       The page being filtered.
707
-         * @param string $sep           The separator.
708
-         */
709
-         $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
710
-    }
711
-
712
-    $location_replace_vars = array();
713
-    $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
714
-    $location_replace_vars['%%location%%'] = $full_location;
715
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
716
-    $location_replace_vars['%%location_single%%'] = $location_single;
717
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
718
-
719
-    foreach ($location_names as $type => $name) {
720
-        $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
721
-
722
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
723
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
724
-    }
725
-
726
-    /**
727
-     * Filter the location terms variables to search & replace.
728
-     *
729
-     * @since   1.6.16
730
-     * @package GeoDirectory
731
-     *
732
-     * @param array $location_replace_vars The array of search & replace variables.
733
-     * @param array $location_array The array of location variables.
734
-     * @param string $gd_page       The page being filtered.
735
-     * @param string $sep           The separator.
736
-     */
737
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
698
+	if ( empty( $location_single ) ) {
699
+		/**
700
+		 * Filter the text in meta description in single location is empty.
701
+		 *
702
+		 * @since 1.6.22
703
+		 * 
704
+		 * @param string $location_single Default: Empty.
705
+		 * @param array $location_array The array of location variables.
706
+		 * @param string $gd_page       The page being filtered.
707
+		 * @param string $sep           The separator.
708
+		 */
709
+		 $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
710
+	}
711
+
712
+	$location_replace_vars = array();
713
+	$location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
714
+	$location_replace_vars['%%location%%'] = $full_location;
715
+	$location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
716
+	$location_replace_vars['%%location_single%%'] = $location_single;
717
+	$location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
718
+
719
+	foreach ($location_names as $type => $name) {
720
+		$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
721
+
722
+		$location_replace_vars['%%location_' . $location_type . '%%'] = $name;
723
+		$location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
724
+	}
725
+
726
+	/**
727
+	 * Filter the location terms variables to search & replace.
728
+	 *
729
+	 * @since   1.6.16
730
+	 * @package GeoDirectory
731
+	 *
732
+	 * @param array $location_replace_vars The array of search & replace variables.
733
+	 * @param array $location_array The array of location variables.
734
+	 * @param string $gd_page       The page being filtered.
735
+	 * @param string $sep           The separator.
736
+	 */
737
+	return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
738 738
 }
739 739
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 {
125 125
     global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM ".GEODIR_COUNTRIES_TABLE." ORDER BY Country ASC");
128 128
     
129 129
     $ISO2 = array();
130 130
     $countries = array();
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
     
137 137
     asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
139
+    $out_put = '<option '.selected('', $post_country, false).' value="">'.__('Select Country', 'geodirectory').'</option>';
140 140
     foreach ($countries as $country => $name) {
141 141
         $ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
143
+        $out_put .= '<option '.selected($post_country, $country, false).' value="'.esc_attr($country).'" data-country_code="'.$ccode.'">'.$name.'</option>';
144 144
     }
145 145
 
146 146
     echo $out_put;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
         if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184 184
             foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
185
+                $post_locations = '['.$default_location->city_slug.'],['.$default_location->region_slug.'],['.$default_location->country_slug.']'; // set all overall post location
186 186
 
187 187
                 $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
188
+                    "UPDATE ".$plugin_prefix.$posttypeobj."_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189 189
                     array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190 190
                 );
191 191
                 $wpdb->query($sql);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
          *
234 234
          * @since 1.0.0
235 235
          */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
236
+        $geodir_location = (object) apply_filters('geodir_add_new_location', array('location_id' => 0,
237 237
             'country' => $location_country,
238 238
             'region' => $location_region,
239 239
             'city' => $location_city,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
297
+    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng);
298 298
 
299 299
     $ch = curl_init();
300 300
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	 * @param string $location_array_from Source type of location terms. Default session.
389 389
 	 * @param string $gd_post_type WP post type.
390 390
 	 */
391
-	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
391
+	$location_array = apply_filters('geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type);
392 392
 
393 393
     return $location_array;
394 394
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
  */
435 435
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
436 436
     $url = is_ssl() ? 'https:' : 'http:';
437
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
437
+    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat='.trim($lat).'&lon='.trim($lng).'&zoom=16&addressdetails=1&email='.get_option('admin_email');
438 438
 
439 439
     $ch = curl_init();
440 440
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
     
449 449
     if (!empty($data) && !empty($data->address)) {
450 450
         $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
-        $formatted_address = (array)$data->address;
451
+        $formatted_address = (array) $data->address;
452 452
         
453
-        foreach ( $data->address as $key => $value ) {
453
+        foreach ($data->address as $key => $value) {
454 454
             if (!in_array($key, $address_fields)) {
455 455
                 unset($formatted_address[$key]);
456 456
             }
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     }
481 481
     
482 482
     if (defined('POST_LOCATION_TABLE')) {
483
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
483
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
484 484
         if (!empty($rows)) {
485 485
             foreach ($rows as $row) {
486 486
                 $translated = __($row->country, 'geodirectory');
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             }
491 491
         }
492 492
         
493
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
493
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country));
494 494
         if (!empty($rows)) {
495 495
             foreach ($rows as $row) {
496 496
                 $translated = __($row->country, 'geodirectory');
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
         }
502 502
     }
503 503
     
504
-    if ( $default === '0' ) {
504
+    if ($default === '0') {
505 505
         return NULL;
506 506
     }
507 507
     
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 function geodir_get_country_iso2($country) {
533 533
     global $wpdb;
534 534
     
535
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
535
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
536 536
         return $result;
537 537
     }
538
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
538
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
539 539
         return $result;
540 540
     }
541 541
     
@@ -554,10 +554,10 @@  discard block
 block discarded – undo
554 554
 function geodir_get_country_by_name($country, $iso2 = false) {
555 555
     global $wpdb;
556 556
     
557
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
557
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
558 558
         return $result;
559 559
     }
560
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
560
+    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE ISO2 LIKE %s", $country))) {
561 561
         return $result;
562 562
     }
563 563
     
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
602 602
 
603 603
 
604
-function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
604
+function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = '') {
605 605
 
606 606
     global $wp;
607 607
     
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
                 $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
627 627
                 $location_name = get_actual_location_name($location_type, $location, true);
628 628
             } else {
629
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
630
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
629
+                $location_name = preg_replace('/-(\d+)$/', '', $location_name);
630
+                $location_name = preg_replace('/[_-]/', ' ', $location_name);
631 631
                 $location_name = __(geodir_ucwords($location_name), 'geodirectory');
632 632
             }
633 633
         }
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
646 646
                     $location_single = get_actual_location_name($location_type, $location, true);
647 647
                 } else {
648
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
649
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
648
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
649
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
650 650
                     $location_single = __(geodir_ucwords($location_name), 'geodirectory');
651 651
                 }
652 652
             }
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
667 667
                     $location_name = get_actual_location_name($location_type, $location, true);
668 668
                 } else {
669
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
670
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
669
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
670
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
671 671
                     $location_name = __(geodir_ucwords($location_name), 'geodirectory');
672 672
                 }
673 673
             }
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
             $full_location = array_unique($full_location);
680 680
         }
681 681
     }
682
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
682
+    $full_location = !empty($full_location) ? implode(', ', $full_location) : '';
683 683
     
684
-    if ( empty( $full_location ) ) {
684
+    if (empty($full_location)) {
685 685
         /**
686 686
          * Filter the text in meta description in full location is empty.
687 687
          *
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
          * @param string $gd_page       The page being filtered.
693 693
          * @param string $sep           The separator.
694 694
          */
695
-         $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
695
+         $full_location = apply_filters('geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep);
696 696
     }
697 697
     
698
-    if ( empty( $location_single ) ) {
698
+    if (empty($location_single)) {
699 699
         /**
700 700
          * Filter the text in meta description in single location is empty.
701 701
          *
@@ -706,21 +706,21 @@  discard block
 block discarded – undo
706 706
          * @param string $gd_page       The page being filtered.
707 707
          * @param string $sep           The separator.
708 708
          */
709
-         $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
709
+         $location_single = apply_filters('geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep);
710 710
     }
711 711
 
712 712
     $location_replace_vars = array();
713 713
     $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
714 714
     $location_replace_vars['%%location%%'] = $full_location;
715
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
715
+    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf(_x('in %s', 'in location', 'geodirectory'), $full_location) : '';
716 716
     $location_replace_vars['%%location_single%%'] = $location_single;
717
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
717
+    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf(_x('in %s', 'in location', 'geodirectory'), $location_single) : '';
718 718
 
719 719
     foreach ($location_names as $type => $name) {
720 720
         $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
721 721
 
722
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
723
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
722
+        $location_replace_vars['%%location_'.$location_type.'%%'] = $name;
723
+        $location_replace_vars['%%in_location_'.$location_type.'%%'] = !empty($name) ? sprintf(_x('in %s', 'in location', 'geodirectory'), $name) : '';
724 724
     }
725 725
 
726 726
     /**
@@ -734,5 +734,5 @@  discard block
 block discarded – undo
734 734
      * @param string $gd_page       The page being filtered.
735 735
      * @param string $sep           The separator.
736 736
      */
737
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
737
+    return apply_filters('geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep);
738 738
 }
739 739
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/helper_functions.php 4 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     if (geodir_is_wpml()){
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else{
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else{
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
     if (geodir_is_wpml()){
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else{
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else{
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1173,7 +1173,7 @@
 block discarded – undo
1173 1173
  *
1174 1174
  * @param string $str The string being decoded.
1175 1175
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1176
- * @return string The width of string.
1176
+ * @return integer The width of string.
1177 1177
  */
1178 1178
 function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1179 1179
 	if ( function_exists( 'mb_strwidth' ) ) {
Please login to merge, or discard this patch.
Indentation   +395 added lines, -395 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16 16
 function geodir_add_listing_page_id(){
17
-    $gd_page_id = get_option('geodir_add_listing_page');
17
+	$gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19
-    if (geodir_is_wpml()) {
20
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
21
-    }
19
+	if (geodir_is_wpml()) {
20
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
21
+	}
22 22
 
23
-    return $gd_page_id;
23
+	return $gd_page_id;
24 24
 }
25 25
 
26 26
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33 33
 function geodir_preview_page_id(){
34
-    $gd_page_id = get_option('geodir_preview_page');
34
+	$gd_page_id = get_option('geodir_preview_page');
35 35
 
36
-    if (geodir_is_wpml()) {
37
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
38
-    }
36
+	if (geodir_is_wpml()) {
37
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
38
+	}
39 39
 
40
-    return $gd_page_id;
40
+	return $gd_page_id;
41 41
 }
42 42
 
43 43
 /**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50 50
 function geodir_success_page_id(){
51
-    $gd_page_id = get_option('geodir_success_page');
51
+	$gd_page_id = get_option('geodir_success_page');
52 52
 
53
-    if (geodir_is_wpml()) {
54
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
55
-    }
53
+	if (geodir_is_wpml()) {
54
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
55
+	}
56 56
 
57
-    return $gd_page_id;
57
+	return $gd_page_id;
58 58
 }
59 59
 
60 60
 /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67 67
 function geodir_location_page_id(){
68
-    $gd_page_id = get_option('geodir_location_page');
68
+	$gd_page_id = get_option('geodir_location_page');
69 69
 
70
-    if (geodir_is_wpml()) {
71
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
72
-    }
70
+	if (geodir_is_wpml()) {
71
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
72
+	}
73 73
 
74
-    return $gd_page_id;
74
+	return $gd_page_id;
75 75
 }
76 76
 
77 77
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84 84
 function geodir_home_page_id(){
85
-    $gd_page_id = get_option('geodir_home_page');
85
+	$gd_page_id = get_option('geodir_home_page');
86 86
 
87
-    if (geodir_is_wpml()) {
88
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
89
-    }
87
+	if (geodir_is_wpml()) {
88
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
89
+	}
90 90
 
91
-    return $gd_page_id;
91
+	return $gd_page_id;
92 92
 }
93 93
 
94 94
 /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101 101
 function geodir_info_page_id(){
102
-    $gd_page_id = get_option('geodir_info_page');
102
+	$gd_page_id = get_option('geodir_info_page');
103 103
 
104
-    if (geodir_is_wpml()) {
105
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
106
-    }
104
+	if (geodir_is_wpml()) {
105
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
106
+	}
107 107
 
108
-    return $gd_page_id;
108
+	return $gd_page_id;
109 109
 }
110 110
 
111 111
 /**
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118 118
 function geodir_login_page_id(){
119
-    $gd_page_id = get_option('geodir_login_page');
119
+	$gd_page_id = get_option('geodir_login_page');
120 120
 
121
-    if (geodir_is_wpml()) {
122
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
123
-    }
121
+	if (geodir_is_wpml()) {
122
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
123
+	}
124 124
 
125
-    return $gd_page_id;
125
+	return $gd_page_id;
126 126
 }
127 127
 
128 128
 
@@ -134,51 +134,51 @@  discard block
 block discarded – undo
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136 136
 function geodir_login_url($args=array()){
137
-    $gd_page_id = get_option('geodir_login_page');
138
-
139
-    if (geodir_is_wpml()) {
140
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
141
-    }
142
-
143
-    if (function_exists('geodir_location_geo_home_link')) {
144
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
-    }
146
-
147
-    if (geodir_is_wpml()){
148
-        $home_url = icl_get_home_url();
149
-    }else{
150
-        $home_url = home_url();
151
-    }
152
-
153
-    if (function_exists('geodir_location_geo_home_link')) {
154
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
-    }
156
-
157
-    if($gd_page_id){
158
-        $post = get_post($gd_page_id);
159
-        $slug = $post->post_name;
160
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
-        $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
163
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
164
-    }
165
-
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
168
-    }
169
-
170
-    /**
171
-     * Filter the GeoDirectory login page url.
172
-     *
173
-     * This filter can be used to change the GeoDirectory page url.
174
-     *
175
-     * @since 1.5.3
176
-     * @package GeoDirectory
177
-     * @param string $login_url The url of the login page.
178
-     * @param array $args The array of query args used.
179
-     * @param int $gd_page_id The page id of the GD login page.
180
-     */
181
-	    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
137
+	$gd_page_id = get_option('geodir_login_page');
138
+
139
+	if (geodir_is_wpml()) {
140
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
141
+	}
142
+
143
+	if (function_exists('geodir_location_geo_home_link')) {
144
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
+	}
146
+
147
+	if (geodir_is_wpml()){
148
+		$home_url = icl_get_home_url();
149
+	}else{
150
+		$home_url = home_url();
151
+	}
152
+
153
+	if (function_exists('geodir_location_geo_home_link')) {
154
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
+	}
156
+
157
+	if($gd_page_id){
158
+		$post = get_post($gd_page_id);
159
+		$slug = $post->post_name;
160
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
+		$login_url = trailingslashit($home_url)."$slug/";
162
+	}else{
163
+		$login_url = trailingslashit($home_url)."?geodir_signup=true";
164
+	}
165
+
166
+	if($args){
167
+		$login_url = add_query_arg($args,$login_url );
168
+	}
169
+
170
+	/**
171
+	 * Filter the GeoDirectory login page url.
172
+	 *
173
+	 * This filter can be used to change the GeoDirectory page url.
174
+	 *
175
+	 * @since 1.5.3
176
+	 * @package GeoDirectory
177
+	 * @param string $login_url The url of the login page.
178
+	 * @param array $args The array of query args used.
179
+	 * @param int $gd_page_id The page id of the GD login page.
180
+	 */
181
+		return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -190,40 +190,40 @@  discard block
 block discarded – undo
190 190
  * @return string Info page url.
191 191
  */
192 192
 function geodir_info_url($args=array()){
193
-    $gd_page_id = get_option('geodir_info_page');
194
-
195
-    if (geodir_is_wpml()) {
196
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
197
-    }
198
-
199
-    if (function_exists('geodir_location_geo_home_link')) {
200
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
-    }
202
-
203
-    if (geodir_is_wpml()){
204
-        $home_url = icl_get_home_url();
205
-    }else{
206
-        $home_url = home_url();
207
-    }
208
-
209
-    if (function_exists('geodir_location_geo_home_link')) {
210
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
-    }
212
-
213
-    if($gd_page_id){
214
-        $post = get_post($gd_page_id);
215
-        $slug = $post->post_name;
216
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
-        $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
219
-        $info_url = trailingslashit($home_url);
220
-    }
221
-
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
224
-    }
225
-
226
-    return $info_url;
193
+	$gd_page_id = get_option('geodir_info_page');
194
+
195
+	if (geodir_is_wpml()) {
196
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
197
+	}
198
+
199
+	if (function_exists('geodir_location_geo_home_link')) {
200
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
+	}
202
+
203
+	if (geodir_is_wpml()){
204
+		$home_url = icl_get_home_url();
205
+	}else{
206
+		$home_url = home_url();
207
+	}
208
+
209
+	if (function_exists('geodir_location_geo_home_link')) {
210
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
+	}
212
+
213
+	if($gd_page_id){
214
+		$post = get_post($gd_page_id);
215
+		$slug = $post->post_name;
216
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
+		$info_url = trailingslashit($home_url)."$slug/";
218
+	}else{
219
+		$info_url = trailingslashit($home_url);
220
+	}
221
+
222
+	if($args){
223
+		$info_url = add_query_arg($args,$info_url );
224
+	}
225
+
226
+	return $info_url;
227 227
 }
228 228
 
229 229
 /**
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
  * @return string Returns converted string.
240 240
  */
241 241
 function geodir_ucwords($string, $charset='UTF-8') {
242
-    if (function_exists('mb_convert_case')) {
243
-        return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
-    } else {
245
-        return ucwords($string);
246
-    }
242
+	if (function_exists('mb_convert_case')) {
243
+		return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
+	} else {
245
+		return ucwords($string);
246
+	}
247 247
 }
248 248
 
249 249
 /**
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
  * @return string Returns converted string.
260 260
  */
261 261
 function geodir_strtolower($string, $charset='UTF-8') {
262
-    if (function_exists('mb_convert_case')) {
263
-        return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
-    } else {
265
-        return strtolower($string);
266
-    }
262
+	if (function_exists('mb_convert_case')) {
263
+		return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
+	} else {
265
+		return strtolower($string);
266
+	}
267 267
 }
268 268
 
269 269
 /**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
  * @return string Returns converted string.
280 280
  */
281 281
 function geodir_strtoupper($string, $charset='UTF-8') {
282
-    if (function_exists('mb_convert_case')) {
283
-        return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
-    } else {
285
-        return strtoupper($string);
286
-    }
282
+	if (function_exists('mb_convert_case')) {
283
+		return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
+	} else {
285
+		return strtoupper($string);
286
+	}
287 287
 }
288 288
 
289 289
 /**
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
466
-        return '_gd_die_handler';
467
-    } else {
468
-        die();
469
-    }
465
+	if ( defined( 'GD_TESTING_MODE' ) ) {
466
+		return '_gd_die_handler';
467
+	} else {
468
+		die();
469
+	}
470 470
 }
471 471
 
472 472
 /**
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483 483
 function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
484
+	add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
+	add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
+	wp_die( $message, $title, array( 'response' => $status ));
487 487
 }
488 488
 
489 489
 /*
@@ -660,44 +660,44 @@  discard block
 block discarded – undo
660 660
  * @return string The formatted date.
661 661
  */
662 662
 function geodir_date( $date_input, $date_to, $date_from = '', $locale = false ) {
663
-    if ( empty( $date_input ) || empty( $date_to ) ) {
664
-        return NULL;
665
-    }
663
+	if ( empty( $date_input ) || empty( $date_to ) ) {
664
+		return NULL;
665
+	}
666 666
     
667
-    $date_input = geodir_maybe_untranslate_date( $date_input );
667
+	$date_input = geodir_maybe_untranslate_date( $date_input );
668 668
     
669
-    $timestamp = 0;
670
-    if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
-        $datetime = date_create_from_format( $date_from, $date_input );
672
-        if ( !empty( $datetime ) ) {
673
-            $timestamp = $datetime->getTimestamp();
674
-        }
675
-    }
669
+	$timestamp = 0;
670
+	if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
+		$datetime = date_create_from_format( $date_from, $date_input );
672
+		if ( !empty( $datetime ) ) {
673
+			$timestamp = $datetime->getTimestamp();
674
+		}
675
+	}
676 676
     
677
-    if ( empty( $timestamp ) ) {
678
-        $date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
-        $timestamp = strtotime( $date );
680
-    }
677
+	if ( empty( $timestamp ) ) {
678
+		$date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
+		$timestamp = strtotime( $date );
680
+	}
681 681
     
682
-    $date = date_i18n( $date_to, $timestamp );
682
+	$date = date_i18n( $date_to, $timestamp );
683 683
     
684
-    if ( !$locale ) {
685
-        $date = geodir_maybe_untranslate_date( $date );
686
-    }
684
+	if ( !$locale ) {
685
+		$date = geodir_maybe_untranslate_date( $date );
686
+	}
687 687
     
688
-    /**
689
-     * Filter the the date format conversion.
690
-     *
691
-     * @since 1.6.7
692
-     * @package GeoDirectory
693
-     *
694
-     * @param string $date The date string.
695
-     * @param string $date_input The date input.
696
-     * @param string $date_to The destination date format.
697
-     * @param string $date_from The source date format.
698
-     * @param bool $locale True to retrieve the date in localized format.
699
-     */
700
-    return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
688
+	/**
689
+	 * Filter the the date format conversion.
690
+	 *
691
+	 * @since 1.6.7
692
+	 * @package GeoDirectory
693
+	 *
694
+	 * @param string $date The date string.
695
+	 * @param string $date_input The date input.
696
+	 * @param string $date_to The destination date format.
697
+	 * @param string $date_from The source date format.
698
+	 * @param bool $locale True to retrieve the date in localized format.
699
+	 */
700
+	return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
701 701
 }
702 702
 
703 703
 /**
@@ -722,91 +722,91 @@  discard block
 block discarded – undo
722 722
  * @return string Trimmed string.
723 723
  */
724 724
 function geodir_excerpt($text, $length = 100, $options = array()) {
725
-    if (!(int)$length > 0) {
726
-        return $text;
727
-    }
728
-    $default = array(
729
-        'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
725
+	if (!(int)$length > 0) {
726
+		return $text;
727
+	}
728
+	$default = array(
729
+		'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
730 730
 	);
731
-    if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
732
-        $default['ellipsis'] = "";
733
-    }
734
-    $options += $default;
735
-
736
-    $prefix = '';
737
-    $suffix = $options['ellipsis'];
738
-
739
-    if ($options['html']) {
740
-        $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
741
-
742
-        $truncateLength = 0;
743
-        $totalLength = 0;
744
-        $openTags = array();
745
-        $truncate = '';
746
-
747
-        preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
748
-        foreach ($tags as $tag) {
749
-            $contentLength = geodir_strlen($tag[3], $options);
750
-
751
-            if ($truncate === '') {
752
-                if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
753
-                    if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
754
-                        array_unshift($openTags, $tag[2]);
755
-                    } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
756
-                        $pos = array_search($closeTag[1], $openTags);
757
-                        if ($pos !== false) {
758
-                            array_splice($openTags, $pos, 1);
759
-                        }
760
-                    }
761
-                }
762
-
763
-                $prefix .= $tag[1];
764
-
765
-                if ($totalLength + $contentLength + $ellipsisLength > $length) {
766
-                    $truncate = $tag[3];
767
-                    $truncateLength = $length - $totalLength;
768
-                } else {
769
-                    $prefix .= $tag[3];
770
-                }
771
-            }
772
-
773
-            $totalLength += $contentLength;
774
-            if ($totalLength > $length) {
775
-                break;
776
-            }
777
-        }
778
-
779
-        if ($totalLength <= $length) {
780
-            return $text;
781
-        }
782
-
783
-        $text = $truncate;
784
-        $length = $truncateLength;
785
-
786
-        foreach ($openTags as $tag) {
787
-            $suffix .= '</' . $tag . '>';
788
-        }
789
-    } else {
790
-        if (geodir_strlen($text, $options) <= $length) {
791
-            return $text;
792
-        }
793
-        $ellipsisLength = geodir_strlen($options['ellipsis'], $options);
794
-    }
795
-
796
-    $result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
797
-
798
-    if (!$options['exact']) {
799
-        if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
800
-            $result = geodir_remove_last_word($result);
801
-        }
802
-
803
-        // Do not need to count ellipsis in the cut, if result is empty.
804
-        if (!strlen($result)) {
805
-            $result = geodir_substr($text, 0, $length, $options);
806
-        }
807
-    }
808
-
809
-    return $prefix . $result . $suffix;
731
+	if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
732
+		$default['ellipsis'] = "";
733
+	}
734
+	$options += $default;
735
+
736
+	$prefix = '';
737
+	$suffix = $options['ellipsis'];
738
+
739
+	if ($options['html']) {
740
+		$ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
741
+
742
+		$truncateLength = 0;
743
+		$totalLength = 0;
744
+		$openTags = array();
745
+		$truncate = '';
746
+
747
+		preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
748
+		foreach ($tags as $tag) {
749
+			$contentLength = geodir_strlen($tag[3], $options);
750
+
751
+			if ($truncate === '') {
752
+				if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
753
+					if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
754
+						array_unshift($openTags, $tag[2]);
755
+					} elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
756
+						$pos = array_search($closeTag[1], $openTags);
757
+						if ($pos !== false) {
758
+							array_splice($openTags, $pos, 1);
759
+						}
760
+					}
761
+				}
762
+
763
+				$prefix .= $tag[1];
764
+
765
+				if ($totalLength + $contentLength + $ellipsisLength > $length) {
766
+					$truncate = $tag[3];
767
+					$truncateLength = $length - $totalLength;
768
+				} else {
769
+					$prefix .= $tag[3];
770
+				}
771
+			}
772
+
773
+			$totalLength += $contentLength;
774
+			if ($totalLength > $length) {
775
+				break;
776
+			}
777
+		}
778
+
779
+		if ($totalLength <= $length) {
780
+			return $text;
781
+		}
782
+
783
+		$text = $truncate;
784
+		$length = $truncateLength;
785
+
786
+		foreach ($openTags as $tag) {
787
+			$suffix .= '</' . $tag . '>';
788
+		}
789
+	} else {
790
+		if (geodir_strlen($text, $options) <= $length) {
791
+			return $text;
792
+		}
793
+		$ellipsisLength = geodir_strlen($options['ellipsis'], $options);
794
+	}
795
+
796
+	$result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
797
+
798
+	if (!$options['exact']) {
799
+		if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
800
+			$result = geodir_remove_last_word($result);
801
+		}
802
+
803
+		// Do not need to count ellipsis in the cut, if result is empty.
804
+		if (!strlen($result)) {
805
+			$result = geodir_substr($text, 0, $length, $options);
806
+		}
807
+	}
808
+
809
+	return $prefix . $result . $suffix;
810 810
 }
811 811
 
812 812
 /**
@@ -830,28 +830,28 @@  discard block
 block discarded – undo
830 830
  * @return int
831 831
  */
832 832
 function geodir_strlen($text, array $options) {
833
-    if (empty($options['trimWidth'])) {
834
-        $strlen = 'geodir_utf8_strlen';
835
-    } else {
836
-        $strlen = 'geodir_utf8_strwidth';
837
-    }
838
-
839
-    if (empty($options['html'])) {
840
-        return $strlen($text);
841
-    }
842
-
843
-    $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844
-    $replace = preg_replace_callback(
845
-        $pattern,
846
-        function ($match) use ($strlen) {
847
-            $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848
-
849
-            return str_repeat(' ', $strlen($utf8, 'UTF-8'));
850
-        },
851
-        $text
852
-    );
853
-
854
-    return $strlen($replace);
833
+	if (empty($options['trimWidth'])) {
834
+		$strlen = 'geodir_utf8_strlen';
835
+	} else {
836
+		$strlen = 'geodir_utf8_strwidth';
837
+	}
838
+
839
+	if (empty($options['html'])) {
840
+		return $strlen($text);
841
+	}
842
+
843
+	$pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844
+	$replace = preg_replace_callback(
845
+		$pattern,
846
+		function ($match) use ($strlen) {
847
+			$utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848
+
849
+			return str_repeat(' ', $strlen($utf8, 'UTF-8'));
850
+		},
851
+		$text
852
+	);
853
+
854
+	return $strlen($replace);
855 855
 }
856 856
 
857 857
 /**
@@ -872,80 +872,80 @@  discard block
 block discarded – undo
872 872
  * @return string
873 873
  */
874 874
 function geodir_substr($text, $start, $length, array $options) {
875
-    if (empty($options['trimWidth'])) {
876
-        $substr = 'geodir_utf8_substr';
877
-    } else {
878
-        $substr = 'geodir_utf8_strimwidth';
879
-    }
880
-
881
-    $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
882
-    if ($start < 0) {
883
-        $start += $maxPosition;
884
-        if ($start < 0) {
885
-            $start = 0;
886
-        }
887
-    }
888
-    if ($start >= $maxPosition) {
889
-        return '';
890
-    }
891
-
892
-    if ($length === null) {
893
-        $length = geodir_strlen($text, $options);
894
-    }
895
-
896
-    if ($length < 0) {
897
-        $text = geodir_substr($text, $start, null, $options);
898
-        $start = 0;
899
-        $length += geodir_strlen($text, $options);
900
-    }
901
-
902
-    if ($length <= 0) {
903
-        return '';
904
-    }
905
-
906
-    if (empty($options['html'])) {
907
-        return (string)$substr($text, $start, $length);
908
-    }
909
-
910
-    $totalOffset = 0;
911
-    $totalLength = 0;
912
-    $result = '';
913
-
914
-    $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
915
-    $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
916
-    foreach ($parts as $part) {
917
-        $offset = 0;
918
-
919
-        if ($totalOffset < $start) {
920
-            $len = geodir_strlen($part, array('trimWidth' => false) + $options);
921
-            if ($totalOffset + $len <= $start) {
922
-                $totalOffset += $len;
923
-                continue;
924
-            }
925
-
926
-            $offset = $start - $totalOffset;
927
-            $totalOffset = $start;
928
-        }
929
-
930
-        $len = geodir_strlen($part, $options);
931
-        if ($offset !== 0 || $totalLength + $len > $length) {
932
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
933
-                // Entities cannot be passed substr.
934
-                continue;
935
-            }
936
-
937
-            $part = $substr($part, $offset, $length - $totalLength);
938
-            $len = geodir_strlen($part, $options);
939
-        }
940
-
941
-        $result .= $part;
942
-        $totalLength += $len;
943
-        if ($totalLength >= $length) {
944
-            break;
945
-        }
946
-    }
947
-
948
-    return $result;
875
+	if (empty($options['trimWidth'])) {
876
+		$substr = 'geodir_utf8_substr';
877
+	} else {
878
+		$substr = 'geodir_utf8_strimwidth';
879
+	}
880
+
881
+	$maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
882
+	if ($start < 0) {
883
+		$start += $maxPosition;
884
+		if ($start < 0) {
885
+			$start = 0;
886
+		}
887
+	}
888
+	if ($start >= $maxPosition) {
889
+		return '';
890
+	}
891
+
892
+	if ($length === null) {
893
+		$length = geodir_strlen($text, $options);
894
+	}
895
+
896
+	if ($length < 0) {
897
+		$text = geodir_substr($text, $start, null, $options);
898
+		$start = 0;
899
+		$length += geodir_strlen($text, $options);
900
+	}
901
+
902
+	if ($length <= 0) {
903
+		return '';
904
+	}
905
+
906
+	if (empty($options['html'])) {
907
+		return (string)$substr($text, $start, $length);
908
+	}
909
+
910
+	$totalOffset = 0;
911
+	$totalLength = 0;
912
+	$result = '';
913
+
914
+	$pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
915
+	$parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
916
+	foreach ($parts as $part) {
917
+		$offset = 0;
918
+
919
+		if ($totalOffset < $start) {
920
+			$len = geodir_strlen($part, array('trimWidth' => false) + $options);
921
+			if ($totalOffset + $len <= $start) {
922
+				$totalOffset += $len;
923
+				continue;
924
+			}
925
+
926
+			$offset = $start - $totalOffset;
927
+			$totalOffset = $start;
928
+		}
929
+
930
+		$len = geodir_strlen($part, $options);
931
+		if ($offset !== 0 || $totalLength + $len > $length) {
932
+			if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
933
+				// Entities cannot be passed substr.
934
+				continue;
935
+			}
936
+
937
+			$part = $substr($part, $offset, $length - $totalLength);
938
+			$len = geodir_strlen($part, $options);
939
+		}
940
+
941
+		$result .= $part;
942
+		$totalLength += $len;
943
+		if ($totalLength >= $length) {
944
+			break;
945
+		}
946
+	}
947
+
948
+	return $result;
949 949
 }
950 950
 
951 951
 /**
@@ -958,21 +958,21 @@  discard block
 block discarded – undo
958 958
  * @return string
959 959
  */
960 960
 function geodir_remove_last_word($text) {
961
-    $spacepos = geodir_utf8_strrpos($text, ' ');
961
+	$spacepos = geodir_utf8_strrpos($text, ' ');
962 962
 
963
-    if ($spacepos !== false) {
964
-        $lastWord = geodir_utf8_strrpos($text, $spacepos);
963
+	if ($spacepos !== false) {
964
+		$lastWord = geodir_utf8_strrpos($text, $spacepos);
965 965
 
966
-        // Some languages are written without word separation.
967
-        // We recognize a string as a word if it does not contain any full-width characters.
968
-        if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
969
-            $text = geodir_utf8_substr($text, 0, $spacepos);
970
-        }
966
+		// Some languages are written without word separation.
967
+		// We recognize a string as a word if it does not contain any full-width characters.
968
+		if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
969
+			$text = geodir_utf8_substr($text, 0, $spacepos);
970
+		}
971 971
 
972
-        return $text;
973
-    }
972
+		return $text;
973
+	}
974 974
 
975
-    return '';
975
+	return '';
976 976
 }
977 977
 
978 978
 function geodir_tool_restore_cpt_from_taxonomies(){
@@ -1090,11 +1090,11 @@  discard block
 block discarded – undo
1090 1090
  * @return string
1091 1091
  */
1092 1092
 function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1093
-    if ( function_exists( 'mb_strimwidth' ) ) {
1094
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1095
-    }
1093
+	if ( function_exists( 'mb_strimwidth' ) ) {
1094
+		return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1095
+	}
1096 1096
     
1097
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1097
+	return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1098 1098
 }
1099 1099
 
1100 1100
 /**
@@ -1108,11 +1108,11 @@  discard block
 block discarded – undo
1108 1108
  * @return int Returns the number of characters in string.
1109 1109
  */
1110 1110
 function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1111
-    if ( function_exists( 'mb_strlen' ) ) {
1112
-        return mb_strlen( $str, $encoding );
1113
-    }
1111
+	if ( function_exists( 'mb_strlen' ) ) {
1112
+		return mb_strlen( $str, $encoding );
1113
+	}
1114 1114
         
1115
-    return strlen( $str );
1115
+	return strlen( $str );
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1128,11 +1128,11 @@  discard block
 block discarded – undo
1128 1128
  * @return int Returns the position of the first occurrence of search in the string.
1129 1129
  */
1130 1130
 function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1131
-    if ( function_exists( 'mb_strpos' ) ) {
1132
-        return mb_strpos( $str, $find, $offset, $encoding );
1133
-    }
1131
+	if ( function_exists( 'mb_strpos' ) ) {
1132
+		return mb_strpos( $str, $find, $offset, $encoding );
1133
+	}
1134 1134
         
1135
-    return strpos( $str, $find, $offset );
1135
+	return strpos( $str, $find, $offset );
1136 1136
 }
1137 1137
 
1138 1138
 /**
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
  * @return int Returns the position of the last occurrence of search.
1149 1149
  */
1150 1150
 function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1151
-    if ( function_exists( 'mb_strrpos' ) ) {
1152
-        return mb_strrpos( $str, $find, $offset, $encoding );
1153
-    }
1151
+	if ( function_exists( 'mb_strrpos' ) ) {
1152
+		return mb_strrpos( $str, $find, $offset, $encoding );
1153
+	}
1154 1154
         
1155
-    return strrpos( $str, $find, $offset );
1155
+	return strrpos( $str, $find, $offset );
1156 1156
 }
1157 1157
 
1158 1158
 /**
@@ -1169,15 +1169,15 @@  discard block
 block discarded – undo
1169 1169
  * @return string
1170 1170
  */
1171 1171
 function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1172
-    if ( function_exists( 'mb_substr' ) ) {
1173
-        if ( $length === null ) {
1174
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1175
-        } else {
1176
-            return mb_substr( $str, $start, $length, $encoding );
1177
-        }
1178
-    }
1172
+	if ( function_exists( 'mb_substr' ) ) {
1173
+		if ( $length === null ) {
1174
+			return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1175
+		} else {
1176
+			return mb_substr( $str, $start, $length, $encoding );
1177
+		}
1178
+	}
1179 1179
         
1180
-    return substr( $str, $start, $length );
1180
+	return substr( $str, $start, $length );
1181 1181
 }
1182 1182
 
1183 1183
 /**
@@ -1210,20 +1210,20 @@  discard block
 block discarded – undo
1210 1210
  * @return string The resulting string.
1211 1211
  */
1212 1212
 function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
1213
-    if ( function_exists( 'mb_strlen' ) ) {
1214
-        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1215
-        $str_end = "";
1213
+	if ( function_exists( 'mb_strlen' ) ) {
1214
+		$first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1215
+		$str_end = "";
1216 1216
         
1217
-        if ( $lower_str_end ) {
1218
-            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1219
-        } else {
1220
-            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1221
-        }
1217
+		if ( $lower_str_end ) {
1218
+			$str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1219
+		} else {
1220
+			$str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1221
+		}
1222 1222
         
1223
-        return $first_letter . $str_end;
1224
-    }
1223
+		return $first_letter . $str_end;
1224
+	}
1225 1225
 
1226
-    return ucfirst( $str );
1226
+	return ucfirst( $str );
1227 1227
 }
1228 1228
 
1229 1229
 function geodir_total_listings_count($post_type = false)
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since 1.4.6
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16
-function geodir_add_listing_page_id(){
16
+function geodir_add_listing_page_id() {
17 17
     $gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19 19
     if (geodir_is_wpml()) {
20
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
20
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
21 21
     }
22 22
 
23 23
     return $gd_page_id;
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @since 1.4.6
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33
-function geodir_preview_page_id(){
33
+function geodir_preview_page_id() {
34 34
     $gd_page_id = get_option('geodir_preview_page');
35 35
 
36 36
     if (geodir_is_wpml()) {
37
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
37
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
38 38
     }
39 39
 
40 40
     return $gd_page_id;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * @since 1.4.6
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50
-function geodir_success_page_id(){
50
+function geodir_success_page_id() {
51 51
     $gd_page_id = get_option('geodir_success_page');
52 52
 
53 53
     if (geodir_is_wpml()) {
54
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
54
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
55 55
     }
56 56
 
57 57
     return $gd_page_id;
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
  * @since 1.4.6
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67
-function geodir_location_page_id(){
67
+function geodir_location_page_id() {
68 68
     $gd_page_id = get_option('geodir_location_page');
69 69
 
70 70
     if (geodir_is_wpml()) {
71
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
71
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
72 72
     }
73 73
 
74 74
     return $gd_page_id;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @since 1.5.4
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84
-function geodir_home_page_id(){
84
+function geodir_home_page_id() {
85 85
     $gd_page_id = get_option('geodir_home_page');
86 86
 
87 87
     if (geodir_is_wpml()) {
88
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
88
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
89 89
     }
90 90
 
91 91
     return $gd_page_id;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.3
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101
-function geodir_info_page_id(){
101
+function geodir_info_page_id() {
102 102
     $gd_page_id = get_option('geodir_info_page');
103 103
 
104 104
     if (geodir_is_wpml()) {
105
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
105
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
106 106
     }
107 107
 
108 108
     return $gd_page_id;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @since 1.5.3
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118
-function geodir_login_page_id(){
118
+function geodir_login_page_id() {
119 119
     $gd_page_id = get_option('geodir_login_page');
120 120
 
121 121
     if (geodir_is_wpml()) {
122
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
122
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
123 123
     }
124 124
 
125 125
     return $gd_page_id;
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136
-function geodir_login_url($args=array()){
136
+function geodir_login_url($args = array()) {
137 137
     $gd_page_id = get_option('geodir_login_page');
138 138
 
139 139
     if (geodir_is_wpml()) {
140
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
140
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
141 141
     }
142 142
 
143 143
     if (function_exists('geodir_location_geo_home_link')) {
144 144
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145 145
     }
146 146
 
147
-    if (geodir_is_wpml()){
147
+    if (geodir_is_wpml()) {
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else {
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155 155
     }
156 156
 
157
-    if($gd_page_id){
157
+    if ($gd_page_id) {
158 158
         $post = get_post($gd_page_id);
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else {
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
166
+    if ($args) {
167
+        $login_url = add_query_arg($args, $login_url);
168 168
     }
169 169
 
170 170
     /**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param array $args The array of query args used.
179 179
      * @param int $gd_page_id The page id of the GD login page.
180 180
      */
181
-	    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
181
+	    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
  * @since 1.5.16 Added WPML lang code to url.
190 190
  * @return string Info page url.
191 191
  */
192
-function geodir_info_url($args=array()){
192
+function geodir_info_url($args = array()) {
193 193
     $gd_page_id = get_option('geodir_info_page');
194 194
 
195 195
     if (geodir_is_wpml()) {
196
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
196
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
197 197
     }
198 198
 
199 199
     if (function_exists('geodir_location_geo_home_link')) {
200 200
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201 201
     }
202 202
 
203
-    if (geodir_is_wpml()){
203
+    if (geodir_is_wpml()) {
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else {
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211 211
     }
212 212
 
213
-    if($gd_page_id){
213
+    if ($gd_page_id) {
214 214
         $post = get_post($gd_page_id);
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else {
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
222
+    if ($args) {
223
+        $info_url = add_query_arg($args, $info_url);
224 224
     }
225 225
 
226 226
     return $info_url;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
  * @param string $charset Character set to use for conversion.
239 239
  * @return string Returns converted string.
240 240
  */
241
-function geodir_ucwords($string, $charset='UTF-8') {
241
+function geodir_ucwords($string, $charset = 'UTF-8') {
242 242
     if (function_exists('mb_convert_case')) {
243 243
         return mb_convert_case($string, MB_CASE_TITLE, $charset);
244 244
     } else {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @param string $charset Character set to use for conversion.
259 259
  * @return string Returns converted string.
260 260
  */
261
-function geodir_strtolower($string, $charset='UTF-8') {
261
+function geodir_strtolower($string, $charset = 'UTF-8') {
262 262
     if (function_exists('mb_convert_case')) {
263 263
         return mb_convert_case($string, MB_CASE_LOWER, $charset);
264 264
     } else {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
  * @param string $charset Character set to use for conversion.
279 279
  * @return string Returns converted string.
280 280
  */
281
-function geodir_strtoupper($string, $charset='UTF-8') {
281
+function geodir_strtoupper($string, $charset = 'UTF-8') {
282 282
     if (function_exists('mb_convert_case')) {
283 283
         return mb_convert_case($string, MB_CASE_UPPER, $charset);
284 284
     } else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	
310 310
 	$url = trim($parts[0]);
311 311
 	if ($formatted && $url != '') {
312
-		$url = str_replace( ' ', '%20', $url );
312
+		$url = str_replace(' ', '%20', $url);
313 313
 		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
314 314
 		
315 315
 		if (0 !== stripos($url, 'mailto:')) {
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 		
320 320
 		$url = str_replace(';//', '://', $url);
321 321
 		
322
-		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
-			$url = 'http://' . $url;
322
+		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
+			$url = 'http://'.$url;
324 324
 		}
325 325
 		
326 326
 		$url = wp_kses_normalize_entities($url);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
465
+    if (defined('GD_TESTING_MODE')) {
466 466
         return '_gd_die_handler';
467 467
     } else {
468 468
         die();
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
  * @param string $title   Optional. Error title.
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483
-function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
483
+function gd_die($message = '', $title = '', $status = 400) {
484
+    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3);
485
+    add_filter('wp_die_handler', '_gd_die_handler', 10, 3);
486
+    wp_die($message, $title, array('response' => $status));
487 487
 }
488 488
 
489 489
 /*
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
  * @param string $php_format The PHP date format.
494 494
  * @return string The jQuery format date string.
495 495
  */
496
-function geodir_date_format_php_to_jqueryui( $php_format ) {
496
+function geodir_date_format_php_to_jqueryui($php_format) {
497 497
 	$symbols = array(
498 498
 		// Day
499 499
 		'd' => 'dd',
@@ -533,27 +533,27 @@  discard block
 block discarded – undo
533 533
 	$jqueryui_format = "";
534 534
 	$escaping = false;
535 535
 
536
-	for ( $i = 0; $i < strlen( $php_format ); $i++ ) {
536
+	for ($i = 0; $i < strlen($php_format); $i++) {
537 537
 		$char = $php_format[$i];
538 538
 
539 539
 		// PHP date format escaping character
540
-		if ( $char === '\\' ) {
540
+		if ($char === '\\') {
541 541
 			$i++;
542 542
 
543
-			if ( $escaping ) {
543
+			if ($escaping) {
544 544
 				$jqueryui_format .= $php_format[$i];
545 545
 			} else {
546
-				$jqueryui_format .= '\'' . $php_format[$i];
546
+				$jqueryui_format .= '\''.$php_format[$i];
547 547
 			}
548 548
 
549 549
 			$escaping = true;
550 550
 		} else {
551
-			if ( $escaping ) {
551
+			if ($escaping) {
552 552
 				$jqueryui_format .= "'";
553 553
 				$escaping = false;
554 554
 			}
555 555
 
556
-			if ( isset( $symbols[$char] ) ) {
556
+			if (isset($symbols[$char])) {
557 557
 				$jqueryui_format .= $symbols[$char];
558 558
 			} else {
559 559
 				$jqueryui_format .= $char;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		'December',
592 592
 	);
593 593
 
594
-	$non_english_long_months  = array(
594
+	$non_english_long_months = array(
595 595
 		__('January'),
596 596
 		__('February'),
597 597
 		__('March'),
@@ -605,10 +605,10 @@  discard block
 block discarded – undo
605 605
 		__('November'),
606 606
 		__('December'),
607 607
 	);
608
-	$date = str_replace($non_english_long_months,$english_long_months,$date);
608
+	$date = str_replace($non_english_long_months, $english_long_months, $date);
609 609
     
610
-	if ( !empty( $wp_locale ) ) {
611
-		$date = str_replace( array_values( $wp_locale->month_genitive ), $english_long_months, $date );
610
+	if (!empty($wp_locale)) {
611
+		$date = str_replace(array_values($wp_locale->month_genitive), $english_long_months, $date);
612 612
 	}
613 613
 
614 614
 	$english_short_months = array(
@@ -627,21 +627,21 @@  discard block
 block discarded – undo
627 627
 	);
628 628
 
629 629
 	$non_english_short_months = array(
630
-		' '._x( 'Jan', 'January abbreviation' ).' ',
631
-		' '._x( 'Feb', 'February abbreviation' ).' ',
632
-		' '._x( 'Mar', 'March abbreviation' ).' ',
633
-		' '._x( 'Apr', 'April abbreviation' ).' ',
634
-		' '._x( 'May', 'May abbreviation' ).' ',
635
-		' '._x( 'Jun', 'June abbreviation' ).' ',
636
-		' '._x( 'Jul', 'July abbreviation' ).' ',
637
-		' '._x( 'Aug', 'August abbreviation' ).' ',
638
-		' '._x( 'Sep', 'September abbreviation' ).' ',
639
-		' '._x( 'Oct', 'October abbreviation' ).' ',
640
-		' '._x( 'Nov', 'November abbreviation' ).' ',
641
-		' '._x( 'Dec', 'December abbreviation' ).' ',
630
+		' '._x('Jan', 'January abbreviation').' ',
631
+		' '._x('Feb', 'February abbreviation').' ',
632
+		' '._x('Mar', 'March abbreviation').' ',
633
+		' '._x('Apr', 'April abbreviation').' ',
634
+		' '._x('May', 'May abbreviation').' ',
635
+		' '._x('Jun', 'June abbreviation').' ',
636
+		' '._x('Jul', 'July abbreviation').' ',
637
+		' '._x('Aug', 'August abbreviation').' ',
638
+		' '._x('Sep', 'September abbreviation').' ',
639
+		' '._x('Oct', 'October abbreviation').' ',
640
+		' '._x('Nov', 'November abbreviation').' ',
641
+		' '._x('Dec', 'December abbreviation').' ',
642 642
 	);
643 643
 
644
-	$date = str_replace($non_english_short_months,$english_short_months,$date);
644
+	$date = str_replace($non_english_short_months, $english_short_months, $date);
645 645
 
646 646
 
647 647
 	return $date;
@@ -659,30 +659,30 @@  discard block
 block discarded – undo
659 659
  * @param bool $locale True to retrieve the date in localized format. Default false.
660 660
  * @return string The formatted date.
661 661
  */
662
-function geodir_date( $date_input, $date_to, $date_from = '', $locale = false ) {
663
-    if ( empty( $date_input ) || empty( $date_to ) ) {
662
+function geodir_date($date_input, $date_to, $date_from = '', $locale = false) {
663
+    if (empty($date_input) || empty($date_to)) {
664 664
         return NULL;
665 665
     }
666 666
     
667
-    $date_input = geodir_maybe_untranslate_date( $date_input );
667
+    $date_input = geodir_maybe_untranslate_date($date_input);
668 668
     
669 669
     $timestamp = 0;
670
-    if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
-        $datetime = date_create_from_format( $date_from, $date_input );
672
-        if ( !empty( $datetime ) ) {
670
+    if (!empty($date_from) && function_exists('date_create_from_format')) {
671
+        $datetime = date_create_from_format($date_from, $date_input);
672
+        if (!empty($datetime)) {
673 673
             $timestamp = $datetime->getTimestamp();
674 674
         }
675 675
     }
676 676
     
677
-    if ( empty( $timestamp ) ) {
678
-        $date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
-        $timestamp = strtotime( $date );
677
+    if (empty($timestamp)) {
678
+        $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input;
679
+        $timestamp = strtotime($date);
680 680
     }
681 681
     
682
-    $date = date_i18n( $date_to, $timestamp );
682
+    $date = date_i18n($date_to, $timestamp);
683 683
     
684
-    if ( !$locale ) {
685
-        $date = geodir_maybe_untranslate_date( $date );
684
+    if (!$locale) {
685
+        $date = geodir_maybe_untranslate_date($date);
686 686
     }
687 687
     
688 688
     /**
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
      * @param string $date_from The source date format.
698 698
      * @param bool $locale True to retrieve the date in localized format.
699 699
      */
700
-    return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
700
+    return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from, $locale);
701 701
 }
702 702
 
703 703
 /**
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
  * @return string Trimmed string.
723 723
  */
724 724
 function geodir_excerpt($text, $length = 100, $options = array()) {
725
-    if (!(int)$length > 0) {
725
+    if (!(int) $length > 0) {
726 726
         return $text;
727 727
     }
728 728
     $default = array(
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
         $length = $truncateLength;
785 785
 
786 786
         foreach ($openTags as $tag) {
787
-            $suffix .= '</' . $tag . '>';
787
+            $suffix .= '</'.$tag.'>';
788 788
         }
789 789
     } else {
790 790
         if (geodir_strlen($text, $options) <= $length) {
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
         }
807 807
     }
808 808
 
809
-    return $prefix . $result . $suffix;
809
+    return $prefix.$result.$suffix;
810 810
 }
811 811
 
812 812
 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
     $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844 844
     $replace = preg_replace_callback(
845 845
         $pattern,
846
-        function ($match) use ($strlen) {
846
+        function($match) use ($strlen) {
847 847
             $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848 848
 
849 849
             return str_repeat(' ', $strlen($utf8, 'UTF-8'));
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
     }
905 905
 
906 906
     if (empty($options['html'])) {
907
-        return (string)$substr($text, $start, $length);
907
+        return (string) $substr($text, $start, $length);
908 908
     }
909 909
 
910 910
     $totalOffset = 0;
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 
930 930
         $len = geodir_strlen($part, $options);
931 931
         if ($offset !== 0 || $totalLength + $len > $length) {
932
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
932
+            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) {
933 933
                 // Entities cannot be passed substr.
934 934
                 continue;
935 935
             }
@@ -975,39 +975,39 @@  discard block
 block discarded – undo
975 975
     return '';
976 976
 }
977 977
 
978
-function geodir_tool_restore_cpt_from_taxonomies(){
978
+function geodir_tool_restore_cpt_from_taxonomies() {
979 979
 
980 980
 	$cpts = get_option('geodir_post_types');
981 981
 
982
-	if(!empty($cpts)){return;}
982
+	if (!empty($cpts)) {return; }
983 983
 
984 984
 	$taxonomies = get_option('geodir_taxonomies');
985 985
 
986
-	if(empty($taxonomies)){return;}
986
+	if (empty($taxonomies)) {return; }
987 987
 
988 988
 	$cpts = array();
989 989
 
990
-	foreach($taxonomies as $key => $val){
990
+	foreach ($taxonomies as $key => $val) {
991 991
 
992
-		if(strpos($val['listing_slug'], '/') === false) {
993
-			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']);
992
+		if (strpos($val['listing_slug'], '/') === false) {
993
+			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']);
994 994
 		}
995 995
 
996 996
 	}
997 997
 
998
-	if(empty($cpts)){return;}
998
+	if (empty($cpts)) {return; }
999 999
 
1000 1000
 
1001 1001
 	$cpts_restore = $cpts;
1002 1002
 
1003
-	foreach($cpts as $cpt){
1003
+	foreach ($cpts as $cpt) {
1004 1004
 
1005 1005
 
1006
-		$is_custom = $cpt['cpt']=='gd_place' ? 0 : 1;
1006
+		$is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1;
1007 1007
 
1008
-		$cpts_restore[$cpt['cpt']] = array (
1008
+		$cpts_restore[$cpt['cpt']] = array(
1009 1009
 				'labels' =>
1010
-					array (
1010
+					array(
1011 1011
 						'name' => $cpt['slug'],
1012 1012
 						'singular_name' => $cpt['slug'],
1013 1013
 						'add_new' => 'Add New',
@@ -1035,14 +1035,14 @@  discard block
 block discarded – undo
1035 1035
 				'public' => true,
1036 1036
 				'query_var' => true,
1037 1037
 				'rewrite' =>
1038
-					array (
1038
+					array(
1039 1039
 						'slug' => $cpt['slug'],
1040 1040
 						'with_front' => false,
1041 1041
 						'hierarchical' => true,
1042 1042
 						'feeds' => true,
1043 1043
 					),
1044 1044
 				'supports' =>
1045
-					array (
1045
+					array(
1046 1046
 						0 => 'title',
1047 1047
 						1 => 'editor',
1048 1048
 						2 => 'author',
@@ -1052,14 +1052,14 @@  discard block
 block discarded – undo
1052 1052
 						6 => 'comments',
1053 1053
 					),
1054 1054
 				'taxonomies' =>
1055
-					array (
1055
+					array(
1056 1056
 						0 => $cpt['cpt'].'category',
1057 1057
 						1 => $cpt['cpt'].'_tags',
1058 1058
 					),
1059 1059
 				'is_custom' => $is_custom,
1060 1060
 				'listing_order' => '1',
1061 1061
 				'seo' =>
1062
-					array (
1062
+					array(
1063 1063
 						'meta_keyword' => '',
1064 1064
 						'meta_description' => '',
1065 1065
 					),
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 	}
1072 1072
 
1073 1073
 
1074
-	update_option('geodir_post_types',$cpts_restore);
1074
+	update_option('geodir_post_types', $cpts_restore);
1075 1075
 
1076 1076
 }
1077 1077
 
@@ -1089,12 +1089,12 @@  discard block
 block discarded – undo
1089 1089
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1090 1090
  * @return string
1091 1091
  */
1092
-function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1093
-    if ( function_exists( 'mb_strimwidth' ) ) {
1094
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1092
+function geodir_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
1093
+    if (function_exists('mb_strimwidth')) {
1094
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
1095 1095
     }
1096 1096
     
1097
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1097
+    return geodir_utf8_substr($str, $start, $width, $encoding).$trimmaker;
1098 1098
 }
1099 1099
 
1100 1100
 /**
@@ -1107,12 +1107,12 @@  discard block
 block discarded – undo
1107 1107
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1108 1108
  * @return int Returns the number of characters in string.
1109 1109
  */
1110
-function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1111
-    if ( function_exists( 'mb_strlen' ) ) {
1112
-        return mb_strlen( $str, $encoding );
1110
+function geodir_utf8_strlen($str, $encoding = 'UTF-8') {
1111
+    if (function_exists('mb_strlen')) {
1112
+        return mb_strlen($str, $encoding);
1113 1113
     }
1114 1114
         
1115
-    return strlen( $str );
1115
+    return strlen($str);
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1127,12 +1127,12 @@  discard block
 block discarded – undo
1127 1127
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1128 1128
  * @return int Returns the position of the first occurrence of search in the string.
1129 1129
  */
1130
-function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1131
-    if ( function_exists( 'mb_strpos' ) ) {
1132
-        return mb_strpos( $str, $find, $offset, $encoding );
1130
+function geodir_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1131
+    if (function_exists('mb_strpos')) {
1132
+        return mb_strpos($str, $find, $offset, $encoding);
1133 1133
     }
1134 1134
         
1135
-    return strpos( $str, $find, $offset );
1135
+    return strpos($str, $find, $offset);
1136 1136
 }
1137 1137
 
1138 1138
 /**
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1148 1148
  * @return int Returns the position of the last occurrence of search.
1149 1149
  */
1150
-function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1151
-    if ( function_exists( 'mb_strrpos' ) ) {
1152
-        return mb_strrpos( $str, $find, $offset, $encoding );
1150
+function geodir_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1151
+    if (function_exists('mb_strrpos')) {
1152
+        return mb_strrpos($str, $find, $offset, $encoding);
1153 1153
     }
1154 1154
         
1155
-    return strrpos( $str, $find, $offset );
1155
+    return strrpos($str, $find, $offset);
1156 1156
 }
1157 1157
 
1158 1158
 /**
@@ -1168,16 +1168,16 @@  discard block
 block discarded – undo
1168 1168
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1169 1169
  * @return string
1170 1170
  */
1171
-function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1172
-    if ( function_exists( 'mb_substr' ) ) {
1173
-        if ( $length === null ) {
1174
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1171
+function geodir_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
1172
+    if (function_exists('mb_substr')) {
1173
+        if ($length === null) {
1174
+            return mb_substr($str, $start, geodir_utf8_strlen($str, $encoding), $encoding);
1175 1175
         } else {
1176
-            return mb_substr( $str, $start, $length, $encoding );
1176
+            return mb_substr($str, $start, $length, $encoding);
1177 1177
         }
1178 1178
     }
1179 1179
         
1180
-    return substr( $str, $start, $length );
1180
+    return substr($str, $start, $length);
1181 1181
 }
1182 1182
 
1183 1183
 /**
@@ -1190,12 +1190,12 @@  discard block
 block discarded – undo
1190 1190
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1191 1191
  * @return string The width of string.
1192 1192
  */
1193
-function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1194
-	if ( function_exists( 'mb_strwidth' ) ) {
1195
-		return mb_strwidth( $str, $encoding );
1193
+function geodir_utf8_strwidth($str, $encoding = 'UTF-8') {
1194
+	if (function_exists('mb_strwidth')) {
1195
+		return mb_strwidth($str, $encoding);
1196 1196
 	}
1197 1197
 
1198
-	return geodir_utf8_strlen( $str, $encoding );
1198
+	return geodir_utf8_strlen($str, $encoding);
1199 1199
 }
1200 1200
 
1201 1201
 /**
@@ -1209,21 +1209,21 @@  discard block
 block discarded – undo
1209 1209
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1210 1210
  * @return string The resulting string.
1211 1211
  */
1212
-function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
1213
-    if ( function_exists( 'mb_strlen' ) ) {
1214
-        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1212
+function geodir_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
1213
+    if (function_exists('mb_strlen')) {
1214
+        $first_letter = geodir_strtoupper(geodir_utf8_substr($str, 0, 1, $encoding), $encoding);
1215 1215
         $str_end = "";
1216 1216
         
1217
-        if ( $lower_str_end ) {
1218
-            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1217
+        if ($lower_str_end) {
1218
+            $str_end = geodir_strtolower(geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding), $encoding);
1219 1219
         } else {
1220
-            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1220
+            $str_end = geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding);
1221 1221
         }
1222 1222
         
1223
-        return $first_letter . $str_end;
1223
+        return $first_letter.$str_end;
1224 1224
     }
1225 1225
 
1226
-    return ucfirst( $str );
1226
+    return ucfirst($str);
1227 1227
 }
1228 1228
 
1229 1229
 function geodir_total_listings_count($post_type = false)
@@ -1233,13 +1233,13 @@  discard block
 block discarded – undo
1233 1233
 	$count = 0;
1234 1234
 	
1235 1235
 	if ($post_type) {
1236
-		$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $post_type . "_detail");
1236
+		$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$post_type."_detail");
1237 1237
 	} else {
1238 1238
 		$all_postypes = geodir_get_posttypes();
1239 1239
 
1240 1240
 		if (!empty($all_postypes)) {
1241 1241
 			foreach ($all_postypes as $key) {
1242
-				$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $key . "_detail");
1242
+				$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$key."_detail");
1243 1243
 			}
1244 1244
 		}	
1245 1245
 	}
Please login to merge, or discard this patch.
geodirectory-templates/listing-filter-form.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,26 +13,26 @@  discard block
 block discarded – undo
13 13
 global $wp_query, $current_term, $query;
14 14
 
15 15
 if (function_exists('geodir_location_geo_home_link')) {
16
-    remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
16
+	remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17 17
 }
18 18
 
19 19
 if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){
20
-    $search_url = icl_get_home_url();
20
+	$search_url = icl_get_home_url();
21 21
 } else {
22
-    $search_url = get_home_url();
22
+	$search_url = get_home_url();
23 23
 }
24 24
 
25 25
 $search_url = trailingslashit($search_url);
26 26
 
27 27
 if (function_exists('geodir_location_geo_home_link')) {
28
-    add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
28
+	add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
29 29
 }
30 30
 
31 31
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
32 32
 $form_class = 'geodir-listing-search';
33 33
 
34 34
 if($new_style){
35
-    $form_class .= ' gd-search-bar-style';
35
+	$form_class .= ' gd-search-bar-style';
36 36
 }
37 37
 ?>
38 38
 <form class="<?php
@@ -49,56 +49,56 @@  discard block
 block discarded – undo
49 49
     <div class="geodir-loc-bar">
50 50
 
51 51
         <?php
52
-        /**
53
-         * Called inside the search form but before any of the fields.
54
-         *
55
-         * @since 1.0.0
56
-         */
57
-        do_action('geodir_before_search_form') ?>
52
+		/**
53
+		 * Called inside the search form but before any of the fields.
54
+		 *
55
+		 * @since 1.0.0
56
+		 */
57
+		do_action('geodir_before_search_form') ?>
58 58
 
59 59
         <div class="clearfix geodir-loc-bar-in">
60 60
             <div class="geodir-search">
61 61
 
62 62
                 <?php
63 63
 
64
-                /**
65
-                 * Adds the input fields to the search form.
66
-                 *
67
-                 * @since 1.6.9
68
-                 */
69
-                do_action('geodir_search_form_inputs');
64
+				/**
65
+				 * Adds the input fields to the search form.
66
+				 *
67
+				 * @since 1.6.9
68
+				 */
69
+				do_action('geodir_search_form_inputs');
70 70
 
71 71
 
72 72
 
73
-                /**
74
-                 * Called on the GD search form just before the search button.
75
-                 *
76
-                 * @since 1.0.0
77
-                 */
78
-                do_action('geodir_before_search_button');
73
+				/**
74
+				 * Called on the GD search form just before the search button.
75
+				 *
76
+				 * @since 1.0.0
77
+				 */
78
+				do_action('geodir_before_search_button');
79 79
 
80 80
                 
81
-                /**
82
-                 * Called on the GD search form just after the search button.
83
-                 *
84
-                 * @since 1.0.0
85
-                 */
86
-                do_action('geodir_after_search_button');
81
+				/**
82
+				 * Called on the GD search form just after the search button.
83
+				 *
84
+				 * @since 1.0.0
85
+				 */
86
+				do_action('geodir_after_search_button');
87 87
 
88 88
                 
89
-                ?>
89
+				?>
90 90
             </div>
91 91
 
92 92
 
93 93
         </div>
94 94
 
95 95
         <?php
96
-        /**
97
-         * Called inside the search form but after all the input fields.
98
-         *
99
-         * @since 1.0.0
100
-         */
101
-        do_action('geodir_after_search_form') ?>
96
+		/**
97
+		 * Called inside the search form but after all the input fields.
98
+		 *
99
+		 * @since 1.0.0
100
+		 */
101
+		do_action('geodir_after_search_form') ?>
102 102
 
103 103
 
104 104
     </div>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17 17
 }
18 18
 
19
-if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){
19
+if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX) {
20 20
     $search_url = icl_get_home_url();
21 21
 } else {
22 22
     $search_url = get_home_url();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
32 32
 $form_class = 'geodir-listing-search';
33 33
 
34
-if($new_style){
34
+if ($new_style) {
35 35
     $form_class .= ' gd-search-bar-style';
36 36
 }
37 37
 ?>
Please login to merge, or discard this patch.
geodirectory-templates/geodir-signup.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
  */
15 15
 if (get_current_user_id()) {
16 16
 
17
-    $_redirect = home_url();
18
-    if (isset($_REQUEST['redirect_add_listing'])) {
19
-        $_redirect = $_REQUEST['redirect_add_listing'];
20
-    }
17
+	$_redirect = home_url();
18
+	if (isset($_REQUEST['redirect_add_listing'])) {
19
+		$_redirect = $_REQUEST['redirect_add_listing'];
20
+	}
21 21
 
22
-    wp_safe_redirect($_redirect , 302);
23
-    exit;
22
+	wp_safe_redirect($_redirect , 302);
23
+	exit;
24 24
 }
25 25
 
26 26
 // call header
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         $_redirect = $_REQUEST['redirect_add_listing'];
20 20
     }
21 21
 
22
-    wp_safe_redirect($_redirect , 302);
22
+    wp_safe_redirect($_redirect, 302);
23 23
     exit;
24 24
 }
25 25
 
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/title_meta_settings_array.php 2 patches
Indentation   +367 added lines, -367 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 $gd_wpseo_use = '';
12 12
 if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
13
-    $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />";
13
+	$gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />";
14 14
 }
15 15
 
16 16
 /**
@@ -21,375 +21,375 @@  discard block
 block discarded – undo
21 21
  */
22 22
 $geodir_settings['title_meta_settings'] = apply_filters('geodir_title_meta_settings', array(
23 23
 
24
-    /* Listing Permalink Settings start */
25
-    array('name' => __('Title / Meta', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set page title and meta', 'id' => 'geodir_title_meta_settings '),
24
+	/* Listing Permalink Settings start */
25
+	array('name' => __('Title / Meta', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set page title and meta', 'id' => 'geodir_title_meta_settings '),
26 26
 
27
-    array('name' => $gd_wpseo_use.__('Available Variables', 'geodirectory'),
28
-        'desc' => '%%title%%, %%sitename%%, %%sitedesc%%, %%excerpt%%, %%pt_single%%, %%pt_plural%%, %%category%%, %%id%%, %%sep%%, %%location%%, %%in_location%%, %%in_location_single%%, %%location_single%%, %%location_country%%, %%in_location_country%%, %%location_region%%, %%in_location_region%%, %%location_city%%, %%in_location_city%%, %%location_sep%%, %%search_term%%, %%search_near%%, %%name%%, %%page%%, %%pagenumber%%, %%pagetotal%%',
29
-        'type' => 'sectionstart',
30
-        'id' => 'geodir_meta_vars'),
27
+	array('name' => $gd_wpseo_use.__('Available Variables', 'geodirectory'),
28
+		'desc' => '%%title%%, %%sitename%%, %%sitedesc%%, %%excerpt%%, %%pt_single%%, %%pt_plural%%, %%category%%, %%id%%, %%sep%%, %%location%%, %%in_location%%, %%in_location_single%%, %%location_single%%, %%location_country%%, %%in_location_country%%, %%location_region%%, %%in_location_region%%, %%location_city%%, %%in_location_city%%, %%location_sep%%, %%search_term%%, %%search_near%%, %%name%%, %%page%%, %%pagenumber%%, %%pagetotal%%',
29
+		'type' => 'sectionstart',
30
+		'id' => 'geodir_meta_vars'),
31 31
 
32
-    array('type' => 'sectionend', 'id' => 'geodir_meta_vars'),
32
+	array('type' => 'sectionend', 'id' => 'geodir_meta_vars'),
33 33
     
34
-    array('name' => __('Title & Metas Settings', 'geodirectory'),
35
-        'type' => 'sectionstart',
36
-        'desc' => '',
37
-        'id' => 'geodir_titles_and_metas'),
38
-
39
-    array(  
40
-        'name' => __( 'Disable overwrite by Yoast SEO titles & metas on GD pages', 'geodirectory' ),
41
-        'desc' => __( 'This allows to disable overwriting by Yoast SEO titles & metas on GD pages. If ticked then GD pages will use titles & metas settings from GeoDirectory > Titles & Metas. Otherwise it will use titles & metas settings from SEO > Titles & Metas.', 'geodirectory' ),
42
-        'id' => 'geodir_disable_yoast_meta',
43
-        'type' => 'checkbox',
44
-        'std' => '0'
45
-    ),
46
-
47
-    array('type' => 'sectionend', 'id' => 'geodir_titles_and_metas'),
48
-
49
-    array('name' => __('Homepage Meta Settings', 'geodirectory'),
50
-        'type' => 'sectionstart',
51
-        'desc' => '',
52
-        'id' => 'geodir_home_meta'),
53
-
54
-    array(
55
-        'name' => __('Homepage meta title', 'geodirectory'),
56
-        'desc' => __('This will use the title of the page set as frontpage if left blank.', 'geodirectory'),
57
-        'id' => 'geodir_meta_title_homepage',
58
-        'type' => 'text',
59
-        'css' => 'width:100%;',
60
-        'std' => '',
61
-        'placeholder' => ''
62
-    ),
63
-
64
-    array(
65
-        'name' => __('Homepage meta description', 'geodirectory'),
66
-        'desc' => __('Enter the meta description for the homepage.', 'geodirectory'),
67
-        'id' => 'geodir_meta_desc_homepage',
68
-        'type' => 'textarea',
69
-        'css' => 'width:100%;',
70
-        'std' => ''
71
-    ),
72
-
73
-    array('type' => 'sectionend', 'id' => 'geodir_home_meta'),
74
-
75
-    // details page meta
76
-    array('name' => __('Details Page Meta Settings', 'geodirectory'),
77
-        'type' => 'sectionstart',
78
-        'desc' => '',
79
-        'id' => 'geodir_details_meta'),
80
-
81
-    array(
82
-        'name' => __('Details page meta title', 'geodirectory'),
83
-        'desc' => __('Enter the meta title for the details page.', 'geodirectory'),
84
-        'id' => 'geodir_meta_title_detail',
85
-        'type' => 'text',
86
-        'css' => 'width:100%;',
87
-        'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
88
-        'placeholder' => '%%title%% %%sep%% %%sitename%%'
89
-    ),
90
-
91
-    array(
92
-        'name' => __('Details page meta description', 'geodirectory'),
93
-        'desc' => __('Enter the meta description for the details page.', 'geodirectory'),
94
-        'id' => 'geodir_meta_desc_detail',
95
-        'type' => 'textarea',
96
-        'css' => 'width:100%;',
97
-        'std' => __('%%excerpt%%', 'geodirectory'),
98
-        'placeholder' => '%%excerpt%%'
99
-    ),
100
-
101
-    array('type' => 'sectionend', 'id' => 'geodir_details_meta'),
102
-
103
-    // CPT page meta
104
-    array('name' => __('Post Type Page Meta Settings', 'geodirectory'),
105
-        'type' => 'sectionstart',
106
-        'desc' => '',
107
-        'id' => 'geodir_pt_meta'),
108
-
109
-    array(
110
-        'name' => __('Post type page meta title', 'geodirectory'),
111
-        'desc' => __('Enter the meta title for the post type pages.', 'geodirectory'),
112
-        'id' => 'geodir_meta_title_pt',
113
-        'type' => 'text',
114
-        'css' => 'width:100%;',
115
-        'std' => __('%%pt_plural%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'),
116
-        'placeholder' => '%%pt_plural%% %%in_location%% %%sep%% %%sitename%%'
117
-    ),
118
-
119
-    array(
120
-        'name' => __('Post type page meta description', 'geodirectory'),
121
-        'desc' => __('Enter the meta description for the post type pages.', 'geodirectory'),
122
-        'id' => 'geodir_meta_desc_pt',
123
-        'type' => 'textarea',
124
-        'css' => 'width:100%;',
125
-        'std' => __('%%pt_plural%% %%in_location%%', 'geodirectory'),
126
-        'placeholder' => '%%pt_plural%% %%in_location%%'
127
-    ),
128
-
129
-    array(
130
-        'name' => __('Post type page title', 'geodirectory'),
131
-        'desc' => __('Enter the title for the post type pages.', 'geodirectory'),
132
-        'id' => 'geodir_page_title_pt',
133
-        'type' => 'text',
134
-        'css' => 'width:100%;',
135
-        'std' => __('All %%pt_plural%% %%in_location_single%%', 'geodirectory'),
136
-        'placeholder' => 'All %%pt_plural%% %%in_location_single%%'
137
-    ),
138
-
139
-    array('type' => 'sectionend', 'id' => 'geodir_pt_meta'),
140
-
141
-    // Cat listing page meta
142
-    array('name' => __('Listing Page Meta Settings', 'geodirectory'),
143
-        'type' => 'sectionstart',
144
-        'desc' => '',
145
-        'id' => 'geodir_pt_meta'),
146
-
147
-    array(
148
-        'name' => __('Listing page meta title', 'geodirectory'),
149
-        'desc' => __('Enter the meta title for the category listing pages.', 'geodirectory'),
150
-        'id' => 'geodir_meta_title_listing',
151
-        'type' => 'text',
152
-        'css' => 'width:100%;',
153
-        'std' => __('%%category%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'),
154
-        'placeholder' => '%%category%% %%in_location%% %%sep%% %%sitename%%'
155
-    ),
156
-
157
-    array(
158
-        'name' => __('Listing page meta description', 'geodirectory'),
159
-        'desc' => __('Enter the meta description for the category listing pages.', 'geodirectory'),
160
-        'id' => 'geodir_meta_desc_listing',
161
-        'type' => 'textarea',
162
-        'css' => 'width:100%;',
163
-        'std' => __('Posts related to Category: %%category%% %%in_location%%', 'geodirectory'),
164
-        'placeholder' => 'Posts related to Category: %%category%% %%in_location%%'
165
-    ),
166
-
167
-    array(
168
-        'name' => __('Category listing page title', 'geodirectory'),
169
-        'desc' => __('Enter the title for the category listing pages.', 'geodirectory'),
170
-        'id' => 'geodir_page_title_cat-listing',
171
-        'type' => 'text',
172
-        'css' => 'width:100%;',
173
-        'std' => __('All %%category%% %%in_location_single%%', 'geodirectory'),
174
-        'placeholder' => 'All %%category%% %%in_location_single%%'
175
-    ),
176
-
177
-    array(
178
-        'name' => __('Tag listing page title', 'geodirectory'),
179
-        'desc' => __('Enter the title for the tag listing pages.', 'geodirectory'),
180
-        'id' => 'geodir_page_title_tag-listing',
181
-        'type' => 'text',
182
-        'css' => 'width:100%;',
183
-        'std' => __('Tag: %%tag%% %%in_location_single%%', 'geodirectory'),
184
-        'placeholder' => 'Tag: %%tag%% %%in_location_single%%'
185
-    ),
186
-
187
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
188
-
189
-    // location page meta
190
-    array('name' => __('Location Page Meta Settings', 'geodirectory'),
191
-        'type' => 'sectionstart',
192
-        'desc' => '',
193
-        'id' => 'geodir_pt_meta'),
194
-
195
-    array(
196
-        'name' => __('Location page meta title', 'geodirectory'),
197
-        'desc' => __('Enter the meta title for the location pages.', 'geodirectory'),
198
-        'id' => 'geodir_meta_title_location',
199
-        'type' => 'text',
200
-        'css' => 'width:100%;',
201
-        'std' => __('%%title%% %%location%% %%sep%% %%sitename%%', 'geodirectory'),
202
-        'placeholder' => '%%title%% %%location%% %%sep%% %%sitename%%'
203
-    ),
204
-
205
-    array(
206
-        'name' => __('Location page meta description', 'geodirectory'),
207
-        'desc' => __('Enter the meta description for the location pages.', 'geodirectory'),
208
-        'id' => 'geodir_meta_desc_location',
209
-        'type' => 'textarea',
210
-        'css' => 'width:100%;',
211
-        'std' => __('%%location%%', 'geodirectory'),
212
-        'placeholder' => '%%location%%'
213
-    ),
214
-
215
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
216
-
217
-    // Search page meta
218
-    array('name' => __('Search Page Meta Settings', 'geodirectory'),
219
-        'type' => 'sectionstart',
220
-        'desc' => '',
221
-        'id' => 'geodir_pt_meta'),
222
-
223
-    array(
224
-        'name' => __('Search page meta title', 'geodirectory'),
225
-        'desc' => __('Enter the meta title for the search page.', 'geodirectory'),
226
-        'id' => 'geodir_meta_title_search',
227
-        'type' => 'text',
228
-        'css' => 'width:100%;',
229
-        'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%', 'geodirectory'),
230
-        'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%'
231
-    ),
232
-
233
-    array(
234
-        'name' => __('Search page meta description', 'geodirectory'),
235
-        'desc' => __('Enter the meta description for the search page.', 'geodirectory'),
236
-        'id' => 'geodir_meta_desc_search',
237
-        'type' => 'textarea',
238
-        'css' => 'width:100%;',
239
-        'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%%', 'geodirectory'),
240
-        'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%%'
241
-    ),
242
-
243
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
244
-
245
-    //Add listing page meta
246
-    array('name' => __('Add Listing Page Meta Settings', 'geodirectory'),
247
-        'type' => 'sectionstart',
248
-        'desc' => '',
249
-        'id' => 'geodir_pt_meta'),
250
-
251
-    array(
252
-        'name' => __('Add listing page meta title', 'geodirectory'),
253
-        'desc' => __('Enter the meta title for the add listing page.', 'geodirectory'),
254
-        'id' => 'geodir_meta_title_add-listing',
255
-        'type' => 'text',
256
-        'css' => 'width:100%;',
257
-        'std' => __('Add %%pt_single%% %%sep%% %%sitename%%', 'geodirectory'),
258
-        'placeholder' => 'Add %%pt_single%% %%sep%% %%sitename%%'
259
-    ),
260
-
261
-    array(
262
-        'name' => __('Add listing page meta description', 'geodirectory'),
263
-        'desc' => __('Enter the meta description for the add listing page.', 'geodirectory'),
264
-        'id' => 'geodir_meta_desc_add-listing',
265
-        'type' => 'textarea',
266
-        'css' => 'width:100%;',
267
-        'std' => __('Add %%pt_single%%', 'geodirectory'),
268
-        'placeholder' => 'Add %%pt_single%%'
269
-    ),
270
-
271
-    array(
272
-        'name' => __('Add listing page title', 'geodirectory'),
273
-        'desc' => __('Enter the title for the add listing page.', 'geodirectory'),
274
-        'id' => 'geodir_page_title_add-listing',
275
-        'type' => 'text',
276
-        'css' => 'width:100%;',
277
-        'std' => __('Add %%pt_single%%', 'geodirectory'),
278
-        'placeholder' => 'Add %%pt_single%%'
279
-    ),
280
-
281
-    array(
282
-        'name' => __('Edit listing page title', 'geodirectory'),
283
-        'desc' => __('Enter the title for the edit listing page.', 'geodirectory'),
284
-        'id' => 'geodir_page_title_edit-listing',
285
-        'type' => 'text',
286
-        'css' => 'width:100%;',
287
-        'std' => __('Edit %%pt_single%%', 'geodirectory'),
288
-        'placeholder' => 'Edit %%pt_single%%'
289
-    ),
290
-
291
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
292
-
293
-    //Author page meta
294
-    array('name' => __('Author Page Meta Settings', 'geodirectory'),
295
-        'type' => 'sectionstart',
296
-        'desc' => '',
297
-        'id' => 'geodir_pt_meta'),
298
-
299
-    array(
300
-        'name' => __('Author page meta title', 'geodirectory'),
301
-        'desc' => __('Enter the meta title for the author page.', 'geodirectory'),
302
-        'id' => 'geodir_meta_title_author',
303
-        'type' => 'text',
304
-        'css' => 'width:100%;',
305
-        'std' => __('Author: %%name%% %%sep%% %%sitename%%', 'geodirectory'),
306
-        'placeholder' => 'Author: %%name%% %%sep%% %%sitename%%'
307
-    ),
308
-
309
-    array(
310
-        'name' => __('Author page meta description', 'geodirectory'),
311
-        'desc' => __('Enter the meta description for the author page.', 'geodirectory'),
312
-        'id' => 'geodir_meta_desc_author',
313
-        'type' => 'textarea',
314
-        'css' => 'width:100%;',
315
-        'std' => ''
316
-    ),
317
-
318
-    array(
319
-        'name' => __('Author page title', 'geodirectory'),
320
-        'desc' => __('Enter the title for the author page.', 'geodirectory'),
321
-        'id' => 'geodir_page_title_author',
322
-        'type' => 'text',
323
-        'css' => 'width:100%;',
324
-        'std' => __('%%pt_plural%% by: %%name%%', 'geodirectory'),
325
-        'placeholder' => '%%pt_plural%% by: %%name%%'
326
-    ),
327
-
328
-    array(
329
-        'name' => __('Author favorite page title', 'geodirectory'),
330
-        'desc' => __('Enter the title for the author favorite page.', 'geodirectory'),
331
-        'id' => 'geodir_page_title_favorite',
332
-        'type' => 'text',
333
-        'css' => 'width:100%;',
334
-        'std' => __('%%name%%: Favorite %%pt_plural%%', 'geodirectory'),
335
-        'placeholder' => '%%name%%: Favorite %%pt_plural%%'
336
-    ),
337
-
338
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
339
-
340
-    //Login page meta
341
-    array('name' => __('Login Page Meta Settings', 'geodirectory'),
342
-        'type' => 'sectionstart',
343
-        'desc' => '',
344
-        'id' => 'geodir_login_meta'),
345
-
346
-    array(
347
-        'name' => __('Login page meta title', 'geodirectory'),
348
-        'desc' => __('Enter the meta title for the login page.', 'geodirectory'),
349
-        'id' => 'geodir_meta_title_login',
350
-        'type' => 'text',
351
-        'css' => 'width:100%;',
352
-        'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
353
-        'placeholder' => '%%title%% %%sep%% %%sitename%%'
354
-    ),
355
-
356
-    array(
357
-        'name' => __('Login page meta description', 'geodirectory'),
358
-        'desc' => __('Enter the meta description for the login page.', 'geodirectory'),
359
-        'id' => 'geodir_meta_desc_login',
360
-        'type' => 'textarea',
361
-        'css' => 'width:100%;',
362
-        'std' => ''
363
-    ),
364
-
365
-    array('type' => 'sectionend', 'id' => 'geodir_login_meta'),
366
-
367
-    //Listing success page meta
368
-    array('name' => __('Listing Success Page Meta Settings', 'geodirectory'),
369
-        'type' => 'sectionstart',
370
-        'desc' => '',
371
-        'id' => 'geodir_login_meta'),
372
-
373
-    array(
374
-        'name' => __('Listing success page meta title', 'geodirectory'),
375
-        'desc' => __('Enter the meta title for the listing success page.', 'geodirectory'),
376
-        'id' => 'geodir_meta_title_listing-success',
377
-        'type' => 'text',
378
-        'css' => 'width:100%;',
379
-        'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
380
-        'placeholder' => '%%title%% %%sep%% %%sitename%%'
381
-    ),
382
-
383
-    array(
384
-        'name' => __('Listing success page meta description', 'geodirectory'),
385
-        'desc' => __('Enter the meta description for the listing success page.', 'geodirectory'),
386
-        'id' => 'geodir_meta_desc_listing-success',
387
-        'type' => 'textarea',
388
-        'css' => 'width:100%;',
389
-        'std' => ''
390
-    ),
391
-
392
-    array('type' => 'sectionend', 'id' => 'geodir_login_meta'),
34
+	array('name' => __('Title & Metas Settings', 'geodirectory'),
35
+		'type' => 'sectionstart',
36
+		'desc' => '',
37
+		'id' => 'geodir_titles_and_metas'),
38
+
39
+	array(  
40
+		'name' => __( 'Disable overwrite by Yoast SEO titles & metas on GD pages', 'geodirectory' ),
41
+		'desc' => __( 'This allows to disable overwriting by Yoast SEO titles & metas on GD pages. If ticked then GD pages will use titles & metas settings from GeoDirectory > Titles & Metas. Otherwise it will use titles & metas settings from SEO > Titles & Metas.', 'geodirectory' ),
42
+		'id' => 'geodir_disable_yoast_meta',
43
+		'type' => 'checkbox',
44
+		'std' => '0'
45
+	),
46
+
47
+	array('type' => 'sectionend', 'id' => 'geodir_titles_and_metas'),
48
+
49
+	array('name' => __('Homepage Meta Settings', 'geodirectory'),
50
+		'type' => 'sectionstart',
51
+		'desc' => '',
52
+		'id' => 'geodir_home_meta'),
53
+
54
+	array(
55
+		'name' => __('Homepage meta title', 'geodirectory'),
56
+		'desc' => __('This will use the title of the page set as frontpage if left blank.', 'geodirectory'),
57
+		'id' => 'geodir_meta_title_homepage',
58
+		'type' => 'text',
59
+		'css' => 'width:100%;',
60
+		'std' => '',
61
+		'placeholder' => ''
62
+	),
63
+
64
+	array(
65
+		'name' => __('Homepage meta description', 'geodirectory'),
66
+		'desc' => __('Enter the meta description for the homepage.', 'geodirectory'),
67
+		'id' => 'geodir_meta_desc_homepage',
68
+		'type' => 'textarea',
69
+		'css' => 'width:100%;',
70
+		'std' => ''
71
+	),
72
+
73
+	array('type' => 'sectionend', 'id' => 'geodir_home_meta'),
74
+
75
+	// details page meta
76
+	array('name' => __('Details Page Meta Settings', 'geodirectory'),
77
+		'type' => 'sectionstart',
78
+		'desc' => '',
79
+		'id' => 'geodir_details_meta'),
80
+
81
+	array(
82
+		'name' => __('Details page meta title', 'geodirectory'),
83
+		'desc' => __('Enter the meta title for the details page.', 'geodirectory'),
84
+		'id' => 'geodir_meta_title_detail',
85
+		'type' => 'text',
86
+		'css' => 'width:100%;',
87
+		'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
88
+		'placeholder' => '%%title%% %%sep%% %%sitename%%'
89
+	),
90
+
91
+	array(
92
+		'name' => __('Details page meta description', 'geodirectory'),
93
+		'desc' => __('Enter the meta description for the details page.', 'geodirectory'),
94
+		'id' => 'geodir_meta_desc_detail',
95
+		'type' => 'textarea',
96
+		'css' => 'width:100%;',
97
+		'std' => __('%%excerpt%%', 'geodirectory'),
98
+		'placeholder' => '%%excerpt%%'
99
+	),
100
+
101
+	array('type' => 'sectionend', 'id' => 'geodir_details_meta'),
102
+
103
+	// CPT page meta
104
+	array('name' => __('Post Type Page Meta Settings', 'geodirectory'),
105
+		'type' => 'sectionstart',
106
+		'desc' => '',
107
+		'id' => 'geodir_pt_meta'),
108
+
109
+	array(
110
+		'name' => __('Post type page meta title', 'geodirectory'),
111
+		'desc' => __('Enter the meta title for the post type pages.', 'geodirectory'),
112
+		'id' => 'geodir_meta_title_pt',
113
+		'type' => 'text',
114
+		'css' => 'width:100%;',
115
+		'std' => __('%%pt_plural%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'),
116
+		'placeholder' => '%%pt_plural%% %%in_location%% %%sep%% %%sitename%%'
117
+	),
118
+
119
+	array(
120
+		'name' => __('Post type page meta description', 'geodirectory'),
121
+		'desc' => __('Enter the meta description for the post type pages.', 'geodirectory'),
122
+		'id' => 'geodir_meta_desc_pt',
123
+		'type' => 'textarea',
124
+		'css' => 'width:100%;',
125
+		'std' => __('%%pt_plural%% %%in_location%%', 'geodirectory'),
126
+		'placeholder' => '%%pt_plural%% %%in_location%%'
127
+	),
128
+
129
+	array(
130
+		'name' => __('Post type page title', 'geodirectory'),
131
+		'desc' => __('Enter the title for the post type pages.', 'geodirectory'),
132
+		'id' => 'geodir_page_title_pt',
133
+		'type' => 'text',
134
+		'css' => 'width:100%;',
135
+		'std' => __('All %%pt_plural%% %%in_location_single%%', 'geodirectory'),
136
+		'placeholder' => 'All %%pt_plural%% %%in_location_single%%'
137
+	),
138
+
139
+	array('type' => 'sectionend', 'id' => 'geodir_pt_meta'),
140
+
141
+	// Cat listing page meta
142
+	array('name' => __('Listing Page Meta Settings', 'geodirectory'),
143
+		'type' => 'sectionstart',
144
+		'desc' => '',
145
+		'id' => 'geodir_pt_meta'),
146
+
147
+	array(
148
+		'name' => __('Listing page meta title', 'geodirectory'),
149
+		'desc' => __('Enter the meta title for the category listing pages.', 'geodirectory'),
150
+		'id' => 'geodir_meta_title_listing',
151
+		'type' => 'text',
152
+		'css' => 'width:100%;',
153
+		'std' => __('%%category%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'),
154
+		'placeholder' => '%%category%% %%in_location%% %%sep%% %%sitename%%'
155
+	),
156
+
157
+	array(
158
+		'name' => __('Listing page meta description', 'geodirectory'),
159
+		'desc' => __('Enter the meta description for the category listing pages.', 'geodirectory'),
160
+		'id' => 'geodir_meta_desc_listing',
161
+		'type' => 'textarea',
162
+		'css' => 'width:100%;',
163
+		'std' => __('Posts related to Category: %%category%% %%in_location%%', 'geodirectory'),
164
+		'placeholder' => 'Posts related to Category: %%category%% %%in_location%%'
165
+	),
166
+
167
+	array(
168
+		'name' => __('Category listing page title', 'geodirectory'),
169
+		'desc' => __('Enter the title for the category listing pages.', 'geodirectory'),
170
+		'id' => 'geodir_page_title_cat-listing',
171
+		'type' => 'text',
172
+		'css' => 'width:100%;',
173
+		'std' => __('All %%category%% %%in_location_single%%', 'geodirectory'),
174
+		'placeholder' => 'All %%category%% %%in_location_single%%'
175
+	),
176
+
177
+	array(
178
+		'name' => __('Tag listing page title', 'geodirectory'),
179
+		'desc' => __('Enter the title for the tag listing pages.', 'geodirectory'),
180
+		'id' => 'geodir_page_title_tag-listing',
181
+		'type' => 'text',
182
+		'css' => 'width:100%;',
183
+		'std' => __('Tag: %%tag%% %%in_location_single%%', 'geodirectory'),
184
+		'placeholder' => 'Tag: %%tag%% %%in_location_single%%'
185
+	),
186
+
187
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
188
+
189
+	// location page meta
190
+	array('name' => __('Location Page Meta Settings', 'geodirectory'),
191
+		'type' => 'sectionstart',
192
+		'desc' => '',
193
+		'id' => 'geodir_pt_meta'),
194
+
195
+	array(
196
+		'name' => __('Location page meta title', 'geodirectory'),
197
+		'desc' => __('Enter the meta title for the location pages.', 'geodirectory'),
198
+		'id' => 'geodir_meta_title_location',
199
+		'type' => 'text',
200
+		'css' => 'width:100%;',
201
+		'std' => __('%%title%% %%location%% %%sep%% %%sitename%%', 'geodirectory'),
202
+		'placeholder' => '%%title%% %%location%% %%sep%% %%sitename%%'
203
+	),
204
+
205
+	array(
206
+		'name' => __('Location page meta description', 'geodirectory'),
207
+		'desc' => __('Enter the meta description for the location pages.', 'geodirectory'),
208
+		'id' => 'geodir_meta_desc_location',
209
+		'type' => 'textarea',
210
+		'css' => 'width:100%;',
211
+		'std' => __('%%location%%', 'geodirectory'),
212
+		'placeholder' => '%%location%%'
213
+	),
214
+
215
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
216
+
217
+	// Search page meta
218
+	array('name' => __('Search Page Meta Settings', 'geodirectory'),
219
+		'type' => 'sectionstart',
220
+		'desc' => '',
221
+		'id' => 'geodir_pt_meta'),
222
+
223
+	array(
224
+		'name' => __('Search page meta title', 'geodirectory'),
225
+		'desc' => __('Enter the meta title for the search page.', 'geodirectory'),
226
+		'id' => 'geodir_meta_title_search',
227
+		'type' => 'text',
228
+		'css' => 'width:100%;',
229
+		'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%', 'geodirectory'),
230
+		'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%'
231
+	),
232
+
233
+	array(
234
+		'name' => __('Search page meta description', 'geodirectory'),
235
+		'desc' => __('Enter the meta description for the search page.', 'geodirectory'),
236
+		'id' => 'geodir_meta_desc_search',
237
+		'type' => 'textarea',
238
+		'css' => 'width:100%;',
239
+		'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%%', 'geodirectory'),
240
+		'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%%'
241
+	),
242
+
243
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
244
+
245
+	//Add listing page meta
246
+	array('name' => __('Add Listing Page Meta Settings', 'geodirectory'),
247
+		'type' => 'sectionstart',
248
+		'desc' => '',
249
+		'id' => 'geodir_pt_meta'),
250
+
251
+	array(
252
+		'name' => __('Add listing page meta title', 'geodirectory'),
253
+		'desc' => __('Enter the meta title for the add listing page.', 'geodirectory'),
254
+		'id' => 'geodir_meta_title_add-listing',
255
+		'type' => 'text',
256
+		'css' => 'width:100%;',
257
+		'std' => __('Add %%pt_single%% %%sep%% %%sitename%%', 'geodirectory'),
258
+		'placeholder' => 'Add %%pt_single%% %%sep%% %%sitename%%'
259
+	),
260
+
261
+	array(
262
+		'name' => __('Add listing page meta description', 'geodirectory'),
263
+		'desc' => __('Enter the meta description for the add listing page.', 'geodirectory'),
264
+		'id' => 'geodir_meta_desc_add-listing',
265
+		'type' => 'textarea',
266
+		'css' => 'width:100%;',
267
+		'std' => __('Add %%pt_single%%', 'geodirectory'),
268
+		'placeholder' => 'Add %%pt_single%%'
269
+	),
270
+
271
+	array(
272
+		'name' => __('Add listing page title', 'geodirectory'),
273
+		'desc' => __('Enter the title for the add listing page.', 'geodirectory'),
274
+		'id' => 'geodir_page_title_add-listing',
275
+		'type' => 'text',
276
+		'css' => 'width:100%;',
277
+		'std' => __('Add %%pt_single%%', 'geodirectory'),
278
+		'placeholder' => 'Add %%pt_single%%'
279
+	),
280
+
281
+	array(
282
+		'name' => __('Edit listing page title', 'geodirectory'),
283
+		'desc' => __('Enter the title for the edit listing page.', 'geodirectory'),
284
+		'id' => 'geodir_page_title_edit-listing',
285
+		'type' => 'text',
286
+		'css' => 'width:100%;',
287
+		'std' => __('Edit %%pt_single%%', 'geodirectory'),
288
+		'placeholder' => 'Edit %%pt_single%%'
289
+	),
290
+
291
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
292
+
293
+	//Author page meta
294
+	array('name' => __('Author Page Meta Settings', 'geodirectory'),
295
+		'type' => 'sectionstart',
296
+		'desc' => '',
297
+		'id' => 'geodir_pt_meta'),
298
+
299
+	array(
300
+		'name' => __('Author page meta title', 'geodirectory'),
301
+		'desc' => __('Enter the meta title for the author page.', 'geodirectory'),
302
+		'id' => 'geodir_meta_title_author',
303
+		'type' => 'text',
304
+		'css' => 'width:100%;',
305
+		'std' => __('Author: %%name%% %%sep%% %%sitename%%', 'geodirectory'),
306
+		'placeholder' => 'Author: %%name%% %%sep%% %%sitename%%'
307
+	),
308
+
309
+	array(
310
+		'name' => __('Author page meta description', 'geodirectory'),
311
+		'desc' => __('Enter the meta description for the author page.', 'geodirectory'),
312
+		'id' => 'geodir_meta_desc_author',
313
+		'type' => 'textarea',
314
+		'css' => 'width:100%;',
315
+		'std' => ''
316
+	),
317
+
318
+	array(
319
+		'name' => __('Author page title', 'geodirectory'),
320
+		'desc' => __('Enter the title for the author page.', 'geodirectory'),
321
+		'id' => 'geodir_page_title_author',
322
+		'type' => 'text',
323
+		'css' => 'width:100%;',
324
+		'std' => __('%%pt_plural%% by: %%name%%', 'geodirectory'),
325
+		'placeholder' => '%%pt_plural%% by: %%name%%'
326
+	),
327
+
328
+	array(
329
+		'name' => __('Author favorite page title', 'geodirectory'),
330
+		'desc' => __('Enter the title for the author favorite page.', 'geodirectory'),
331
+		'id' => 'geodir_page_title_favorite',
332
+		'type' => 'text',
333
+		'css' => 'width:100%;',
334
+		'std' => __('%%name%%: Favorite %%pt_plural%%', 'geodirectory'),
335
+		'placeholder' => '%%name%%: Favorite %%pt_plural%%'
336
+	),
337
+
338
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
339
+
340
+	//Login page meta
341
+	array('name' => __('Login Page Meta Settings', 'geodirectory'),
342
+		'type' => 'sectionstart',
343
+		'desc' => '',
344
+		'id' => 'geodir_login_meta'),
345
+
346
+	array(
347
+		'name' => __('Login page meta title', 'geodirectory'),
348
+		'desc' => __('Enter the meta title for the login page.', 'geodirectory'),
349
+		'id' => 'geodir_meta_title_login',
350
+		'type' => 'text',
351
+		'css' => 'width:100%;',
352
+		'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
353
+		'placeholder' => '%%title%% %%sep%% %%sitename%%'
354
+	),
355
+
356
+	array(
357
+		'name' => __('Login page meta description', 'geodirectory'),
358
+		'desc' => __('Enter the meta description for the login page.', 'geodirectory'),
359
+		'id' => 'geodir_meta_desc_login',
360
+		'type' => 'textarea',
361
+		'css' => 'width:100%;',
362
+		'std' => ''
363
+	),
364
+
365
+	array('type' => 'sectionend', 'id' => 'geodir_login_meta'),
366
+
367
+	//Listing success page meta
368
+	array('name' => __('Listing Success Page Meta Settings', 'geodirectory'),
369
+		'type' => 'sectionstart',
370
+		'desc' => '',
371
+		'id' => 'geodir_login_meta'),
372
+
373
+	array(
374
+		'name' => __('Listing success page meta title', 'geodirectory'),
375
+		'desc' => __('Enter the meta title for the listing success page.', 'geodirectory'),
376
+		'id' => 'geodir_meta_title_listing-success',
377
+		'type' => 'text',
378
+		'css' => 'width:100%;',
379
+		'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
380
+		'placeholder' => '%%title%% %%sep%% %%sitename%%'
381
+	),
382
+
383
+	array(
384
+		'name' => __('Listing success page meta description', 'geodirectory'),
385
+		'desc' => __('Enter the meta description for the listing success page.', 'geodirectory'),
386
+		'id' => 'geodir_meta_desc_listing-success',
387
+		'type' => 'textarea',
388
+		'css' => 'width:100%;',
389
+		'std' => ''
390
+	),
391
+
392
+	array('type' => 'sectionend', 'id' => 'geodir_login_meta'),
393 393
 
394 394
 
395 395
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 $gd_wpseo_use = '';
12 12
 if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
13
-    $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />";
13
+    $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.', 'geodirectory')."</b><br />";
14 14
 }
15 15
 
16 16
 /**
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
         'id' => 'geodir_titles_and_metas'),
38 38
 
39 39
     array(  
40
-        'name' => __( 'Disable overwrite by Yoast SEO titles & metas on GD pages', 'geodirectory' ),
41
-        'desc' => __( 'This allows to disable overwriting by Yoast SEO titles & metas on GD pages. If ticked then GD pages will use titles & metas settings from GeoDirectory > Titles & Metas. Otherwise it will use titles & metas settings from SEO > Titles & Metas.', 'geodirectory' ),
40
+        'name' => __('Disable overwrite by Yoast SEO titles & metas on GD pages', 'geodirectory'),
41
+        'desc' => __('This allows to disable overwriting by Yoast SEO titles & metas on GD pages. If ticked then GD pages will use titles & metas settings from GeoDirectory > Titles & Metas. Otherwise it will use titles & metas settings from SEO > Titles & Metas.', 'geodirectory'),
42 42
         'id' => 'geodir_disable_yoast_meta',
43 43
         'type' => 'checkbox',
44 44
         'std' => '0'
Please login to merge, or discard this patch.