@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | if (!isset($default_cat) || empty($default_cat)) {
|
| 28 | 28 | $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : ''; |
| 29 | - }else{
|
|
| 30 | - if(!is_int($default_cat)){
|
|
| 29 | + } else {
|
|
| 30 | + if (!is_int($default_cat)) {
|
|
| 31 | 31 | $category = get_term_by('name', $default_cat, $taxonomy);
|
| 32 | - if(isset($category->term_id)){
|
|
| 33 | - $default_cat = $category->term_id; |
|
| 32 | + if (isset($category->term_id)) {
|
|
| 33 | + $default_cat = $category->term_id; |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | if ($default_pos === false) {
|
| 60 | 60 | |
| 61 | - $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str); |
|
| 61 | + $change_cat_str = str_replace($default_cat.',y:', $default_cat.',y,d:', $change_cat_str); |
|
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $send_post_submit_mail = false; |
| 228 | 228 | |
| 229 | 229 | // unhook this function so it doesn't loop infinitely |
| 230 | - remove_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 230 | + remove_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 231 | 231 | |
| 232 | 232 | if (isset($request_info['pid']) && $request_info['pid'] != '') {
|
| 233 | 233 | $post['ID'] = $request_info['pid']; |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // re-hook this function |
| 254 | - add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 254 | + add_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 255 | 255 | |
| 256 | 256 | $post_tags = ''; |
| 257 | 257 | if (!isset($request_info['post_tags'])) {
|
| 258 | 258 | |
| 259 | 259 | $post_type = $request_info['listing_type']; |
| 260 | - $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
|
|
| 260 | + $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type.'_tags', array('fields' => 'names')));
|
|
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
@@ -275,13 +275,13 @@ discard block |
||
| 275 | 275 | $payment_info = array(); |
| 276 | 276 | $package_info = array(); |
| 277 | 277 | |
| 278 | - $package_info = (array)geodir_post_package_info($package_info, $post); |
|
| 278 | + $package_info = (array) geodir_post_package_info($package_info, $post); |
|
| 279 | 279 | |
| 280 | 280 | $post_package_id = geodir_get_post_meta($last_post_id, 'package_id'); |
| 281 | 281 | |
| 282 | 282 | if (!empty($package_info) && !$post_package_id) {
|
| 283 | 283 | if (isset($package_info['days']) && $package_info['days'] != 0) {
|
| 284 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
|
|
| 284 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['days']." days"));
|
|
| 285 | 285 | } else {
|
| 286 | 286 | $payment_info['expire_date'] = 'Never'; |
| 287 | 287 | } |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | $extrafields = $val['extra_fields']; |
| 303 | 303 | |
| 304 | 304 | if (trim($type) == 'address') {
|
| 305 | - $prefix = $name . '_'; |
|
| 306 | - $address = $prefix . 'address'; |
|
| 305 | + $prefix = $name.'_'; |
|
| 306 | + $address = $prefix.'address'; |
|
| 307 | 307 | |
| 308 | 308 | if (isset($request_info[$address]) && $request_info[$address] != '') {
|
| 309 | 309 | $gd_post_info[$address] = wp_slash($request_info[$address]); |
@@ -313,59 +313,59 @@ discard block |
||
| 313 | 313 | $extrafields = unserialize($extrafields); |
| 314 | 314 | |
| 315 | 315 | |
| 316 | - if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
|
|
| 316 | + if (!isset($request_info[$prefix.'city']) || $request_info[$prefix.'city'] == '') {
|
|
| 317 | 317 | |
| 318 | 318 | $location_result = geodir_get_default_location(); |
| 319 | 319 | |
| 320 | - $gd_post_info[$prefix . 'city'] = $location_result->city; |
|
| 321 | - $gd_post_info[$prefix . 'region'] = $location_result->region; |
|
| 322 | - $gd_post_info[$prefix . 'country'] = $location_result->country; |
|
| 320 | + $gd_post_info[$prefix.'city'] = $location_result->city; |
|
| 321 | + $gd_post_info[$prefix.'region'] = $location_result->region; |
|
| 322 | + $gd_post_info[$prefix.'country'] = $location_result->country; |
|
| 323 | 323 | |
| 324 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 324 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location |
|
| 325 | 325 | |
| 326 | 326 | } else {
|
| 327 | 327 | |
| 328 | - $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city']; |
|
| 329 | - $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region']; |
|
| 330 | - $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country']; |
|
| 328 | + $gd_post_info[$prefix.'city'] = $request_info[$prefix.'city']; |
|
| 329 | + $gd_post_info[$prefix.'region'] = $request_info[$prefix.'region']; |
|
| 330 | + $gd_post_info[$prefix.'country'] = $request_info[$prefix.'country']; |
|
| 331 | 331 | |
| 332 | 332 | //----------set post locations when import dummy data------- |
| 333 | 333 | $location_result = geodir_get_default_location(); |
| 334 | 334 | |
| 335 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 335 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location |
|
| 336 | 336 | //----------------------------------------------------------------- |
| 337 | 337 | |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
| 341 | - if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
|
|
| 342 | - $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip']; |
|
| 341 | + if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix.'zip'])) {
|
|
| 342 | + $gd_post_info[$prefix.'zip'] = $request_info[$prefix.'zip']; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | |
| 346 | 346 | if (isset($extrafields['show_map']) && $extrafields['show_map']) {
|
| 347 | 347 | |
| 348 | - if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
|
|
| 349 | - $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude']; |
|
| 348 | + if (isset($request_info[$prefix.'latitude']) && $request_info[$prefix.'latitude'] != '') {
|
|
| 349 | + $gd_post_info[$prefix.'latitude'] = $request_info[$prefix.'latitude']; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
|
|
| 353 | - $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude']; |
|
| 352 | + if (isset($request_info[$prefix.'longitude']) && $request_info[$prefix.'longitude'] != '') {
|
|
| 353 | + $gd_post_info[$prefix.'longitude'] = $request_info[$prefix.'longitude']; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
|
|
| 357 | - $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview']; |
|
| 356 | + if (isset($request_info[$prefix.'mapview']) && $request_info[$prefix.'mapview'] != '') {
|
|
| 357 | + $gd_post_info[$prefix.'mapview'] = $request_info[$prefix.'mapview']; |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
|
|
| 361 | - $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom']; |
|
| 360 | + if (isset($request_info[$prefix.'mapzoom']) && $request_info[$prefix.'mapzoom'] != '') {
|
|
| 361 | + $gd_post_info[$prefix.'mapzoom'] = $request_info[$prefix.'mapzoom']; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // show lat lng |
| 367 | - if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
|
|
| 368 | - $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng']; |
|
| 367 | + if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix.'latlng'])) {
|
|
| 368 | + $gd_post_info[$prefix.'latlng'] = $request_info[$prefix.'latlng']; |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
@@ -390,16 +390,16 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | // check if we need to change the format or not |
| 392 | 392 | $date_format_len = strlen(str_replace(' ', '', $date_format));
|
| 393 | - if($date_format_len>5){// if greater then 5 then it's the old style format.
|
|
| 393 | + if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
|
|
| 394 | 394 | |
| 395 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
|
|
| 396 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
|
| 395 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
|
|
| 396 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
|
|
| 397 | 397 | |
| 398 | 398 | $date_format = str_replace($search, $replace, $date_format); |
| 399 | 399 | |
| 400 | 400 | $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
|
| 401 | 401 | |
| 402 | - }else{
|
|
| 402 | + } else {
|
|
| 403 | 403 | $post_htmlvar_value = $request_info[$name]; |
| 404 | 404 | } |
| 405 | 405 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | if (isset($request_info[$name])) {
|
| 415 | 415 | $gd_post_info[$name] = $request_info[$name]; |
| 416 | 416 | } else {
|
| 417 | - if (isset($request_info['gd_field_' . $name])) {
|
|
| 417 | + if (isset($request_info['gd_field_'.$name])) {
|
|
| 418 | 418 | $gd_post_info[$name] = ''; /* fix de-select for multiselect */ |
| 419 | 419 | } |
| 420 | 420 | } |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | if (is_array($post_tags)) {
|
| 477 | - $taxonomy = $request_info['listing_type'] . '_tags'; |
|
| 477 | + $taxonomy = $request_info['listing_type'].'_tags'; |
|
| 478 | 478 | wp_set_object_terms($last_post_id, $post_tags, $taxonomy); |
| 479 | 479 | } |
| 480 | 480 | |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | $tmpimgArr = trim($request_info['post_images'], ","); |
| 487 | 487 | $tmpimgArr = explode(",", $tmpimgArr);
|
| 488 | 488 | geodir_save_post_images($last_post_id, $tmpimgArr, $dummy); |
| 489 | - } else{
|
|
| 489 | + } else {
|
|
| 490 | 490 | geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy); |
| 491 | 491 | } |
| 492 | 492 | |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | if (!in_array($post_type, $all_postypes)) |
| 568 | 568 | return false; |
| 569 | 569 | |
| 570 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 570 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 571 | 571 | |
| 572 | 572 | /** |
| 573 | 573 | * Apply Filter to change Post info |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | * @since 1.0.0 |
| 578 | 578 | * @package GeoDirectory |
| 579 | 579 | */ |
| 580 | - $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
|
|
| 580 | + $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM ".$wpdb->posts." p,".$table." pd
|
|
| 581 | 581 | WHERE p.ID = pd.post_id |
| 582 | 582 | AND post_id = " . $post_id); |
| 583 | 583 | |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | |
| 641 | 641 | $post_type = get_post_type($post_id); |
| 642 | 642 | |
| 643 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 643 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 644 | 644 | |
| 645 | 645 | /** |
| 646 | 646 | * Filter to change Post info |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | |
| 662 | 662 | $columns = $wpdb->get_col("show columns from $table");
|
| 663 | 663 | foreach ($postmeta as $mkey => $mval) {
|
| 664 | - if(in_array($mkey,$columns)) {
|
|
| 664 | + if (in_array($mkey, $columns)) {
|
|
| 665 | 665 | if (is_array($mval)) {
|
| 666 | 666 | $mval = implode(",", $mval);
|
| 667 | 667 | } |
@@ -690,12 +690,12 @@ discard block |
||
| 690 | 690 | */ |
| 691 | 691 | do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
|
| 692 | 692 | |
| 693 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 693 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 694 | 694 | |
| 695 | 695 | $query_string_array[] = $post_id; |
| 696 | 696 | $wpdb->query( |
| 697 | 697 | $wpdb->prepare( |
| 698 | - "UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d", |
|
| 698 | + "UPDATE ".$table." SET ".$query_string_escaped." where post_id =%d", |
|
| 699 | 699 | $query_string_array |
| 700 | 700 | ) |
| 701 | 701 | ); |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | array_unshift($query_string_array, $post_id); |
| 707 | 707 | $wpdb->query( |
| 708 | 708 | $wpdb->prepare( |
| 709 | - "INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped, |
|
| 709 | + "INSERT INTO ".$table." SET post_id = %d,".$query_string_escaped, |
|
| 710 | 710 | $query_string_array |
| 711 | 711 | ) |
| 712 | 712 | ); |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | $post_type = get_post_type($post_id); |
| 754 | 754 | |
| 755 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 755 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 756 | 756 | |
| 757 | 757 | if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
|
| 758 | 758 | |
@@ -760,11 +760,11 @@ discard block |
||
| 760 | 760 | $meta_value = implode(",", $meta_value);
|
| 761 | 761 | } |
| 762 | 762 | |
| 763 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 763 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 764 | 764 | |
| 765 | 765 | $wpdb->query( |
| 766 | 766 | $wpdb->prepare( |
| 767 | - "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d", |
|
| 767 | + "UPDATE ".$table." SET ".$postmeta." = '".$meta_value."' where post_id =%d", |
|
| 768 | 768 | array($post_id) |
| 769 | 769 | ) |
| 770 | 770 | ); |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | $wpdb->query( |
| 775 | 775 | $wpdb->prepare( |
| 776 | - "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'", |
|
| 776 | + "INSERT INTO ".$table." SET post_id = %d, ".$postmeta." = '".$meta_value."'", |
|
| 777 | 777 | array($post_id) |
| 778 | 778 | ) |
| 779 | 779 | ); |
@@ -806,14 +806,14 @@ discard block |
||
| 806 | 806 | |
| 807 | 807 | $post_type = get_post_type($post_id); |
| 808 | 808 | |
| 809 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 809 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 810 | 810 | |
| 811 | 811 | if (is_array($postmeta) && !empty($postmeta) && $post_id) {
|
| 812 | 812 | $post_meta_set_query = ''; |
| 813 | 813 | |
| 814 | 814 | foreach ($postmeta as $mkey) {
|
| 815 | 815 | if ($mval != '') |
| 816 | - $post_meta_set_query .= $mkey . " = '', "; |
|
| 816 | + $post_meta_set_query .= $mkey." = '', "; |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | $post_meta_set_query = trim($post_meta_set_query, ", "); |
@@ -822,11 +822,11 @@ discard block |
||
| 822 | 822 | return false; |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 825 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
|
|
| 826 | 826 | |
| 827 | 827 | $wpdb->query( |
| 828 | 828 | $wpdb->prepare( |
| 829 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d", |
|
| 829 | + "UPDATE ".$table." SET ".$post_meta_set_query." where post_id = %d", |
|
| 830 | 830 | array($post_id) |
| 831 | 831 | ) |
| 832 | 832 | ); |
@@ -835,11 +835,11 @@ discard block |
||
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | } elseif ($postmeta != '' && $post_id) {
|
| 838 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 838 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
|
|
| 839 | 839 | |
| 840 | 840 | $wpdb->query( |
| 841 | 841 | $wpdb->prepare( |
| 842 | - "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d", |
|
| 842 | + "UPDATE ".$table." SET ".$postmeta."= '' where post_id = %d", |
|
| 843 | 843 | array($post_id) |
| 844 | 844 | ) |
| 845 | 845 | ); |
@@ -881,10 +881,10 @@ discard block |
||
| 881 | 881 | if (!in_array($post_type, $all_postypes)) |
| 882 | 882 | return false; |
| 883 | 883 | |
| 884 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 884 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 885 | 885 | |
| 886 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
|
|
| 887 | - $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
|
|
| 886 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$meta_key."'") != '') {
|
|
| 887 | + $meta_value = $wpdb->get_var($wpdb->prepare("SELECT ".$meta_key." from ".$table." where post_id = %d", array($post_id)));
|
|
| 888 | 888 | |
| 889 | 889 | if ($meta_value && $meta_value !== '') {
|
| 890 | 890 | return maybe_serialize($meta_value); |
@@ -918,13 +918,13 @@ discard block |
||
| 918 | 918 | |
| 919 | 919 | $post_type = get_post_type($post_id); |
| 920 | 920 | |
| 921 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 921 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 922 | 922 | |
| 923 | 923 | $post_images = geodir_get_images($post_id); |
| 924 | 924 | |
| 925 | 925 | $wpdb->query( |
| 926 | 926 | $wpdb->prepare( |
| 927 | - "UPDATE " . $table . " SET featured_image = '' where post_id =%d", |
|
| 927 | + "UPDATE ".$table." SET featured_image = '' where post_id =%d", |
|
| 928 | 928 | array($post_id) |
| 929 | 929 | ) |
| 930 | 930 | ); |
@@ -954,12 +954,12 @@ discard block |
||
| 954 | 954 | $file_path = ''; |
| 955 | 955 | /* --------- start ------- */ |
| 956 | 956 | |
| 957 | - $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
|
|
| 957 | + $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
|
|
| 958 | 958 | |
| 959 | 959 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
| 960 | 960 | |
| 961 | 961 | |
| 962 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
|
|
| 962 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM ".GEODIR_ATTACHMENT_TABLE." WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
|
|
| 963 | 963 | |
| 964 | 964 | /* --------- end ------- */ |
| 965 | 965 | $curr_img_url = $post_image[$m]; |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | // If the uploaded file is the right format |
| 1004 | 1004 | if (in_array($uploaded_file_type, $allowed_file_types)) {
|
| 1005 | 1005 | if (!function_exists('wp_handle_upload')) {
|
| 1006 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1006 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | if (!is_dir($geodir_uploadpath)) {
|
@@ -1011,41 +1011,41 @@ discard block |
||
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | $external_img = false; |
| 1014 | - if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) {
|
|
| 1014 | + if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
|
|
| 1015 | 1015 | } else {
|
| 1016 | 1016 | $external_img = true; |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | if ($dummy || $external_img) {
|
| 1020 | 1020 | $uploaded_file = array(); |
| 1021 | - $uploaded = (array)fetch_remote_file($curr_img_url); |
|
| 1021 | + $uploaded = (array) fetch_remote_file($curr_img_url); |
|
| 1022 | 1022 | |
| 1023 | 1023 | if (isset($uploaded['error']) && empty($uploaded['error'])) {
|
| 1024 | 1024 | $new_name = basename($uploaded['file']); |
| 1025 | 1025 | $uploaded_file = $uploaded; |
| 1026 | - }else{
|
|
| 1027 | - print_r($uploaded);exit; |
|
| 1026 | + } else {
|
|
| 1027 | + print_r($uploaded); exit; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | $external_img = false; |
| 1030 | 1030 | } else {
|
| 1031 | - $new_name = $post_id . '_' . $file_name; |
|
| 1031 | + $new_name = $post_id.'_'.$file_name; |
|
| 1032 | 1032 | |
| 1033 | 1033 | if ($curr_img_dir == $sub_dir) {
|
| 1034 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1035 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1034 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1035 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1036 | 1036 | } else {
|
| 1037 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1038 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1037 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1038 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | 1041 | $uploaded_file = ''; |
| 1042 | 1042 | |
| 1043 | 1043 | if (file_exists($img_path)) {
|
| 1044 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1044 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1045 | 1045 | $file_path = ''; |
| 1046 | - } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
|
|
| 1046 | + } else if (file_exists($uploads['basedir'].$curr_img_dir.$filename)) {
|
|
| 1047 | 1047 | $uploaded_file = true; |
| 1048 | - $file_path = $curr_img_dir . '/' . $filename; |
|
| 1048 | + $file_path = $curr_img_dir.'/'.$filename; |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
@@ -1054,14 +1054,14 @@ discard block |
||
| 1054 | 1054 | |
| 1055 | 1055 | if (!empty($uploaded_file)) {
|
| 1056 | 1056 | if (!isset($file_path) || !$file_path) {
|
| 1057 | - $file_path = $sub_dir . '/' . $new_name; |
|
| 1057 | + $file_path = $sub_dir.'/'.$new_name; |
|
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
|
|
| 1060 | + $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'].$file_path);
|
|
| 1061 | 1061 | |
| 1062 | 1062 | if ($menu_order == 1) {
|
| 1063 | 1063 | |
| 1064 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
|
|
| 1064 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
|
|
| 1065 | 1065 | |
| 1066 | 1066 | } |
| 1067 | 1067 | |
@@ -1079,12 +1079,12 @@ discard block |
||
| 1079 | 1079 | |
| 1080 | 1080 | foreach ($attachment as $key => $val) {
|
| 1081 | 1081 | if ($val != '') |
| 1082 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1082 | + $attachment_set .= $key." = '".$val."', "; |
|
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | 1085 | $attachment_set = trim($attachment_set, ", "); |
| 1086 | 1086 | |
| 1087 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 1087 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 1088 | 1088 | |
| 1089 | 1089 | $valid_file_ids[] = $wpdb->insert_id; |
| 1090 | 1090 | } |
@@ -1095,17 +1095,17 @@ discard block |
||
| 1095 | 1095 | } else {
|
| 1096 | 1096 | $valid_file_ids[] = $find_image; |
| 1097 | 1097 | |
| 1098 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
|
|
| 1098 | + $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
|
|
| 1099 | 1099 | |
| 1100 | 1100 | $wpdb->query( |
| 1101 | 1101 | $wpdb->prepare( |
| 1102 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d", |
|
| 1102 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d where file =%s AND post_id =%d", |
|
| 1103 | 1103 | array($menu_order, $split_img_path[1], $post_id) |
| 1104 | 1104 | ) |
| 1105 | 1105 | ); |
| 1106 | 1106 | |
| 1107 | 1107 | if ($menu_order == 1) |
| 1108 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1108 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1109 | 1109 | |
| 1110 | 1110 | } |
| 1111 | 1111 | |
@@ -1129,9 +1129,9 @@ discard block |
||
| 1129 | 1129 | |
| 1130 | 1130 | foreach ($post_images as $img) {
|
| 1131 | 1131 | |
| 1132 | - if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
|
|
| 1132 | + if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
|
|
| 1133 | 1133 | |
| 1134 | - $invalid_files[] = (object)array('src' => $img->src);
|
|
| 1134 | + $invalid_files[] = (object) array('src' => $img->src);
|
|
| 1135 | 1135 | |
| 1136 | 1136 | } |
| 1137 | 1137 | |
@@ -1139,12 +1139,12 @@ discard block |
||
| 1139 | 1139 | |
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | - $invalid_files = (object)$invalid_files; |
|
| 1142 | + $invalid_files = (object) $invalid_files; |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | $remove_files[] = $post_id; |
| 1146 | 1146 | |
| 1147 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
|
|
| 1147 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ".$valid_files_condition." post_id = %d", $remove_files));
|
|
| 1148 | 1148 | |
| 1149 | 1149 | if (!empty($invalid_files)) |
| 1150 | 1150 | geodir_remove_attachments($invalid_files); |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | rmdir($dirPath); |
| 1185 | 1185 | } */ |
| 1186 | 1186 | |
| 1187 | - $dirname = $uploads_dir . '/temp_' . $current_user->ID; |
|
| 1187 | + $dirname = $uploads_dir.'/temp_'.$current_user->ID; |
|
| 1188 | 1188 | geodir_delete_directory($dirname); |
| 1189 | 1189 | } |
| 1190 | 1190 | |
@@ -1206,10 +1206,10 @@ discard block |
||
| 1206 | 1206 | return false; |
| 1207 | 1207 | while ($file = readdir($dir_handle)) {
|
| 1208 | 1208 | if ($file != "." && $file != "..") {
|
| 1209 | - if (!is_dir($dirname . "/" . $file)) |
|
| 1210 | - unlink($dirname . "/" . $file); |
|
| 1209 | + if (!is_dir($dirname."/".$file)) |
|
| 1210 | + unlink($dirname."/".$file); |
|
| 1211 | 1211 | else |
| 1212 | - geodir_delete_directory($dirname . '/' . $file); |
|
| 1212 | + geodir_delete_directory($dirname.'/'.$file); |
|
| 1213 | 1213 | } |
| 1214 | 1214 | } |
| 1215 | 1215 | closedir($dir_handle); |
@@ -1238,8 +1238,8 @@ discard block |
||
| 1238 | 1238 | foreach ($postcurr_images as $postimg) {
|
| 1239 | 1239 | $image_name_arr = explode('/', $postimg->src);
|
| 1240 | 1240 | $filename = end($image_name_arr); |
| 1241 | - if (file_exists($uploads_dir . '/' . $filename)) |
|
| 1242 | - unlink($uploads_dir . '/' . $filename); |
|
| 1241 | + if (file_exists($uploads_dir.'/'.$filename)) |
|
| 1242 | + unlink($uploads_dir.'/'.$filename); |
|
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | } // endif |
@@ -1280,16 +1280,16 @@ discard block |
||
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | if (!in_array($post_type, geodir_get_posttypes())) {
|
| 1283 | - return false;// if not a GD CPT return; |
|
| 1283 | + return false; // if not a GD CPT return; |
|
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1286 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1287 | 1287 | |
| 1288 | 1288 | if (!$file) {
|
| 1289 | 1289 | if (isset($post->featured_image)) {
|
| 1290 | 1290 | $file = $post->featured_image; |
| 1291 | 1291 | } else {
|
| 1292 | - $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
|
|
| 1292 | + $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM ".$table." WHERE post_id = %d", array($post_id)));
|
|
| 1293 | 1293 | } |
| 1294 | 1294 | } |
| 1295 | 1295 | |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | |
| 1308 | 1308 | $file_name = $file_info['basename']; |
| 1309 | 1309 | |
| 1310 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1310 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
| 1311 | 1311 | /* |
| 1312 | 1312 | * Allows the filter of image src for such things as CDN change. |
| 1313 | 1313 | * |
@@ -1317,8 +1317,8 @@ discard block |
||
| 1317 | 1317 | * @param string $uploads_url The server upload directory url. |
| 1318 | 1318 | * @param string $uploads_baseurl The uploads dir base url. |
| 1319 | 1319 | */ |
| 1320 | - $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1321 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1320 | + $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
|
|
| 1321 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1322 | 1322 | $width = 0; |
| 1323 | 1323 | $height = 0; |
| 1324 | 1324 | if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | $file_name = $file_info['basename']; |
| 1362 | 1362 | |
| 1363 | 1363 | $img_arr['src'] = $default_img; |
| 1364 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1364 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1365 | 1365 | |
| 1366 | 1366 | $width = 0; |
| 1367 | 1367 | $height = 0; |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | if (!empty($img_arr)) |
| 1381 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1381 | + return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1382 | 1382 | else |
| 1383 | 1383 | return false; |
| 1384 | 1384 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
| 1441 | 1441 | |
| 1442 | 1442 | $arrImages = $wpdb->get_results( |
| 1443 | 1443 | $wpdb->prepare( |
| 1444 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ", |
|
| 1444 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d".$not_featured." ORDER BY menu_order ASC, ID DESC $limit_q ", |
|
| 1445 | 1445 | array('%image%', $post_id)
|
| 1446 | 1446 | ) |
| 1447 | 1447 | ); |
@@ -1467,7 +1467,7 @@ discard block |
||
| 1467 | 1467 | |
| 1468 | 1468 | $file_name = $file_info['basename']; |
| 1469 | 1469 | |
| 1470 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1470 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
| 1471 | 1471 | /* |
| 1472 | 1472 | * Allows the filter of image src for such things as CDN change. |
| 1473 | 1473 | * |
@@ -1477,8 +1477,8 @@ discard block |
||
| 1477 | 1477 | * @param string $uploads_url The server upload directory url. |
| 1478 | 1478 | * @param string $uploads_baseurl The uploads dir base url. |
| 1479 | 1479 | */ |
| 1480 | - $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1481 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1480 | + $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
|
|
| 1481 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1482 | 1482 | $width = 0; |
| 1483 | 1483 | $height = 0; |
| 1484 | 1484 | if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
@@ -1495,11 +1495,11 @@ discard block |
||
| 1495 | 1495 | $img_arr['content'] = $attechment->content; // add the description to the array |
| 1496 | 1496 | $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1. |
| 1497 | 1497 | |
| 1498 | - $return_arr[] = (object)$img_arr; |
|
| 1498 | + $return_arr[] = (object) $img_arr; |
|
| 1499 | 1499 | |
| 1500 | 1500 | $counter++; |
| 1501 | 1501 | } |
| 1502 | - return (object)$return_arr; |
|
| 1502 | + return (object) $return_arr; |
|
| 1503 | 1503 | } else if ($no_images) {
|
| 1504 | 1504 | $default_img = ''; |
| 1505 | 1505 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
@@ -1538,7 +1538,7 @@ discard block |
||
| 1538 | 1538 | $img_arr['title'] = $file_info['filename']; // add the title to the array |
| 1539 | 1539 | $img_arr['content'] = $file_info['filename']; // add the description to the array |
| 1540 | 1540 | |
| 1541 | - $return_arr[] = (object)$img_arr; |
|
| 1541 | + $return_arr[] = (object) $img_arr; |
|
| 1542 | 1542 | |
| 1543 | 1543 | return $return_arr; |
| 1544 | 1544 | } else |
@@ -1565,8 +1565,8 @@ discard block |
||
| 1565 | 1565 | |
| 1566 | 1566 | $html = ''; |
| 1567 | 1567 | if (!empty($request)) {
|
| 1568 | - if (!is_object($request)){
|
|
| 1569 | - $request = (object)$request; |
|
| 1568 | + if (!is_object($request)) {
|
|
| 1569 | + $request = (object) $request; |
|
| 1570 | 1570 | } |
| 1571 | 1571 | |
| 1572 | 1572 | if (isset($request->src) && !isset($request->path)) {
|
@@ -1580,7 +1580,7 @@ discard block |
||
| 1580 | 1580 | $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
|
| 1581 | 1581 | $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
|
| 1582 | 1582 | if (strpos($img_no_http, $upload_no_http) !== false) {
|
| 1583 | - $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path); |
|
| 1583 | + $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path); |
|
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | $width = 0; |
@@ -1595,7 +1595,7 @@ discard block |
||
| 1595 | 1595 | $image->width = $width; |
| 1596 | 1596 | $image->height = $height; |
| 1597 | 1597 | |
| 1598 | - $max_size = (object)geodir_get_imagesize($size); |
|
| 1598 | + $max_size = (object) geodir_get_imagesize($size); |
|
| 1599 | 1599 | |
| 1600 | 1600 | if (!is_wp_error($max_size)) {
|
| 1601 | 1601 | if ($image->width) {
|
@@ -1607,15 +1607,15 @@ discard block |
||
| 1607 | 1607 | $width_per = 100; |
| 1608 | 1608 | } |
| 1609 | 1609 | |
| 1610 | - if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
|
|
| 1611 | - $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>'; |
|
| 1610 | + if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
|
|
| 1611 | + $html = '<div class="geodir_thumbnail"><img style="max-height:'.$max_size->h.'px;" alt="place image" src="'.$image->src.'" /></div>'; |
|
| 1612 | 1612 | } else {
|
| 1613 | - if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
|
|
| 1614 | - $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
|
| 1615 | - }else{
|
|
| 1613 | + if ($size == 'widget-thumb' || !get_option('geodir_lazy_load', 1)) {
|
|
| 1614 | + $html = '<div class="geodir_thumbnail" style="background-image:url(\''.$image->src.'\');"></div>'; |
|
| 1615 | + } else {
|
|
| 1616 | 1616 | //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>'; |
| 1617 | 1617 | //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>'; |
| 1618 | - $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
|
|
| 1618 | + $html = '<div data-src="'.str_replace(' ', '%20', $image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
|
|
| 1619 | 1619 | |
| 1620 | 1620 | } |
| 1621 | 1621 | |
@@ -1651,15 +1651,15 @@ discard block |
||
| 1651 | 1651 | |
| 1652 | 1652 | $post_type = get_post_type($post_id); |
| 1653 | 1653 | |
| 1654 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1654 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1655 | 1655 | |
| 1656 | 1656 | if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
|
| 1657 | 1657 | |
| 1658 | - if ($taxonomy == $post_type . '_tags') {
|
|
| 1658 | + if ($taxonomy == $post_type.'_tags') {
|
|
| 1659 | 1659 | if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
| 1660 | 1660 | geodir_save_post_meta($post_id, 'post_tags', $terms); |
| 1661 | 1661 | } |
| 1662 | - } elseif ($taxonomy == $post_type . 'category') {
|
|
| 1662 | + } elseif ($taxonomy == $post_type.'category') {
|
|
| 1663 | 1663 | $srcharr = array('"', '\\');
|
| 1664 | 1664 | $replarr = array(""", '');
|
| 1665 | 1665 | |
@@ -1681,7 +1681,7 @@ discard block |
||
| 1681 | 1681 | |
| 1682 | 1682 | $wpdb->get_var( |
| 1683 | 1683 | $wpdb->prepare( |
| 1684 | - "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
| 1684 | + "DELETE from ".GEODIR_ICON_TABLE." WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
| 1685 | 1685 | $cat_ids_array_del |
| 1686 | 1686 | ) |
| 1687 | 1687 | ); |
@@ -1689,7 +1689,7 @@ discard block |
||
| 1689 | 1689 | |
| 1690 | 1690 | $post_term = $wpdb->get_col( |
| 1691 | 1691 | $wpdb->prepare( |
| 1692 | - "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
| 1692 | + "SELECT term_id FROM ".$wpdb->term_taxonomy." WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
| 1693 | 1693 | $cat_ids_array |
| 1694 | 1694 | ) |
| 1695 | 1695 | ); |
@@ -1711,16 +1711,16 @@ discard block |
||
| 1711 | 1711 | $lat = geodir_get_post_meta($post_id, 'post_latitude', true); |
| 1712 | 1712 | $lng = geodir_get_post_meta($post_id, 'post_longitude', true); |
| 1713 | 1713 | |
| 1714 | - $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
|
|
| 1715 | - $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true); |
|
| 1714 | + $timing = ' - '.date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
|
|
| 1715 | + $timing .= ' - '.geodir_get_post_meta($post_id, 'st_time', true); |
|
| 1716 | 1716 | |
| 1717 | 1717 | $json = '{';
|
| 1718 | - $json .= '"id":"' . $post_id . '",'; |
|
| 1719 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
| 1720 | - $json .= '"long_pos": "' . $lng . '",'; |
|
| 1721 | - $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",'; |
|
| 1722 | - $json .= '"icon":"' . $term_icon . '",'; |
|
| 1723 | - $json .= '"group":"catgroup' . $cat_id . '"'; |
|
| 1718 | + $json .= '"id":"'.$post_id.'",'; |
|
| 1719 | + $json .= '"lat_pos": "'.$lat.'",'; |
|
| 1720 | + $json .= '"long_pos": "'.$lng.'",'; |
|
| 1721 | + $json .= '"marker_id":"'.$post_id.'_'.$cat_id.'",'; |
|
| 1722 | + $json .= '"icon":"'.$term_icon.'",'; |
|
| 1723 | + $json .= '"group":"catgroup'.$cat_id.'"'; |
|
| 1724 | 1724 | $json .= '}'; |
| 1725 | 1725 | |
| 1726 | 1726 | |
@@ -1728,9 +1728,9 @@ discard block |
||
| 1728 | 1728 | $post_marker_json = $json; |
| 1729 | 1729 | |
| 1730 | 1730 | |
| 1731 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
|
|
| 1731 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".GEODIR_ICON_TABLE." WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
|
|
| 1732 | 1732 | |
| 1733 | - $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
|
|
| 1733 | + $json_query = $wpdb->prepare("UPDATE ".GEODIR_ICON_TABLE." SET
|
|
| 1734 | 1734 | post_title = %s, |
| 1735 | 1735 | json = %s |
| 1736 | 1736 | WHERE post_id = %d AND cat_id = %d ", |
@@ -1738,7 +1738,7 @@ discard block |
||
| 1738 | 1738 | |
| 1739 | 1739 | } else {
|
| 1740 | 1740 | |
| 1741 | - $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
|
|
| 1741 | + $json_query = $wpdb->prepare("INSERT INTO ".GEODIR_ICON_TABLE." SET
|
|
| 1742 | 1742 | post_id = %d, |
| 1743 | 1743 | post_title = %s, |
| 1744 | 1744 | cat_id = %d, |
@@ -1756,17 +1756,17 @@ discard block |
||
| 1756 | 1756 | if (!empty($post_term) && is_array($post_term)) {
|
| 1757 | 1757 | $categories = implode(',', $post_term);
|
| 1758 | 1758 | |
| 1759 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
| 1759 | + if ($categories != '' && $categories != 0) $categories = ','.$categories.','; |
|
| 1760 | 1760 | |
| 1761 | 1761 | if (empty($post_marker_json)) |
| 1762 | 1762 | $post_marker_json = isset($json) ? $json : ''; |
| 1763 | 1763 | |
| 1764 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 1764 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 1765 | 1765 | |
| 1766 | 1766 | $wpdb->query( |
| 1767 | 1767 | $wpdb->prepare( |
| 1768 | - "UPDATE " . $table . " SET |
|
| 1769 | - " . $taxonomy . " = %s, |
|
| 1768 | + "UPDATE ".$table." SET |
|
| 1769 | + " . $taxonomy." = %s, |
|
| 1770 | 1770 | marker_json = %s |
| 1771 | 1771 | where post_id = %d", |
| 1772 | 1772 | array($categories, $post_marker_json, $post_id) |
@@ -1787,7 +1787,7 @@ discard block |
||
| 1787 | 1787 | |
| 1788 | 1788 | $wpdb->query( |
| 1789 | 1789 | $wpdb->prepare( |
| 1790 | - "UPDATE " . $table . " SET |
|
| 1790 | + "UPDATE ".$table." SET |
|
| 1791 | 1791 | default_category = %s |
| 1792 | 1792 | where post_id = %d", |
| 1793 | 1793 | array($categories[0], $post_id) |
@@ -1812,9 +1812,9 @@ discard block |
||
| 1812 | 1812 | |
| 1813 | 1813 | $wpdb->query( |
| 1814 | 1814 | $wpdb->prepare( |
| 1815 | - "INSERT INTO " . $table . " SET |
|
| 1815 | + "INSERT INTO ".$table." SET |
|
| 1816 | 1816 | post_id = %d, |
| 1817 | - " . $taxonomy . " = %s, |
|
| 1817 | + " . $taxonomy." = %s, |
|
| 1818 | 1818 | marker_json = %s ", |
| 1819 | 1819 | |
| 1820 | 1820 | array($post_id, $categories, $post_marker_json) |
@@ -1938,7 +1938,7 @@ discard block |
||
| 1938 | 1938 | } ?>"><img alt="bubble image" style="max-height:50px;" |
| 1939 | 1939 | src="<?php echo $post_images[0]; ?>"/></a></div> |
| 1940 | 1940 | <?php |
| 1941 | - }else{
|
|
| 1941 | + } else {
|
|
| 1942 | 1942 | echo '<div class="geodir-bubble_image"></div>'; |
| 1943 | 1943 | } |
| 1944 | 1944 | } else {
|
@@ -1946,7 +1946,7 @@ discard block |
||
| 1946 | 1946 | ?> |
| 1947 | 1947 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
| 1948 | 1948 | <?php |
| 1949 | - }else{
|
|
| 1949 | + } else {
|
|
| 1950 | 1950 | echo '<div class="geodir-bubble_image"></div>'; |
| 1951 | 1951 | } |
| 1952 | 1952 | } |
@@ -1979,7 +1979,7 @@ discard block |
||
| 1979 | 1979 | * @param object $postinfo_obj The posts info as an object. |
| 1980 | 1980 | * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * |
| 1981 | 1981 | */ |
| 1982 | - do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
|
|
| 1982 | + do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
|
|
| 1983 | 1983 | ?> |
| 1984 | 1984 | </div> |
| 1985 | 1985 | <?php |
@@ -1991,10 +1991,10 @@ discard block |
||
| 1991 | 1991 | <div class="geodir-bubble-meta-fade"></div> |
| 1992 | 1992 | |
| 1993 | 1993 | <div class="geodir-bubble-meta-bottom"> |
| 1994 | - <span class="geodir-bubble-rating"><?php echo $rating_star;?></span> |
|
| 1994 | + <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span> |
|
| 1995 | 1995 | |
| 1996 | 1996 | <span |
| 1997 | - class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span> |
|
| 1997 | + class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span> |
|
| 1998 | 1998 | <span class="geodir-bubble-reviews"><a href="<?php echo get_comments_link($ID); ?>" |
| 1999 | 1999 | class="geodir-pcomments"><i class="fa fa-comments"></i> |
| 2000 | 2000 | <?php echo get_comments_number($ID); ?> |
@@ -2059,11 +2059,11 @@ discard block |
||
| 2059 | 2059 | |
| 2060 | 2060 | $post_type = get_post_type($post_id); |
| 2061 | 2061 | |
| 2062 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2062 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2063 | 2063 | |
| 2064 | 2064 | $wpdb->query( |
| 2065 | 2065 | $wpdb->prepare( |
| 2066 | - "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d", |
|
| 2066 | + "UPDATE ".$table." SET post_status=%s WHERE post_id=%d", |
|
| 2067 | 2067 | array($status, $post_id) |
| 2068 | 2068 | ) |
| 2069 | 2069 | ); |
@@ -2135,18 +2135,18 @@ discard block |
||
| 2135 | 2135 | |
| 2136 | 2136 | $post_type = get_post_type($post_id); |
| 2137 | 2137 | |
| 2138 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2138 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2139 | 2139 | |
| 2140 | 2140 | $wpdb->query( |
| 2141 | 2141 | $wpdb->prepare( |
| 2142 | - "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2142 | + "UPDATE ".$table." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2143 | 2143 | array($updatingpost, $temppost) |
| 2144 | 2144 | ) |
| 2145 | 2145 | ); |
| 2146 | 2146 | |
| 2147 | 2147 | $wpdb->query( |
| 2148 | 2148 | $wpdb->prepare( |
| 2149 | - "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2149 | + "UPDATE ".GEODIR_ICON_TABLE." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2150 | 2150 | array($updatingpost, $temppost) |
| 2151 | 2151 | ) |
| 2152 | 2152 | ); |
@@ -2155,7 +2155,7 @@ discard block |
||
| 2155 | 2155 | |
| 2156 | 2156 | $wpdb->query( |
| 2157 | 2157 | $wpdb->prepare( |
| 2158 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2158 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2159 | 2159 | array($updatingpost, $temppost) |
| 2160 | 2160 | ) |
| 2161 | 2161 | ); |
@@ -2193,12 +2193,12 @@ discard block |
||
| 2193 | 2193 | if (!in_array($post_type, $all_postypes)) |
| 2194 | 2194 | return false; |
| 2195 | 2195 | |
| 2196 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2196 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2197 | 2197 | |
| 2198 | 2198 | /* Delete custom post meta*/ |
| 2199 | 2199 | $wpdb->query( |
| 2200 | 2200 | $wpdb->prepare( |
| 2201 | - "DELETE FROM " . $table . " WHERE `post_id` = %d", |
|
| 2201 | + "DELETE FROM ".$table." WHERE `post_id` = %d", |
|
| 2202 | 2202 | array($deleted_postid) |
| 2203 | 2203 | ) |
| 2204 | 2204 | ); |
@@ -2207,7 +2207,7 @@ discard block |
||
| 2207 | 2207 | |
| 2208 | 2208 | $wpdb->query( |
| 2209 | 2209 | $wpdb->prepare( |
| 2210 | - "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d", |
|
| 2210 | + "DELETE FROM ".GEODIR_ICON_TABLE." WHERE `post_id` = %d", |
|
| 2211 | 2211 | array($deleted_postid) |
| 2212 | 2212 | ) |
| 2213 | 2213 | ); |
@@ -2217,7 +2217,7 @@ discard block |
||
| 2217 | 2217 | |
| 2218 | 2218 | $wpdb->query( |
| 2219 | 2219 | $wpdb->prepare( |
| 2220 | - "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d", |
|
| 2220 | + "DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE `post_id` = %d", |
|
| 2221 | 2221 | array($deleted_postid) |
| 2222 | 2222 | ) |
| 2223 | 2223 | ); |
@@ -2289,7 +2289,7 @@ discard block |
||
| 2289 | 2289 | */ |
| 2290 | 2290 | do_action('geodir_before_add_from_favorite', $post_id);
|
| 2291 | 2291 | |
| 2292 | - echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>'; |
|
| 2292 | + echo '<a href="javascript:void(0);" title="'.$remove_favourite_text.'" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'remove\');"><i class="'.$favourite_icon.'"></i> '.$unfavourite_text.'</a>'; |
|
| 2293 | 2293 | |
| 2294 | 2294 | /** |
| 2295 | 2295 | * Called after adding the post from favourites. |
@@ -2368,7 +2368,7 @@ discard block |
||
| 2368 | 2368 | */ |
| 2369 | 2369 | do_action('geodir_before_remove_from_favorite', $post_id);
|
| 2370 | 2370 | |
| 2371 | - echo '<a href="javascript:void(0);" title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>'; |
|
| 2371 | + echo '<a href="javascript:void(0);" title="'.$add_favourite_text.'" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'add\');"><i class="'.$favourite_icon.'"></i> '.$favourite_text.'</a>'; |
|
| 2372 | 2372 | |
| 2373 | 2373 | /** |
| 2374 | 2374 | * Called after removing the post from favourites. |
@@ -2463,24 +2463,24 @@ discard block |
||
| 2463 | 2463 | $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
| 2464 | 2464 | |
| 2465 | 2465 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
|
| 2466 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
|
| 2466 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>" ><a |
|
| 2467 | 2467 | class="geodir-removetofav-icon" href="javascript:void(0);" |
| 2468 | - onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');" |
|
| 2469 | - title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?> |
|
| 2468 | + onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');" |
|
| 2469 | + title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?> |
|
| 2470 | 2470 | </a> </span><?php |
| 2471 | 2471 | |
| 2472 | 2472 | } else {
|
| 2473 | 2473 | |
| 2474 | 2474 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
|
| 2475 | - $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
|
| 2475 | + $script_text = 'javascript:window.location.href=\''.geodir_login_url().'\''; |
|
| 2476 | 2476 | } else |
| 2477 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
|
|
| 2477 | + $script_text = 'javascript:addToFavourite('.$post_id.',\'add\')';
|
|
| 2478 | 2478 | |
| 2479 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
|
| 2479 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon" |
|
| 2480 | 2480 | href="javascript:void(0);" |
| 2481 | - onclick="<?php echo $script_text;?>" |
|
| 2482 | - title="<?php echo $add_favourite_text;?>"><i |
|
| 2483 | - class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span> |
|
| 2481 | + onclick="<?php echo $script_text; ?>" |
|
| 2482 | + title="<?php echo $add_favourite_text; ?>"><i |
|
| 2483 | + class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span> |
|
| 2484 | 2484 | <?php } |
| 2485 | 2485 | } |
| 2486 | 2486 | } |
@@ -2510,7 +2510,7 @@ discard block |
||
| 2510 | 2510 | |
| 2511 | 2511 | $post_type = $taxonomy_obj->object_type[0]; |
| 2512 | 2512 | |
| 2513 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2513 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2514 | 2514 | |
| 2515 | 2515 | /** |
| 2516 | 2516 | * Filter to modify the 'join' query |
@@ -2533,8 +2533,8 @@ discard block |
||
| 2533 | 2533 | $where = apply_filters('geodir_cat_post_count_where', $where, $term);
|
| 2534 | 2534 | |
| 2535 | 2535 | $count_query = "SELECT count(post_id) FROM |
| 2536 | - " . $table . " as pd " . $join . " |
|
| 2537 | - WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
|
|
| 2536 | + " . $table." as pd ".$join." |
|
| 2537 | + WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id."',".$term->taxonomy.") ".$where;
|
|
| 2538 | 2538 | |
| 2539 | 2539 | $cat_post_count = $wpdb->get_var($count_query); |
| 2540 | 2540 | if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
@@ -2617,7 +2617,7 @@ discard block |
||
| 2617 | 2617 | global $post; |
| 2618 | 2618 | $all_postypes = geodir_get_posttypes(); |
| 2619 | 2619 | if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
|
| 2620 | - return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>'; |
|
| 2620 | + return ' <a href="'.get_permalink($post->ID).'">'.READ_MORE_TXT.'</a>'; |
|
| 2621 | 2621 | } |
| 2622 | 2622 | |
| 2623 | 2623 | return $more; |
@@ -2644,14 +2644,14 @@ discard block |
||
| 2644 | 2644 | if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
|
| 2645 | 2645 | |
| 2646 | 2646 | $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy); |
| 2647 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 2647 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 2648 | 2648 | |
| 2649 | 2649 | $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']); |
| 2650 | - $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png'; |
|
| 2650 | + $term_icon = $path_parts['dirname'].'/cat_icon_'.$term_id.'.png'; |
|
| 2651 | 2651 | |
| 2652 | 2652 | $posts = $wpdb->get_results( |
| 2653 | 2653 | $wpdb->prepare( |
| 2654 | - "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
| 2654 | + "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM ".$table." WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
| 2655 | 2655 | array($term_id, $taxonomy) |
| 2656 | 2656 | ) |
| 2657 | 2657 | ); |
@@ -2663,19 +2663,19 @@ discard block |
||
| 2663 | 2663 | $lng = $post_obj->post_longitude; |
| 2664 | 2664 | |
| 2665 | 2665 | $json = '{';
|
| 2666 | - $json .= '"id":"' . $post_obj->post_id . '",'; |
|
| 2667 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
| 2668 | - $json .= '"long_pos": "' . $lng . '",'; |
|
| 2669 | - $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",'; |
|
| 2670 | - $json .= '"icon":"' . $term_icon . '",'; |
|
| 2671 | - $json .= '"group":"catgroup' . $term_id . '"'; |
|
| 2666 | + $json .= '"id":"'.$post_obj->post_id.'",'; |
|
| 2667 | + $json .= '"lat_pos": "'.$lat.'",'; |
|
| 2668 | + $json .= '"long_pos": "'.$lng.'",'; |
|
| 2669 | + $json .= '"marker_id":"'.$post_obj->post_id.'_'.$term_id.'",'; |
|
| 2670 | + $json .= '"icon":"'.$term_icon.'",'; |
|
| 2671 | + $json .= '"group":"catgroup'.$term_id.'"'; |
|
| 2672 | 2672 | $json .= '}'; |
| 2673 | 2673 | |
| 2674 | 2674 | if ($post_obj->default_category == $term_id) {
|
| 2675 | 2675 | |
| 2676 | 2676 | $wpdb->query( |
| 2677 | 2677 | $wpdb->prepare( |
| 2678 | - "UPDATE " . $table . " SET marker_json = %s where post_id = %d", |
|
| 2678 | + "UPDATE ".$table." SET marker_json = %s where post_id = %d", |
|
| 2679 | 2679 | array($json, $post_obj->post_id) |
| 2680 | 2680 | ) |
| 2681 | 2681 | ); |
@@ -2683,7 +2683,7 @@ discard block |
||
| 2683 | 2683 | |
| 2684 | 2684 | $wpdb->query( |
| 2685 | 2685 | $wpdb->prepare( |
| 2686 | - "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
| 2686 | + "UPDATE ".GEODIR_ICON_TABLE." SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
| 2687 | 2687 | array($json, $post_obj->post_id, $term_id) |
| 2688 | 2688 | ) |
| 2689 | 2689 | ); |
@@ -2807,7 +2807,7 @@ discard block |
||
| 2807 | 2807 | // print_r($uploads ) ; |
| 2808 | 2808 | $post_first_image = $wpdb->get_results( |
| 2809 | 2809 | $wpdb->prepare( |
| 2810 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
| 2810 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
| 2811 | 2811 | ) |
| 2812 | 2812 | ); |
| 2813 | 2813 | |
@@ -2828,9 +2828,9 @@ discard block |
||
| 2828 | 2828 | |
| 2829 | 2829 | $post_type = get_post_type($post_id); |
| 2830 | 2830 | |
| 2831 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
| 2831 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
| 2832 | 2832 | |
| 2833 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
|
|
| 2833 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='".$post_first_image[0]->file."' WHERE post_id =".$post_id);
|
|
| 2834 | 2834 | |
| 2835 | 2835 | $new_attachment_name = basename($post_first_image[0]->file); |
| 2836 | 2836 | |
@@ -2843,11 +2843,11 @@ discard block |
||
| 2843 | 2843 | wp_delete_attachment($post_thumbnail_id); |
| 2844 | 2844 | |
| 2845 | 2845 | } |
| 2846 | - $filename = $uploads['basedir'] . $post_first_image[0]->file; |
|
| 2846 | + $filename = $uploads['basedir'].$post_first_image[0]->file; |
|
| 2847 | 2847 | |
| 2848 | 2848 | $attachment = array( |
| 2849 | 2849 | 'post_mime_type' => $post_first_image[0]->mime_type, |
| 2850 | - 'guid' => $uploads['baseurl'] . $post_first_image[0]->file, |
|
| 2850 | + 'guid' => $uploads['baseurl'].$post_first_image[0]->file, |
|
| 2851 | 2851 | 'post_parent' => $post_id, |
| 2852 | 2852 | 'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
|
| 2853 | 2853 | 'post_content' => '' |
@@ -2860,7 +2860,7 @@ discard block |
||
| 2860 | 2860 | |
| 2861 | 2861 | set_post_thumbnail($post_id, $id); |
| 2862 | 2862 | |
| 2863 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 2863 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
| 2864 | 2864 | wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename)); |
| 2865 | 2865 | |
| 2866 | 2866 | } |
@@ -2893,35 +2893,35 @@ discard block |
||
| 2893 | 2893 | $post_id = absint($_POST['post_id']); |
| 2894 | 2894 | $upload_dir = wp_upload_dir(); |
| 2895 | 2895 | $post_type = get_post_type($_POST['post_id']); |
| 2896 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2896 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2897 | 2897 | |
| 2898 | 2898 | $post_arr = $wpdb->get_results($wpdb->prepare( |
| 2899 | - "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
| 2899 | + "SELECT * FROM $wpdb->posts p JOIN ".$table." gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
| 2900 | 2900 | array($post_id) |
| 2901 | 2901 | ) |
| 2902 | 2902 | , ARRAY_A); |
| 2903 | 2903 | |
| 2904 | 2904 | $arrImages = $wpdb->get_results( |
| 2905 | 2905 | $wpdb->prepare( |
| 2906 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
| 2906 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
| 2907 | 2907 | array('%image%', $post_id)
|
| 2908 | 2908 | ) |
| 2909 | 2909 | ); |
| 2910 | 2910 | if ($arrImages) {
|
| 2911 | 2911 | $image_arr = array(); |
| 2912 | 2912 | foreach ($arrImages as $img) {
|
| 2913 | - $image_arr[] = $upload_dir['baseurl'] . $img->file; |
|
| 2913 | + $image_arr[] = $upload_dir['baseurl'].$img->file; |
|
| 2914 | 2914 | } |
| 2915 | 2915 | $comma_separated = implode(",", $image_arr);
|
| 2916 | 2916 | $post_arr[0]['post_images'] = $comma_separated; |
| 2917 | 2917 | } |
| 2918 | 2918 | |
| 2919 | 2919 | |
| 2920 | - $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category']; |
|
| 2920 | + $cats = $post_arr[0][$post_arr[0]['post_type'].'category']; |
|
| 2921 | 2921 | $cat_arr = array_filter(explode(",", $cats));
|
| 2922 | 2922 | $trans_cat = array(); |
| 2923 | 2923 | foreach ($cat_arr as $cat) {
|
| 2924 | - $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false); |
|
| 2924 | + $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'].'category', false); |
|
| 2925 | 2925 | } |
| 2926 | 2926 | |
| 2927 | 2927 | |
@@ -2963,7 +2963,7 @@ discard block |
||
| 2963 | 2963 | |
| 2964 | 2964 | $get_data = $wpdb->get_results( |
| 2965 | 2965 | $wpdb->prepare( |
| 2966 | - "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'", |
|
| 2966 | + "SELECT htmlvar_name, field_type, extra_fields FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1'", |
|
| 2967 | 2967 | array($listing_type) |
| 2968 | 2968 | ) |
| 2969 | 2969 | ); |
@@ -2976,12 +2976,12 @@ discard block |
||
| 2976 | 2976 | |
| 2977 | 2977 | $extra_fields = unserialize($data->extra_fields); |
| 2978 | 2978 | |
| 2979 | - $prefix = $data->htmlvar_name . '_'; |
|
| 2979 | + $prefix = $data->htmlvar_name.'_'; |
|
| 2980 | 2980 | |
| 2981 | - $fields_info[$prefix . 'address'] = $data->field_type; |
|
| 2981 | + $fields_info[$prefix.'address'] = $data->field_type; |
|
| 2982 | 2982 | |
| 2983 | 2983 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
| 2984 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 2984 | + $fields_info[$prefix.'zip'] = $data->field_type; |
|
| 2985 | 2985 | |
| 2986 | 2986 | } else {
|
| 2987 | 2987 | |
@@ -3079,13 +3079,13 @@ discard block |
||
| 3079 | 3079 | * @since 1.4.9 |
| 3080 | 3080 | * @package GeoDirectory |
| 3081 | 3081 | */ |
| 3082 | -function geodir_fb_like_thumbnail(){
|
|
| 3082 | +function geodir_fb_like_thumbnail() {
|
|
| 3083 | 3083 | |
| 3084 | 3084 | // return if not a single post |
| 3085 | - if(!is_single()){return;}
|
|
| 3085 | + if (!is_single()) {return; }
|
|
| 3086 | 3086 | |
| 3087 | 3087 | global $post; |
| 3088 | - if(isset($post->featured_image) && $post->featured_image){
|
|
| 3088 | + if (isset($post->featured_image) && $post->featured_image) {
|
|
| 3089 | 3089 | $upload_dir = wp_upload_dir(); |
| 3090 | 3090 | $thumb = $upload_dir['baseurl'].$post->featured_image; |
| 3091 | 3091 | echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n"; |