@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $title = str_replace($srcharr, $replarr, $post_title); |
| 65 | 65 | |
| 66 | 66 | if (is_ssl()) {
|
| 67 | - $icon = str_replace("http:","https:",$icon );
|
|
| 67 | + $icon = str_replace("http:", "https:", $icon);
|
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | if ($icon != '') {
|
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $icon_size = array('w' => 36, 'h' => 45);
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
|
|
| 83 | + $post_json = '{"id":"'.$post->ID.'","t": "'.$title.'","lt": "'.$post->post_latitude.'","ln": "'.$post->post_longitude.'","mk_id":"'.$post->ID.'_'.$post->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"}';
|
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Filter the json data when creating output for post json marker.. |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @param string $post_json JSON representation of the post marker info. |
| 90 | 90 | * @param object $post The post object. |
| 91 | 91 | */ |
| 92 | - $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
|
|
| 92 | + $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
|
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | if (is_array($map_jason) && !empty($map_jason)) {
|
| 111 | 111 | if ($canvas == 'detail_page_map_canvas') {
|
| 112 | 112 | global $post; |
| 113 | - foreach($map_jason as $key => $content) |
|
| 113 | + foreach ($map_jason as $key => $content) |
|
| 114 | 114 | {
|
| 115 | 115 | $content = json_decode($content); |
| 116 | - if ( $content->id != $post->ID ) {
|
|
| 116 | + if ($content->id != $post->ID) {
|
|
| 117 | 117 | unset($map_jason[$key]); |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | } |
| 122 | - $canvas_jason = $canvas . "_jason"; |
|
| 122 | + $canvas_jason = $canvas."_jason"; |
|
| 123 | 123 | $map_canvas_arr[$canvas] = array_unique($map_jason); |
| 124 | 124 | unset($cat_content_info); |
| 125 | 125 | $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
|
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | if (!empty($cat_content_info)) {
|
| 128 | 128 | $json_content = substr(implode(',', $cat_content_info), 1);
|
| 129 | 129 | $json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
| 130 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 130 | + $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
|
|
| 131 | 131 | } else {
|
| 132 | 132 | $canvas_jason = '[{"totalcount":"0"}]';
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 135 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | * @param string $canvas Map canvas array key. |
| 145 | 145 | * @param array $map_canvas_jason_args Map canvas args. |
| 146 | 146 | */ |
| 147 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 147 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
|
|
| 148 | 148 | |
| 149 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 149 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
|
|
| 150 | 150 | } else {
|
| 151 | 151 | $canvas_jason = '[{"totalcount":"0"}]';
|
| 152 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 152 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | * @param string $canvas Map canvas array key. |
| 162 | 162 | * @param array $map_canvas_jason_args Map canvas args. |
| 163 | 163 | */ |
| 164 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 165 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 164 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
|
|
| 165 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
|
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
| 227 | - $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 227 | + $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
| 228 | 228 | |
| 229 | 229 | $geodir_cat_icons = geodir_get_term_icon(); |
| 230 | 230 | |
@@ -240,16 +240,16 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | // Untick the category by default on home map |
| 242 | 242 | if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
|
| 243 | - if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
|
|
| 243 | + if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$cat_term->term_id, $geodir_home_map_untick)) {
|
|
| 244 | 244 | $checked = ''; |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
| 249 | - $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
| 250 | - $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
| 251 | - $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
| 252 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 248 | + $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"'; |
|
| 249 | + $term_check .= ' name="'.$map_canvas_name.'_cat[]" '; |
|
| 250 | + $term_check .= ' title="'.esc_attr(ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">'; |
|
| 251 | + $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.ucfirst($cat_term->name).'"/>'; |
|
| 252 | + $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 253 | 253 | |
| 254 | 254 | endif; |
| 255 | 255 | |
@@ -361,11 +361,11 @@ discard block |
||
| 361 | 361 | * @package GeoDirectory |
| 362 | 362 | */ |
| 363 | 363 | function geodir_map_load_style() {
|
| 364 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
|
|
| 364 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
|
|
| 365 | 365 | ?> |
| 366 | 366 | <script type="text/javascript"> |
| 367 | 367 | if (!(window.google && typeof google.maps !== 'undefined')) {
|
| 368 | - document.write('<' + 'link id="geodirectory-leaflet-style-css" media="all" type="text/css" href="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>" rel="stylesheet"' + '>');
|
|
| 368 | + document.write('<' + 'link id="geodirectory-leaflet-style-css" media="all" type="text/css" href="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>" rel="stylesheet"' + '>');
|
|
| 369 | 369 | } |
| 370 | 370 | </script> |
| 371 | 371 | <?php |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | * @package GeoDirectory |
| 382 | 382 | */ |
| 383 | 383 | function geodir_map_load_script() {
|
| 384 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
|
|
| 384 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
|
|
| 385 | 385 | ?> |
| 386 | 386 | <script type="text/javascript"> |
| 387 | 387 | if (!(window.google && typeof google.maps !== 'undefined')) {
|
| 388 | - document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
|
|
| 389 | - document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
|
|
| 388 | + document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
|
|
| 389 | + document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
|
|
| 390 | 390 | } |
| 391 | 391 | </script> |
| 392 | 392 | <?php |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | } // Distance |
| 100 | 100 | |
| 101 | 101 | if (isset($_REQUEST['sgeo_lat'])) {
|
| 102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 102 | + $mylat = (float) esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | 103 | } else {
|
| 104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
| 104 | + $mylat = (float) geodir_get_current_city_lat(); |
|
| 105 | 105 | } // Latatude |
| 106 | 106 | |
| 107 | 107 | if (isset($_REQUEST['sgeo_lon'])) {
|
| 108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 108 | + $mylon = (float) esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | 109 | } else {
|
| 110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
| 110 | + $mylon = (float) geodir_get_current_city_lng(); |
|
| 111 | 111 | } // Distance |
| 112 | 112 | |
| 113 | 113 | if (isset($_REQUEST['snear'])) {
|
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | if ($snear == 'NEAR ME') {
|
| 122 | 122 | $ip = $_SERVER['REMOTE_ADDR']; |
| 123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
|
|
| 124 | 124 | $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
| 125 | 125 | $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
| 126 | 126 | } |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | $s_AA = str_replace(" ", "", $s);
|
| 131 | 131 | $s_A = explode(",", $s_AA);
|
| 132 | 132 | $s_A = implode('","', $s_A);
|
| 133 | - $s_A = '"' . $s_A . '"'; |
|
| 133 | + $s_A = '"'.$s_A.'"'; |
|
| 134 | 134 | } else {
|
| 135 | - $s_A = '"' . $s . '"'; |
|
| 135 | + $s_A = '"'.$s.'"'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (strstr($s, ' ')) {
|
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
| 195 | 195 | |
| 196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 196 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 197 | 197 | |
| 198 | 198 | add_filter('posts_fields', 'geodir_posts_fields', 1);
|
| 199 | 199 | add_filter('posts_join', 'geodir_posts_join', 1);
|
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
| 234 | 234 | |
| 235 | 235 | // Filter-Location-Manager to add location table. |
| 236 | - $fields .= ", " . $table . ".* "; |
|
| 236 | + $fields .= ", ".$table.".* "; |
|
| 237 | 237 | |
| 238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) {
|
| 239 | 239 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
@@ -243,16 +243,16 @@ discard block |
||
| 243 | 243 | $mylon = $gd_session->get('user_lon');
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 246 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | global $s; |
| 250 | 250 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
| 251 | 251 | $keywords = explode(" ", $s);
|
| 252 | 252 | |
| 253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | - foreach($keywords as $kkey=>$kword){
|
|
| 255 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 253 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 254 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 255 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) {
|
|
| 256 | 256 | unset($keywords[$kkey]); |
| 257 | 257 | } |
| 258 | 258 | } |
@@ -270,24 +270,24 @@ discard block |
||
| 270 | 270 | $count = 0; |
| 271 | 271 | foreach ($keywords as $keyword) {
|
| 272 | 272 | $keyword = trim($keyword); |
| 273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 273 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
| 274 | 274 | $count++; |
| 275 | 275 | if ($count < count($keywords)) {
|
| 276 | 276 | // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
| 277 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
|
| 277 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." "; |
|
| 278 | 278 | } else {
|
| 279 | 279 | //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
| 280 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
|
| 280 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) "; |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.","; |
|
| 284 | 284 | } |
| 285 | 285 | } else {
|
| 286 | 286 | $gd_titlematch_part = ""; |
| 287 | 287 | } |
| 288 | - $s = stripslashes_deep( $s ); |
|
| 289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 290 | - $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
|
|
| 288 | + $s = stripslashes_deep($s); |
|
| 289 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
| 290 | + $fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s));
|
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | return $fields; |
@@ -316,13 +316,13 @@ discard block |
||
| 316 | 316 | $lang_code = ICL_LANGUAGE_CODE; |
| 317 | 317 | $default_lang_code = $sitepress->get_default_language(); |
| 318 | 318 | if ($lang_code) {
|
| 319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 319 | + $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | } |
| 323 | 323 | ########### WPML ########### |
| 324 | 324 | |
| 325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 325 | + $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID) ";
|
|
| 326 | 326 | //===old code start |
| 327 | 327 | //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
| 328 | 328 | |
@@ -405,20 +405,20 @@ discard block |
||
| 405 | 405 | break; |
| 406 | 406 | case 'low_review': |
| 407 | 407 | case 'rating_count_asc': |
| 408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 408 | + $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, "; |
|
| 409 | 409 | break; |
| 410 | 410 | case 'high_review': |
| 411 | 411 | case 'rating_count_desc': |
| 412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 412 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
| 413 | 413 | break; |
| 414 | 414 | case 'low_rating': |
| 415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 415 | + $orderby = "( ".$table.".overall_rating ) ASC, ".$table.".rating_count ASC, "; |
|
| 416 | 416 | break; |
| 417 | 417 | case 'high_rating': |
| 418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 418 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
| 419 | 419 | break; |
| 420 | 420 | case 'featured': |
| 421 | - $orderby = $table . ".is_featured asc, "; |
|
| 421 | + $orderby = $table.".is_featured asc, "; |
|
| 422 | 422 | break; |
| 423 | 423 | case 'nearest': |
| 424 | 424 | $orderby = " distance asc, "; |
@@ -441,24 +441,24 @@ discard block |
||
| 441 | 441 | |
| 442 | 442 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
| 443 | 443 | $keywords = explode(" ", $s);
|
| 444 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 445 | - foreach($keywords as $kkey=>$kword){
|
|
| 446 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 444 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 445 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 446 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) {
|
|
| 447 | 447 | unset($keywords[$kkey]); |
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
| 452 | 452 | if (count($keywords) > 1) {
|
| 453 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 453 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 454 | 454 | } else {
|
| 455 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 455 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 456 | 456 | } |
| 457 | 457 | } else {
|
| 458 | 458 | if (count($keywords) > 1) {
|
| 459 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 459 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby; |
|
| 460 | 460 | } else {
|
| 461 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 461 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby; |
|
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | } |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | */ |
| 474 | 474 | $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
| 475 | 475 | |
| 476 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 476 | + $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 477 | 477 | |
| 478 | 478 | return $orderby; |
| 479 | 479 | } |
@@ -505,31 +505,31 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
| 507 | 507 | |
| 508 | - $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 508 | + $sort_by = str_replace('_'.$order, '', $sort_by);
|
|
| 509 | 509 | |
| 510 | 510 | switch ($sort_by): |
| 511 | 511 | |
| 512 | 512 | case 'post_date': |
| 513 | 513 | case 'comment_count': |
| 514 | 514 | |
| 515 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 515 | + $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", "; |
|
| 516 | 516 | break; |
| 517 | 517 | |
| 518 | 518 | case 'distance': |
| 519 | - $orderby = $sort_by . " " . $order . ", "; |
|
| 519 | + $orderby = $sort_by." ".$order.", "; |
|
| 520 | 520 | break; |
| 521 | 521 | |
| 522 | 522 | |
| 523 | 523 | // sort by rating |
| 524 | 524 | case 'overall_rating': |
| 525 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 525 | + $orderby = " ".$table.".".$sort_by." ".$order.", ".$table.".rating_count ".$order.", "; |
|
| 526 | 526 | |
| 527 | 527 | break; |
| 528 | 528 | |
| 529 | 529 | |
| 530 | 530 | default: |
| 531 | 531 | if (geodir_column_exist($table, $sort_by)) {
|
| 532 | - $orderby = $table . "." . $sort_by . " " . $order . ", "; |
|
| 532 | + $orderby = $table.".".$sort_by." ".$order.", "; |
|
| 533 | 533 | } |
| 534 | 534 | break; |
| 535 | 535 | |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | //if (!geodir_is_page('detail'))
|
| 580 | - add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 580 | + add_filter('posts_where', 'geodir_default_where', 1); /**/
|
|
| 581 | 581 | |
| 582 | 582 | //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
| 583 | 583 | |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
| 649 | 649 | //echo '##########'.$q_post_type; |
| 650 | 650 | if ($lang_code && $q_post_type) {
|
| 651 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 651 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
|
|
| 652 | 652 | //$where .= " AND icl_t.language_code = '$lang_code' "; |
| 653 | 653 | } |
| 654 | 654 | |
@@ -715,8 +715,8 @@ discard block |
||
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | $s = trim($s); |
| 718 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 719 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 718 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
| 719 | + $s_A = wp_specialchars_decode($s_A, ENT_QUOTES); |
|
| 720 | 720 | |
| 721 | 721 | $where = ''; |
| 722 | 722 | $better_search_terms = ''; |
@@ -727,9 +727,9 @@ discard block |
||
| 727 | 727 | |
| 728 | 728 | if ($s != '') {
|
| 729 | 729 | $keywords = explode(" ", $s);
|
| 730 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 731 | - foreach($keywords as $kkey=>$kword){
|
|
| 732 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 730 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 731 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 732 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) {
|
|
| 733 | 733 | unset($keywords[$kkey]); |
| 734 | 734 | } |
| 735 | 735 | } |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | if (!empty($keywords)) {
|
| 739 | 739 | foreach ($keywords as $keyword) {
|
| 740 | 740 | $keyword = trim($keyword); |
| 741 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 741 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
| 742 | 742 | if ($keyword != '') {
|
| 743 | 743 | /** |
| 744 | 744 | * Filter the search query keywords SQL. |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | * @param array $keywords The array of keywords for the query. |
| 750 | 750 | * @param string $keyword The single keyword being searched. |
| 751 | 751 | */ |
| 752 | - $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
|
|
| 752 | + $better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword);
|
|
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | } |
@@ -757,10 +757,10 @@ discard block |
||
| 757 | 757 | |
| 758 | 758 | /* get taxonomy */ |
| 759 | 759 | $taxonomies = geodir_get_taxonomies($post_types, true); |
| 760 | - if($taxonomies) {
|
|
| 760 | + if ($taxonomies) {
|
|
| 761 | 761 | $taxonomies = implode("','", $taxonomies);
|
| 762 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 763 | - }else{$taxonomies='';}
|
|
| 762 | + $taxonomies = "'".$taxonomies."'"; |
|
| 763 | + } else {$taxonomies = ''; }
|
|
| 764 | 764 | |
| 765 | 765 | $content_where = $terms_where = ''; |
| 766 | 766 | if ($s != '') {
|
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | * @package GeoDirectory |
| 772 | 772 | * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
| 773 | 773 | */ |
| 774 | - $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
|
| 774 | + $content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
|
| 775 | 775 | /** |
| 776 | 776 | * Filter the search query term values. |
| 777 | 777 | * |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | * @package GeoDirectory |
| 780 | 780 | * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
| 781 | 781 | */ |
| 782 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 782 | + $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | if ($snear != '') {
|
@@ -814,12 +814,12 @@ discard block |
||
| 814 | 814 | ) |
| 815 | 815 | AND $wpdb->posts.post_type in ('{$post_types}')
|
| 816 | 816 | AND ($wpdb->posts.post_status = 'publish') |
| 817 | - AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
|
| 818 | - AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
|
| 817 | + AND ( ".$table.".post_latitude between $rlat1 and $rlat2 ) |
|
| 818 | + AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) "; |
|
| 819 | 819 | |
| 820 | 820 | if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
| 821 | 821 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
| 822 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 822 | + $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist;
|
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | } else {
|
@@ -840,11 +840,11 @@ discard block |
||
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | ########### WPML ########### |
| 843 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 843 | + if (function_exists('icl_object_id')) {
|
|
| 844 | 844 | $lang_code = ICL_LANGUAGE_CODE; |
| 845 | 845 | |
| 846 | 846 | if ($lang_code && $post_types) {
|
| 847 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 847 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
|
|
| 848 | 848 | } |
| 849 | 849 | } |
| 850 | 850 | ########### WPML ########### |
@@ -867,10 +867,10 @@ discard block |
||
| 867 | 867 | global $wpdb, $geodir_post_type, $table, $curr; |
| 868 | 868 | |
| 869 | 869 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
| 870 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 870 | + $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0; |
|
| 871 | 871 | |
| 872 | 872 | if (isset($_REQUEST['stype'])) {
|
| 873 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 873 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
|
|
| 874 | 874 | } else {
|
| 875 | 875 | $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
| 876 | 876 | } |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | } else |
| 884 | 884 | $where .= " AND $wpdb->posts.post_author = $user_id"; |
| 885 | 885 | |
| 886 | - if ($user_id == (int)get_current_user_id()) {
|
|
| 886 | + if ($user_id == (int) get_current_user_id()) {
|
|
| 887 | 887 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
| 888 | 888 | } else {
|
| 889 | 889 | $where .= " AND $wpdb->posts.post_status = 'publish' "; |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | if (function_exists('icl_object_id')) {
|
| 897 | 897 | $lang_code = ICL_LANGUAGE_CODE; |
| 898 | 898 | if ($lang_code) {
|
| 899 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 899 | + $where .= " AND icl_t.language_code='".$lang_code."' "; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | } |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | {
|
| 920 | 920 | global $wp_query, $table; |
| 921 | 921 | if (!empty($wp_query->query['with_pics_only'])) {
|
| 922 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 922 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
| 923 | 923 | } |
| 924 | 924 | return $join; |
| 925 | 925 | } |
@@ -938,16 +938,16 @@ discard block |
||
| 938 | 938 | {
|
| 939 | 939 | global $wp_query, $table; |
| 940 | 940 | if (!empty($wp_query->query['show_featured_only'])) {
|
| 941 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 941 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
| 942 | 942 | } |
| 943 | 943 | if (!empty($wp_query->query['show_special_only'])) {
|
| 944 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 944 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
| 945 | 945 | } |
| 946 | 946 | if (!empty($wp_query->query['with_pics_only'])) {
|
| 947 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 947 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id"; |
|
| 948 | 948 | } |
| 949 | 949 | if (!empty($wp_query->query['with_videos_only'])) {
|
| 950 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 950 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
| 951 | 951 | } |
| 952 | 952 | return $where; |
| 953 | 953 | } |
@@ -956,18 +956,18 @@ discard block |
||
| 956 | 956 | function geodir_related_posts_fields($fields) {
|
| 957 | 957 | global $wp_query, $wpdb, $table, $post; |
| 958 | 958 | |
| 959 | - $fields .= ", " . $table . ".* "; |
|
| 959 | + $fields .= ", ".$table.".* "; |
|
| 960 | 960 | |
| 961 | 961 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
| 962 | 962 | |
| 963 | 963 | $mylat = $post->post_latitude; |
| 964 | 964 | $mylon = $post->post_longitude; |
| 965 | 965 | |
| 966 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 966 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 967 | 967 | return $fields; |
| 968 | 968 | } |
| 969 | 969 | function geodir_related_posts_fields_filter($query) {
|
| 970 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 970 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 971 | 971 | && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
| 972 | 972 | && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
| 973 | 973 | ) {
|