@@ -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 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $gd_post = $post; |
| 147 | 147 | if (!empty($gd_post) && is_array($gd_post)) {
|
| 148 | - $gd_post = (object)$post; |
|
| 148 | + $gd_post = (object) $post; |
|
| 149 | 149 | |
| 150 | 150 | // Fix WPML duplicate. |
| 151 | 151 | if (geodir_is_wpml() && !empty($request_info['action']) && $request_info['action'] == 'editpost' && !empty($request_info['icl_trid']) && !isset($post['post_date'])) {
|
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $send_post_submit_mail = false; |
| 240 | 240 | |
| 241 | 241 | // unhook this function so it doesn't loop infinitely |
| 242 | - remove_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 242 | + remove_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 243 | 243 | |
| 244 | 244 | if (isset($request_info['pid']) && $request_info['pid'] != '') {
|
| 245 | 245 | $post['ID'] = $request_info['pid']; |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // re-hook this function |
| 266 | - add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 266 | + add_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 267 | 267 | |
| 268 | 268 | $post_tags = ''; |
| 269 | 269 | if (!isset($request_info['post_tags'])) {
|
| 270 | 270 | |
| 271 | 271 | $post_type = $request_info['listing_type']; |
| 272 | - $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
|
|
| 272 | + $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type.'_tags', array('fields' => 'names')));
|
|
| 273 | 273 | |
| 274 | 274 | } |
| 275 | 275 | |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | $payment_info = array(); |
| 288 | 288 | $package_info = array(); |
| 289 | 289 | |
| 290 | - $package_info = (array)geodir_post_package_info($package_info, $post); |
|
| 290 | + $package_info = (array) geodir_post_package_info($package_info, $post); |
|
| 291 | 291 | |
| 292 | 292 | $post_package_id = geodir_get_post_meta($last_post_id, 'package_id'); |
| 293 | 293 | |
| 294 | 294 | if (!empty($package_info) && !$post_package_id) {
|
| 295 | 295 | if (isset($package_info['days']) && $package_info['days'] != 0) {
|
| 296 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
|
|
| 296 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['days']." days"));
|
|
| 297 | 297 | } else {
|
| 298 | 298 | $payment_info['expire_date'] = 'Never'; |
| 299 | 299 | } |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | $extrafields = $val['extra_fields']; |
| 315 | 315 | |
| 316 | 316 | if (trim($type) == 'address') {
|
| 317 | - $prefix = $name . '_'; |
|
| 318 | - $address = $prefix . 'address'; |
|
| 317 | + $prefix = $name.'_'; |
|
| 318 | + $address = $prefix.'address'; |
|
| 319 | 319 | |
| 320 | 320 | if (isset($request_info[$address]) && $request_info[$address] != '') {
|
| 321 | 321 | $gd_post_info[$address] = wp_slash($request_info[$address]); |
@@ -325,59 +325,59 @@ discard block |
||
| 325 | 325 | $extrafields = unserialize($extrafields); |
| 326 | 326 | |
| 327 | 327 | |
| 328 | - if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
|
|
| 328 | + if (!isset($request_info[$prefix.'city']) || $request_info[$prefix.'city'] == '') {
|
|
| 329 | 329 | |
| 330 | 330 | $location_result = geodir_get_default_location(); |
| 331 | 331 | |
| 332 | - $gd_post_info[$prefix . 'city'] = $location_result->city; |
|
| 333 | - $gd_post_info[$prefix . 'region'] = $location_result->region; |
|
| 334 | - $gd_post_info[$prefix . 'country'] = $location_result->country; |
|
| 332 | + $gd_post_info[$prefix.'city'] = $location_result->city; |
|
| 333 | + $gd_post_info[$prefix.'region'] = $location_result->region; |
|
| 334 | + $gd_post_info[$prefix.'country'] = $location_result->country; |
|
| 335 | 335 | |
| 336 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 336 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location |
|
| 337 | 337 | |
| 338 | 338 | } else {
|
| 339 | 339 | |
| 340 | - $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city']; |
|
| 341 | - $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region']; |
|
| 342 | - $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country']; |
|
| 340 | + $gd_post_info[$prefix.'city'] = $request_info[$prefix.'city']; |
|
| 341 | + $gd_post_info[$prefix.'region'] = $request_info[$prefix.'region']; |
|
| 342 | + $gd_post_info[$prefix.'country'] = $request_info[$prefix.'country']; |
|
| 343 | 343 | |
| 344 | 344 | //----------set post locations when import dummy data------- |
| 345 | 345 | $location_result = geodir_get_default_location(); |
| 346 | 346 | |
| 347 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 347 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location |
|
| 348 | 348 | //----------------------------------------------------------------- |
| 349 | 349 | |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | |
| 353 | - if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
|
|
| 354 | - $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip']; |
|
| 353 | + if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix.'zip'])) {
|
|
| 354 | + $gd_post_info[$prefix.'zip'] = $request_info[$prefix.'zip']; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | |
| 358 | 358 | if (isset($extrafields['show_map']) && $extrafields['show_map']) {
|
| 359 | 359 | |
| 360 | - if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
|
|
| 361 | - $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude']; |
|
| 360 | + if (isset($request_info[$prefix.'latitude']) && $request_info[$prefix.'latitude'] != '') {
|
|
| 361 | + $gd_post_info[$prefix.'latitude'] = $request_info[$prefix.'latitude']; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
|
|
| 365 | - $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude']; |
|
| 364 | + if (isset($request_info[$prefix.'longitude']) && $request_info[$prefix.'longitude'] != '') {
|
|
| 365 | + $gd_post_info[$prefix.'longitude'] = $request_info[$prefix.'longitude']; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
|
|
| 369 | - $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview']; |
|
| 368 | + if (isset($request_info[$prefix.'mapview']) && $request_info[$prefix.'mapview'] != '') {
|
|
| 369 | + $gd_post_info[$prefix.'mapview'] = $request_info[$prefix.'mapview']; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
|
|
| 373 | - $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom']; |
|
| 372 | + if (isset($request_info[$prefix.'mapzoom']) && $request_info[$prefix.'mapzoom'] != '') {
|
|
| 373 | + $gd_post_info[$prefix.'mapzoom'] = $request_info[$prefix.'mapzoom']; |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | // show lat lng |
| 379 | - if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
|
|
| 380 | - $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng']; |
|
| 379 | + if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix.'latlng'])) {
|
|
| 380 | + $gd_post_info[$prefix.'latlng'] = $request_info[$prefix.'latlng']; |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
@@ -403,16 +403,16 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | // check if we need to change the format or not |
| 405 | 405 | $date_format_len = strlen(str_replace(' ', '', $date_format));
|
| 406 | - if($date_format_len>5){// if greater then 5 then it's the old style format.
|
|
| 406 | + if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
|
|
| 407 | 407 | |
| 408 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
|
|
| 409 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
|
| 408 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
|
|
| 409 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
|
|
| 410 | 410 | |
| 411 | 411 | $date_format = str_replace($search, $replace, $date_format); |
| 412 | 412 | |
| 413 | 413 | $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
|
| 414 | 414 | |
| 415 | - }else{
|
|
| 415 | + } else {
|
|
| 416 | 416 | $post_htmlvar_value = $request_info[$name]; |
| 417 | 417 | } |
| 418 | 418 | |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | if (isset($request_info[$name])) {
|
| 427 | 427 | $gd_post_info[$name] = $request_info[$name]; |
| 428 | 428 | } else {
|
| 429 | - if (isset($request_info['gd_field_' . $name])) {
|
|
| 429 | + if (isset($request_info['gd_field_'.$name])) {
|
|
| 430 | 430 | $gd_post_info[$name] = ''; /* fix de-select for multiselect */ |
| 431 | 431 | } |
| 432 | 432 | } |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | if (is_array($post_tags)) {
|
| 489 | - $taxonomy = $request_info['listing_type'] . '_tags'; |
|
| 489 | + $taxonomy = $request_info['listing_type'].'_tags'; |
|
| 490 | 490 | wp_set_object_terms($last_post_id, $post_tags, $taxonomy); |
| 491 | 491 | } |
| 492 | 492 | |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $tmpimgArr = trim($request_info['post_images'], ","); |
| 499 | 499 | $tmpimgArr = explode(",", $tmpimgArr);
|
| 500 | 500 | geodir_save_post_images($last_post_id, $tmpimgArr, $dummy); |
| 501 | - } else{
|
|
| 501 | + } else {
|
|
| 502 | 502 | geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy); |
| 503 | 503 | } |
| 504 | 504 | |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | if (!in_array($post_type, $all_postypes)) |
| 580 | 580 | return false; |
| 581 | 581 | |
| 582 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 582 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 583 | 583 | |
| 584 | 584 | /** |
| 585 | 585 | * Apply Filter to change Post info |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | * @since 1.0.0 |
| 590 | 590 | * @package GeoDirectory |
| 591 | 591 | */ |
| 592 | - $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
|
|
| 592 | + $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM ".$wpdb->posts." p,".$table." pd
|
|
| 593 | 593 | WHERE p.ID = pd.post_id |
| 594 | 594 | AND pd.post_id = %d", $post_id)); |
| 595 | 595 | |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | |
| 653 | 653 | $post_type = get_post_type($post_id); |
| 654 | 654 | |
| 655 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 655 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 656 | 656 | |
| 657 | 657 | /** |
| 658 | 658 | * Filter to change Post info |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | $columns = $wpdb->get_col("show columns from $table");
|
| 675 | 675 | foreach ($postmeta as $mkey => $mval) {
|
| 676 | - if(in_array($mkey,$columns)) {
|
|
| 676 | + if (in_array($mkey, $columns)) {
|
|
| 677 | 677 | if (is_array($mval)) {
|
| 678 | 678 | $mval = implode(",", $mval);
|
| 679 | 679 | } |
@@ -702,12 +702,12 @@ discard block |
||
| 702 | 702 | */ |
| 703 | 703 | do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
|
| 704 | 704 | |
| 705 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 705 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 706 | 706 | |
| 707 | 707 | $query_string_array[] = $post_id; |
| 708 | 708 | $wpdb->query( |
| 709 | 709 | $wpdb->prepare( |
| 710 | - "UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d", |
|
| 710 | + "UPDATE ".$table." SET ".$query_string_escaped." where post_id =%d", |
|
| 711 | 711 | $query_string_array |
| 712 | 712 | ) |
| 713 | 713 | ); |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | array_unshift($query_string_array, $post_id); |
| 719 | 719 | $wpdb->query( |
| 720 | 720 | $wpdb->prepare( |
| 721 | - "INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped, |
|
| 721 | + "INSERT INTO ".$table." SET post_id = %d,".$query_string_escaped, |
|
| 722 | 722 | $query_string_array |
| 723 | 723 | ) |
| 724 | 724 | ); |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | $post_type = get_post_type($post_id); |
| 766 | 766 | |
| 767 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 767 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 768 | 768 | |
| 769 | 769 | if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
|
| 770 | 770 | |
@@ -772,11 +772,11 @@ discard block |
||
| 772 | 772 | $meta_value = implode(",", $meta_value);
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 775 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 776 | 776 | |
| 777 | 777 | $wpdb->query( |
| 778 | 778 | $wpdb->prepare( |
| 779 | - "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d", |
|
| 779 | + "UPDATE ".$table." SET ".$postmeta." = '".$meta_value."' where post_id =%d", |
|
| 780 | 780 | array($post_id) |
| 781 | 781 | ) |
| 782 | 782 | ); |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | |
| 786 | 786 | $wpdb->query( |
| 787 | 787 | $wpdb->prepare( |
| 788 | - "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'", |
|
| 788 | + "INSERT INTO ".$table." SET post_id = %d, ".$postmeta." = '".$meta_value."'", |
|
| 789 | 789 | array($post_id) |
| 790 | 790 | ) |
| 791 | 791 | ); |
@@ -818,14 +818,14 @@ discard block |
||
| 818 | 818 | |
| 819 | 819 | $post_type = get_post_type($post_id); |
| 820 | 820 | |
| 821 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 821 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 822 | 822 | |
| 823 | 823 | if (is_array($postmeta) && !empty($postmeta) && $post_id) {
|
| 824 | 824 | $post_meta_set_query = ''; |
| 825 | 825 | |
| 826 | 826 | foreach ($postmeta as $mkey) {
|
| 827 | 827 | if ($mval != '') |
| 828 | - $post_meta_set_query .= $mkey . " = '', "; |
|
| 828 | + $post_meta_set_query .= $mkey." = '', "; |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | $post_meta_set_query = trim($post_meta_set_query, ", "); |
@@ -834,11 +834,11 @@ discard block |
||
| 834 | 834 | return false; |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 837 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
|
|
| 838 | 838 | |
| 839 | 839 | $wpdb->query( |
| 840 | 840 | $wpdb->prepare( |
| 841 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d", |
|
| 841 | + "UPDATE ".$table." SET ".$post_meta_set_query." where post_id = %d", |
|
| 842 | 842 | array($post_id) |
| 843 | 843 | ) |
| 844 | 844 | ); |
@@ -847,11 +847,11 @@ discard block |
||
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | } elseif ($postmeta != '' && $post_id) {
|
| 850 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 850 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
|
|
| 851 | 851 | |
| 852 | 852 | $wpdb->query( |
| 853 | 853 | $wpdb->prepare( |
| 854 | - "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d", |
|
| 854 | + "UPDATE ".$table." SET ".$postmeta."= '' where post_id = %d", |
|
| 855 | 855 | array($post_id) |
| 856 | 856 | ) |
| 857 | 857 | ); |
@@ -893,10 +893,10 @@ discard block |
||
| 893 | 893 | if (!in_array($post_type, $all_postypes)) |
| 894 | 894 | return false; |
| 895 | 895 | |
| 896 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 896 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 897 | 897 | |
| 898 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
|
|
| 899 | - $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
|
|
| 898 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$meta_key."'") != '') {
|
|
| 899 | + $meta_value = $wpdb->get_var($wpdb->prepare("SELECT ".$meta_key." from ".$table." where post_id = %d", array($post_id)));
|
|
| 900 | 900 | |
| 901 | 901 | if ($meta_value && $meta_value !== '') {
|
| 902 | 902 | $meta_value = maybe_serialize($meta_value); |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | * @param string $meta_key The meta key to retrieve. |
| 916 | 916 | * @param bool $single Optional. Whether to return a single value. Default false. |
| 917 | 917 | */ |
| 918 | - return apply_filters( 'geodir_get_post_meta', $meta_value, $post_id, $meta_key, $single ); |
|
| 918 | + return apply_filters('geodir_get_post_meta', $meta_value, $post_id, $meta_key, $single);
|
|
| 919 | 919 | } |
| 920 | 920 | } |
| 921 | 921 | |
@@ -941,13 +941,13 @@ discard block |
||
| 941 | 941 | |
| 942 | 942 | $post_type = get_post_type($post_id); |
| 943 | 943 | |
| 944 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 944 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 945 | 945 | |
| 946 | 946 | $post_images = geodir_get_images($post_id); |
| 947 | 947 | |
| 948 | 948 | $wpdb->query( |
| 949 | 949 | $wpdb->prepare( |
| 950 | - "UPDATE " . $table . " SET featured_image = '' where post_id =%d", |
|
| 950 | + "UPDATE ".$table." SET featured_image = '' where post_id =%d", |
|
| 951 | 951 | array($post_id) |
| 952 | 952 | ) |
| 953 | 953 | ); |
@@ -977,12 +977,12 @@ discard block |
||
| 977 | 977 | $file_path = ''; |
| 978 | 978 | /* --------- start ------- */ |
| 979 | 979 | |
| 980 | - $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
|
|
| 980 | + $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
|
|
| 981 | 981 | |
| 982 | 982 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
| 983 | 983 | |
| 984 | 984 | |
| 985 | - 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)))) {
|
|
| 985 | + 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)))) {
|
|
| 986 | 986 | |
| 987 | 987 | /* --------- end ------- */ |
| 988 | 988 | $curr_img_url = $post_image[$m]; |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | // If the uploaded file is the right format |
| 1027 | 1027 | if (in_array($uploaded_file_type, $allowed_file_types)) {
|
| 1028 | 1028 | if (!function_exists('wp_handle_upload')) {
|
| 1029 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1029 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | 1032 | if (!is_dir($geodir_uploadpath)) {
|
@@ -1034,41 +1034,41 @@ discard block |
||
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | $external_img = false; |
| 1037 | - if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) {
|
|
| 1037 | + if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
|
|
| 1038 | 1038 | } else {
|
| 1039 | 1039 | $external_img = true; |
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | if ($dummy || $external_img) {
|
| 1043 | 1043 | $uploaded_file = array(); |
| 1044 | - $uploaded = (array)fetch_remote_file($curr_img_url); |
|
| 1044 | + $uploaded = (array) fetch_remote_file($curr_img_url); |
|
| 1045 | 1045 | |
| 1046 | 1046 | if (isset($uploaded['error']) && empty($uploaded['error'])) {
|
| 1047 | 1047 | $new_name = basename($uploaded['file']); |
| 1048 | 1048 | $uploaded_file = $uploaded; |
| 1049 | - }else{
|
|
| 1050 | - print_r($uploaded);exit; |
|
| 1049 | + } else {
|
|
| 1050 | + print_r($uploaded); exit; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | $external_img = false; |
| 1053 | 1053 | } else {
|
| 1054 | - $new_name = $post_id . '_' . $file_name; |
|
| 1054 | + $new_name = $post_id.'_'.$file_name; |
|
| 1055 | 1055 | |
| 1056 | 1056 | if ($curr_img_dir == $sub_dir) {
|
| 1057 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1058 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1057 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1058 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1059 | 1059 | } else {
|
| 1060 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1061 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1060 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1061 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | $uploaded_file = ''; |
| 1065 | 1065 | |
| 1066 | 1066 | if (file_exists($img_path)) {
|
| 1067 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1067 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1068 | 1068 | $file_path = ''; |
| 1069 | - } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
|
|
| 1069 | + } else if (file_exists($uploads['basedir'].$curr_img_dir.$filename)) {
|
|
| 1070 | 1070 | $uploaded_file = true; |
| 1071 | - $file_path = $curr_img_dir . '/' . $filename; |
|
| 1071 | + $file_path = $curr_img_dir.'/'.$filename; |
|
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
@@ -1077,14 +1077,14 @@ discard block |
||
| 1077 | 1077 | |
| 1078 | 1078 | if (!empty($uploaded_file)) {
|
| 1079 | 1079 | if (!isset($file_path) || !$file_path) {
|
| 1080 | - $file_path = $sub_dir . '/' . $new_name; |
|
| 1080 | + $file_path = $sub_dir.'/'.$new_name; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
|
|
| 1083 | + $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'].$file_path);
|
|
| 1084 | 1084 | |
| 1085 | 1085 | if ($menu_order == 1) {
|
| 1086 | 1086 | |
| 1087 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
|
|
| 1087 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
|
|
| 1088 | 1088 | |
| 1089 | 1089 | } |
| 1090 | 1090 | |
@@ -1102,12 +1102,12 @@ discard block |
||
| 1102 | 1102 | |
| 1103 | 1103 | foreach ($attachment as $key => $val) {
|
| 1104 | 1104 | if ($val != '') |
| 1105 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1105 | + $attachment_set .= $key." = '".$val."', "; |
|
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | $attachment_set = trim($attachment_set, ", "); |
| 1109 | 1109 | |
| 1110 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 1110 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 1111 | 1111 | |
| 1112 | 1112 | $valid_file_ids[] = $wpdb->insert_id; |
| 1113 | 1113 | } |
@@ -1118,17 +1118,17 @@ discard block |
||
| 1118 | 1118 | } else {
|
| 1119 | 1119 | $valid_file_ids[] = $find_image; |
| 1120 | 1120 | |
| 1121 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
|
|
| 1121 | + $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
|
|
| 1122 | 1122 | |
| 1123 | 1123 | $wpdb->query( |
| 1124 | 1124 | $wpdb->prepare( |
| 1125 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d", |
|
| 1125 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d where file =%s AND post_id =%d", |
|
| 1126 | 1126 | array($menu_order, $split_img_path[1], $post_id) |
| 1127 | 1127 | ) |
| 1128 | 1128 | ); |
| 1129 | 1129 | |
| 1130 | 1130 | if ($menu_order == 1) |
| 1131 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1131 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1132 | 1132 | |
| 1133 | 1133 | } |
| 1134 | 1134 | |
@@ -1152,9 +1152,9 @@ discard block |
||
| 1152 | 1152 | |
| 1153 | 1153 | foreach ($post_images as $img) {
|
| 1154 | 1154 | |
| 1155 | - if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
|
|
| 1155 | + if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
|
|
| 1156 | 1156 | |
| 1157 | - $invalid_files[] = (object)array('src' => $img->src);
|
|
| 1157 | + $invalid_files[] = (object) array('src' => $img->src);
|
|
| 1158 | 1158 | |
| 1159 | 1159 | } |
| 1160 | 1160 | |
@@ -1162,12 +1162,12 @@ discard block |
||
| 1162 | 1162 | |
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | - $invalid_files = (object)$invalid_files; |
|
| 1165 | + $invalid_files = (object) $invalid_files; |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | $remove_files[] = $post_id; |
| 1169 | 1169 | |
| 1170 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
|
|
| 1170 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ".$valid_files_condition." post_id = %d", $remove_files));
|
|
| 1171 | 1171 | |
| 1172 | 1172 | if (!empty($invalid_files)) |
| 1173 | 1173 | geodir_remove_attachments($invalid_files); |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | rmdir($dirPath); |
| 1208 | 1208 | } */ |
| 1209 | 1209 | |
| 1210 | - $dirname = $uploads_dir . '/temp_' . $current_user->ID; |
|
| 1210 | + $dirname = $uploads_dir.'/temp_'.$current_user->ID; |
|
| 1211 | 1211 | geodir_delete_directory($dirname); |
| 1212 | 1212 | } |
| 1213 | 1213 | |
@@ -1229,10 +1229,10 @@ discard block |
||
| 1229 | 1229 | return false; |
| 1230 | 1230 | while ($file = readdir($dir_handle)) {
|
| 1231 | 1231 | if ($file != "." && $file != "..") {
|
| 1232 | - if (!is_dir($dirname . "/" . $file)) |
|
| 1233 | - unlink($dirname . "/" . $file); |
|
| 1232 | + if (!is_dir($dirname."/".$file)) |
|
| 1233 | + unlink($dirname."/".$file); |
|
| 1234 | 1234 | else |
| 1235 | - geodir_delete_directory($dirname . '/' . $file); |
|
| 1235 | + geodir_delete_directory($dirname.'/'.$file); |
|
| 1236 | 1236 | } |
| 1237 | 1237 | } |
| 1238 | 1238 | closedir($dir_handle); |
@@ -1261,8 +1261,8 @@ discard block |
||
| 1261 | 1261 | foreach ($postcurr_images as $postimg) {
|
| 1262 | 1262 | $image_name_arr = explode('/', $postimg->src);
|
| 1263 | 1263 | $filename = end($image_name_arr); |
| 1264 | - if (file_exists($uploads_dir . '/' . $filename)) |
|
| 1265 | - unlink($uploads_dir . '/' . $filename); |
|
| 1264 | + if (file_exists($uploads_dir.'/'.$filename)) |
|
| 1265 | + unlink($uploads_dir.'/'.$filename); |
|
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | 1268 | } // endif |
@@ -1303,28 +1303,28 @@ discard block |
||
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | 1305 | if (!in_array($post_type, geodir_get_posttypes())) {
|
| 1306 | - return false;// if not a GD CPT return; |
|
| 1306 | + return false; // if not a GD CPT return; |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | |
| 1310 | - $list_img_size = get_option('geodir_listing_img_size','default');
|
|
| 1310 | + $list_img_size = get_option('geodir_listing_img_size', 'default');
|
|
| 1311 | 1311 | |
| 1312 | - if( $size=='list-thumb' && $list_img_size != 'default' ){
|
|
| 1313 | - $fimg = get_the_post_thumbnail_url($post_id,$list_img_size); |
|
| 1314 | - if($fimg){
|
|
| 1312 | + if ($size == 'list-thumb' && $list_img_size != 'default') {
|
|
| 1313 | + $fimg = get_the_post_thumbnail_url($post_id, $list_img_size); |
|
| 1314 | + if ($fimg) {
|
|
| 1315 | 1315 | $uploads = wp_upload_dir(); |
| 1316 | 1316 | $uploads_baseurl = $uploads['baseurl']; |
| 1317 | - $file = str_replace($uploads_baseurl,'',$fimg); |
|
| 1317 | + $file = str_replace($uploads_baseurl, '', $fimg); |
|
| 1318 | 1318 | } |
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1321 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1322 | 1322 | |
| 1323 | 1323 | if (!$file) {
|
| 1324 | 1324 | if (isset($post->featured_image)) {
|
| 1325 | 1325 | $file = $post->featured_image; |
| 1326 | 1326 | } else {
|
| 1327 | - $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
|
|
| 1327 | + $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM ".$table." WHERE post_id = %d", array($post_id)));
|
|
| 1328 | 1328 | } |
| 1329 | 1329 | } |
| 1330 | 1330 | |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | |
| 1344 | 1344 | $file_name = $file_info['basename']; |
| 1345 | 1345 | |
| 1346 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1346 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
| 1347 | 1347 | /* |
| 1348 | 1348 | * Allows the filter of image src for such things as CDN change. |
| 1349 | 1349 | * |
@@ -1353,8 +1353,8 @@ discard block |
||
| 1353 | 1353 | * @param string $uploads_url The server upload directory url. |
| 1354 | 1354 | * @param string $uploads_baseurl The uploads dir base url. |
| 1355 | 1355 | */ |
| 1356 | - $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1357 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1356 | + $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
|
|
| 1357 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1358 | 1358 | $width = 0; |
| 1359 | 1359 | $height = 0; |
| 1360 | 1360 | if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | $file_name = $file_info['basename']; |
| 1398 | 1398 | |
| 1399 | 1399 | $img_arr['src'] = $default_img; |
| 1400 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1400 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1401 | 1401 | |
| 1402 | 1402 | $width = 0; |
| 1403 | 1403 | $height = 0; |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | 1416 | if (!empty($img_arr)) |
| 1417 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1417 | + return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1418 | 1418 | else |
| 1419 | 1419 | return false; |
| 1420 | 1420 | } |
@@ -1477,7 +1477,7 @@ discard block |
||
| 1477 | 1477 | |
| 1478 | 1478 | $arrImages = $wpdb->get_results( |
| 1479 | 1479 | $wpdb->prepare( |
| 1480 | - "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 ", |
|
| 1480 | + "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 ", |
|
| 1481 | 1481 | array('%image%', $post_id)
|
| 1482 | 1482 | ) |
| 1483 | 1483 | ); |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | |
| 1504 | 1504 | $file_name = $file_info['basename']; |
| 1505 | 1505 | |
| 1506 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1506 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
| 1507 | 1507 | /* |
| 1508 | 1508 | * Allows the filter of image src for such things as CDN change. |
| 1509 | 1509 | * |
@@ -1513,8 +1513,8 @@ discard block |
||
| 1513 | 1513 | * @param string $uploads_url The server upload directory url. |
| 1514 | 1514 | * @param string $uploads_baseurl The uploads dir base url. |
| 1515 | 1515 | */ |
| 1516 | - $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1517 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1516 | + $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
|
|
| 1517 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1518 | 1518 | $width = 0; |
| 1519 | 1519 | $height = 0; |
| 1520 | 1520 | if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
@@ -1531,7 +1531,7 @@ discard block |
||
| 1531 | 1531 | $img_arr['content'] = $attechment->content; // add the description to the array |
| 1532 | 1532 | $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1. |
| 1533 | 1533 | |
| 1534 | - $return_arr[] = (object)$img_arr; |
|
| 1534 | + $return_arr[] = (object) $img_arr; |
|
| 1535 | 1535 | |
| 1536 | 1536 | $counter++; |
| 1537 | 1537 | } |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | * @since 1.6.20 |
| 1543 | 1543 | * @param array $return_arr The array of image objects. |
| 1544 | 1544 | */ |
| 1545 | - return apply_filters('geodir_get_images_arr',$return_arr);
|
|
| 1545 | + return apply_filters('geodir_get_images_arr', $return_arr);
|
|
| 1546 | 1546 | } else if ($no_images) {
|
| 1547 | 1547 | $default_img = ''; |
| 1548 | 1548 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | $img_arr['title'] = $file_info['filename']; // add the title to the array |
| 1582 | 1582 | $img_arr['content'] = $file_info['filename']; // add the description to the array |
| 1583 | 1583 | |
| 1584 | - $return_arr[] = (object)$img_arr; |
|
| 1584 | + $return_arr[] = (object) $img_arr; |
|
| 1585 | 1585 | |
| 1586 | 1586 | /** |
| 1587 | 1587 | * Filter the images array so things can be changed. |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | * @since 1.6.20 |
| 1590 | 1590 | * @param array $return_arr The array of image objects. |
| 1591 | 1591 | */ |
| 1592 | - return apply_filters('geodir_get_images_arr',$return_arr);
|
|
| 1592 | + return apply_filters('geodir_get_images_arr', $return_arr);
|
|
| 1593 | 1593 | } else |
| 1594 | 1594 | return false; |
| 1595 | 1595 | } |
@@ -1614,8 +1614,8 @@ discard block |
||
| 1614 | 1614 | |
| 1615 | 1615 | $html = ''; |
| 1616 | 1616 | if (!empty($request)) {
|
| 1617 | - if (!is_object($request)){
|
|
| 1618 | - $request = (object)$request; |
|
| 1617 | + if (!is_object($request)) {
|
|
| 1618 | + $request = (object) $request; |
|
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | if (isset($request->src) && !isset($request->path)) {
|
@@ -1629,7 +1629,7 @@ discard block |
||
| 1629 | 1629 | $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
|
| 1630 | 1630 | $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
|
| 1631 | 1631 | if (strpos($img_no_http, $upload_no_http) !== false) {
|
| 1632 | - $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path); |
|
| 1632 | + $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | 1635 | $width = 0; |
@@ -1646,7 +1646,7 @@ discard block |
||
| 1646 | 1646 | $image->height = $height; |
| 1647 | 1647 | $image->title = isset($request->title) ? $request->title : ''; |
| 1648 | 1648 | |
| 1649 | - $max_size = (object)geodir_get_imagesize($size); |
|
| 1649 | + $max_size = (object) geodir_get_imagesize($size); |
|
| 1650 | 1650 | |
| 1651 | 1651 | if (!is_wp_error($max_size)) {
|
| 1652 | 1652 | if ($image->width) {
|
@@ -1658,13 +1658,13 @@ discard block |
||
| 1658 | 1658 | $width_per = 100; |
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | - if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
|
|
| 1662 | - $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>'; |
|
| 1661 | + if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
|
|
| 1662 | + $html = '<div class="geodir_thumbnail"><img style="max-height:'.$max_size->h.'px;" alt="place image" src="'.$image->src.'" /></div>'; |
|
| 1663 | 1663 | } else {
|
| 1664 | - if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
|
|
| 1665 | - $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');" title="'.$image->title.'" aria-label="'.$image->title.'" ></div>'; |
|
| 1666 | - }else{
|
|
| 1667 | - $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" title="'.$image->title.'" aria-label="'.$image->title.'"></div>';
|
|
| 1664 | + if ($size == 'widget-thumb' || !get_option('geodir_lazy_load', 1)) {
|
|
| 1665 | + $html = '<div class="geodir_thumbnail" style="background-image:url(\''.$image->src.'\');" title="'.$image->title.'" aria-label="'.$image->title.'" ></div>'; |
|
| 1666 | + } else {
|
|
| 1667 | + $html = '<div data-src="'.str_replace(' ', '%20', $image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" title="'.$image->title.'" aria-label="'.$image->title.'"></div>';
|
|
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | 1670 | } |
@@ -1699,15 +1699,15 @@ discard block |
||
| 1699 | 1699 | |
| 1700 | 1700 | $post_type = get_post_type($post_id); |
| 1701 | 1701 | |
| 1702 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1702 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1703 | 1703 | |
| 1704 | 1704 | if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
|
| 1705 | 1705 | |
| 1706 | - if ($taxonomy == $post_type . '_tags') {
|
|
| 1706 | + if ($taxonomy == $post_type.'_tags') {
|
|
| 1707 | 1707 | if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
| 1708 | 1708 | geodir_save_post_meta($post_id, 'post_tags', $terms); |
| 1709 | 1709 | } |
| 1710 | - } elseif ($taxonomy == $post_type . 'category') {
|
|
| 1710 | + } elseif ($taxonomy == $post_type.'category') {
|
|
| 1711 | 1711 | $srcharr = array('"', '\\');
|
| 1712 | 1712 | $replarr = array(""", '');
|
| 1713 | 1713 | |
@@ -1729,7 +1729,7 @@ discard block |
||
| 1729 | 1729 | |
| 1730 | 1730 | $wpdb->get_var( |
| 1731 | 1731 | $wpdb->prepare( |
| 1732 | - "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
| 1732 | + "DELETE from ".GEODIR_ICON_TABLE." WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
| 1733 | 1733 | $cat_ids_array_del |
| 1734 | 1734 | ) |
| 1735 | 1735 | ); |
@@ -1737,7 +1737,7 @@ discard block |
||
| 1737 | 1737 | |
| 1738 | 1738 | $post_term = $wpdb->get_col( |
| 1739 | 1739 | $wpdb->prepare( |
| 1740 | - "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
| 1740 | + "SELECT term_id FROM ".$wpdb->term_taxonomy." WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
| 1741 | 1741 | $cat_ids_array |
| 1742 | 1742 | ) |
| 1743 | 1743 | ); |
@@ -1759,16 +1759,16 @@ discard block |
||
| 1759 | 1759 | $lat = geodir_get_post_meta($post_id, 'post_latitude', true); |
| 1760 | 1760 | $lng = geodir_get_post_meta($post_id, 'post_longitude', true); |
| 1761 | 1761 | |
| 1762 | - $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
|
|
| 1763 | - $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true); |
|
| 1762 | + $timing = ' - '.date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
|
|
| 1763 | + $timing .= ' - '.geodir_get_post_meta($post_id, 'st_time', true); |
|
| 1764 | 1764 | |
| 1765 | 1765 | $json = '{';
|
| 1766 | - $json .= '"id":"' . $post_id . '",'; |
|
| 1767 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
| 1768 | - $json .= '"long_pos": "' . $lng . '",'; |
|
| 1769 | - $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",'; |
|
| 1770 | - $json .= '"icon":"' . $term_icon . '",'; |
|
| 1771 | - $json .= '"group":"catgroup' . $cat_id . '"'; |
|
| 1766 | + $json .= '"id":"'.$post_id.'",'; |
|
| 1767 | + $json .= '"lat_pos": "'.$lat.'",'; |
|
| 1768 | + $json .= '"long_pos": "'.$lng.'",'; |
|
| 1769 | + $json .= '"marker_id":"'.$post_id.'_'.$cat_id.'",'; |
|
| 1770 | + $json .= '"icon":"'.$term_icon.'",'; |
|
| 1771 | + $json .= '"group":"catgroup'.$cat_id.'"'; |
|
| 1772 | 1772 | $json .= '}'; |
| 1773 | 1773 | |
| 1774 | 1774 | |
@@ -1776,9 +1776,9 @@ discard block |
||
| 1776 | 1776 | $post_marker_json = $json; |
| 1777 | 1777 | |
| 1778 | 1778 | |
| 1779 | - 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)))) {
|
|
| 1779 | + 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)))) {
|
|
| 1780 | 1780 | |
| 1781 | - $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
|
|
| 1781 | + $json_query = $wpdb->prepare("UPDATE ".GEODIR_ICON_TABLE." SET
|
|
| 1782 | 1782 | post_title = %s, |
| 1783 | 1783 | json = %s |
| 1784 | 1784 | WHERE post_id = %d AND cat_id = %d ", |
@@ -1786,7 +1786,7 @@ discard block |
||
| 1786 | 1786 | |
| 1787 | 1787 | } else {
|
| 1788 | 1788 | |
| 1789 | - $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
|
|
| 1789 | + $json_query = $wpdb->prepare("INSERT INTO ".GEODIR_ICON_TABLE." SET
|
|
| 1790 | 1790 | post_id = %d, |
| 1791 | 1791 | post_title = %s, |
| 1792 | 1792 | cat_id = %d, |
@@ -1804,17 +1804,17 @@ discard block |
||
| 1804 | 1804 | if (!empty($post_term) && is_array($post_term)) {
|
| 1805 | 1805 | $categories = implode(',', $post_term);
|
| 1806 | 1806 | |
| 1807 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
| 1807 | + if ($categories != '' && $categories != 0) $categories = ','.$categories.','; |
|
| 1808 | 1808 | |
| 1809 | 1809 | if (empty($post_marker_json)) |
| 1810 | 1810 | $post_marker_json = isset($json) ? $json : ''; |
| 1811 | 1811 | |
| 1812 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 1812 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 1813 | 1813 | |
| 1814 | 1814 | $wpdb->query( |
| 1815 | 1815 | $wpdb->prepare( |
| 1816 | - "UPDATE " . $table . " SET |
|
| 1817 | - " . $taxonomy . " = %s, |
|
| 1816 | + "UPDATE ".$table." SET |
|
| 1817 | + " . $taxonomy." = %s, |
|
| 1818 | 1818 | marker_json = %s |
| 1819 | 1819 | where post_id = %d", |
| 1820 | 1820 | array($categories, $post_marker_json, $post_id) |
@@ -1835,7 +1835,7 @@ discard block |
||
| 1835 | 1835 | |
| 1836 | 1836 | $wpdb->query( |
| 1837 | 1837 | $wpdb->prepare( |
| 1838 | - "UPDATE " . $table . " SET |
|
| 1838 | + "UPDATE ".$table." SET |
|
| 1839 | 1839 | default_category = %s |
| 1840 | 1840 | where post_id = %d", |
| 1841 | 1841 | array($categories[0], $post_id) |
@@ -1860,9 +1860,9 @@ discard block |
||
| 1860 | 1860 | |
| 1861 | 1861 | $wpdb->query( |
| 1862 | 1862 | $wpdb->prepare( |
| 1863 | - "INSERT INTO " . $table . " SET |
|
| 1863 | + "INSERT INTO ".$table." SET |
|
| 1864 | 1864 | post_id = %d, |
| 1865 | - " . $taxonomy . " = %s, |
|
| 1865 | + " . $taxonomy." = %s, |
|
| 1866 | 1866 | marker_json = %s ", |
| 1867 | 1867 | |
| 1868 | 1868 | array($post_id, $categories, $post_marker_json) |
@@ -1994,7 +1994,7 @@ discard block |
||
| 1994 | 1994 | } ?>"><img alt="bubble image" style="max-height:50px;" |
| 1995 | 1995 | src="<?php echo $post_images[0]; ?>"/></a></div> |
| 1996 | 1996 | <?php |
| 1997 | - }else{
|
|
| 1997 | + } else {
|
|
| 1998 | 1998 | echo '<div class="geodir-bubble_image"></div>'; |
| 1999 | 1999 | } |
| 2000 | 2000 | } else {
|
@@ -2002,7 +2002,7 @@ discard block |
||
| 2002 | 2002 | ?> |
| 2003 | 2003 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
| 2004 | 2004 | <?php |
| 2005 | - }else{
|
|
| 2005 | + } else {
|
|
| 2006 | 2006 | echo '<div class="geodir-bubble_image"></div>'; |
| 2007 | 2007 | } |
| 2008 | 2008 | } |
@@ -2032,7 +2032,7 @@ discard block |
||
| 2032 | 2032 | * @param object $postinfo_obj The posts info as an object. |
| 2033 | 2033 | * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * |
| 2034 | 2034 | */ |
| 2035 | - do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
|
|
| 2035 | + do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
|
|
| 2036 | 2036 | ?> |
| 2037 | 2037 | </div> |
| 2038 | 2038 | <?php |
@@ -2042,9 +2042,9 @@ discard block |
||
| 2042 | 2042 | <div class="geodir-bubble-meta-fade"></div> |
| 2043 | 2043 | <div class="geodir-bubble-meta-bottom"> |
| 2044 | 2044 | <?php if ($rating_star != '') { ?>
|
| 2045 | - <span class="geodir-bubble-rating"><?php echo $rating_star;?></span> |
|
| 2045 | + <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span> |
|
| 2046 | 2046 | <?php } ?> |
| 2047 | - <span class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span> |
|
| 2047 | + <span class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span> |
|
| 2048 | 2048 | <span class="geodir-bubble-reviews"> |
| 2049 | 2049 | <a href="<?php echo get_comments_link($ID); ?>" class="geodir-pcomments"><i class="fa fa-comments"></i> <?php echo get_comments_number($ID); ?></a> |
| 2050 | 2050 | </span> |
@@ -2106,11 +2106,11 @@ discard block |
||
| 2106 | 2106 | |
| 2107 | 2107 | $post_type = get_post_type($post_id); |
| 2108 | 2108 | |
| 2109 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2109 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2110 | 2110 | |
| 2111 | 2111 | $wpdb->query( |
| 2112 | 2112 | $wpdb->prepare( |
| 2113 | - "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d", |
|
| 2113 | + "UPDATE ".$table." SET post_status=%s WHERE post_id=%d", |
|
| 2114 | 2114 | array($status, $post_id) |
| 2115 | 2115 | ) |
| 2116 | 2116 | ); |
@@ -2182,18 +2182,18 @@ discard block |
||
| 2182 | 2182 | |
| 2183 | 2183 | $post_type = get_post_type($post_id); |
| 2184 | 2184 | |
| 2185 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2185 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2186 | 2186 | |
| 2187 | 2187 | $wpdb->query( |
| 2188 | 2188 | $wpdb->prepare( |
| 2189 | - "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2189 | + "UPDATE ".$table." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2190 | 2190 | array($updatingpost, $temppost) |
| 2191 | 2191 | ) |
| 2192 | 2192 | ); |
| 2193 | 2193 | |
| 2194 | 2194 | $wpdb->query( |
| 2195 | 2195 | $wpdb->prepare( |
| 2196 | - "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2196 | + "UPDATE ".GEODIR_ICON_TABLE." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2197 | 2197 | array($updatingpost, $temppost) |
| 2198 | 2198 | ) |
| 2199 | 2199 | ); |
@@ -2202,7 +2202,7 @@ discard block |
||
| 2202 | 2202 | |
| 2203 | 2203 | $wpdb->query( |
| 2204 | 2204 | $wpdb->prepare( |
| 2205 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2205 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2206 | 2206 | array($updatingpost, $temppost) |
| 2207 | 2207 | ) |
| 2208 | 2208 | ); |
@@ -2240,12 +2240,12 @@ discard block |
||
| 2240 | 2240 | if (!in_array($post_type, $all_postypes)) |
| 2241 | 2241 | return false; |
| 2242 | 2242 | |
| 2243 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2243 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2244 | 2244 | |
| 2245 | 2245 | /* Delete custom post meta*/ |
| 2246 | 2246 | $wpdb->query( |
| 2247 | 2247 | $wpdb->prepare( |
| 2248 | - "DELETE FROM " . $table . " WHERE `post_id` = %d", |
|
| 2248 | + "DELETE FROM ".$table." WHERE `post_id` = %d", |
|
| 2249 | 2249 | array($deleted_postid) |
| 2250 | 2250 | ) |
| 2251 | 2251 | ); |
@@ -2254,7 +2254,7 @@ discard block |
||
| 2254 | 2254 | |
| 2255 | 2255 | $wpdb->query( |
| 2256 | 2256 | $wpdb->prepare( |
| 2257 | - "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d", |
|
| 2257 | + "DELETE FROM ".GEODIR_ICON_TABLE." WHERE `post_id` = %d", |
|
| 2258 | 2258 | array($deleted_postid) |
| 2259 | 2259 | ) |
| 2260 | 2260 | ); |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | |
| 2265 | 2265 | $wpdb->query( |
| 2266 | 2266 | $wpdb->prepare( |
| 2267 | - "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d", |
|
| 2267 | + "DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE `post_id` = %d", |
|
| 2268 | 2268 | array($deleted_postid) |
| 2269 | 2269 | ) |
| 2270 | 2270 | ); |
@@ -2336,7 +2336,7 @@ discard block |
||
| 2336 | 2336 | */ |
| 2337 | 2337 | do_action('geodir_before_add_from_favorite', $post_id);
|
| 2338 | 2338 | |
| 2339 | - 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>'; |
|
| 2339 | + 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>'; |
|
| 2340 | 2340 | |
| 2341 | 2341 | /** |
| 2342 | 2342 | * Called after adding the post from favourites. |
@@ -2415,7 +2415,7 @@ discard block |
||
| 2415 | 2415 | */ |
| 2416 | 2416 | do_action('geodir_before_remove_from_favorite', $post_id);
|
| 2417 | 2417 | |
| 2418 | - 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>'; |
|
| 2418 | + 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>'; |
|
| 2419 | 2419 | |
| 2420 | 2420 | /** |
| 2421 | 2421 | * Called after removing the post from favourites. |
@@ -2510,24 +2510,24 @@ discard block |
||
| 2510 | 2510 | $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
| 2511 | 2511 | |
| 2512 | 2512 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
|
| 2513 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
|
| 2513 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>" ><a |
|
| 2514 | 2514 | class="geodir-removetofav-icon" href="javascript:void(0);" |
| 2515 | - onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');" |
|
| 2516 | - title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?> |
|
| 2515 | + onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');" |
|
| 2516 | + title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?> |
|
| 2517 | 2517 | </a> </span><?php |
| 2518 | 2518 | |
| 2519 | 2519 | } else {
|
| 2520 | 2520 | |
| 2521 | 2521 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
|
| 2522 | - $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
|
| 2522 | + $script_text = 'javascript:window.location.href=\''.geodir_login_url().'\''; |
|
| 2523 | 2523 | } else |
| 2524 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
|
|
| 2524 | + $script_text = 'javascript:addToFavourite('.$post_id.',\'add\')';
|
|
| 2525 | 2525 | |
| 2526 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
|
| 2526 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon" |
|
| 2527 | 2527 | href="javascript:void(0);" |
| 2528 | - onclick="<?php echo $script_text;?>" |
|
| 2529 | - title="<?php echo $add_favourite_text;?>"><i |
|
| 2530 | - class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span> |
|
| 2528 | + onclick="<?php echo $script_text; ?>" |
|
| 2529 | + title="<?php echo $add_favourite_text; ?>"><i |
|
| 2530 | + class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span> |
|
| 2531 | 2531 | <?php } |
| 2532 | 2532 | } |
| 2533 | 2533 | } |
@@ -2557,7 +2557,7 @@ discard block |
||
| 2557 | 2557 | |
| 2558 | 2558 | $post_type = $taxonomy_obj->object_type[0]; |
| 2559 | 2559 | |
| 2560 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2560 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2561 | 2561 | |
| 2562 | 2562 | /** |
| 2563 | 2563 | * Filter to modify the 'join' query |
@@ -2580,8 +2580,8 @@ discard block |
||
| 2580 | 2580 | $where = apply_filters('geodir_cat_post_count_where', $where, $term);
|
| 2581 | 2581 | |
| 2582 | 2582 | $count_query = "SELECT count(post_id) FROM |
| 2583 | - " . $table . " as pd " . $join . " |
|
| 2584 | - WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
|
|
| 2583 | + " . $table." as pd ".$join." |
|
| 2584 | + WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id."',".$term->taxonomy.") ".$where;
|
|
| 2585 | 2585 | |
| 2586 | 2586 | $cat_post_count = $wpdb->get_var($count_query); |
| 2587 | 2587 | if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
@@ -2664,13 +2664,13 @@ discard block |
||
| 2664 | 2664 | global $post; |
| 2665 | 2665 | $all_postypes = geodir_get_posttypes(); |
| 2666 | 2666 | if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
|
| 2667 | - $out = ' <a class="excerpt-read-more" href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; |
|
| 2667 | + $out = ' <a class="excerpt-read-more" href="'.get_permalink($post->ID).'" title="'.get_the_title($post->ID).'">'; |
|
| 2668 | 2668 | /** |
| 2669 | 2669 | * Filter excerpt read more text. |
| 2670 | 2670 | * |
| 2671 | 2671 | * @since 1.0.0 |
| 2672 | 2672 | */ |
| 2673 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
| 2673 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
|
|
| 2674 | 2674 | $out .= '</a>'; |
| 2675 | 2675 | return $out; |
| 2676 | 2676 | } |
@@ -2699,14 +2699,14 @@ discard block |
||
| 2699 | 2699 | if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
|
| 2700 | 2700 | |
| 2701 | 2701 | $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy); |
| 2702 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 2702 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 2703 | 2703 | |
| 2704 | 2704 | $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']); |
| 2705 | - $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png'; |
|
| 2705 | + $term_icon = $path_parts['dirname'].'/cat_icon_'.$term_id.'.png'; |
|
| 2706 | 2706 | |
| 2707 | 2707 | $posts = $wpdb->get_results( |
| 2708 | 2708 | $wpdb->prepare( |
| 2709 | - "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
| 2709 | + "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM ".$table." WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
| 2710 | 2710 | array($term_id, $taxonomy) |
| 2711 | 2711 | ) |
| 2712 | 2712 | ); |
@@ -2718,19 +2718,19 @@ discard block |
||
| 2718 | 2718 | $lng = $post_obj->post_longitude; |
| 2719 | 2719 | |
| 2720 | 2720 | $json = '{';
|
| 2721 | - $json .= '"id":"' . $post_obj->post_id . '",'; |
|
| 2722 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
| 2723 | - $json .= '"long_pos": "' . $lng . '",'; |
|
| 2724 | - $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",'; |
|
| 2725 | - $json .= '"icon":"' . $term_icon . '",'; |
|
| 2726 | - $json .= '"group":"catgroup' . $term_id . '"'; |
|
| 2721 | + $json .= '"id":"'.$post_obj->post_id.'",'; |
|
| 2722 | + $json .= '"lat_pos": "'.$lat.'",'; |
|
| 2723 | + $json .= '"long_pos": "'.$lng.'",'; |
|
| 2724 | + $json .= '"marker_id":"'.$post_obj->post_id.'_'.$term_id.'",'; |
|
| 2725 | + $json .= '"icon":"'.$term_icon.'",'; |
|
| 2726 | + $json .= '"group":"catgroup'.$term_id.'"'; |
|
| 2727 | 2727 | $json .= '}'; |
| 2728 | 2728 | |
| 2729 | 2729 | if ($post_obj->default_category == $term_id) {
|
| 2730 | 2730 | |
| 2731 | 2731 | $wpdb->query( |
| 2732 | 2732 | $wpdb->prepare( |
| 2733 | - "UPDATE " . $table . " SET marker_json = %s where post_id = %d", |
|
| 2733 | + "UPDATE ".$table." SET marker_json = %s where post_id = %d", |
|
| 2734 | 2734 | array($json, $post_obj->post_id) |
| 2735 | 2735 | ) |
| 2736 | 2736 | ); |
@@ -2738,7 +2738,7 @@ discard block |
||
| 2738 | 2738 | |
| 2739 | 2739 | $wpdb->query( |
| 2740 | 2740 | $wpdb->prepare( |
| 2741 | - "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
| 2741 | + "UPDATE ".GEODIR_ICON_TABLE." SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
| 2742 | 2742 | array($json, $post_obj->post_id, $term_id) |
| 2743 | 2743 | ) |
| 2744 | 2744 | ); |
@@ -2862,7 +2862,7 @@ discard block |
||
| 2862 | 2862 | // print_r($uploads ) ; |
| 2863 | 2863 | $post_first_image = $wpdb->get_results( |
| 2864 | 2864 | $wpdb->prepare( |
| 2865 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
| 2865 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
| 2866 | 2866 | ) |
| 2867 | 2867 | ); |
| 2868 | 2868 | |
@@ -2883,9 +2883,9 @@ discard block |
||
| 2883 | 2883 | |
| 2884 | 2884 | $post_type = get_post_type($post_id); |
| 2885 | 2885 | |
| 2886 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
| 2886 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
| 2887 | 2887 | |
| 2888 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
|
|
| 2888 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='".$post_first_image[0]->file."' WHERE post_id =".$post_id);
|
|
| 2889 | 2889 | |
| 2890 | 2890 | $new_attachment_name = basename($post_first_image[0]->file); |
| 2891 | 2891 | |
@@ -2898,11 +2898,11 @@ discard block |
||
| 2898 | 2898 | wp_delete_attachment($post_thumbnail_id); |
| 2899 | 2899 | |
| 2900 | 2900 | } |
| 2901 | - $filename = $uploads['basedir'] . $post_first_image[0]->file; |
|
| 2901 | + $filename = $uploads['basedir'].$post_first_image[0]->file; |
|
| 2902 | 2902 | |
| 2903 | 2903 | $attachment = array( |
| 2904 | 2904 | 'post_mime_type' => $post_first_image[0]->mime_type, |
| 2905 | - 'guid' => $uploads['baseurl'] . $post_first_image[0]->file, |
|
| 2905 | + 'guid' => $uploads['baseurl'].$post_first_image[0]->file, |
|
| 2906 | 2906 | 'post_parent' => $post_id, |
| 2907 | 2907 | 'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
|
| 2908 | 2908 | 'post_content' => '' |
@@ -2915,7 +2915,7 @@ discard block |
||
| 2915 | 2915 | |
| 2916 | 2916 | set_post_thumbnail($post_id, $id); |
| 2917 | 2917 | |
| 2918 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 2918 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
| 2919 | 2919 | wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename)); |
| 2920 | 2920 | |
| 2921 | 2921 | } |
@@ -2948,35 +2948,35 @@ discard block |
||
| 2948 | 2948 | $post_id = absint($_POST['post_id']); |
| 2949 | 2949 | $upload_dir = wp_upload_dir(); |
| 2950 | 2950 | $post_type = get_post_type($_POST['post_id']); |
| 2951 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2951 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2952 | 2952 | |
| 2953 | 2953 | $post_arr = $wpdb->get_results($wpdb->prepare( |
| 2954 | - "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
| 2954 | + "SELECT * FROM $wpdb->posts p JOIN ".$table." gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
| 2955 | 2955 | array($post_id) |
| 2956 | 2956 | ) |
| 2957 | 2957 | , ARRAY_A); |
| 2958 | 2958 | |
| 2959 | 2959 | $arrImages = $wpdb->get_results( |
| 2960 | 2960 | $wpdb->prepare( |
| 2961 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
| 2961 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
| 2962 | 2962 | array('%image%', $post_id)
|
| 2963 | 2963 | ) |
| 2964 | 2964 | ); |
| 2965 | 2965 | if ($arrImages) {
|
| 2966 | 2966 | $image_arr = array(); |
| 2967 | 2967 | foreach ($arrImages as $img) {
|
| 2968 | - $image_arr[] = $upload_dir['baseurl'] . $img->file; |
|
| 2968 | + $image_arr[] = $upload_dir['baseurl'].$img->file; |
|
| 2969 | 2969 | } |
| 2970 | 2970 | $comma_separated = implode(",", $image_arr);
|
| 2971 | 2971 | $post_arr[0]['post_images'] = $comma_separated; |
| 2972 | 2972 | } |
| 2973 | 2973 | |
| 2974 | 2974 | |
| 2975 | - $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category']; |
|
| 2975 | + $cats = $post_arr[0][$post_arr[0]['post_type'].'category']; |
|
| 2976 | 2976 | $cat_arr = array_filter(explode(",", $cats));
|
| 2977 | 2977 | $trans_cat = array(); |
| 2978 | 2978 | foreach ($cat_arr as $cat) {
|
| 2979 | - $trans_cat[] = geodir_wpml_object_id($cat, $post_arr[0]['post_type'] . 'category', false); |
|
| 2979 | + $trans_cat[] = geodir_wpml_object_id($cat, $post_arr[0]['post_type'].'category', false); |
|
| 2980 | 2980 | } |
| 2981 | 2981 | |
| 2982 | 2982 | |
@@ -3018,7 +3018,7 @@ discard block |
||
| 3018 | 3018 | |
| 3019 | 3019 | $get_data = $wpdb->get_results( |
| 3020 | 3020 | $wpdb->prepare( |
| 3021 | - "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'", |
|
| 3021 | + "SELECT htmlvar_name, field_type, extra_fields FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1'", |
|
| 3022 | 3022 | array($listing_type) |
| 3023 | 3023 | ) |
| 3024 | 3024 | ); |
@@ -3031,12 +3031,12 @@ discard block |
||
| 3031 | 3031 | |
| 3032 | 3032 | $extra_fields = unserialize($data->extra_fields); |
| 3033 | 3033 | |
| 3034 | - $prefix = $data->htmlvar_name . '_'; |
|
| 3034 | + $prefix = $data->htmlvar_name.'_'; |
|
| 3035 | 3035 | |
| 3036 | - $fields_info[$prefix . 'address'] = $data->field_type; |
|
| 3036 | + $fields_info[$prefix.'address'] = $data->field_type; |
|
| 3037 | 3037 | |
| 3038 | 3038 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
| 3039 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3039 | + $fields_info[$prefix.'zip'] = $data->field_type; |
|
| 3040 | 3040 | |
| 3041 | 3041 | } else {
|
| 3042 | 3042 | |
@@ -3135,18 +3135,18 @@ discard block |
||
| 3135 | 3135 | * @since 1.6.22 Added image from location page. |
| 3136 | 3136 | * @package GeoDirectory |
| 3137 | 3137 | */ |
| 3138 | -function geodir_fb_like_thumbnail(){
|
|
| 3138 | +function geodir_fb_like_thumbnail() {
|
|
| 3139 | 3139 | |
| 3140 | 3140 | $facebook_image = ''; |
| 3141 | 3141 | |
| 3142 | - if(is_single()){// single post
|
|
| 3142 | + if (is_single()) {// single post
|
|
| 3143 | 3143 | global $post; |
| 3144 | - if(isset($post->featured_image) && $post->featured_image){
|
|
| 3144 | + if (isset($post->featured_image) && $post->featured_image) {
|
|
| 3145 | 3145 | $upload_dir = wp_upload_dir(); |
| 3146 | 3146 | $facebook_image = $upload_dir['baseurl'].$post->featured_image; |
| 3147 | 3147 | |
| 3148 | 3148 | } |
| 3149 | - }elseif(geodir_is_page('location')){// location page
|
|
| 3149 | + }elseif (geodir_is_page('location')) {// location page
|
|
| 3150 | 3150 | if (function_exists('geodir_get_location_seo')) {
|
| 3151 | 3151 | $seo = geodir_get_location_seo(); |
| 3152 | 3152 | if (isset($seo->seo_image) && $seo->seo_image) {
|
@@ -3155,11 +3155,11 @@ discard block |
||
| 3155 | 3155 | } |
| 3156 | 3156 | } |
| 3157 | 3157 | |
| 3158 | - if(!$facebook_image){
|
|
| 3158 | + if (!$facebook_image) {
|
|
| 3159 | 3159 | global $post; |
| 3160 | 3160 | |
| 3161 | - if (has_post_thumbnail( $post->ID ) ){
|
|
| 3162 | - $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); |
|
| 3161 | + if (has_post_thumbnail($post->ID)) {
|
|
| 3162 | + $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); |
|
| 3163 | 3163 | $facebook_image = isset($image[0]) ? $image[0] : ''; |
| 3164 | 3164 | } |
| 3165 | 3165 | } |
@@ -3172,16 +3172,16 @@ discard block |
||
| 3172 | 3172 | * @since 1.6.22 |
| 3173 | 3173 | * @param string $facebook_image The image URL or blank. |
| 3174 | 3174 | */ |
| 3175 | - $facebook_image = apply_filters('geodir_fb_share_image',$facebook_image);
|
|
| 3175 | + $facebook_image = apply_filters('geodir_fb_share_image', $facebook_image);
|
|
| 3176 | 3176 | |
| 3177 | - if($facebook_image){
|
|
| 3177 | + if ($facebook_image) {
|
|
| 3178 | 3178 | echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$facebook_image\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n"; |
| 3179 | 3179 | } |
| 3180 | 3180 | |
| 3181 | 3181 | |
| 3182 | 3182 | } |
| 3183 | 3183 | |
| 3184 | -add_action( 'save_post', 'geodir_clear_map_cache_on_save', 10,2 ); |
|
| 3184 | +add_action('save_post', 'geodir_clear_map_cache_on_save', 10, 2);
|
|
| 3185 | 3185 | |
| 3186 | 3186 | |
| 3187 | 3187 | /** |
@@ -3189,10 +3189,10 @@ discard block |
||
| 3189 | 3189 | * |
| 3190 | 3190 | * @since 1.6.22 |
| 3191 | 3191 | */ |
| 3192 | -function geodir_delete_map_cache(){
|
|
| 3192 | +function geodir_delete_map_cache() {
|
|
| 3193 | 3193 | $files = glob(realpath(dirname(__FILE__))."/map-functions/map-cache/*.json"); // get all file names |
| 3194 | - foreach($files as $file){ // iterate files
|
|
| 3195 | - if(is_file($file)) |
|
| 3194 | + foreach ($files as $file) { // iterate files
|
|
| 3195 | + if (is_file($file)) |
|
| 3196 | 3196 | unlink($file); // delete file |
| 3197 | 3197 | } |
| 3198 | 3198 | } |
@@ -3207,21 +3207,21 @@ discard block |
||
| 3207 | 3207 | */ |
| 3208 | 3208 | function geodir_clear_map_cache_on_save($post_id, $post) {
|
| 3209 | 3209 | |
| 3210 | - if(!get_option('geodir_enable_map_cache')){
|
|
| 3210 | + if (!get_option('geodir_enable_map_cache')) {
|
|
| 3211 | 3211 | return; |
| 3212 | 3212 | } |
| 3213 | 3213 | |
| 3214 | - if ( isset( $post->post_type ) && ( $post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post' ) ) {
|
|
| 3214 | + if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
|
|
| 3215 | 3215 | return; |
| 3216 | 3216 | } |
| 3217 | 3217 | |
| 3218 | 3218 | $geodir_posttypes = geodir_get_posttypes(); |
| 3219 | 3219 | |
| 3220 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
|
| 3220 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
|
|
| 3221 | 3221 | return; |
| 3222 | 3222 | } |
| 3223 | 3223 | |
| 3224 | - if ( ! wp_is_post_revision( $post_id ) && isset( $post->post_type ) && in_array( $post->post_type, $geodir_posttypes ) ) {
|
|
| 3224 | + if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
|
|
| 3225 | 3225 | geodir_delete_map_cache(); |
| 3226 | 3226 | } |
| 3227 | 3227 | |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Enable map cache if set |
| 10 | -if(get_option('geodir_enable_map_cache')){
|
|
| 11 | - add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | - add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 10 | +if (get_option('geodir_enable_map_cache')) {
|
|
| 11 | + add_filter('geodir_get_markers_cache', 'geodir_get_map_cache');
|
|
| 12 | + add_filter('geodir_markers_json', 'geodir_save_map_cache', 10);
|
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * @since 1.6.22 |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | -function geodir_get_map_cache($cache){
|
|
| 24 | +function geodir_get_map_cache($cache) {
|
|
| 25 | 25 | |
| 26 | 26 | // if a search is going on then dont even try to check for cache. |
| 27 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 27 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 28 | 28 | return $cache; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -43,27 +43,27 @@ discard block |
||
| 43 | 43 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 44 | 44 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 45 | 45 | |
| 46 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 46 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 47 | 47 | |
| 48 | 48 | $blog_id = get_current_blog_id(); |
| 49 | - if($blog_id>1){
|
|
| 49 | + if ($blog_id > 1) {
|
|
| 50 | 50 | $file_name = $blog_id."_".$file_name; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - if(file_exists($file_path.$file_name.".json")){
|
|
| 56 | + if (file_exists($file_path.$file_name.".json")) {
|
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | // do the cache delete stuff |
| 60 | 60 | $cache_time = get_option('geodir_map_cache');
|
| 61 | - if(!$cache_time){
|
|
| 61 | + if (!$cache_time) {
|
|
| 62 | 62 | $cache_time = time(); |
| 63 | 63 | update_option('geodir_map_cache', $cache_time);
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 66 | + if ((time() - $cache_time) > 86400) { // delete the cache every 24 hours
|
|
| 67 | 67 | geodir_delete_map_cache(); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | * @since 1.6.22 |
| 84 | 84 | * @return mixed |
| 85 | 85 | */ |
| 86 | -function geodir_save_map_cache($map_json){
|
|
| 86 | +function geodir_save_map_cache($map_json) {
|
|
| 87 | 87 | |
| 88 | 88 | // if a search is going on then dont even try to check for cache. |
| 89 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 89 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 90 | 90 | return $map_json; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 106 | 106 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 107 | 107 | |
| 108 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 108 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 109 | 109 | |
| 110 | 110 | $blog_id = get_current_blog_id(); |
| 111 | - if($blog_id>1){
|
|
| 111 | + if ($blog_id > 1) {
|
|
| 112 | 112 | $file_name = $blog_id."_".$file_name; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
| 135 | 135 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
| 136 | 136 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
| 137 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 137 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
| 138 | 138 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
| 139 | 139 | die; |
| 140 | 140 | } |
@@ -154,21 +154,21 @@ discard block |
||
| 154 | 154 | global $wpdb, $plugin_prefix, $gd_session; |
| 155 | 155 | |
| 156 | 156 | if ($_REQUEST['m_id'] != '') {
|
| 157 | - $pid = (int)$_REQUEST['m_id']; |
|
| 157 | + $pid = (int) $_REQUEST['m_id']; |
|
| 158 | 158 | } else {
|
| 159 | 159 | echo __('No marker data found', 'geodirectory');
|
| 160 | 160 | exit; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
| 164 | - $post = (object)$gd_ses_listing; |
|
| 164 | + $post = (object) $gd_ses_listing; |
|
| 165 | 165 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
| 166 | 166 | } else {
|
| 167 | 167 | $geodir_post_type = get_post_type($pid); |
| 168 | 168 | |
| 169 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 169 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 170 | 170 | |
| 171 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 171 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
|
|
| 172 | 172 | |
| 173 | 173 | $postinfo = $wpdb->get_results($sql); |
| 174 | 174 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | function get_markers() {
|
| 204 | 204 | |
| 205 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 205 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session; |
|
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @since 1.6.22 |
| 212 | 212 | */ |
| 213 | - $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 214 | - if($map_cache){
|
|
| 213 | + $map_cache = apply_filters('geodir_get_markers_cache', '');
|
|
| 214 | + if ($map_cache) {
|
|
| 215 | 215 | return $map_cache; |
| 216 | 216 | wp_die(); |
| 217 | 217 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
| 227 | 227 | |
| 228 | 228 | $map_cat_ids_array = array('0');
|
| 229 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 229 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
|
|
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | $field_default_cat = ''; |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
| 235 | 235 | |
| 236 | 236 | if (!empty($map_cat_arr)) {
|
| 237 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 237 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
|
|
| 238 | 238 | |
| 239 | 239 | $map_cat_ids_array = explode(',', $map_cat_arr);
|
| 240 | 240 | $cat_find_array = array(); |
| 241 | 241 | foreach ($map_cat_ids_array as $cat_id) {
|
| 242 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 243 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 242 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
| 243 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
| 244 | 244 | $main_query_array[] = $cat_id; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | $field_default_cat = ''; |
| 252 | 252 | |
| 253 | 253 | if (!empty($cat_find_array)) |
| 254 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 254 | + $search .= "AND (".implode(' OR ', $cat_find_array).")";
|
|
| 255 | 255 | |
| 256 | 256 | $main_query_array = $map_cat_ids_array; |
| 257 | 257 | |
| 258 | 258 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
| 259 | 259 | $search .= " AND p.post_title LIKE %s"; |
| 260 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 260 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -279,14 +279,14 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | $gd_posttype = ''; |
| 281 | 281 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
| 282 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 282 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
| 283 | 283 | $gd_posttype = " AND p.post_type = %s"; |
| 284 | 284 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 285 | 285 | |
| 286 | 286 | } else |
| 287 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 287 | + $table = $plugin_prefix.'gd_place_detail'; |
|
| 288 | 288 | |
| 289 | - $join = ", " . $table . " AS pd "; |
|
| 289 | + $join = ", ".$table." AS pd "; |
|
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | 292 | * Filter the SQL JOIN clause for the markers data |
@@ -306,14 +306,14 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 308 | 308 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
| 309 | - $cat_type = $post_type . 'category'; |
|
| 309 | + $cat_type = $post_type.'category'; |
|
| 310 | 310 | if ($post_type == 'gd_event') {
|
| 311 | 311 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
| 312 | 312 | } else {
|
| 313 | 313 | $event_select = ""; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 316 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
| 317 | 317 | /** |
| 318 | 318 | * Filter the SQL SELECT clause to retrive fields data |
| 319 | 319 | * |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 335 | 335 | |
| 336 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 336 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
|
|
| 337 | 337 | |
| 338 | 338 | /** |
| 339 | 339 | * Filter the SQL query to retrive markers data |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
| 384 | 384 | |
| 385 | 385 | $today = strtotime(date_i18n('Y-m-d'));
|
| 386 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 386 | + $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 387 | 387 | |
| 388 | 388 | foreach ($catinfo as $catinfo_obj) {
|
| 389 | 389 | $post_title = $catinfo_obj->post_title; |
@@ -399,29 +399,29 @@ discard block |
||
| 399 | 399 | $endtimes = ''; |
| 400 | 400 | $astarttimes = array(); |
| 401 | 401 | $aendtimes = array(); |
| 402 | - if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 402 | + if (!isset($recurring_data['repeat_type'])) {
|
|
| 403 | 403 | $recurring_data['repeat_type'] = 'custom'; |
| 404 | 404 | } |
| 405 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 406 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 405 | + $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
|
|
| 406 | + $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false; |
|
| 407 | 407 | |
| 408 | 408 | $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
| 409 | 409 | |
| 410 | - if ( !empty( $recurring_dates ) ) {
|
|
| 411 | - if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 412 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 413 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 414 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 410 | + if (!empty($recurring_dates)) {
|
|
| 411 | + if (empty($recurring_data['all_day'])) {
|
|
| 412 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 413 | + $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 414 | + $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 415 | 415 | } else {
|
| 416 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 417 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 416 | + $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 417 | + $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | $e = 0; |
| 422 | - foreach( $recurring_dates as $key => $date ) {
|
|
| 423 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 424 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 422 | + foreach ($recurring_dates as $key => $date) {
|
|
| 423 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 424 | + if (!empty($astarttimes) && isset($astarttimes[$key])) {
|
|
| 425 | 425 | $starttimes = $astarttimes[$key]; |
| 426 | 426 | $endtimes = $aendtimes[$key]; |
| 427 | 427 | } else {
|
@@ -430,50 +430,50 @@ discard block |
||
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 433 | + $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1; |
|
| 434 | 434 | $duration--; |
| 435 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 435 | + $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day'));
|
|
| 436 | 436 | |
| 437 | 437 | // Hide past dates |
| 438 | - if ( strtotime( $enddate ) < $today ) {
|
|
| 438 | + if (strtotime($enddate) < $today) {
|
|
| 439 | 439 | continue; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 443 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 442 | + $sdate = strtotime($date.' '.$starttimes); |
|
| 443 | + $edate = strtotime($enddate.' '.$endtimes); |
|
| 444 | 444 | |
| 445 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 446 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 445 | + $start_date = date_i18n($geodir_date_time_format, $sdate); |
|
| 446 | + $end_date = date_i18n($geodir_date_time_format, $edate); |
|
| 447 | 447 | |
| 448 | 448 | $same_day = false; |
| 449 | 449 | $full_day = false; |
| 450 | 450 | $same_datetime = false; |
| 451 | 451 | |
| 452 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 452 | + if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) {
|
|
| 453 | 453 | $full_day = true; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - if ( $start_date == $end_date && $full_day ) {
|
|
| 456 | + if ($start_date == $end_date && $full_day) {
|
|
| 457 | 457 | $same_datetime = true; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 461 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 462 | - if ( $full_day ) {
|
|
| 460 | + $link_date = date_i18n('Y-m-d', $sdate);
|
|
| 461 | + $title_date = date_i18n($geodir_date_format, $sdate); |
|
| 462 | + if ($full_day) {
|
|
| 463 | 463 | $start_date = $title_date; |
| 464 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 464 | + $end_date = date_i18n($geodir_date_format, $edate); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 467 | + if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) {
|
|
| 468 | 468 | $same_day = true; |
| 469 | 469 | |
| 470 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 470 | + $start_date .= ' - '.date_i18n($geodir_time_format, $edate); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - $event_dates .= ' :: ' . $start_date; |
|
| 473 | + $event_dates .= ' :: '.$start_date; |
|
| 474 | 474 | |
| 475 | - if ( !$same_day && !$same_datetime ) {
|
|
| 476 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 475 | + if (!$same_day && !$same_datetime) {
|
|
| 476 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $e++; |
@@ -484,67 +484,67 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | } else {
|
| 487 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 488 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 489 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 490 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 491 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 487 | + $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : ''; |
|
| 488 | + $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date; |
|
| 489 | + $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false; |
|
| 490 | + $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 491 | + $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 492 | 492 | |
| 493 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 494 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 495 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 493 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 494 | + $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 495 | + $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 496 | 496 | |
| 497 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 497 | + if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) {
|
|
| 498 | 498 | $start_date = $event_recurring_dates[0]; |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 501 | + if (strtotime($end_date) < strtotime($start_date)) {
|
|
| 502 | 502 | $end_date = $start_date; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | if ($end_date != '' && strtotime($end_date) >= $today) {
|
| 506 | - if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 506 | + if ($starttime == '' && !empty($starttimes)) {
|
|
| 507 | 507 | $starttime = $starttimes[0]; |
| 508 | 508 | $endtime = $endtimes[0]; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | $same_day = false; |
| 512 | 512 | $one_day = false; |
| 513 | - if ( $start_date == $end_date && $all_day ) {
|
|
| 513 | + if ($start_date == $end_date && $all_day) {
|
|
| 514 | 514 | $one_day = true; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if ( $all_day ) {
|
|
| 518 | - $start_datetime = strtotime( $start_date ); |
|
| 519 | - $end_datetime = strtotime( $end_date ); |
|
| 517 | + if ($all_day) {
|
|
| 518 | + $start_datetime = strtotime($start_date); |
|
| 519 | + $end_datetime = strtotime($end_date); |
|
| 520 | 520 | |
| 521 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 522 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 523 | - if ( $start_date == $end_date ) {
|
|
| 521 | + $start_date = date_i18n($geodir_date_format, $start_datetime); |
|
| 522 | + $end_date = date_i18n($geodir_date_format, $end_datetime); |
|
| 523 | + if ($start_date == $end_date) {
|
|
| 524 | 524 | $one_day = true; |
| 525 | 525 | } |
| 526 | 526 | } else {
|
| 527 | - if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 528 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 527 | + if ($start_date == $end_date && $starttime == $endtime) {
|
|
| 528 | + $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day'));
|
|
| 529 | 529 | $one_day = false; |
| 530 | 530 | } |
| 531 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 532 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 531 | + $start_datetime = strtotime($start_date.' '.$starttime); |
|
| 532 | + $end_datetime = strtotime($end_date.' '.$endtime); |
|
| 533 | 533 | |
| 534 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 535 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 534 | + $start_date = date_i18n($geodir_date_time_format, $start_datetime); |
|
| 535 | + $end_date = date_i18n($geodir_date_time_format, $end_datetime); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 538 | + if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) {
|
|
| 539 | 539 | $same_day = true; |
| 540 | 540 | |
| 541 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 541 | + $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - $event_dates .= ' :: ' . $start_date; |
|
| 544 | + $event_dates .= ' :: '.$start_date; |
|
| 545 | 545 | |
| 546 | - if ( !$same_day && !$one_day ) {
|
|
| 547 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 546 | + if (!$same_day && !$one_day) {
|
|
| 547 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | } |
@@ -560,8 +560,8 @@ discard block |
||
| 560 | 560 | $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
| 561 | 561 | |
| 562 | 562 | // if single cat lets just show that icon |
| 563 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 564 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
| 563 | + if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) {
|
|
| 564 | + $default_cat = (int) $map_cat_ids_array[0]; |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | $icon_size = array('w' => 36, 'h' => 45);
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 584 | + $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
|
|
| 585 | 585 | $post_ids[] = $catinfo_obj->post_id; |
| 586 | 586 | } |
| 587 | 587 | } |
@@ -605,10 +605,10 @@ discard block |
||
| 605 | 605 | $totalcount = count(array_unique($post_ids)); |
| 606 | 606 | |
| 607 | 607 | if (!empty($cat_content_info)) {
|
| 608 | - $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 608 | + $map_json = '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
|
|
| 609 | 609 | } |
| 610 | 610 | else {
|
| 611 | - $map_json = '[{"totalcount":"0"}]';
|
|
| 611 | + $map_json = '[{"totalcount":"0"}]';
|
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | * @since 1.6.22 |
| 619 | 619 | * @param string $map_json The JSON string of the map markers results. |
| 620 | 620 | */ |
| 621 | - return apply_filters('geodir_markers_json',$map_json);
|
|
| 621 | + return apply_filters('geodir_markers_json', $map_json);
|
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | function geodir_get_admin_option_form($current_tab) |
| 64 | 64 | {
|
| 65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
| 65 | + geodir_admin_option_form($current_tab); // defined in admin template tags.php |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
|
| 71 | 71 | add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
|
| 72 | 72 | add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
|
| 73 | -add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
|
|
| 73 | +add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
|
|
| 74 | 74 | |
| 75 | 75 | //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
|
| 76 | 76 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // Disable VC editor for GD post types. |
| 101 | 101 | if (class_exists('Vc_Role_Access_Controller')) {
|
| 102 | - add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 ); |
|
| 102 | + add_filter('vc_role_access_with_post_types_can', '__return_false', 100);
|
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | add_action('admin_panel_init', 'geodir_admin_list_columns', 2);
|
| 127 | 127 | |
| 128 | 128 | /* --- insert dummy post action ---*/ |
| 129 | -add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3);
|
|
| 130 | -add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3);
|
|
| 129 | +add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3);
|
|
| 130 | +add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3);
|
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | // Filter-Payment-Manager |
| 238 | 238 | |
| 239 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 239 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 240 | 240 | |
| 241 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 241 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 242 | 242 | |
| 243 | 243 | // no need of this box as all fields moved to main information box |
| 244 | 244 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | -add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 250 | +add_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
| 276 | 276 | |
| 277 | - if(!empty($gd_taxonomy)) {
|
|
| 277 | + if (!empty($gd_taxonomy)) {
|
|
| 278 | 278 | foreach ($gd_taxonomy as $tax) {
|
| 279 | 279 | |
| 280 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 280 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
| 281 | 281 | |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -363,14 +363,14 @@ discard block |
||
| 363 | 363 | add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined');
|
| 364 | 364 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
|
| 365 | 365 | |
| 366 | -function geodir_manage_available_fields_predefined($sub_tab){
|
|
| 367 | - if($sub_tab=='custom_fields'){
|
|
| 366 | +function geodir_manage_available_fields_predefined($sub_tab) {
|
|
| 367 | + if ($sub_tab == 'custom_fields') {
|
|
| 368 | 368 | geodir_custom_available_fields('predefined');
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | -function geodir_manage_available_fields_custom($sub_tab){
|
|
| 373 | - if($sub_tab=='custom_fields'){
|
|
| 372 | +function geodir_manage_available_fields_custom($sub_tab) {
|
|
| 373 | + if ($sub_tab == 'custom_fields') {
|
|
| 374 | 374 | geodir_custom_available_fields('custom');
|
| 375 | 375 | } |
| 376 | 376 | } |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | global $wpdb; |
| 441 | 441 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 442 | 442 | ?> |
| 443 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 443 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 444 | 444 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 445 | 445 | <ul> |
| 446 | 446 | <?php |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | $check_html_variable = $wpdb->get_var( |
| 453 | 453 | $wpdb->prepare( |
| 454 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 454 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 455 | 455 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
| 456 | 456 | ) |
| 457 | 457 | ); |
@@ -459,23 +459,23 @@ discard block |
||
| 459 | 459 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
| 460 | 460 | ?> |
| 461 | 461 | |
| 462 | - <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
|
| 462 | + <li class="gd-cf-tooltip-wrap" <?php echo $display; ?>> |
|
| 463 | 463 | <?php |
| 464 | - if(isset($val['description']) && $val['description']){
|
|
| 464 | + if (isset($val['description']) && $val['description']) {
|
|
| 465 | 465 | echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
| 466 | 466 | }?> |
| 467 | 467 | |
| 468 | - <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>" data-field-type="<?php echo $val['field_type'];?>" |
|
| 469 | - title="<?php echo $val['site_title'];?>" |
|
| 470 | - class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
|
| 468 | + <a id="gd-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" data-field-type-key="<?php echo $val['htmlvar_name']; ?>" data-field-type="<?php echo $val['field_type']; ?>" |
|
| 469 | + title="<?php echo $val['site_title']; ?>" |
|
| 470 | + class="gd-draggable-form-items gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);"> |
|
| 471 | 471 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
|
| 472 | 472 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
| 473 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 473 | + }elseif (isset($val['field_icon']) && $val['field_icon']) {
|
|
| 474 | 474 | echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
|
| 475 | - }else{
|
|
| 475 | + } else {
|
|
| 476 | 476 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 477 | 477 | }?> |
| 478 | - <?php echo $val['site_title'];?> |
|
| 478 | + <?php echo $val['site_title']; ?> |
|
| 479 | 479 | </a> |
| 480 | 480 | </li> |
| 481 | 481 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | <?php |
| 504 | 504 | global $wpdb; |
| 505 | 505 | |
| 506 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 506 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 507 | 507 | |
| 508 | 508 | if (!empty($fields)) {
|
| 509 | 509 | foreach ($fields as $field) {
|
@@ -528,14 +528,14 @@ discard block |
||
| 528 | 528 | * @since 1.6.9 |
| 529 | 529 | * @package GeoDirectory |
| 530 | 530 | */ |
| 531 | -function geodir_custom_fields_custom($post_type=''){
|
|
| 531 | +function geodir_custom_fields_custom($post_type = '') {
|
|
| 532 | 532 | |
| 533 | 533 | $custom_fields = array(); |
| 534 | 534 | |
| 535 | 535 | /** |
| 536 | 536 | * @see `geodir_custom_fields` |
| 537 | 537 | */ |
| 538 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
|
|
| 538 | + return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type);
|
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | * @since 1.6.6 |
| 547 | 547 | * @package GeoDirectory |
| 548 | 548 | */ |
| 549 | -function geodir_custom_fields($post_type=''){
|
|
| 549 | +function geodir_custom_fields($post_type = '') {
|
|
| 550 | 550 | |
| 551 | 551 | $custom_fields = array( |
| 552 | 552 | 'text' => array( |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | * } |
| 682 | 682 | * @param string $post_type The post type requested. |
| 683 | 683 | */ |
| 684 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 684 | + return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
|
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /** |
@@ -692,25 +692,25 @@ discard block |
||
| 692 | 692 | * @param string $type The custom field type, predefined, custom or blank for default |
| 693 | 693 | * @package GeoDirectory |
| 694 | 694 | */ |
| 695 | -function geodir_custom_available_fields($type='') |
|
| 695 | +function geodir_custom_available_fields($type = '') |
|
| 696 | 696 | {
|
| 697 | 697 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 698 | 698 | ?> |
| 699 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 699 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 700 | 700 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
| 701 | 701 | |
| 702 | 702 | <?php |
| 703 | - if($type=='predefined'){
|
|
| 703 | + if ($type == 'predefined') {
|
|
| 704 | 704 | $cfs = geodir_custom_fields_predefined($listing_type); |
| 705 | - }elseif($type=='custom'){
|
|
| 705 | + }elseif ($type == 'custom') {
|
|
| 706 | 706 | $cfs = geodir_custom_fields_custom($listing_type); |
| 707 | - }else{
|
|
| 707 | + } else {
|
|
| 708 | 708 | $cfs = geodir_custom_fields($listing_type); |
| 709 | 709 | ?> |
| 710 | 710 | <ul class="full gd-cf-tooltip-wrap"> |
| 711 | 711 | <li> |
| 712 | 712 | <div class="gdcf-tooltip"> |
| 713 | - <?php _e('This adds a section separator with a title.', 'geodirectory');?>
|
|
| 713 | + <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
|
|
| 714 | 714 | </div> |
| 715 | 715 | <a id="gt-fieldset" |
| 716 | 716 | class="gd-draggable-form-items gt-fieldset" |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | |
| 722 | 722 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 723 | 723 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 724 | - <?php _e('Fieldset (section separator)', 'geodirectory');?>
|
|
| 724 | + <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
|
|
| 725 | 725 | </a> |
| 726 | 726 | </li> |
| 727 | 727 | </ul> |
@@ -729,15 +729,15 @@ discard block |
||
| 729 | 729 | <?php |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - if(!empty($cfs)) {
|
|
| 732 | + if (!empty($cfs)) {
|
|
| 733 | 733 | echo '<ul>'; |
| 734 | - foreach ( $cfs as $id => $cf ) {
|
|
| 734 | + foreach ($cfs as $id => $cf) {
|
|
| 735 | 735 | ?> |
| 736 | 736 | |
| 737 | 737 | <li class="gd-cf-tooltip-wrap"> |
| 738 | 738 | <?php |
| 739 | - if ( isset( $cf['description'] ) && $cf['description'] ) {
|
|
| 740 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
| 739 | + if (isset($cf['description']) && $cf['description']) {
|
|
| 740 | + echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
| 741 | 741 | } ?> |
| 742 | 742 | |
| 743 | 743 | <a id="gd-<?php echo $id; ?>" |
@@ -747,10 +747,10 @@ discard block |
||
| 747 | 747 | class="gd-draggable-form-items <?php echo $cf['class']; ?>" |
| 748 | 748 | href="javascript:void(0);"> |
| 749 | 749 | |
| 750 | - <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
|
|
| 751 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
| 752 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
|
|
| 753 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
|
|
| 750 | + <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
|
| 751 | + echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 752 | + } elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 753 | + echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 754 | 754 | } else {
|
| 755 | 755 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 756 | 756 | } ?> |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | </li> |
| 760 | 760 | <?php |
| 761 | 761 | } |
| 762 | - }else{
|
|
| 762 | + } else {
|
|
| 763 | 763 | _e('There are no custom fields here yet.', 'geodirectory');
|
| 764 | 764 | } |
| 765 | 765 | ?> |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | <ul class="core"> |
| 788 | 788 | <?php |
| 789 | 789 | global $wpdb; |
| 790 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 790 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 791 | 791 | |
| 792 | 792 | if (!empty($fields)) {
|
| 793 | 793 | foreach ($fields as $field) {
|
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | $field_type_key = $field->field_type_key; |
| 798 | 798 | $field_ins_upd = 'display'; |
| 799 | 799 | |
| 800 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 800 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key); |
|
| 801 | 801 | } |
| 802 | 802 | } |
| 803 | 803 | ?></ul> |
@@ -956,8 +956,8 @@ discard block |
||
| 956 | 956 | |
| 957 | 957 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 958 | 958 | |
| 959 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 959 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
|
|
| 961 | 961 | |
| 962 | 962 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 963 | 963 | |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | case 'diagnosis' : |
| 987 | 987 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
| 988 | 988 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 989 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 989 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 990 | 990 | |
| 991 | 991 | } |
| 992 | 992 | exit(); |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | case 'diagnosis-fix' : |
| 996 | 996 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
| 997 | 997 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 998 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 998 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 999 | 999 | exit(); |
| 1000 | 1000 | break; |
| 1001 | 1001 | } |
@@ -1020,50 +1020,50 @@ discard block |
||
| 1020 | 1020 | {
|
| 1021 | 1021 | global $wpdb; |
| 1022 | 1022 | //$filter_arr['output_str'] .='###'.$table.'###'; |
| 1023 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 1024 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 1023 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
|
|
| 1024 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
|
|
| 1025 | 1025 | $filter_arr['is_error_during_diagnose'] = true; |
| 1026 | 1026 | |
| 1027 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1028 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1027 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 1028 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1029 | 1029 | $filter_arr['is_error_during_diagnose'] = true; |
| 1030 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
|
|
| 1030 | + $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>";
|
|
| 1031 | 1031 | $filter_arr['is_error_during_diagnose'] = true; |
| 1032 | 1032 | |
| 1033 | 1033 | if ($fix) {
|
| 1034 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 1035 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 1034 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
|
|
| 1035 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
|
|
| 1036 | 1036 | |
| 1037 | 1037 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
| 1038 | 1038 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
| 1039 | 1039 | |
| 1040 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 1040 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
|
|
| 1041 | 1041 | |
| 1042 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1043 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 1042 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 1043 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
|
|
| 1044 | 1044 | } else {
|
| 1045 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1045 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
| 1049 | 1049 | |
| 1050 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 1051 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 1050 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
|
|
| 1051 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
|
|
| 1052 | 1052 | |
| 1053 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1053 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
|
|
| 1055 | 1055 | } else {
|
| 1056 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1056 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
| 1060 | 1060 | |
| 1061 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 1061 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
|
|
| 1062 | 1062 | |
| 1063 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1064 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 1063 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 1064 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
|
|
| 1065 | 1065 | } else {
|
| 1066 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1066 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | } |
@@ -1071,54 +1071,54 @@ discard block |
||
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | |
| 1074 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1075 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1074 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 1075 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1076 | 1076 | $filter_arr['is_error_during_diagnose'] = true; |
| 1077 | 1077 | |
| 1078 | 1078 | if ($fix) {
|
| 1079 | 1079 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
| 1080 | 1080 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
| 1081 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1081 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
|
|
| 1082 | 1082 | } else {
|
| 1083 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1083 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
|
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1088 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1086 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
|
|
| 1088 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1089 | 1089 | } else {
|
| 1090 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1090 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1091 | 1091 | } |
| 1092 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1092 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1094 | 1094 | } else {
|
| 1095 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1095 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1096 | 1096 | } |
| 1097 | 1097 | } else {// else rename the original table to _ms_bak
|
| 1098 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1098 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>";
|
|
| 1100 | 1100 | } else {
|
| 1101 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1101 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>";
|
|
| 1102 | 1102 | } |
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1107 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1106 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1107 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1108 | 1108 | $filter_arr['is_error_during_diagnose'] = true; |
| 1109 | 1109 | |
| 1110 | 1110 | if ($fix) {
|
| 1111 | 1111 | // if original table exists but new does not, rename |
| 1112 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1112 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1114 | 1114 | } else {
|
| 1115 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1115 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1121 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1120 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1121 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1122 | 1122 | $filter_arr['is_error_during_diagnose'] = true; |
| 1123 | 1123 | |
| 1124 | 1124 | if ($fix) {
|
@@ -1132,11 +1132,11 @@ discard block |
||
| 1132 | 1132 | delete_option('geodir_custom_posts_db_version');
|
| 1133 | 1133 | delete_option('geodir_reviewratings_db_version');
|
| 1134 | 1134 | delete_option('geodiradvancesearch_db_version');
|
| 1135 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1135 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
|
|
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | } else {
|
| 1139 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1139 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1140 | 1140 | } |
| 1141 | 1141 | return $filter_arr; |
| 1142 | 1142 | } |
@@ -1177,21 +1177,21 @@ discard block |
||
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | if ($stepped_process) {
|
| 1180 | - $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset ); |
|
| 1181 | - $posts = $wpdb->get_results( $sql ); |
|
| 1180 | + $sql = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."geodir_".$ptype."_detail LIMIT %d OFFSET %d", $step_max_items, $offset);
|
|
| 1181 | + $posts = $wpdb->get_results($sql); |
|
| 1182 | 1182 | |
| 1183 | 1183 | if (!empty($posts)) {
|
| 1184 | 1184 | |
| 1185 | 1185 | foreach ($posts as $p) {
|
| 1186 | 1186 | $p->post_type = $ptype; |
| 1187 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1187 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1188 | 1188 | if (empty($raw_tags)) {
|
| 1189 | 1189 | $post_tags = ''; |
| 1190 | 1190 | } else {
|
| 1191 | 1191 | $post_tags = implode(",", $raw_tags);
|
| 1192 | 1192 | } |
| 1193 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1194 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1193 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1194 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1195 | 1195 | |
| 1196 | 1196 | } |
| 1197 | 1197 | if ($step >= $max_step) {
|
@@ -1207,23 +1207,23 @@ discard block |
||
| 1207 | 1207 | if (!empty($all_postypes)) {
|
| 1208 | 1208 | foreach ($all_postypes as $key) {
|
| 1209 | 1209 | // update each GD CPT |
| 1210 | - $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1210 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail");
|
|
| 1211 | 1211 | |
| 1212 | 1212 | if (!empty($posts)) {
|
| 1213 | 1213 | |
| 1214 | 1214 | foreach ($posts as $p) {
|
| 1215 | 1215 | $p->post_type = $key; |
| 1216 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1216 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1217 | 1217 | if (empty($raw_tags)) {
|
| 1218 | 1218 | $post_tags = ''; |
| 1219 | 1219 | } else {
|
| 1220 | 1220 | $post_tags = implode(",", $raw_tags);
|
| 1221 | 1221 | } |
| 1222 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1223 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1222 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1223 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1224 | 1224 | |
| 1225 | 1225 | } |
| 1226 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1226 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | } |
@@ -1234,14 +1234,14 @@ discard block |
||
| 1234 | 1234 | |
| 1235 | 1235 | if ($is_error_during_diagnose) {
|
| 1236 | 1236 | $info_div_class = "geodir_problem_info"; |
| 1237 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1237 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1238 | 1238 | } else {
|
| 1239 | 1239 | $info_div_class = "geodir_noproblem_info"; |
| 1240 | 1240 | $fix_button_txt = ''; |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | if ($stepped_process) {
|
| 1244 | - $percent = ($step/$max_step) * 100; |
|
| 1244 | + $percent = ($step / $max_step) * 100; |
|
| 1245 | 1245 | if ($output_str == 'done') {
|
| 1246 | 1246 | echo $output_str; |
| 1247 | 1247 | } else {
|
@@ -1284,29 +1284,29 @@ discard block |
||
| 1284 | 1284 | if (!empty($all_postypes)) {
|
| 1285 | 1285 | foreach ($all_postypes as $key) {
|
| 1286 | 1286 | // update each GD CTP |
| 1287 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1287 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
|
|
| 1288 | 1288 | |
| 1289 | 1289 | if (!empty($posts)) {
|
| 1290 | 1290 | |
| 1291 | 1291 | foreach ($posts as $p) {
|
| 1292 | 1292 | $p->post_type = $key; |
| 1293 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1293 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
|
|
| 1294 | 1294 | |
| 1295 | 1295 | if (empty($raw_cats)) {
|
| 1296 | 1296 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
| 1297 | 1297 | |
| 1298 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1299 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1300 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1298 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
|
|
| 1299 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
|
|
| 1300 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
|
|
| 1301 | 1301 | if (is_numeric($cat_part)) {
|
| 1302 | - $raw_cats[] = (int)$cat_part; |
|
| 1302 | + $raw_cats[] = (int) $cat_part; |
|
| 1303 | 1303 | } |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | if (!empty($raw_cats)) {
|
| 1309 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1309 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
| 1310 | 1310 | |
| 1311 | 1311 | } |
| 1312 | 1312 | |
@@ -1316,14 +1316,14 @@ discard block |
||
| 1316 | 1316 | if (empty($raw_cats)) {
|
| 1317 | 1317 | $post_cats = ''; |
| 1318 | 1318 | } else {
|
| 1319 | - $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1319 | + $post_cats = ','.implode(",", $raw_cats).',';
|
|
| 1320 | 1320 | } |
| 1321 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1322 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1321 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1322 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | } |
| 1326 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1326 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1327 | 1327 | |
| 1328 | 1328 | } |
| 1329 | 1329 | |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | if ($is_error_during_diagnose) {
|
| 1333 | 1333 | $info_div_class = "geodir_problem_info"; |
| 1334 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1334 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1335 | 1335 | } else {
|
| 1336 | 1336 | $info_div_class = "geodir_noproblem_info"; |
| 1337 | 1337 | $fix_button_txt = ''; |
@@ -1384,15 +1384,15 @@ discard block |
||
| 1384 | 1384 | if (!empty($ver_arr)) {
|
| 1385 | 1385 | foreach ($ver_arr as $key => $val) {
|
| 1386 | 1386 | if (delete_option($val)) {
|
| 1387 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1387 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
|
|
| 1388 | 1388 | } else {
|
| 1389 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1389 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
|
|
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | 1394 | if ($output_str) {
|
| 1395 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1395 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
|
|
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | 1398 | } |
@@ -1429,43 +1429,43 @@ discard block |
||
| 1429 | 1429 | $output_str = ''; |
| 1430 | 1430 | |
| 1431 | 1431 | // check review locations |
| 1432 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1432 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
|
|
| 1434 | 1434 | $is_error_during_diagnose = true; |
| 1435 | 1435 | |
| 1436 | 1436 | if ($fix) {
|
| 1437 | 1437 | if (geodir_fix_review_location()) {
|
| 1438 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1438 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
|
|
| 1439 | 1439 | } else {
|
| 1440 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1440 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
|
|
| 1441 | 1441 | } |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | 1444 | } else {
|
| 1445 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1445 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
|
|
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | 1448 | // check review content |
| 1449 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1450 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1449 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
|
|
| 1450 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
|
|
| 1451 | 1451 | $is_error_during_diagnose = true; |
| 1452 | 1452 | |
| 1453 | 1453 | if ($fix) {
|
| 1454 | 1454 | if (geodir_fix_review_content()) {
|
| 1455 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1455 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
|
|
| 1456 | 1456 | } else {
|
| 1457 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1457 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
|
|
| 1458 | 1458 | } |
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | 1461 | } else {
|
| 1462 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1462 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
|
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | |
| 1466 | 1466 | if ($is_error_during_diagnose) {
|
| 1467 | 1467 | $info_div_class = "geodir_problem_info"; |
| 1468 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1468 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1469 | 1469 | } else {
|
| 1470 | 1470 | $info_div_class = "geodir_noproblem_info"; |
| 1471 | 1471 | $fix_button_txt = ''; |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | |
| 1530 | 1530 | if ($is_error_during_diagnose) {
|
| 1531 | 1531 | $info_div_class = "geodir_problem_info"; |
| 1532 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1532 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1533 | 1533 | } else {
|
| 1534 | 1534 | $info_div_class = "geodir_noproblem_info"; |
| 1535 | 1535 | $fix_button_txt = ''; |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | else {
|
| 1564 | 1564 | $page_found = $wpdb->get_var( |
| 1565 | 1565 | $wpdb->prepare( |
| 1566 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1566 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
| 1567 | 1567 | array($slug) |
| 1568 | 1568 | ) |
| 1569 | 1569 | ); |
@@ -1609,18 +1609,18 @@ discard block |
||
| 1609 | 1609 | ////////////////////////////////// |
| 1610 | 1610 | $option_value = get_option('geodir_home_page');
|
| 1611 | 1611 | $page = get_post($option_value); |
| 1612 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1612 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1613 | 1613 | |
| 1614 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1615 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1614 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1615 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1616 | 1616 | else {
|
| 1617 | 1617 | $is_error_during_diagnose = true; |
| 1618 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1618 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1619 | 1619 | if ($fix) {
|
| 1620 | 1620 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
| 1621 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1621 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
|
|
| 1622 | 1622 | } else {
|
| 1623 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1623 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1624 | 1624 | } |
| 1625 | 1625 | } |
| 1626 | 1626 | } |
@@ -1634,18 +1634,18 @@ discard block |
||
| 1634 | 1634 | ////////////////////////////////// |
| 1635 | 1635 | $option_value = get_option('geodir_add_listing_page');
|
| 1636 | 1636 | $page = get_post($option_value); |
| 1637 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1637 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1638 | 1638 | |
| 1639 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1640 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1639 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1640 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1641 | 1641 | else {
|
| 1642 | 1642 | $is_error_during_diagnose = true; |
| 1643 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1643 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1644 | 1644 | if ($fix) {
|
| 1645 | 1645 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
| 1646 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1646 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
|
|
| 1647 | 1647 | } else {
|
| 1648 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1648 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1649 | 1649 | } |
| 1650 | 1650 | } |
| 1651 | 1651 | } |
@@ -1660,18 +1660,18 @@ discard block |
||
| 1660 | 1660 | ////////////////////////////////// |
| 1661 | 1661 | $option_value = get_option('geodir_preview_page');
|
| 1662 | 1662 | $page = get_post($option_value); |
| 1663 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1663 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1664 | 1664 | |
| 1665 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1666 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1665 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1666 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1667 | 1667 | else {
|
| 1668 | 1668 | $is_error_during_diagnose = true; |
| 1669 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1669 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1670 | 1670 | if ($fix) {
|
| 1671 | 1671 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
| 1672 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1672 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
|
|
| 1673 | 1673 | } else {
|
| 1674 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1674 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1675 | 1675 | } |
| 1676 | 1676 | } |
| 1677 | 1677 | } |
@@ -1685,18 +1685,18 @@ discard block |
||
| 1685 | 1685 | ////////////////////////////////// |
| 1686 | 1686 | $option_value = get_option('geodir_success_page');
|
| 1687 | 1687 | $page = get_post($option_value); |
| 1688 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1688 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1689 | 1689 | |
| 1690 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1691 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1690 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1691 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1692 | 1692 | else {
|
| 1693 | 1693 | $is_error_during_diagnose = true; |
| 1694 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1694 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1695 | 1695 | if ($fix) {
|
| 1696 | 1696 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
| 1697 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1697 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
|
|
| 1698 | 1698 | } else {
|
| 1699 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1699 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1700 | 1700 | } |
| 1701 | 1701 | } |
| 1702 | 1702 | } |
@@ -1710,18 +1710,18 @@ discard block |
||
| 1710 | 1710 | ////////////////////////////////// |
| 1711 | 1711 | $option_value = get_option('geodir_info_page');
|
| 1712 | 1712 | $page = get_post($option_value); |
| 1713 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1713 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1714 | 1714 | |
| 1715 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1716 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1715 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1716 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1717 | 1717 | else {
|
| 1718 | 1718 | $is_error_during_diagnose = true; |
| 1719 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1719 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1720 | 1720 | if ($fix) {
|
| 1721 | 1721 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
| 1722 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1722 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
|
|
| 1723 | 1723 | } else {
|
| 1724 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1724 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1725 | 1725 | } |
| 1726 | 1726 | } |
| 1727 | 1727 | } |
@@ -1735,18 +1735,18 @@ discard block |
||
| 1735 | 1735 | ////////////////////////////////// |
| 1736 | 1736 | $option_value = get_option('geodir_login_page');
|
| 1737 | 1737 | $page = get_post($option_value); |
| 1738 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1738 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1739 | 1739 | |
| 1740 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1741 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1740 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1741 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1742 | 1742 | else {
|
| 1743 | 1743 | $is_error_during_diagnose = true; |
| 1744 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1744 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1745 | 1745 | if ($fix) {
|
| 1746 | 1746 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
| 1747 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1747 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
|
|
| 1748 | 1748 | } else {
|
| 1749 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1749 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1750 | 1750 | } |
| 1751 | 1751 | } |
| 1752 | 1752 | } |
@@ -1760,18 +1760,18 @@ discard block |
||
| 1760 | 1760 | ////////////////////////////////// |
| 1761 | 1761 | $option_value = get_option('geodir_location_page');
|
| 1762 | 1762 | $page = get_post($option_value); |
| 1763 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1763 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1764 | 1764 | |
| 1765 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1766 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1765 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1766 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1767 | 1767 | else {
|
| 1768 | 1768 | $is_error_during_diagnose = true; |
| 1769 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1769 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1770 | 1770 | if ($fix) {
|
| 1771 | 1771 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
| 1772 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1772 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
|
|
| 1773 | 1773 | } else {
|
| 1774 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1774 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1775 | 1775 | } |
| 1776 | 1776 | } |
| 1777 | 1777 | } |
@@ -1780,13 +1780,13 @@ discard block |
||
| 1780 | 1780 | /* Diagnose Location Page Ends */ |
| 1781 | 1781 | //////////////////////////////// |
| 1782 | 1782 | |
| 1783 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1783 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
|
|
| 1784 | 1784 | /** |
| 1785 | 1785 | * This action is called at the end of the GD Tools page check function. |
| 1786 | 1786 | * |
| 1787 | 1787 | * @since 1.5.2 |
| 1788 | 1788 | */ |
| 1789 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1789 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
|
|
| 1790 | 1790 | |
| 1791 | 1791 | $output_str = $page_chk_arr['output_str']; |
| 1792 | 1792 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1796,7 +1796,7 @@ discard block |
||
| 1796 | 1796 | flush_rewrite_rules(); |
| 1797 | 1797 | } |
| 1798 | 1798 | $info_div_class = "geodir_problem_info"; |
| 1799 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1799 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1800 | 1800 | } else {
|
| 1801 | 1801 | $info_div_class = "geodir_noproblem_info"; |
| 1802 | 1802 | $fix_button_txt = ''; |
@@ -1824,10 +1824,10 @@ discard block |
||
| 1824 | 1824 | $fix_button_txt = ''; |
| 1825 | 1825 | |
| 1826 | 1826 | if ($is_error_during_diagnose) {
|
| 1827 | - $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
|
|
| 1827 | + $output_str .= "<li>".__('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory').' '.geodir_plugin_path().'/db-language.php'."</li>";
|
|
| 1828 | 1828 | $info_div_class = "geodir_problem_info"; |
| 1829 | 1829 | } else {
|
| 1830 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1830 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
|
|
| 1831 | 1831 | $info_div_class = "geodir_noproblem_info"; |
| 1832 | 1832 | $fix_button_txt = ''; |
| 1833 | 1833 | } |
@@ -1869,17 +1869,17 @@ discard block |
||
| 1869 | 1869 | global $wpdb, $wp_query, $plugin_prefix; |
| 1870 | 1870 | |
| 1871 | 1871 | if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
|
| 1872 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1872 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
| 1873 | 1873 | |
| 1874 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1874 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
| 1875 | 1875 | $clauses['join'] = $join; |
| 1876 | 1876 | |
| 1877 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1877 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
| 1878 | 1878 | $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
| 1879 | 1879 | $clauses['fields'] = $fields; |
| 1880 | 1880 | |
| 1881 | 1881 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
| 1882 | - $orderby = 'gd_expire ' . $order; |
|
| 1882 | + $orderby = 'gd_expire '.$order; |
|
| 1883 | 1883 | $clauses['orderby'] = $orderby; |
| 1884 | 1884 | } |
| 1885 | 1885 | return $clauses; |
@@ -1922,7 +1922,7 @@ discard block |
||
| 1922 | 1922 | global $current_user; |
| 1923 | 1923 | $upload_dir = wp_upload_dir(); |
| 1924 | 1924 | |
| 1925 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1925 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
| 1926 | 1926 | $handle = fopen($file, 'w'); |
| 1927 | 1927 | |
| 1928 | 1928 | fwrite($handle, $input); |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | $uploads_dir = $uploads['path']; |
| 1968 | 1968 | $image_name_arr = explode('/', $filename);
|
| 1969 | 1969 | $filename = end($image_name_arr); |
| 1970 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1970 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1971 | 1971 | $return = array(); |
| 1972 | 1972 | $return['file'] = $uploadedFile; |
| 1973 | 1973 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
@@ -1984,8 +1984,8 @@ discard block |
||
| 1984 | 1984 | |
| 1985 | 1985 | if (($handle = fopen($target_path, "r")) !== FALSE) {
|
| 1986 | 1986 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
| 1987 | - if(is_array($data) && !empty($data)) {
|
|
| 1988 | - $file[] = '"' . implode('","', $data) . '"';
|
|
| 1987 | + if (is_array($data) && !empty($data)) {
|
|
| 1988 | + $file[] = '"'.implode('","', $data).'"';
|
|
| 1989 | 1989 | } |
| 1990 | 1990 | } |
| 1991 | 1991 | fclose($handle); |
@@ -2102,10 +2102,10 @@ discard block |
||
| 2102 | 2102 | $tag_arr = explode(',', $post_tags);
|
| 2103 | 2103 | } |
| 2104 | 2104 | |
| 2105 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 2105 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
| 2106 | 2106 | |
| 2107 | 2107 | $error = ''; |
| 2108 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 2108 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
|
|
| 2109 | 2109 | $invalid_post_type++; |
| 2110 | 2110 | continue; |
| 2111 | 2111 | } |
@@ -2131,7 +2131,7 @@ discard block |
||
| 2131 | 2131 | if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
| 2132 | 2132 | $submitdata = date('Y-m-d');
|
| 2133 | 2133 | |
| 2134 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 2134 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
|
|
| 2135 | 2135 | } else {
|
| 2136 | 2136 | $gd_post_info['expire_date'] = 'Never'; |
| 2137 | 2137 | } |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | |
| 2160 | 2160 | // Post status |
| 2161 | 2161 | if ($customKeyarray[$c] == 'post_status') {
|
| 2162 | - $post_status = sanitize_key( $buffer[$c] ); |
|
| 2162 | + $post_status = sanitize_key($buffer[$c]); |
|
| 2163 | 2163 | } |
| 2164 | 2164 | } |
| 2165 | 2165 | |
@@ -2177,8 +2177,8 @@ discard block |
||
| 2177 | 2177 | |
| 2178 | 2178 | // Default post status |
| 2179 | 2179 | $default_status = 'publish'; |
| 2180 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 2181 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 2180 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 2181 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 2182 | 2182 | |
| 2183 | 2183 | $my_post['post_title'] = $post_title; |
| 2184 | 2184 | $my_post['post_content'] = $post_desc; |
@@ -2222,7 +2222,7 @@ discard block |
||
| 2222 | 2222 | $payment_info = array(); |
| 2223 | 2223 | $package_info = array(); |
| 2224 | 2224 | |
| 2225 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2225 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2226 | 2226 | $package_id = ''; |
| 2227 | 2227 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
| 2228 | 2228 | $package_id = $gd_post_info['package_id']; |
@@ -2232,7 +2232,7 @@ discard block |
||
| 2232 | 2232 | $payment_info['package_id'] = $package_info['pid']; |
| 2233 | 2233 | |
| 2234 | 2234 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
| 2235 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2235 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
|
|
| 2236 | 2236 | } else {
|
| 2237 | 2237 | $payment_info['expire_date'] = 'Never'; |
| 2238 | 2238 | } |
@@ -2244,7 +2244,7 @@ discard block |
||
| 2244 | 2244 | |
| 2245 | 2245 | $post_type = get_post_type($last_postid); |
| 2246 | 2246 | |
| 2247 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2247 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2248 | 2248 | |
| 2249 | 2249 | geodir_save_post_info($last_postid, $gd_post_info); |
| 2250 | 2250 | |
@@ -2265,7 +2265,7 @@ discard block |
||
| 2265 | 2265 | $attachment['post_id'] = $last_postid; |
| 2266 | 2266 | $attachment['title'] = $img_name_arr[0]; |
| 2267 | 2267 | $attachment['content'] = ''; |
| 2268 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2268 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
| 2269 | 2269 | $attachment['mime_type'] = $uploaded_file_type; |
| 2270 | 2270 | $attachment['menu_order'] = $menu_order; |
| 2271 | 2271 | $attachment['is_featured'] = 0; |
@@ -2274,15 +2274,15 @@ discard block |
||
| 2274 | 2274 | |
| 2275 | 2275 | foreach ($attachment as $key => $val) {
|
| 2276 | 2276 | if ($val != '') |
| 2277 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2277 | + $attachment_set .= $key." = '".$val."', "; |
|
| 2278 | 2278 | } |
| 2279 | 2279 | $attachment_set = trim($attachment_set, ", "); |
| 2280 | 2280 | |
| 2281 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2281 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 2282 | 2282 | |
| 2283 | 2283 | if ($menu_order == 1) {
|
| 2284 | 2284 | $post_type = get_post_type($last_postid); |
| 2285 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2285 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
|
|
| 2286 | 2286 | } |
| 2287 | 2287 | $menu_order++; |
| 2288 | 2288 | } |
@@ -2323,11 +2323,11 @@ discard block |
||
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | 2325 | // Add the tab in left sidebar menu fro import & export page. |
| 2326 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
| 2326 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
|
|
| 2327 | 2327 | |
| 2328 | 2328 | // Handle ajax request for import/export. |
| 2329 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
| 2330 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
| 2329 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
|
|
| 2330 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
|
|
| 2331 | 2331 | |
| 2332 | 2332 | |
| 2333 | 2333 | /** |
@@ -2338,40 +2338,40 @@ discard block |
||
| 2338 | 2338 | * @param $post_id int $post_id The post ID of the post being saved. |
| 2339 | 2339 | * @param $post object $post The post object of the post being saved. |
| 2340 | 2340 | */ |
| 2341 | -function geodir_update_location_prefix($post_id,$post){
|
|
| 2342 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2343 | - update_option('geodir_location_prefix',$post->post_name);
|
|
| 2341 | +function geodir_update_location_prefix($post_id, $post) {
|
|
| 2342 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
|
|
| 2343 | + update_option('geodir_location_prefix', $post->post_name);
|
|
| 2344 | 2344 | } |
| 2345 | 2345 | |
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | -add_action('save_post', 'geodir_update_location_prefix',10,2);
|
|
| 2348 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2);
|
|
| 2349 | 2349 | |
| 2350 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
| 2350 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
|
|
| 2351 | 2351 | |
| 2352 | -function geodir_ga_callback(){
|
|
| 2352 | +function geodir_ga_callback() {
|
|
| 2353 | 2353 | |
| 2354 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2354 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2355 | 2355 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
| 2356 | 2356 | $code = "code=".$_REQUEST['code']; |
| 2357 | 2357 | $grant_type = "&grant_type=authorization_code"; |
| 2358 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2358 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
|
|
| 2359 | 2359 | $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
| 2360 | 2360 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
| 2361 | 2361 | |
| 2362 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2362 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
| 2363 | 2363 | |
| 2364 | 2364 | $response = wp_remote_post($auth_url, array('timeout' => 15));
|
| 2365 | 2365 | |
| 2366 | 2366 | //print_r($response); |
| 2367 | 2367 | |
| 2368 | - $error_msg = __('Something went wrong','geodirectory');
|
|
| 2369 | - if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2368 | + $error_msg = __('Something went wrong', 'geodirectory');
|
|
| 2369 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
|
|
| 2370 | 2370 | |
| 2371 | 2371 | $parts = json_decode($response['body']); |
| 2372 | 2372 | //print_r($parts); |
| 2373 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2374 | - else{
|
|
| 2373 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
|
|
| 2374 | + else {
|
|
| 2375 | 2375 | |
| 2376 | 2376 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2377 | 2377 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2380,18 +2380,18 @@ discard block |
||
| 2380 | 2380 | |
| 2381 | 2381 | |
| 2382 | 2382 | } |
| 2383 | - elseif(!empty($response['response']['code'])) {
|
|
| 2383 | + elseif (!empty($response['response']['code'])) {
|
|
| 2384 | 2384 | $parts = json_decode($response['body']); |
| 2385 | 2385 | |
| 2386 | - if(isset($parts->error)){
|
|
| 2387 | - echo $parts->error.": ".$parts->error_description;exit; |
|
| 2388 | - }else{
|
|
| 2389 | - echo $error_msg." - #2";exit; |
|
| 2386 | + if (isset($parts->error)) {
|
|
| 2387 | + echo $parts->error.": ".$parts->error_description; exit; |
|
| 2388 | + } else {
|
|
| 2389 | + echo $error_msg." - #2"; exit; |
|
| 2390 | 2390 | } |
| 2391 | 2391 | |
| 2392 | - }else{
|
|
| 2392 | + } else {
|
|
| 2393 | 2393 | |
| 2394 | - echo $error_msg." - #3";exit; |
|
| 2394 | + echo $error_msg." - #3"; exit; |
|
| 2395 | 2395 | |
| 2396 | 2396 | } |
| 2397 | 2397 | } |
@@ -2413,7 +2413,7 @@ discard block |
||
| 2413 | 2413 | function geodir_uninstall_settings($general_settings) {
|
| 2414 | 2414 | $settings = array(); |
| 2415 | 2415 | $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
| 2416 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
| 2416 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
|
|
| 2417 | 2417 | |
| 2418 | 2418 | $plugins = get_plugins(); |
| 2419 | 2419 | $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
@@ -2425,7 +2425,7 @@ discard block |
||
| 2425 | 2425 | if (in_array($plugin_name, $un_plugins)) {
|
| 2426 | 2426 | $settings[] = array( |
| 2427 | 2427 | 'type' => 'checkbox', |
| 2428 | - 'id' => 'geodir_un_' . $plugin_name, |
|
| 2428 | + 'id' => 'geodir_un_'.$plugin_name, |
|
| 2429 | 2429 | 'name' => $data['Name'], |
| 2430 | 2430 | 'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
| 2431 | 2431 | 'std' => '0' |
@@ -2459,7 +2459,7 @@ discard block |
||
| 2459 | 2459 | * @since 1.6.9 |
| 2460 | 2460 | */ |
| 2461 | 2461 | function geodir_uninstall_settings_desc() {
|
| 2462 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory') . '</p>';
|
|
| 2462 | + echo '<p class="gd-un-settings-desc">'.__('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory').'</p>';
|
|
| 2463 | 2463 | } |
| 2464 | 2464 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
|
| 2465 | 2465 | |
@@ -2523,12 +2523,12 @@ discard block |
||
| 2523 | 2523 | |
| 2524 | 2524 | |
| 2525 | 2525 | if ($delete) {
|
| 2526 | - $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
| 2526 | + $output_str .= "<li><strong>".__('Table dropped, refresh page to reinstall.', 'geodirectory')."</strong></li>";
|
|
| 2527 | 2527 | ob_start(); |
| 2528 | 2528 | geodir_diagnose_version_clear(); |
| 2529 | 2529 | ob_end_clean(); |
| 2530 | - }else{
|
|
| 2531 | - $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
|
|
| 2530 | + } else {
|
|
| 2531 | + $output_str .= "<li><strong>".__('Something went wrong.', 'geodirectory')."</strong></li>";
|
|
| 2532 | 2532 | } |
| 2533 | 2533 | |
| 2534 | 2534 | if ($is_error_during_diagnose) {
|
@@ -2553,9 +2553,9 @@ discard block |
||
| 2553 | 2553 | * @param object $row The post|taxonomy object. |
| 2554 | 2554 | * @return array Filtered actions. |
| 2555 | 2555 | */ |
| 2556 | -function geodir_disable_quick_edit( $actions = array(), $row = null ) {
|
|
| 2557 | - if ( isset( $actions['inline hide-if-no-js'] ) ) {
|
|
| 2558 | - unset( $actions['inline hide-if-no-js'] ); |
|
| 2556 | +function geodir_disable_quick_edit($actions = array(), $row = null) {
|
|
| 2557 | + if (isset($actions['inline hide-if-no-js'])) {
|
|
| 2558 | + unset($actions['inline hide-if-no-js']); |
|
| 2559 | 2559 | } |
| 2560 | 2560 | |
| 2561 | 2561 | return $actions; |
@@ -2574,24 +2574,24 @@ discard block |
||
| 2574 | 2574 | function geodir_check_quick_edit() {
|
| 2575 | 2575 | global $pagenow, $current_screen, $gd_cpt_screen; |
| 2576 | 2576 | |
| 2577 | - if ( ( $pagenow == 'edit.php' || $pagenow == 'edit-tags.php' ) && !empty( $current_screen->post_type ) ) {
|
|
| 2578 | - if ( empty( $gd_cpt_screen ) ) {
|
|
| 2579 | - if ( in_array( $current_screen->post_type, geodir_get_posttypes() ) ) {
|
|
| 2577 | + if (($pagenow == 'edit.php' || $pagenow == 'edit-tags.php') && !empty($current_screen->post_type)) {
|
|
| 2578 | + if (empty($gd_cpt_screen)) {
|
|
| 2579 | + if (in_array($current_screen->post_type, geodir_get_posttypes())) {
|
|
| 2580 | 2580 | $gd_cpt_screen = 'y'; |
| 2581 | 2581 | } else {
|
| 2582 | 2582 | $gd_cpt_screen = 'n'; |
| 2583 | 2583 | } |
| 2584 | 2584 | } |
| 2585 | 2585 | |
| 2586 | - if ( $gd_cpt_screen == 'y' ) {
|
|
| 2587 | - if ( $pagenow == 'edit.php' ) {
|
|
| 2588 | - add_filter( 'post_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2589 | - add_filter( 'page_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2590 | - } elseif ( $pagenow == 'edit-tags.php' && !empty( $current_screen->taxonomy ) ) {
|
|
| 2591 | - add_filter( $current_screen->taxonomy . '_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2586 | + if ($gd_cpt_screen == 'y') {
|
|
| 2587 | + if ($pagenow == 'edit.php') {
|
|
| 2588 | + add_filter('post_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
| 2589 | + add_filter('page_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
| 2590 | + } elseif ($pagenow == 'edit-tags.php' && !empty($current_screen->taxonomy)) {
|
|
| 2591 | + add_filter($current_screen->taxonomy.'_row_actions', 'geodir_disable_quick_edit', 10, 2); |
|
| 2592 | 2592 | } |
| 2593 | 2593 | } |
| 2594 | 2594 | } |
| 2595 | 2595 | } |
| 2596 | -add_action( 'admin_head', 'geodir_check_quick_edit', 10 ); |
|
| 2596 | +add_action('admin_head', 'geodir_check_quick_edit', 10);
|
|
| 2597 | 2597 | |